From ee172befe41ce88bea9bae7aed545ce453d15cef Mon Sep 17 00:00:00 2001 From: Dniel97 <6324072+Dniel97@users.noreply.github.com> Date: Thu, 25 Nov 2021 13:02:28 +0100 Subject: [PATCH] Hotfix: Python 3.8 added, Windows fixed --- interface.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/interface.py b/interface.py index 42bcee4..b9b0732 100644 --- a/interface.py +++ b/interface.py @@ -35,7 +35,7 @@ class AudioTrack: codec: str sample_rate: int bitrate: int - urls: list[str] + urls: list class ModuleInterface: @@ -267,7 +267,7 @@ class ModuleInterface: return track_info @staticmethod - def parse_mpd(xml: bytes) -> list[AudioTrack]: + def parse_mpd(xml: bytes) -> list: xml = xml.decode('UTF-8') # Removes default namespace definition, don't do that! xml = re.sub(r'xmlns="[^"]+"', '', xml, count=1) @@ -333,24 +333,25 @@ class ModuleInterface: return TrackDownloadInfo(download_type=DownloadEnum.URL, file_url=file_url) # MPEG-DASH - # Download all segments and save the locations inside temp_locations - temp_locations = [] - # Use the total_file size for a better progress bar? Is it even possible to calculate the total size from MPD? try: columns = os.get_terminal_size().columns if os.name == 'nt': - bar = tqdm(ncols=(columns - self.oprinter.indent_number), + bar = tqdm(audio_track.urls, ncols=(columns - self.oprinter.indent_number), bar_format=' ' * self.oprinter.indent_number + '{l_bar}{bar}{r_bar}') else: raise OSError except OSError: bar = tqdm(audio_track.urls, bar_format=' ' * self.oprinter.indent_number + '{l_bar}{bar}{r_bar}') + # Download all segments and save the locations inside temp_locations + temp_locations = [] for download_url in bar: temp_locations.append(download_to_temp(download_url, extension='mp4')) + # Concatenated/Merged .mp4 file merged_temp_location = create_temp_filename() + '.mp4' + # Actual converted .flac file output_location = create_temp_filename() + '.' + codec_data[audio_track.codec].container.name # Download is finished, merge chunks into 1 file