diff --git a/biliup/engine/download.py b/biliup/engine/download.py index 7d0c2d0..68b18d1 100644 --- a/biliup/engine/download.py +++ b/biliup/engine/download.py @@ -70,10 +70,10 @@ 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'{time.strftime(filename)} part-%03d.{self.suffix}'] + args += ['-f', 'segment', f'{(time.strftime(filename).encode("unicode-escape").decode()).encode().decode("unicode-escape")} part-%03d.{self.suffix}'] else: - args += [f'{time.strftime(filename)}.{self.suffix}.part'] - + args += [f'{(time.strftime(filename).encode("unicode-escape").decode()).encode().decode("unicode-escape")}.{self.suffix}'] + proc = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) try: with proc.stdout as stdout: @@ -178,8 +178,8 @@ 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 = re.sub(r"(?u)[^-\w.%{}\[\]【】「」]", "", s) + #s = str(name).strip().replace(" ", "_") #因为有些人会在主播名中间加入空格,为了避免和录播完毕自动改名冲突,所以注释掉 + s = re.sub(r"(?u)[^-\w.%{}\[\]【】「」\s]", "", str(name)) if s in {"", ".", ".."}: raise RuntimeError("Could not derive file name from '%s'" % name) return s