Bug 264874 - The files organizing new dialog does not work properly
Summary: The files organizing new dialog does not work properly
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Collections/Local (show other bugs)
Version: 2.4-GIT
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 2.5
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-30 18:56 UTC by Mickaël
Modified: 2012-08-19 16:53 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.5


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mickaël 2011-01-30 18:56:08 UTC
Version:           2.4-GIT (using KDE 4.6.0) 
OS:                Linux

With the latest GIT release, the preview of the new path/name of the file is not correctly filled with the artist, title, album, track, etc... and the corresponding "%artist","%title" strings are not replaced.

Reproducible: Always

Steps to Reproduce:
Juste right-click on a file in your collection and try to "Organize file", then click on the preview button or check the "automatic preview" box, the new name of your file is not dynamically generated.

Actual Results:  
The previewed path for my file is "/donnees/Musiques/%artist/%album (%year)/%track - %title.mp3", and the file is moved to this exact path.

Expected Results:  
The string should correctly contain the artist, title, etc... and the file should be moved to the correct path.

OS: Linux (x86_64) release 2.6.36-ARCH
Compiler: gcc
Comment 1 Mickaël 2011-02-12 13:23:23 UTC
Oops, I have just seen that it did not work because of my pattern... It seems that now, patterns are like "%artist%" and not "%artist", and my old preset was selected...
Comment 2 Mickaël 2011-02-12 13:37:08 UTC
I think users must be informed that preset are no more valid...
And there is an other small bug on the same dialog :
when using the regular expression replacement, replacement is effected before the other filters, and for example the VFAT filter replaces ":" by "_", and it is not possible to replace this "_" by nothing or by a space with the expression replacement system...
It is the same when a variable is empty and we want to remove something ugly : for example "%album% (%year%)" becomes "album ()" and it is not possible to replace this with replacement system...
Comment 3 Julien Lorentz 2011-09-01 23:01:30 UTC
I totally agree with you with the empty variable thing. For example my pattern is %artist%/%year% - %album%/%track% - %title%
I have some artists, with some random songs, not in an album, so no year, no album, no track. It will be put under:
John Doe/ - / - Song.mp3
which is, indeed, very ugly

Under Amarok 1 if I remember, we could do like this {%artist/}{year - }{album /}{%track - }{%title%} which would hide the characters between the brackets if the variable is empty.

Would it be possible to implement this again?


(In reply to comment #2)
> I think users must be informed that preset are no more valid...
> And there is an other small bug on the same dialog :
> when using the regular expression replacement, replacement is effected before
> the other filters, and for example the VFAT filter replaces ":" by "_", and it
> is not possible to replace this "_" by nothing or by a space with the
> expression replacement system...
> It is the same when a variable is empty and we want to remove something ugly :
> for example "%album% (%year%)" becomes "album ()" and it is not possible to
> replace this with replacement system...
Comment 4 Sergey Ivanov 2011-09-17 18:05:20 UTC
(In reply to comment #2)
> I think users must be informed that preset are no more valid...
> And there is an other small bug on the same dialog :
> when using the regular expression replacement, replacement is effected before
> the other filters, and for example the VFAT filter replaces ":" by "_", and it
> is not possible to replace this "_" by nothing or by a space with the
> expression replacement system...
> It is the same when a variable is empty and we want to remove something ugly :
> for example "%album% (%year%)" becomes "album ()" and it is not possible to
> replace this with replacement system...

Well, Amarok 2.4.1 (IIRC) supplied with kconf_update script to update legacy format presets to new syntax, so It's strange that your config haven't been updated.
Filters order could be changed, your suggestions? :)
All this "ugly" things could be wiped out by using braces (they are still work, and AFIK never stopped to)
Comment 5 Julien Lorentz 2011-09-19 13:39:19 UTC
(In reply to comment #4)
> (In reply to comment #2)
> > I think users must be informed that preset are no more valid...
> > And there is an other small bug on the same dialog :
> > when using the regular expression replacement, replacement is effected before
> > the other filters, and for example the VFAT filter replaces ":" by "_", and it
> > is not possible to replace this "_" by nothing or by a space with the
> > expression replacement system...
> > It is the same when a variable is empty and we want to remove something ugly :
> > for example "%album% (%year%)" becomes "album ()" and it is not possible to
> > replace this with replacement system...
> 
> Well, Amarok 2.4.1 (IIRC) supplied with kconf_update script to update legacy
> format presets to new syntax, so It's strange that your config haven't been
> updated.
> Filters order could be changed, your suggestions? :)
> All this "ugly" things could be wiped out by using braces (they are still work,
> and AFIK never stopped to)

OK I just checked in details and the braces thing doesn't work properly with me with Amarok 2.4.1... For example it's working with the %track% tag, but not with the %year% or %album% tag.
I just tried with a song which doesn't have album, year or track number.
My pattern is {%artist%/}{%year% - }{%album%/}{%track% - }{%title%}
I would like the song to be under Artist/Title.mp3 but it goes under Artist/ - Unknown album/Title.mp3
Here is the problem!

Actually the best would that for the tags %artist% and %album% we can choose an option (or for example use new delimiters than braces, like square brackets) which makes that when there is no artist or no album it is replaced by "Unknown artist" or "Unknown album" instead of disappearing at all. Because right now it is the case for album, and not for artist. And for album (as I was explaining before), we can't choose the option the tag invisible at all.
It would be just very practicle to have a real file organisation system. For example for me I would like all songs of unknown arists to be in an "Unknown artist" folder, but when they have unknown albums, I want the songs just to be in the artist folder, not in any particular sub-folder.
I hope I made myself understandable, if not I could try to rephrase it! :)

A last thing also, if an album is from various artists, it might be nice to have an option to sort them under a folder Various artists, because now they all songs go under their artist's folders...
Comment 6 Sergey Ivanov 2011-10-30 15:06:00 UTC
Git commit 072f85ce4af65dc7c3e5e6102085edeaecc19246 by Sergey Ivanov.
Committed on 30/10/2011 at 15:58.
Pushed by ivanov into branch 'master'.

Add new type of optional tokens in format string (Collection Organizer) - "[]" square brackets. Syntax: [%token%: any formatted string], or Its short format: [%token%]. If you specified replacement string (string after colon ":" ) empty token will be replaced with this string (replacement can also include tokens and optional tokens); If no replacement defined default value will be used (e.g. Unknown artist for %artist%).
Split QStringx.h on .h and .cpp because It became huge.
BUG: 264874

M  +6    -0    ChangeLog
M  +1    -0    src/CMakeLists.txt
M  +30   -114  src/QStringx.h
M  +19   -5    src/dialogs/TrackOrganizer.cpp
M  +2    -0    tests/CMakeLists.txt
M  +6    -3    tests/TestQStringx.cpp

http://commits.kde.org/amarok/072f85ce4af65dc7c3e5e6102085edeaecc19246
Comment 7 Julien Lorentz 2011-10-31 14:29:12 UTC
Thanks! :)
Comment 8 Julien Lorentz 2011-12-12 19:21:38 UTC
I was using K3B yesterday and I wanted to convert to MP3 the tracks of a CUE files, and I discovered the tool to specify the directory and name of extracted files.
Very well done tool! There are conditional inclusions. Thus, if you type !a='%A'{%a} only includes the title's artist information (%a) if it does not differ from the album artist (%A). Also for example you could decide for soundtracks or compilation to use a pattern "Album/Track - Artist - Title" instead of "Artist/Album/Track - Title' otherwise... Infinite possibilities!
The only thing with the K3B tool, it doesn't seem to work properly (or I misunderstood the use). So it would be supergreat to have something like this in Amarok! You still could steal the code from K3B?! :)

Chears,
Julien