dakusan / PlexPlaylistImporter

Import playlists into Plex
Other
79 stars 18 forks source link

[Linux] Symlinks' path converted to destination path #7

Open qoxxxx opened 7 years ago

qoxxxx commented 7 years ago

My music library folder have symlinks pointing to tracks from all over .. For example, /plex/music_folder/symlink_of_track1.mp3, which points to /hard/drive/track1.mp3 So Plex only knows /plex/music_folder/symlink_of_track1.mp3, not /hard/drive/track1.mp3

The problem is PlexPlaylistImporter converts the symlink path to the path it points to, so it can't find the track in the database.

The line responsible is in M3U.py, line 31

LookupPath=os.path.realpath(('' if IsAbsolutePath else PlaylistDirPath)+LineStr.rstrip('\n'))

Replacing it by LookupPath=LineStr.rstrip('\n') does the trick.

I can see it's there to support relative path, but I'm guessing converting symlinks is a side effect.

PS: PlexPlaylistImporter is an awesome contribution ! I can't believe Plex doesn't support it still..

dakusan commented 7 years ago

Can you instead change "realpath" to say "normpath" and see if it fixes it? I think that will make the old stuff work and no longer follow symlinks (which i consider the preferred behavior).

And thanks :D

qoxxxx commented 7 years ago

normpath is working fine for me, thanks.

weetabixface commented 6 years ago

thanks for this tool, very useful to import lots of playlists

I had a similar problem to the OP , Plex for me runs in a jail on my FreeNAS so the full path to files is something like /mnt/tank/<user>/media/music/<artist>/<track>

the media folder is then mounted in the jail as /media so in the Plex DB the entries to files entries are /media/music/<artist>/<track> so was getting lots of errors with files paths not matching between .m3u and DB

workaround was to use the fix described here for relative/absolute paths and also editing line 40 to ensure what was pulled from the .m3u playlist went into the PlaylistFiles output in the correct format to include the leading / of the mount point in the jail