修复 (#271)
* 注销自动替换文件名中空格为_字符的功能,避免和录播完毕自动改名冲突 * 修改postprocessor,避免出现指令有问题导致反复从头开始执行任务的问题 即使输入的指令有问题,也会直接跳过并执行接下来的指令,不会反复重新执行(比如设置了该主播上传b站,在上传完毕之后,开始执行postprocessor,如果这个时候postprocessor里面的指令有问题,则会导致报错,并从头开始重新上传,如此反复) * 完善downloader的描述 * 补充toml里面漏掉的downloader设置 * 修复stream-gears录制文件名重复导致分段覆盖的问题 * 更新上传节点介绍
This commit is contained in:
1 parent
9db6ead04c
commit
18703328a0
5 files changed
+34
-17
No files matched your search
+9
-1
@@ -5,7 +5,15 @@
|
||||
- 🔧已修复的问题
|
||||
- ⚠️需要手动操作的更新信息
|
||||
|
||||
## 0.3.10
|
||||
## 0.3.11
|
||||
- 更新时间:2023.02.02
|
||||
- 🔧修复config.yaml示例中filename_prefix配置格式 [@FairyWorld](https://github.com/FairyWorld)
|
||||
- 🔧添加config.toml示例中缺失的关于downloader的设置 [@haha114514](https://github.com/haha114514)
|
||||
- 🔧修改postprocessor,避免出现指令有问题导致反复从头开始执行任务的问题 [@haha114514](https://github.com/haha114514)
|
||||
- 🔧去掉自动替换文件名中空格为_字符的功能,避免和录播完毕自动改名冲突 [@haha114514](https://github.com/haha114514)
|
||||
- 🔧修复由于上一版的修改导致stream-gears录制文件名重复出现分段覆盖的问题[@haha114514](https://github.com/haha114514)
|
||||
|
||||
## 0.3.10 ⚠️⚠️此版本存在stream-gears录制文件名重复导致覆盖上一段分段的问题,请勿使用
|
||||
- 更新时间:2023.02.01
|
||||
- 💡添加全局与单个主播自定义录播文件命名设置 [@haha114514](https://github.com/haha114514)
|
||||
- ⚠️新增与主播自定义录播文件命名设置的两个参数,如需使用此功能,请老版本用户参考config的示例添加。[@haha114514](https://github.com/haha114514)
|
||||
|
||||
@@ -53,7 +53,9 @@ class DownloadBase:
|
||||
|
||||
def download(self, filename):
|
||||
if self.filename_prefix: # 判断是否存在自定义录播命名设置
|
||||
filename = time.strftime(self.filename_prefix.format(streamer=self.fname, room_title=self.room_title).encode('unicode-escape').decode()).encode().decode("unicode-escape")
|
||||
filename = (self.filename_prefix.format(streamer=self.fname, room_title=self.room_title).encode('unicode-escape').decode()).encode().decode("unicode-escape")
|
||||
else:
|
||||
filename = f'{self.fname}%Y-%m-%dT%H_%M_%S'
|
||||
filename = get_valid_filename(filename)
|
||||
if self.downloader == 'stream-gears':
|
||||
stream_gears_download(self.raw_stream_url, self.fake_headers, filename, config.get('segment_time'),
|
||||
@@ -68,9 +70,9 @@ class DownloadBase:
|
||||
'-i', self.raw_stream_url, *self.default_output_args, *self.opt_args,
|
||||
'-c', 'copy', '-f', self.suffix]
|
||||
if config.get('segment_time'):
|
||||
args += ['-f', 'segment', f'{filename} part-%03d.{self.suffix}']
|
||||
args += ['-f', 'segment', f'{time.strftime(filename)} part-%03d.{self.suffix}']
|
||||
else:
|
||||
args += [f'{filename}.{self.suffix}.part']
|
||||
args += [f'{time.strftime(filename)}.{self.suffix}.part']
|
||||
|
||||
proc = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
try:
|
||||
@@ -176,7 +178,7 @@ def get_valid_filename(name):
|
||||
>>> get_valid_filename("{self.fname}%Y-%m-%dT%H_%M_%S")
|
||||
'{self.fname}%Y-%m-%dT%H_%M_%S'
|
||||
"""
|
||||
s = str(name).strip().replace(" ", "_")
|
||||
#s = str(name).strip().replace(" ", "_") #因为有些人会在主播名中间加入空格,为了避免和录播完毕自动改名冲突,所以注销掉
|
||||
s = re.sub(r"(?u)[^-\w.%{}\[\]【】「」]", "", s)
|
||||
if s in {"", ".", ".."}:
|
||||
raise RuntimeError("Could not derive file name from '%s'" % name)
|
||||
|
||||
+14
-9
@@ -75,14 +75,19 @@ class UploadBase:
|
||||
dest = Path(post_processor['mv'])
|
||||
if not dest.is_dir():
|
||||
dest.mkdir(parents=True, exist_ok=True)
|
||||
#path.rename(dest / path.name)
|
||||
shutil.move(path, dest / path.name)
|
||||
try:
|
||||
shutil.move(path, dest / path.name)
|
||||
except Exception as e:
|
||||
logger.exception(e)
|
||||
continue
|
||||
logger.info(f"move to {(dest / path.name).absolute()}")
|
||||
if post_processor.get('run'):
|
||||
process = subprocess.run(
|
||||
post_processor['run'], shell=True, input=reduce(lambda x, y: x + str(Path(y).absolute()) + '\n', data, ''),
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
|
||||
if process.returncode != 0:
|
||||
logger.error(process.stdout)
|
||||
raise Exception("PostProcessorRunTimeError")
|
||||
logger.info(process.stdout.rstrip())
|
||||
try:
|
||||
process_output = subprocess.check_output(
|
||||
post_processor['run'], shell=True,
|
||||
input=reduce(lambda x, y: x + str(Path(y).absolute()) + '\n', data, ''),
|
||||
stderr=subprocess.STDOUT, text=True)
|
||||
logger.info(process_output.rstrip())
|
||||
except subprocess.CalledProcessError as e:
|
||||
logger.exception(e.output)
|
||||
continue
|
||||
@@ -1,5 +1,7 @@
|
||||
# 选择全局默认上传插件,Noop为不上传,但会执行后处理,可选bili_web,biliup-rs
|
||||
#uploader = "Noop"
|
||||
# 选择全局默认的下载插件,默认为stream-gears。可选ffmpeg与stream-gears。
|
||||
#downloader= "ffmpeg"
|
||||
# b站上传线路选择,默认为自动模式,目前可手动切换为bda2, kodo, ws, qn, cos, cos-internal(支持腾讯云内网免流+提速)
|
||||
lines = "AUTO"
|
||||
# 单文件并发上传数,未达到带宽上限时增大此值可提高上传速度
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
# 选择全局默认上传插件,Noop为不上传,但会执行后处理,可选bili_web,biliup-rs
|
||||
#uploader: Noop
|
||||
#downloader: ffmpeg # 可选stream-gears
|
||||
|
||||
# 选择全局默认的下载插件,默认为stream-gears。可选ffmpeg与stream-gears。
|
||||
#downloader: ffmpeg
|
||||
# b站上传线路选择,默认为自动模式,目前可手动切换为bda2, kodo, ws, qn, cos, cos-internal(支持腾讯云内网免流+提速)
|
||||
lines: AUTO
|
||||
# 单文件并发上传数,未达到带宽上限时增大此值可提高上传速度
|
||||
@@ -42,7 +42,7 @@ streamers:
|
||||
- mv: backup/ # 移动文件到backup目录下
|
||||
- run: python3 path/to/mail.py # 执行一个 Python 脚本,可以用来发送邮件等,详见 https://biliup.github.io/biliup/Guide.html#%E4%B8%8A%E4%BC%A0%E5%AE%8C%E6%88%90%E5%90%8E%E5%8F%91%E9%80%81%E9%82%AE%E4%BB%B6%E9%80%9A%E7%9F%A5
|
||||
- run: sh ./run.sh # 执行一个shell脚本,用途多样,主要调用系统内的cli工具。示例 https://gist.github.com/UVJkiNTQ/ae4282e8f9fe4e45b3144b57605b4178
|
||||
# - rm # 删除文件,为默认操作
|
||||
#- rm # 删除文件,为默认操作
|
||||
tags:
|
||||
- biliup # 希望你可以保留软件出处
|
||||
- 视频标签
|
||||
|
||||
Reference in new issue
Block a user