Hey everyone, MovieFan figured out, that playlists need to be encoded in UTF-8 rather than ANSI to import titles with ‘uncommon’ characters.
I simply converted my playlists using Notepad++. When doing this, make sure to convert the files to UTF-8 without BOM or else the import to Plex will fail.
Thanks for the help and keep up the good work.
I sent over my new database file and the playlist I'm having problems with to you, MovieFan. Please have a look at it if you're able to. :)
Got it. Will look into it when I get to my computer.
Sent from my VS980 4G using Tapatalk
Found your problem. Your playlist has the BOM header info, so it is not being read properly. I don't see foreign characters in your list so you can just resave it as ANSI and it will be fine. I tested that and it worked for me. I'm putting in something to test a file to try and identify the type automatically.
I've pulled the script for now. See first post for details.
I'll be releasing my new script later tonight. Through testing with a user who was having problems with the old script, I think I've got all the bugs worked out. A playlist with 14K songs imported properly in 30 seconds. I've also added a few more features including an iTunes XML importer.
Ok. I didn't have as much time to work on this as I would have liked due to my phone deciding to go into a boot loop. That took way too long to fix. Anyways, here you go. New name to go with the extra features. I even followed Plex's naming guidelines. :P :P :P Even more features to come.
MovieFan's Database Tool for Plex v0.1
Features
- m3u Playlist import (works very fast now)
- iTunes XML to m3u autoconvert and import (still working to make this more user friendly, but for now, it works)
- database backup and restore (basically just copies Plex's database file so you can play around and not worry about messing up the file)
Limitations
- m3u playlists must be less than around 800k in size (The script I use has a limit of reading files up to 1 MB. I have a work around but haven't had time to implement it yet.)
- playlists must be in utf-8 format with BOM (This is the normal way most programs will create the file. If for some reason your files are not in this format, you can easily open and resave in regular Windows notepad. Also, this is the format the iTunes exporter creates.)
- a playlist entry is created in the database even if no matching files were found (I haven't figured out how to handle this yet, ideas are welcome)
I tested the new script, but I couldn't get it to work with my database from my Linux server.
Do we need the executable for Plex Media Server for the script to work?
No, that is only so it can close out plex when restoring a backup. Just pick any exe file to skip that part. I’ll fix that so it will only ask for it when you want to do a restore.
Quick fix so it won't ask for the PMS file until you want to try and restore a backup.
First off, thanks a ton for putting together this script. I almost exclusively listen to my music via playlist so not having them in Plex almost makes plex a no go for me.
Im having an odd issue where some playlists import successfully but show up in the library as containing 0 songs. Ive read through this forum thread and have been unable to solve the issue. Early on in the thread you said to use UTF-8 without BOM, later with BOM. Ive tried both ways. The playlist im focusing on does not have any special characters so ive also tried changing back to ANSI. Ive also tried opening and saving in notepad and wordpad. I have iTunes installed with all of my playslist imported. Ive tried importing the playlist from the itunes database using your script and ive also exported the playlist from iTunes as an m3u and then imported that. I get the same result regardless. However, when i use the iTunes channel in Plex im able to play the playlist. I also have another playlist with is all of my smaller playlists in one. It contains all the same files that are listed in the smaller artist specific playlist. It imports and works fine. So far ive tried importing 14 playlists 7 work, 7 have the issue. Also, for what its worth, the first playlist i imported was the big one that contains all the rest; so its not having an issue with multiple playlists referencing the same song otherwise none of the subsequent playlists ive imported would have worked.
I tried to attach my database file but its too big, 175M.
Thanks a ton for your help,
Zach
Edit: I carried on adding the rest of my playlists, 25 out of 70 worked. Same issue with all the others.
It shouldn't have issues referencing the same files, so that is definitely not the issue.
The playlists need to be in UTF8 with the BOM. It was getting too confusing trying to track if it had it or not and with was the most common. I didn't have time to test what happens if the BOM is not there or with ANSI versions. I'll do that tonight.
To troubleshoot this, open my script in notepad or some other text editor. Near the top just under the copyright notices find the line
bolDebug = False
Change the False to True and try running the script again. This time it will create 3 files. 1) import.csv, 2) import.sql, and 3) playlist_temp.txt. Send me these 3 files.
Thanks again for your help.
Im uploading my database to Dropbox so ill be able to share it shortly.
Ok, I do see something odd. Your ID numbers which identify the playlist is not sequential. When generating the playlist entry, it is suppose to auto increment this number from the highest value, but for some reason, your database has ID numbers that are higher than the newly created value, which is confusing my script. I can fix this. I'm away from my main computer so I can't test but I will provide an updated script which should avoid this problem. Give me a few minutes.
You rock, thx. No rush.
Ok. Try this version.
Im getting the following error.
'temp.txt' couldnt be opened
Line 534 (E:\Download\MovieFan's Database Tool for Plex v0.1.2.mscr):
strSelectID = Part(ReadFile("temp.txt"), "\", True)
Im making some headway, have not figured out the problem yet but its with my playlists. Ill let you know when i do.
Sorry about that. Got ahead of myself. Try this.
For your playlsit, check if the files are a relative directory instead of absolute. In other words, does it have the drive letter? My tester told me that iTunes exports playlist relative to the iTunes drive, so if your iTunes is on C: and the music file is on C:, it gives the path as "\some music folder\..." without the drive letter. You can force it to add the drive letter if you save the playlist to some other drive location.