projects
/
smooth-dl.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8b4fc0a
)
smooth-dl.py: only create dest_dir once
author
Antonio Ospite <ao2@ao2.it>
Fri, 15 Jan 2016 19:08:27 +0000
(20:08 +0100)
committer
Antonio Ospite <ao2@ao2.it>
Fri, 15 Jan 2016 19:08:27 +0000
(20:08 +0100)
smooth-dl.py
patch
|
blob
|
history
diff --git
a/smooth-dl.py
b/smooth-dl.py
index
eda931a
..
44ef722
100755
(executable)
--- a/
smooth-dl.py
+++ b/
smooth-dl.py
@@
-109,12
+109,9
@@
def download_file(src_url, dest_file, mode):
return data
return data
-def get_manifest(url, dest_dir
=tempfile.gettempdir()
):
+def get_manifest(url, dest_dir):
"""Returns the manifest element and the base content URL"""
"""Returns the manifest element and the base content URL"""
- if not os.path.exists(dest_dir):
- os.mkdir(dest_dir, 0755)
-
# Remove the querystring if present
manifest_url = urlunparse(urlparse(url)._replace(query=''))
# Remove the querystring if present
manifest_url = urlunparse(urlparse(url)._replace(query=''))
@@
-207,10
+204,6
@@
def get_chunk_name_string(stream, chunk_time):
def download_chunks(base_url, manifest, stream_index, quality_level, dest_dir):
def download_chunks(base_url, manifest, stream_index, quality_level, dest_dir):
-
- if not os.path.exists(dest_dir):
- os.mkdir(dest_dir, 0755)
-
stream = manifest.findall('.//StreamIndex')[stream_index]
chunks_quality = get_chunk_quality_string(stream, quality_level)
stream = manifest.findall('.//StreamIndex')[stream_index]
chunks_quality = get_chunk_quality_string(stream, quality_level)
@@
-353,7
+346,7
@@
def get_clip_duration(manifest):
return float(duration) / 10000000 # here is the default timescale
return float(duration) / 10000000 # here is the default timescale
-def smooth_download(url, manifest, dest_dir
=tempfile.gettempdir()
,
+def smooth_download(url, manifest, dest_dir,
video_stream_index=0, audio_stream_index=1,
video_quality_level=0, audio_quality_level=0,
chunks_dir=None, download=True,
video_stream_index=0, audio_stream_index=1,
video_quality_level=0, audio_quality_level=0,
chunks_dir=None, download=True,
@@
-438,6
+431,9
@@
def main():
parser.print_help()
parser.exit(1)
parser.print_help()
parser.exit(1)
+ if not os.path.exists(options.dest_dir):
+ os.mkdir(options.dest_dir, 0755)
+
url = args[0]
manifest, url = get_manifest(url, options.dest_dir)
url = args[0]
manifest, url = get_manifest(url, options.dest_dir)