update
This commit is contained in:
Binary file not shown.
@@ -44,10 +44,11 @@ def run_command(command):
|
|||||||
state = 0
|
state = 0
|
||||||
current_frag = 0
|
current_frag = 0
|
||||||
total_frag = 1
|
total_frag = 1
|
||||||
|
result_txt = ''
|
||||||
while True:
|
while True:
|
||||||
output = process.stdout.readline().decode("utf-8")
|
output = process.stdout.readline().decode("utf-8")
|
||||||
if "[download] 100" in output:
|
if "[download] 100" in output:
|
||||||
result_txt = 'Result: ' + output.split("[download]")[-1].strip()
|
result_txt = 'Result: ' + output.split("[download]")[1].strip()
|
||||||
|
|
||||||
if output == '' and process.poll() is not None:
|
if output == '' and process.poll() is not None:
|
||||||
break
|
break
|
||||||
@@ -63,7 +64,7 @@ def run_command(command):
|
|||||||
pbar.update(100 - state)
|
pbar.update(100 - state)
|
||||||
pbar.close()
|
pbar.close()
|
||||||
rc = process.poll()
|
rc = process.poll()
|
||||||
print(result_txt)
|
if result_txt != '': print(result_txt)
|
||||||
return rc
|
return rc
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
@@ -126,16 +127,26 @@ def ph_download_playlist(url, model_name, limit):
|
|||||||
# global duration
|
# global duration
|
||||||
check_output_dir(model_name)
|
check_output_dir(model_name)
|
||||||
|
|
||||||
# tmp_playlist download
|
|
||||||
print('... Getting playlist information...')
|
|
||||||
playlist_download_command = [".\yt-dlp", "-j",
|
|
||||||
"--flat-playlist", "--no-check-certificate", url]
|
|
||||||
res = subprocess.run(playlist_download_command,
|
|
||||||
capture_output=True, text=True).stdout.split("\n")
|
|
||||||
if (limit != 0):
|
if (limit != 0):
|
||||||
print("[!] Limit: {} videos".format(limit))
|
print("[!] Limit: {} videos".format(limit))
|
||||||
|
|
||||||
|
# tmp_playlist download
|
||||||
|
print('... Getting playlist information...')
|
||||||
|
try:
|
||||||
|
playlist_download_command = [".\yt-dlp", "-j",
|
||||||
|
"--flat-playlist", "--no-check-certificate", url]
|
||||||
|
res = subprocess.run(playlist_download_command,
|
||||||
|
capture_output=True, text=True).stdout.split("\n")
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
sys.exit(1)
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
|
if res == ['']:
|
||||||
|
print("Cannot download playlist information!")
|
||||||
|
sys.exit(1)
|
||||||
|
print("Playlist has {} videos".format(len(res)))
|
||||||
|
|
||||||
for i in range(len(res) - 1):
|
for i in range(len(res) - 1):
|
||||||
if (count == limit and limit != 0):
|
if (count == limit and limit != 0):
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user