From: Antonio Ospite Date: Fri, 23 Mar 2012 13:42:27 +0000 (+0100) Subject: smooth-dl: fix a FutureWarning from python 2.7 X-Git-Url: https://git.ao2.it/smooth-dl.git/commitdiff_plain/3b8a5827480b918de8ec9a0cac4e615c9d9de6c5 smooth-dl: fix a FutureWarning from python 2.7 ./smooth-dl.py:137: FutureWarning: This search is broken in 1.3 and earlier, and will be fixed in a future version. If you rely on the current behaviour, change it to './/StreamIndex' --- diff --git a/smooth-dl.py b/smooth-dl.py index 36ba345..2baa009 100755 --- a/smooth-dl.py +++ b/smooth-dl.py @@ -134,7 +134,7 @@ def get_manifest(base_url, dest_dir=tempfile.gettempdir(), def print_manifest_info(manifest): - streams = manifest.findall('//StreamIndex') + streams = manifest.findall('.//StreamIndex') for i, s in enumerate(streams): stream_type = s.attrib["Type"] @@ -166,7 +166,7 @@ def download_chunks(base_url, manifest, stream_index, quality_level, dest_dir): if os.path.exists(dest_dir) == False: os.mkdir(dest_dir, 0755) - stream = manifest.findall('//StreamIndex')[stream_index] + stream = manifest.findall('.//StreamIndex')[stream_index] quality = stream.findall("QualityLevel")[quality_level] bitrate = quality.attrib["Bitrate"] @@ -216,7 +216,7 @@ def rebuild_stream(manifest, stream_index, quality_level, src_dir, if final_dest_file == None: final_dest_file = dest_file_name - stream = manifest.findall('//StreamIndex')[stream_index] + stream = manifest.findall('.//StreamIndex')[stream_index] quality = stream.findall("QualityLevel")[quality_level] bitrate = quality.attrib["Bitrate"] @@ -275,7 +275,7 @@ def rebuild_stream(manifest, stream_index, quality_level, src_dir, def calc_tracks_delay(manifest, stream1_index, stream2_index): - streams = manifest.findall('//StreamIndex') + streams = manifest.findall('.//StreamIndex') s1 = streams[stream1_index] s2 = streams[stream2_index]