deadbeef icon indicating copy to clipboard operation
deadbeef copied to clipboard

Add an option to sort added tracks by configurable script, after them being added to playlist

Open orbea opened this issue 9 years ago • 9 comments

OS: Slackware64-current deadbeef-8214e4f_2016.04.22_master-x86_64-1_git

When adding folders (albums) to a playlist the tracks are added in the order of the file names rather than being sorted by the track number included in the metadata as in music players such as cmus or fb2k.

In the below example the albums Monotony Fields and Shades Of are added in the correct order while Illusion's Play and angels of distress are added in the incorrect track order. This is especially annoying as the sort option is not capable of sorting only the highlighted tracks as in fb2k and requires the albums to be sorted by hand each time they are added to a playlist.

Shape Of Despair$ ls *
Illusion's Play:
Curse Life.flac          Fragile Emptiness.flac  Sleep Mirrored.flac
Entwined in Misery.flac  Illusion's Play.flac    Still-motion.flac

Monotony Fields:
Shape Of Despair - Monotony Fields - 01 Reaching The Innermost.flac
Shape Of Despair - Monotony Fields - 02 Monotony Fields.flac
Shape Of Despair - Monotony Fields - 03 Descending Inner Night.flac
Shape Of Despair - Monotony Fields - 04 The Distant Dream Of Life.flac
Shape Of Despair - Monotony Fields - 05 Withdrawn.flac
Shape Of Despair - Monotony Fields - 06 In Longing.flac
Shape Of Despair - Monotony Fields - 07 The Blank Journey.flac

Shades Of:
01 - ...In The Mist.flac  03 - Down Into The Stream.flac  05 - Sylvan-Night.flac
02 - Woundheir.flac       04 - Shadowed Dreams.flac

angels of distress:
Angels Of Distress.flac  Quiet These Paintings Are.flac
Fallen.flac              To Live For My Death.flac
Night's Dew.flac

orbea avatar Apr 27 '16 22:04 orbea

This is by design, and not going to be changed. Changing this to be sorted by metadata would break far more use cases, than fix.

Oleksiy-Yakovenko avatar May 04 '16 09:05 Oleksiy-Yakovenko

Out of curiosity do you have an example of a use case this would break? Even if this behavior is not added there are less drastic ways of "solving" this. Like if it were possible to sort only highlighted tracks in a playlist than the entire playlist.

Would it still break use cases if this was an optional feature so that users could choose how they want tracks sorted by default? Bluntly, this is a major issue as far as my personal use case is concerned. :)

orbea avatar May 04 '16 14:05 orbea

Out of curiosity do you have an example of a use case this would break?

Yeah.. how would you sort this? I couldn't make the sorting work. There are many other corner cases like this, which work fine when sorting by %path%, but would require special code if you want to sort by metadata.

image

edit: I needed to mention that my Track Nr. title formatting is this %tracknumber%[ \[disc %disc%[/%numdiscs%]\]], but the main point is that there are 2 CDs with tracks in each of them starting from 00, with identical album/artist.

edit2: Another obvious corner case is when some files don't have any metadata. That would especially be a problem when adding a large collection to the same playlist recursively. Many albums would get messed up.

Oleksiy-Yakovenko avatar May 04 '16 15:05 Oleksiy-Yakovenko

Like if it were possible to sort only highlighted tracks in a playlist than the entire playlist.

This issue is asking to sort the files by metadata, when they're being added to playlist. If you want to request another feature -- e.g. sorting selected tracks -- please post a new feature request.

Oleksiy-Yakovenko avatar May 04 '16 15:05 Oleksiy-Yakovenko

Would it still break use cases if this was an optional feature so that users could choose how they want tracks sorted by default?

I closed this because of the way this issue is written - as a bug. It implies changing the way files are sorted from their natural (fs-based) sorting to post-process sorting, based on metadata. This is not going to happen.

Rewording this issue into a feature request to add an option to automatically sort the added files after adding them to playlist -- would work better.

Oleksiy-Yakovenko avatar May 04 '16 15:05 Oleksiy-Yakovenko

@orbea

I'm open to suggestions which title formatting to use for default post-process sorting.

I'd start with something like this:

$directory_path(%path%)
[%disc%]
%track number%
%album%
%artist%

Oleksiy-Yakovenko avatar May 04 '16 15:05 Oleksiy-Yakovenko

another script idea

$directory_path(%path%)-
$if2($pad(%disc%,2,0),00)-
$if2(%track number%,00)-
[%album%]-
[%artist%]

This might even work.

($pad is not implemented yet though, but that's not a big deal to add)

Oleksiy-Yakovenko avatar May 04 '16 15:05 Oleksiy-Yakovenko

I was not sure on how you thought would be the best way to address this so I left my wording possibly vague.

The problem with my use case is that my music library is extensive and the CDs I ripped years ago don't have the track number in the file name. So this left my music directory with inconsistent naming conventions which would take a lot of work to untangle. This has never been a problem with other players (cmus, fb2k) because they relied exclusively on the metadata defaulting to the file name only if the metadata was missing.

With deadbeef it adds tracks with only the file name, so that it fails with a huge portion of my music library leaving me to sort albums manually by hand. This is a minor and constant inconvenience except for the few albums with 20+ tracks where it becomes more work to sort than reasonable.

My ideal solution would be to add two features.

  • To be able to configure the default behavior for sorting any new tracks added, preferably to address all use cases.
  • To be able to sort only select tracks in a playlist by hilighting them and then using the sort function which could also be added to the right click menu. Fb2k implements this feature and could be used as an example for how it should work. (This would also be very helpful for other use cases too, like to organize large playlists.)

I did not think of the script idea when I made this issue report, I'm not really sure how effectively it would solve my personal use case yet. Though I am certainly open to trying it. :)

orbea avatar May 04 '16 16:05 orbea

I did not think of the script idea

That's the only way how sorting works in deadbeef - it's always a title formatting script.

Oleksiy-Yakovenko avatar May 04 '16 16:05 Oleksiy-Yakovenko