further character sanitization: brackets

This commit is contained in:
Karl Voit 2024-11-17 16:08:00 +01:00
parent b9825617a8
commit 42016beaf1

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
PROG_VERSION = u"Time-stamp: <2024-11-16 12:53:10 vk>"
PROG_VERSION = u"Time-stamp: <2024-11-17 16:07:55 vk>"
# TODO:
@ -1036,7 +1036,9 @@ class GuessFilename(object):
'required meta data for YouTube download file style')
# example from unit tests: "2007-09-13 youtube - The Star7 PDA Prototype - Ahg8OBYixL0.mp4"
# sanitizing title since it may contain characters that are not valid or practical in a file name:
sanitized_title = data['fulltitle'].replace('/', '')
# slash / → issue with renaming since it is the folder separation characters on most file systems
# brackets [] → it interferes with orgdown file link with description
sanitized_title = data['fulltitle'].replace('/', u'').replace('[', u'').replace(']', u'')
return data['upload_date'][:4] + '-' + data['upload_date'][4:6] + '-' + data['upload_date'][6:] + ' ' + data["extractor"] + ' - ' + sanitized_title + ' - ' + data["display_id"] + ' ' + data["duration_string"].replace(':', ';') + '.' + data["ext"]
else:
logging.debug('derive_new_filename_from_json_metadata: found all required meta data ' +