DeaDBeeF-Player / deadbeef

DeaDBeeF Player
https://deadbeef.sourceforge.io/
Other
1.65k stars 178 forks source link

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

Open orbea opened 8 years ago

orbea commented 8 years ago

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
Oleksiy-Yakovenko commented 8 years ago

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.

orbea commented 8 years ago

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. :)

Oleksiy-Yakovenko commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

@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 commented 8 years ago

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)

orbea commented 8 years ago

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.

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. :)

Oleksiy-Yakovenko commented 8 years ago

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.