Bug 494653

Summary: Audio CD ripping: rip fails (default ripped files pattern fails to parse)
Product: [Applications] k3b Reporter: scaylathefox
Component: Audio ProjectAssignee: k3b developers <k3b>
Status: RESOLVED FIXED    
Severity: normal CC: michalm, trueg
Priority: NOR    
Version: 24.08.1   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description scaylathefox 2024-10-13 11:27:31 UTC
SUMMARY

Attempting to use conditional inclusion of strings in "ripped files pattern" causes the rip to fail with an error: "Please check the naming pattern. All filenames need to be unique.". The preview of filenames above also seems broken, only displaying part of the titles - anything before the conditional inclusion string is lost, but anything after is kept.

An example:
- Album artist: artistA
- Track artist: artistB
- Title: title
Using pattern: %A - !a='%A'{%a - }%t
Expected preview: "artistA - artistB - title.flac"
Actual preview: "title.flac" (plus the rip fails with above error)


STEPS TO REPRODUCE
1. Insert an audio CD and click "Start Ripping" to get to the "CD Ripping" dialog
2. Under "File Naming" tab ensure that you're using conditional inclusion in "Ripped files pattern" - the default string will do it (%A - %T/%n - !a='%A'{%a - }%t)
3. Click "Start Ripping"

OBSERVED RESULT
The files in preview only show titles and extension.
The ripping process fails with an unhelpful message "Please check the naming pattern. All filenames need to be unique."

EXPECTED RESULT
The files in preview show album artist, album title, optionally the track artist, song title.
The ripping process starts as configured with no errors.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE neon User Edition 24.04
KDE Plasma Version: 6.2.0
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION
I don't know if the behavior also happens on older versions of application, I noticed it just now.
Comment 1 Volker Krause 2024-10-14 20:56:05 UTC
Git commit d8d9fb7b79e73710e298dc1d97b3ff3c53997b84 by Volker Krause.
Committed on 14/10/2024 at 15:07.
Pushed by aacid into branch 'master'.

Fix conditional ripped file pattern parsing

Since 7b92455f2614 we match against substrings rather than at an offset,
so capturedStart() is not the offset we matched at.

M  +1    -1    src/rip/k3bpatternparser.cpp

https://invent.kde.org/multimedia/k3b/-/commit/d8d9fb7b79e73710e298dc1d97b3ff3c53997b84
Comment 2 Albert Astals Cid 2024-10-14 20:56:42 UTC
Git commit 911905376fc90911343105bc54e902f1d43536e7 by Albert Astals Cid, on behalf of Volker Krause.
Committed on 14/10/2024 at 20:56.
Pushed by aacid into branch 'release/24.08'.

Fix conditional ripped file pattern parsing

Since 7b92455f2614 we match against substrings rather than at an offset,
so capturedStart() is not the offset we matched at.
(cherry picked from commit d8d9fb7b79e73710e298dc1d97b3ff3c53997b84)

M  +1    -1    src/rip/k3bpatternparser.cpp

https://invent.kde.org/multimedia/k3b/-/commit/911905376fc90911343105bc54e902f1d43536e7