Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for forward and backslash in playlist on Windows #607

Closed
MartyLake opened this issue Jul 19, 2019 · 0 comments
Closed

Support for forward and backslash in playlist on Windows #607

MartyLake opened this issue Jul 19, 2019 · 0 comments

Comments

@MartyLake
Copy link

Feature request

Most of music software support m3u containing backslashes or forward-slashes. I managed to convert my existing playlists using bash and sed.

My problem is that I uses beets.io to maintain "automatic libraries" that are created and updated based on queries (for example "all the songs from the 2000"). These are called automatic playlists because they are automatically updated when I modify my library ("beets import new_folder_music_mp3") so I don't have to think about yet another manual step.
Unfortunately, I am using Windows, and beets uses backslashes on windows, and MPD can only recognize forwards.

I tried to skim the source code, and if I got things correctly, the problem is here

MPD/src/fs/Traits.cxx

Lines 87 to 119 in e87f0ca

template<typename Traits>
typename Traits::const_pointer_type
RelativePathImpl(typename Traits::const_pointer_type base,
typename Traits::const_pointer_type other) noexcept
{
assert(base != nullptr);
assert(other != nullptr);
other = StringAfterPrefix(other, base);
if (other == nullptr)
/* mismatch */
return nullptr;
if (*other != 0) {
if (!Traits::IsSeparator(*other)) {
if (*base != 0 && Traits::IsSeparator(other[-1]))
/* "other" has no more slash, but the
matching base ended with a slash:
enough to detect a match */
return other;
/* mismatch */
return nullptr;
}
/* skip remaining path separators */
do {
++other;
} while (Traits::IsSeparator(*other));
}
return other;
}
some path comparison is done using string comparison which does not work is forward and backlsashes are mixed. Would adding here a "sanitizing" pass (let's say, "if the path contains 0 forward, and 1+ backslash, convert all the backslashes into forward") be an option ? Can you help me figure out if my way of solving the problem (fixing mpd) is correct, and if this part of the source code may be the good approach ?

Long live MPD, the best music player so far !

Example of playlist that works fixed by bash+sed:

#EXTINF:346,Le Knight Club - Coco Girlz
Le Knight Club/Ilictronix/01 Coco Girlz.mp3
#EXTINF:325,Alec Carlsson - OMG
Compilations/Shiny Disco Club Presents_ Millenium Disco (vol.1)/18 OMG.mp3
#EXTINF:190,Calypso
Compilations/Shiny Disco Club Presents_ Millenium Disco (vol.1)/12 Calypso.mp3
#EXTINF:225,Kartell - Ending Season
Compilations/Shiny Disco Club Presents_ Millenium Disco (vol.1)/19 Ending Season.mp3

Example of playlist that does not work, generated by beets.io:

Compilations\Sakifo Musik Festival 2006\05 Avec Le Vent.mp3
Compilations\Disco Hits\00 Ring My Bell (badq).mp3
Anita Ward\Maximum Disco 12''\00 Ring My Bell (Original Disco Version).mp3
BlastRec\Volume Zero\09 Astrid Eve.mp3
Django Unchained\Original Motion Picture Soundtrack\23 Trinity (Titoli).mp3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant