1

I want a playlist to refer to a relative file path, so I can copy it to my mobile phone or any future drive and it will still work.

The playlist is located in /home/gratis/Music/Hip-Hop/50 Cent/The Very Best Of 50 Cent/11 - Patiently Waiting (ft. Eminem).m3u, and its entries are:

#EXTM3U
#EXTINF:286,Eminem - Patiently Waiting (ft. 50 Cent)
/home/gratis/Music/Hip-Hop/Eminem/The EMINEM Anthology/074 - Patiently Waiting (ft. 50 Cent).opus

So, that's basically two directories up from where it's located -> Eminem -> The EMINEM Anthology -> music file.

I replaced /home/gratis with .., and tried Mark Kirby's suggestion (replacing /home/gratis with ~), but neither of those attempts worked. How can I make these paths relative and/or portable?

4
  • Error for case 1: File reading failed: VLC could not open the file "/home/gratis/Music/Hip-Hop/50 Cent/The Very Best Of 50 Cent/../Music/Hip-Hop/Eminem/The EMINEM Anthology/074 - Patiently Waiting (ft. 50 Cent).opus" (No such file or directory). Your input can't be opened: VLC is unable to open the MRL 'file:///home/gratis/Music/Hip-Hop/50%20Cent/The%20Very%20Best%20Of%2050%20Cent/..%2FMusic%2FHip-Hop%2FEminem%2FThe%20EMINEM%20Anthology%2F074%20-%20Patiently%20Waiting%20%28ft.%2050%20Cent%29.opus'. Check the log for details. Error Case 2: Oct 4, 2016 at 15:59
  • File reading failed: VLC could not open the file "/home/gratis/Music/Hip-Hop/50 Cent/The Very Best Of 50 Cent/~/Music/Hip-Hop/Eminem/The EMINEM Anthology/074 - Patiently Waiting (ft. 50 Cent).opus" (No such file or directory). Your input can't be opened: VLC is unable to open the MRL 'file:///home/gratis/Music/Hip-Hop/50%20Cent/The%20Very%20Best%20Of%2050%20Cent/~%2FMusic%2FHip-Hop%2FEminem%2FThe%20EMINEM%20Anthology%2F074%20-%20Patiently%20Waiting%20%28ft.%2050%20Cent%29.opus'. Check the log for details. Oct 4, 2016 at 16:00
  • ~ is just a synonym for $HOME which is a variable for /home/username so a absolute path remains... this just works for other users with the same paths. Oct 4, 2016 at 16:01
  • Thats what VLC does. It is "only once" in the playlist entry. I remember it was something like ../, so I'm confused that doesnt work Oct 4, 2016 at 16:12

1 Answer 1

2

for a relative path it is interesting where the playlist is located. --> the paths are relative... relative to what? for sure the playlist! ;-)

  • for example the easiest is, everything is located in the same folder... then just delete the complete paths except the filenames and that's it: track.flac
  • or lets assume a sampler with more than one disc in sub-folders: disc1/track.flac
  • or the other way round; the playlist is located in a sub-folder: ../track.flac --> ../ stands for one folder up.
  • and the combination; a sampler with more discs and also playlists in different sub-folders: ../disk1/track.flac

the difference for absolute or relative paths are just the leading /!


so... to combine all them together for your case, the correct relative path would be ../../Eminem/The EMINEM Anthology/074 - Patiently Waiting (ft. 50 Cent).opus (if i'm right). ;-)

--> but keep in mind changing the folder structure will in most cases also mess up relative playlists, except just renaming the playlist-folder(s).

5
  • Hey, the point is to have one music file, that is playable in both Best-Of-Compilations. I tried: "Music/Hip-Hop/Eminem/The EMINEM Anthology/074 - Patiently Waiting (ft. 50 Cent).opus" in the third line of the m3u file, but that would only work, if the playlist was in /home/gratis, right? Oct 4, 2016 at 16:26
  • @MarkusGratis: yes, but this 4 folders in the playlist must never be changed or even renamed to keep the playlist working! - IMHO the best for relative paths is to keep them as short as possible... (and absolute playlists are anyway useless). Oct 4, 2016 at 17:09
  • Yeah, I'm aware of that. But how to do it? With the playlist in /50 Cent/The Best of 50 Cent/ that is... Oct 4, 2016 at 17:11
  • @MarkusGratis: please read the complete answer careful. - i added a second part for your concrete case, so you only have to copy&paste. - if it isn't working please post, what isn't working, the error-message, etc... Oct 4, 2016 at 17:18
  • I'm sorry, I only saw the second part just now. Thank you so much! That works ;) Oct 4, 2016 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.