MovieFan's Database Tool for Plex

Ive got it working with the original script.  Its definitely something with my playlists.  I think it has to do with encoding but i cant find a difference between test versions that work that the one that does not.  To fix the issue i open the failing playlist in notepad++ and chose save as saving it as a new file.  That file works.  I had previously been using the encoding menu to convert to UTF-8.  Bonnie Raitt.m3u does not work, Bonnie Raitt Save As.m3u does.  All i did is open Bonnie Raitt.m3u and save it as Bonnie Raitt Save As.m3u.  The appear to be encoded the same.  I cant find a difference.  But it works.  Sorry to bother you.

Still not sure what the source of the issue was but with some playing around ive got everything imported and everything ive tested works as it should.  Couple of things for you though.  It appears that something happened to the database when those imports failed.  Once i fixed the files if I imported them under another name, like Bonnie Raitt Save As, they work.  As soon as i change them back to just Bonnie Raitt and import them they fail.  I found that if i import them as something else like ....Save As, then either from within Plex or using your script change the name to Bonnie Raitt it works.  In doing so i found a bug in the change playlist name portion of your script.  The first time you use it it works, but if you then choose another playlist you want to rename it allows you to select the playlist but it does not let you choose the new name.  It gives it the same name as the previous file you renamed.  You end up with multiple playlists with the same name.

Very odd.  I compared both files with a hex editor and they are identical, so I have no idea why 1 works but the other doesn't.

What do you mean something happened to the database?  I know in 1 of my tests that if it put a string where a number was expected it would confuse the database.  Deleting that bad entry would fix it up.

Thanks for the bug.  I know whats causing it.  I'll fix it.

Very odd.  I compared both files with a hex editor and they are identical, so I have no idea why 1 works but the other doesn't.

What do you mean something happened to the database?  I know in 1 of my tests that if it put a string where a number was expected it would confuse the database.  Deleting that bad entry would fix it up.

Thanks for the bug.  I know whats causing it.  I'll fix it.

I could be wrong that its something happening to the database, i know all but nothing about databases and have not tried to look at the database itself.  

When i initially added my playlists the majority failed.  As i played with them, playing with encoding etc nothing seemed to work until i started making alternate copies of the playlists themselves; for instance Bonnie Raitt Save As.m3u.  When i imported that file it worked.  Of course I dont want the playlist named Bonnie Raitt Save As so i deleted the playlist entry from Plex and renamed the .m3u file on my computer back to Bonnie Raitt.  I had already deleted the failed playlist in Plex.  When i reimported the playlist named Bonnie Raitt it failed again, but it was the same file that had just worked when named something different.  I ultimately discovered that if i imported the playlist when the file was still named something else then renamed it to just Bonnie Raitt it worked.  It worked renaming it from within Plex and using your script.  That made me think that although i had deleted the failed import some remnant was left behind that was causing future imports with the same name to fail even if the playlist file had been fixed.  Deleting the failed playlist using your script or within Plex made no difference, id still have the issue.

Sitting here thinking through all that i did I think i may have figured out one of the mistakes i was making.  From reading through this thread my first thought when some playlists were failing was encoding.  Again not knowing enough about encoding or notepad++ i chose the option at the top of the encoding menu for UTF-8.  In retrospect i think that was only rendering the info in UTF-8, not actually converting it.  After getting most stuff working i noticed that a few playlists were missing songs.  All the missing songs had special characters.  I went back to the original playlists which were in ASCI and chose the convert to UTF-8 option near the bottom, that fixed the issue.  Also FWIW, i discovered that to get them to work, Tool's album Ænima for instance i had to use UTF-8 withOUT BOM.

That still doesnt explain the naming issue though.

As far as Encoding, what are you using to generate the files?  Some programs want the BOM, some don't.  There's also the difference of having the BOM when it reads the file and when it writes the file.  If you are doing this from iTunes, it is suppose to generate them with the BOM.  The covnersion program I have for iTunes also generates them with BOM.  That's why I ended up choosing that.  I can have my script do it either way, but that would just be confusing I think.

I don't know about the naming problem.  On my end I get the same result, but since I don't have your files, I can't be sure.  From what I can see, both playlists are identical.  If you can send me your database, I can test it on my end to see if I can recreate the problem.

Hi All,

Thanks for this great script!

just started playing with this and seems like I'm going wrong somewhere! Is there a log file so I can see what's up?  

When I import an m3u (in UTF8 with absolute paths) I get the message that it has imported but then nothing is showing in Plex.

Any ideas?

Thanks!

The script does not generate a log by default but there is a debugging feature.  Open the script using notepad or equivalent.  Find this line near the top.

bolDebug = False

Change the false to true.  There are a few temporary files that are created during the process that get deleted.  This will prevent those from getting deleted.  If you upload those files I can check for errors.

playlist_temp.txt

import.csv

import.sql

Thanks for the reply.

I didn't get a playlist_temp but got the other files. As I'm new to the forum it won't let me upload any files :(

Here are pastes of the files:

http://pastebin.com/CRi1pxaK

http://pastebin.com/bkZ8S79a

Not getting the playlist_temp.txt file is an indicator of a problem.  The other 2 look fine so I am not sure at this point the problem.  Can you send me your itunes.xml file so I can test it?  You cam PM me the file/link if you are concerned about security.

I'm not using itunes - I'm browsing to an m3u

Sorry.  Thought this was an iTunes issue.  Ok.  Can you send me the m3u file?

I’m away from home till Friday but I’ll post it up then.


Thanks!

Here's the m3u I've been trying to upload.

Thanks!

nothing attached

http://pastebin.com/qLuAJ7PV

Sorry, still not allowed to attach files :)

Everything looks fine.  Do your files in Plex match the same directory as in the playlist?  i.e.  Your first file:

d:\Music\Tunes\Rumer\Seasons Of My Soul\Aretha.flac

Find the same song in Plex.  Click on the 3 dots and hit info. Match the path to above.  Are they identical?

In Plex it shows the path as :

D:\Music\Tunes\Rumer\Seasons Of My Soul\Aretha.flac

Changing the path to D: instead of d: didn't change anything,

Oh wait, I see the problem.  Your file is not saved in utf-8.  Try opening the file in notepad.  You will see the extra a at the beginning.  Delete this.  Resave the file as utf-8.  Try import again.