replaced : with ; in youtube-dl durations (because of FAT issue on Android)

This commit is contained in:
Karl Voit 2023-03-15 12:00:06 +01:00
parent f6d0227ae9
commit 1581b2d7dc
2 changed files with 5 additions and 5 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
PROG_VERSION = u"Time-stamp: <2023-03-05 22:44:21 vk>"
PROG_VERSION = u"Time-stamp: <2023-03-15 10:52:13 vk>"
# TODO:
@ -972,7 +972,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["duration_string"] + '.' + 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"].replace(':', ';') + '.' + 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 ' +

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8; mode: python; -*-
# Time-stamp: <2023-03-05 22:19:14 vk>
# Time-stamp: <2023-03-15 10:52:15 vk>
import unittest
import logging
@ -442,7 +442,7 @@ class TestGuessFilename(unittest.TestCase):
"acodec": "mp4a.40.2",
"dislike_count": 3,
"abr": 96,
"duration_string": "42:42:42",
"duration_string": "12:34:56",
"creator": null,
"filesize": 26294671,
"id": "Ahg8OBYixL0",
@ -462,7 +462,7 @@ class TestGuessFilename(unittest.TestCase):
new_mediafilename = self.guess_filename.handle_file(mediafile, False)
assert(type(new_mediafilename) == str)
new_mediafilename_generated = os.path.join(tmpdir, new_mediafilename)
new_mediafilename_comparison = os.path.join(tmpdir, "2007-09-13 youtube - The Star7 PDA Prototype - Ahg8OBYixL0 42:42:42.mp4")
new_mediafilename_comparison = os.path.join(tmpdir, "2007-09-13 youtube - The Star7 PDA Prototype - Ahg8OBYixL0 12;34;56.mp4")
self.assertEqual(new_mediafilename_generated, new_mediafilename_comparison)
os.remove(new_mediafilename_generated)