Encode unicode file paths.

This commit is contained in:
ArabCoders 2023-11-27 23:06:59 +03:00
parent 33a23c7868
commit ed94b36097
2 changed files with 4 additions and 2 deletions

View file

@ -2,6 +2,7 @@ import json
import logging import logging
import math import math
import os import os
from urllib.parse import quote
from src.Utils import calcDownloadPath from src.Utils import calcDownloadPath
from ffprobe import FFProbe from ffprobe import FFProbe
from src.Config import Config from src.Config import Config
@ -68,7 +69,7 @@ class M3u8:
else: else:
m3u8 += f"#EXTINF:{segmentSize}, nodesc\n" m3u8 += f"#EXTINF:{segmentSize}, nodesc\n"
m3u8 += f"{self.config.url_prefix}segments/{i}/{file}" m3u8 += f"{self.config.url_prefix}segments/{i}/{quote(file)}"
if len(segmentParams) > 0: if len(segmentParams) > 0:
m3u8 += '?'+'&'.join([f"{key}={value}" for key, m3u8 += '?'+'&'.join([f"{key}={value}" for key,
value in segmentParams.items()]) value in segmentParams.items()])

View file

@ -109,7 +109,8 @@ class Segments:
ffmpegCmd.append('mpegts') ffmpegCmd.append('mpegts')
ffmpegCmd.append('pipe:1') ffmpegCmd.append('pipe:1')
logging.info(f'{self.aconvert}, {self.vconvert} '+' '.join(ffmpegCmd)) logging.debug(
f'Streaming {realFile} segment {self.segment_index}.' + ' '.join(ffmpegCmd))
proc = subprocess.run(ffmpegCmd, stdout=subprocess.PIPE) proc = subprocess.run(ffmpegCmd, stdout=subprocess.PIPE)
return proc.stdout return proc.stdout