From 4cc3b34ee5b628b2e7b7e059c049c6f4f74e930a Mon Sep 17 00:00:00 2001 From: Karl Voit Date: Fri, 7 Jan 2022 17:03:44 +0100 Subject: [PATCH 1/2] more debug output for smartprepend feature --- appendfilename/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/appendfilename/__init__.py b/appendfilename/__init__.py index 5ab375b..3fdf2d4 100755 --- a/appendfilename/__init__.py +++ b/appendfilename/__init__.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -PROG_VERSION = u"Time-stamp: <2022-01-04 17:25:15 vk>" +PROG_VERSION = u"Time-stamp: <2022-01-07 17:03:35 vk>" # TODO: # * fix parts marked with «FIXXME» @@ -288,6 +288,7 @@ def handle_file(filename, text, dryrun): assert(isinstance(filename, str)) num_errors = 0 + new_filename = '' if os.path.isdir(filename): logging.warning("Skipping directory \"%s\" because this tool only processes file names." % filename) @@ -309,9 +310,15 @@ def handle_file(filename, text, dryrun): try: if options.prepend: + logging.debug('options.prepend is set with |' + str(os.path.dirname(filename)) + '|' + + str(text) + '|' + str(separator()) + '|' + str(old_basename) + '|' + str(tags_with_extension)) new_filename = os.path.join(os.path.dirname(filename), text + separator() + old_basename + tags_with_extension) elif options.smartprepend: match = re.match(WITHTIME_AND_SECONDS_PATTERN, filename) + logging.debug('options.smartprepend is set with |' + str(os.path.dirname(filename)) + '|' + + str(text) + '|' + str(separator()) + '|' + str(old_basename) + '|' + str(tags_with_extension)) + logging.debug('options.smartprepend is set with |' + str(type(os.path.dirname(filename))) + '|' + + str(type(text)) + '|' + str(type(separator())) + '|' + str(type(old_basename)) + '|' + str(type(tags_with_extension))) if not match: logging.debug('can\'t find a date/time-stamp, doing a simple prepend') new_filename = os.path.join(os.path.dirname(filename), text + separator() + old_basename + tags_with_extension) From b2be04e913c2eb0c6f035cdfc912bcb96965aaaa Mon Sep 17 00:00:00 2001 From: Karl Voit Date: Fri, 7 Jan 2022 17:11:11 +0100 Subject: [PATCH 2/2] more debug output for smartprepend feature --- appendfilename/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/appendfilename/__init__.py b/appendfilename/__init__.py index 3fdf2d4..c4b9a35 100755 --- a/appendfilename/__init__.py +++ b/appendfilename/__init__.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -PROG_VERSION = u"Time-stamp: <2022-01-07 17:03:35 vk>" +PROG_VERSION = u"Time-stamp: <2022-01-07 17:10:27 vk>" # TODO: # * fix parts marked with «FIXXME» @@ -324,7 +324,12 @@ def handle_file(filename, text, dryrun): new_filename = os.path.join(os.path.dirname(filename), text + separator() + old_basename + tags_with_extension) else: logging.debug('date/time-stamp found, insert text between date/time-stamp and rest') + logging.debug('options.smartprepend is set with |' + str(os.path.dirname(filename)) + '|' + + str(match.group(1)) + '|' + str(match.group(len(match.groups()))) + '|') + logging.debug('options.smartprepend is set with |' + str(type(os.path.dirname(filename))) + '|' + + str(type(match.group(1))) + '|' + str(type(match.group(len(match.groups())))) + '|') new_filename = os.path.join(os.path.dirname(filename), match.group(1) + separator() + text + separator() + match.group(len(match.groups()))) + logging.debug('new_filename is now: ' + new_filename) else: new_filename = os.path.join(os.path.dirname(filename), old_basename + separator() + text + tags_with_extension) except: