Explorar el Código

上传

pull/1/head
chenyukun hace 1 año
padre
commit
c7ffb251d4
Se han modificado 8 ficheros con 22 adiciones y 19 borrados
  1. +4
    -4
      config/application.json
  2. +2
    -0
      master.py
  3. BIN
      media.ico
  4. +3
    -0
      service/PushStreamThread.py
  5. +1
    -2
      service/UploadFileProcess.py
  6. +1
    -1
      util/AliyunUtil.py
  7. +0
    -1
      vodsdk/AliyunVodUploader.py
  8. +11
    -11
      vodsdk/AliyunVodUtils.py

+ 4
- 4
config/application.json Ver fichero

@@ -1,7 +1,7 @@
{
"pullUrl": "rtsp://localhost:8554/live",
"pushUrl": "rtmp://192.168.10.101:19350/rlive/stream_122?sign=iKriFWqD",
"videoPath": "D:\\test\\video",
"imagePath": "D:\\test\\image",
"backup": "D:\\test\\backup"
"pushUrl": "rtmp://live.push.t-aaron.com/live/THSAr",
"videoPath": "\\\\192.168.144.108\\camera\\DCIM\\record",
"imagePath": "\\\\192.168.144.108\\camera\\DCIM\\snap",
"backup": "D:\\airportMedia\\backup"
}

+ 2
- 0
master.py Ver fichero

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from multiprocessing import freeze_support
from os.path import dirname, realpath
from loguru import logger

@@ -10,6 +11,7 @@ from util.LogUtils import init_log
'''

if __name__ == '__main__':
freeze_support()
base_dir = dirname(realpath(__file__))
init_log(base_dir)
logger.info("(♥◠‿◠)ノ゙ 【机场媒体服务】开始启动 ლ(´ڡ`ლ)゙")

BIN
media.ico Ver fichero

Antes Después

+ 3
- 0
service/PushStreamThread.py Ver fichero

@@ -51,16 +51,19 @@ class PushStreamThread(Thread):
time.sleep(1)
if not self.__push_stream_tool.status:
self.__push_stream_tool.close_push_stream_p()
self.__push_stream_tool.status = False
put_queue(push_queue, (0,))
break
except ServiceException as s:
logger.error("{}", s.msg)
self.__push_stream_tool.close_push_stream_p()
self.__push_stream_tool.status = False
put_queue(push_queue, (1, s))
break
except Exception as e:
logger.error("异常:{}", format_exc())
self.__push_stream_tool.close_push_stream_p()
self.__push_stream_tool.status = False
put_queue(push_queue, (1, e))
break
logger.info("推流线程运行结束!")

+ 1
- 2
service/UploadFileProcess.py Ver fichero

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from concurrent.futures import wait, ALL_COMPLETED, ThreadPoolExecutor
from concurrent.futures import ThreadPoolExecutor
from multiprocessing import Process
from os.path import join
from threading import Thread
@@ -235,7 +235,6 @@ class UploadFileProcess(Process):
imageList=imageList, videoList=videoList)
break
sleep(1)
raise Exception
except ServiceException as s:
ex = s.code, s.msg
logger.error("上传文件任务异常失败: {}, requestId:{}", s.msg, requestId)

+ 1
- 1
util/AliyunUtil.py Ver fichero

@@ -82,7 +82,7 @@ class OssUtil:

def resumable_upload(self, uploadPath, filePath):
logger.info("开始上传文件, key: {}, 文件: {}, ", uploadPath, filePath)
MAX_RETRIES = 10
MAX_RETRIES = 3
retry_count = 0
while True:
try:

+ 0
- 1
vodsdk/AliyunVodUploader.py Ver fichero

@@ -21,7 +21,6 @@ VOD_MAX_DESCRIPTION_LENGTH = 1024
class AliyunVodUploader:

__slots__ = (
'__requestId',
'__accessKeyId',
'__accessKeySecret',
'__ecsRegion',

+ 11
- 11
vodsdk/AliyunVodUtils.py Ver fichero

@@ -215,38 +215,38 @@ def catch_error(method):
try:
return method(self, *args, **kwargs)
except ServerException as e:
logger.error("阿里云ServerException异常, error_code: {}, error_msg:{}, status:{}, requestId:{}",
e.get_error_code(), e.get_error_msg(), e.get_http_status(), self.__requestId)
logger.error("阿里云ServerException异常, error_code: {}, error_msg:{}, status:{}",
e.get_error_code(), e.get_error_msg(), e.get_http_status())
# 可能原因:AK错误、账号无权限、参数错误等
raise AliyunVodException('ServerException', e.get_error_code(), e.get_error_msg(), e.get_http_status(),
e.get_request_id())
except ClientException as e:
logger.error("阿里云ClientException异常, error_code: {}, error_msg:{}, requestId:{}", e.get_error_code(),
e.get_error_msg(), self.__requestId)
logger.error("阿里云ClientException异常, error_code: {}, error_msg:{}", e.get_error_code(),
e.get_error_msg())
# 可能原因:本地网络故障(如不能连接外网)等
raise AliyunVodException('ClientException', e.get_error_code(), e.get_error_msg())
except OssError as e:
logger.error("阿里云OssError异常, error_code: {}, error_msg:{}, status:{}, requestId:{}", e.code, e.message,
e.status, self.__requestId)
logger.error("阿里云OssError异常, error_code: {}, error_msg:{}, status:{}", e.code, e.message,
e.status)
# 可能原因:上传凭证过期等
raise AliyunVodException('OssError', e.code, e.message, e.status, e.request_id)
except IOError as e:
logger.error("阿里云IOError异常: {}, requestId:{}", traceback.format_exc(), self.__requestId)
logger.error("阿里云IOError异常: {}", traceback.format_exc())
# 可能原因:文件URL不能访问、本地文件无法读取等
raise AliyunVodException('IOError', repr(e), traceback.format_exc())
except OSError as e:
logger.error("阿里云OSError异常: {}, requestId:{}", traceback.format_exc(), self.__requestId)
logger.error("阿里云OSError异常: {}", traceback.format_exc())
# 可能原因:本地文件不存在等
raise AliyunVodException('OSError', repr(e), traceback.format_exc())
except AliyunVodException as e:
logger.error("阿里云VodException异常: {}, requestId:{}", e, self.__requestId)
logger.error("阿里云VodException异常: {}", e)
# 可能原因:参数错误
raise e
except Exception as e:
logger.error("阿里云UnkownException异常: {}, requestId:{}", traceback.format_exc(), self.__requestId)
logger.error("阿里云UnkownException异常: {}", traceback.format_exc())
raise AliyunVodException('UnkownException', repr(e), traceback.format_exc())
except:
logger.error("阿里云UnkownError异常: {}, requestId:{}", traceback.format_exc(), self.__requestId)
logger.error("阿里云UnkownError异常: {}", traceback.format_exc())
raise AliyunVodException('UnkownError', 'UnkownError', traceback.format_exc())
return wrapper


Cargando…
Cancelar
Guardar