From 42016beaf16149d4add3d3362781ca5fdabc70c2 Mon Sep 17 00:00:00 2001 From: Karl Voit Date: Sun, 17 Nov 2024 16:08:00 +0100 Subject: [PATCH] further character sanitization: brackets --- guessfilename/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/guessfilename/__init__.py b/guessfilename/__init__.py index f8cfd5e..07c14c8 100755 --- a/guessfilename/__init__.py +++ b/guessfilename/__init__.py @@ -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 ' +