Bug 480337 - Filename to Tag: prepend/append string not working (or misleading tooltip?)
Summary: Filename to Tag: prepend/append string not working (or misleading tooltip?)
Status: REPORTED
Alias: None
Product: kid3
Classification: Applications
Component: general (show other bugs)
Version: 3.9.x
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Urs Fleisch
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-25 19:40 UTC by Tarulia
Modified: 2024-01-26 20:34 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tarulia 2024-01-25 19:40:49 UTC
SUMMARY
To preface this: Maybe I'm misunderstanding this feature, but since the Tooltips for both Format fields are actually different, I'm assuming it's not just an oversight in them.
Basically what I want to do is prepend one of the matched parts of the filename with a custom string. Assume we have this filename:
ARTIST - TITLE [COMMENT].ext
I can do
%{artist} - %{title} [%{comment}]
And that works fine, however I want to prepend the Value of the Comment with a custom string, so I used:
%{artist} - %{title} [%{"prependstring"comment}]
However this results in kid3 prepending the Field*name*, not the Field*value*, i.e. my comment gets put in a custom "PREPENDSTRING"COMMENT field.
I'm not entirely sure if this is a bug or if I am misunderstanding the feature (or if the Tooltip is just misleading and there is no pre-/apend for this operation). The Handbook mentions "Any frame name can be used, for instance unified frame names like %{albumartist}, %{discnumber.1}, %{bpm} or format specific names like %{popm}.", however this is in regards to the Tag > Filename operation, not Filename > Tag. If this paragraph is intended for both operations I would see this as at least an unexpected behaviour, since pre-/appending an existing frame-name with a custom string seems not useful when any valid frame-name is allowed anyway.

STEPS TO REPRODUCE
1. Open any file
2. Change the Format (down) code to include a placeholder with a pre- and/or appending string
3. Click either Tag 1 or Tag 2, depending on your file

OBSERVED RESULT
kid3 creates a custom field name consisting of the pre-/append-string in quotes, as well as the actual field name (which presumably would be invalid anyway)

EXPECTED RESULT
kid3 should create a valid field with the value consisting of the prepend string, the extracted value from the filename, and the appended string

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 39
(available in About System)
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.113.0
Qt Version: 5.15.11

ADDITIONAL INFORMATION
Comment 1 Urs Fleisch 2024-01-26 18:25:55 UTC
Thanks for the report. The feature to prepend/append a string is only available when some text (e.g. the filename) is generated from the tags - it should not appear in the "arrow down" tooltip, I will have to remove this. An example usage might be that you want to have "[year]" in the filename, but only if a year exists in the tag, i.e. in the case of an absent year, there should not be a "[]" in the filename.
In the other direction, i.e. extracting some text to put it into tag frames, I see not use for such a feature. If you want to do fancy things when extracting from text, you can explicitly give a regular expression after the %{framename}, the example "/%{track}(\d+) %{title}(.*)" can be found in the handbook. If capturing with regular expressions is not enough, you can have a look at the "Import from Tags", but this will not allow either to prepend/append custom text after extraction. For things which cannot be done with regular expressions, it is probably best to write a custom QML script.
Comment 2 Tarulia 2024-01-26 20:34:18 UTC
Thanks for the clarification. It's good to know that at least I wasn't doing anything wrong :)