diff --git a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py index 722b6684f..c55b3235a 100644 --- a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py +++ b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py @@ -6,6 +6,7 @@ import logging import re import threading +import pathlib LOGGER = logging.getLogger(__name__) @@ -19,7 +20,7 @@ def debug(self, msg): # Hack to fix changing changing extension match = re.search(r'.ffmpeg..Merging formats into..(.*?).$', msg) if match and not self.obj.is_playlist: - self.obj.name = match.group(1) + self.obj.set_name(match.group(1)) @staticmethod def warning(msg): @@ -66,6 +67,10 @@ def download_speed(self): def gid(self): with self.__resource_lock: return self.__gid + + def set_name(self, name): + with self.__resource_lock: + self.__name = pathlib.PurePath(name).name def __onDownloadProgress(self, d): if self.is_cancelled: