YouTube downloads: now with duration in file-name

This commit is contained in:
Karl Voit 2023-01-02 12:46:40 +01:00
parent 5d39ca9e51
commit ef735adbcf
2 changed files with 3 additions and 2 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
PROG_VERSION = u"Time-stamp: <2022-08-11 17:26:57 vk>"
PROG_VERSION = u"Time-stamp: <2023-01-02 12:45:43 vk>"
# TODO:
@ -935,6 +935,7 @@ class GuessFilename(object):
"extractor" in data.keys() and \
"display_id" in data.keys() and \
"ext" in data.keys() and \
"duration_string" in data.keys() and \
"fulltitle" in data.keys():
if data['upload_date'] and len(data['upload_date']) == 8 and \
@ -942,7 +943,7 @@ class GuessFilename(object):
logging.debug('derive_new_filename_from_json_metadata: found all ' +
'required meta data for YouTube download file style')
# example from unit tests: "2007-09-13 youtube - The Star7 PDA Prototype - Ahg8OBYixL0.mp4"
return data['upload_date'][:4] + '-' + data['upload_date'][4:6] + '-' + data['upload_date'][6:] + ' ' + data["extractor"] + ' - ' + data["fulltitle"] + ' - ' + data["display_id"] + '.' + data["ext"]
return data['upload_date'][:4] + '-' + data['upload_date'][4:6] + '-' + data['upload_date'][6:] + ' ' + data["extractor"] + ' - ' + data["fulltitle"] + ' - ' + data["display_id"] + ' ' + data["duration_string"] + '.' + data["ext"]
else:
logging.debug('derive_new_filename_from_json_metadata: found all required meta data ' +
'for YouTube download file style but upload_date or extractor_key do ' +

0
guessfilename_test.py Executable file → Normal file
View file