MovieFan's Database Tool for Plex

Were the missing files on a networked drive?  I am not sure my tool can read network drives?

Thanks a lot

try to use it n ow

Hey MovieFan, love this project.

Q for you:

I'm moving my Plex Server from a PC to a Mac, and desperately want to move my Watched info across. Playing with your program...but can't quite see how I might accomplish this. Is it possible?

Any help appreciated.

Cheers
LP

My tool can’t really help with that, but you don’t really need it. Install pms on mac, do not run yet, copy the db from pc to overwrite the one on the mac, now start pms. Make sure to turn off automatically empty trash on up update. Edit libraries and ADD the correct paths. Update all libraries. Edit the libraries and remove the old path. Done.

Thanks - I'll give it a go :)

The steps I provided are just to get your libraries going.  If you want to recreate your old setup exactly, keeping shared users and other server settings, you will need to do some more research.  There have been a few topics that I cannot find right now that described moving form 1 OS to another.

Thanks for a great tool. It has saved me a lot of work.

One quick question - have you found there is a limitation regarding the size or number of songs in a playlist? I have one that has 1700+ songs and the tool will not import it. It states it does successfully but when I do "List Playlists" it shows "Work ()" and PMS shows "Work - 0 days". The other 3 that I exported to .m3u from J-River Media Center have imported fine and report the correct number of songs out to the side and the largest of those 3 has 995 songs.

Thanks in advance for any insight you can provide.

Yes i am aware of the limit.  I actually had a hack to bypass that limit but decided to put it back to normal as I wasn't sure if there would be any side effects from long term use of that hacked code.  If you are interested I can provide instructions to change the script to bypass that limit.  The script is just a text file and the change is just changing 1 value in 1 line of code.

Yes i am aware of the limit.  I actually had a hack to bypass that limit but decided to put it back to normal as I wasn't sure if there would be any side effects from long term use of that hacked code.  If you are interested I can provide instructions to change the script to bypass that limit.  The script is just a text file and the change is just changing 1 value in 1 line of code.

Yes please. Thank you!

why not have this (removal of limit) as a preference option - one not set by default and it says can be selected at user's own risk 

That way there will be only one version of the tool

@SA2000 - Upon further thought, I should be able to have my script determine how many files it will be importing ahead of time and then give a warning message that you are about to import more than 1,000 and apply the hack only to that list.  This will prevent possible errors with small lists.

Instructions to bypass limit for now.

1 - Open this file in any text editor - "MovieFan's Database Tool for Plex v0.3.2 - Playlist.mscr"

2 - Search for the term "1000".  It should only show up twice in the file.  You want the first one.  It will be part of this expressions.

strSql &= "INSERT INTO play_queue_generators (playlist_id, metadata_item_id, [order], created_at, updated_at) SELECT t1.playlist_id, t1.metadata_item_id, t1.rowid * 1000, t1.created_at, t1.updated_at FROM playlist_import AS t1 WHERE (t1.metadata_item_id <> """");^NL^" 

That number is inversely proportional to the limit.  Replace it with 100 will allow the list to be upto 10,000 entries, 10 will allow 100,000, and 1 will allow 1,000,000 entries.  Change the value to what you think is appropriate for you.

@SA2000 - Upon further thought, I should be able to have my script determine how many files it will be importing ahead of time and then give a warning message that you are about to import more than 1,000 and apply the hack only to that list.  This will prevent possible errors with small lists.

Instructions to bypass limit for now.

1 - Open this file in any text editor - "MovieFan's Database Tool for Plex v0.3.2 - Playlist.mscr"

2 - Search for the term "1000".  It should only show up twice in the file.  You want the first one.  It will be part of this expressions.

strSql &= "INSERT INTO play_queue_generators (playlist_id, metadata_item_id, [order], created_at, updated_at) SELECT t1.playlist_id, t1.metadata_item_id, t1.rowid * 1000, t1.created_at, t1.updated_at FROM playlist_import AS t1 WHERE (t1.metadata_item_id <> """");^NL^" 

That number is inversely proportional to the limit.  Replace it with 100 will allow the list to be upto 10,000 entries, 10 will allow 100,000, and 1 will allow 1,000,000 entries.  Change the value to what you think is appropriate for you.

Well, I tried 10 & 100 and it gives all the signs it worked, just like before I adjusted the sql script but same results as before. I looked at the playlist_import txt & csv files and they look fine. Maybe it's a limitation of the PMS itself?

@MovieFan

Would it be possible to add exporting of TV show Artwork?

^^ Working on it.

@anon18523487 getting a new error when writing images out of database to file system:

Seen this one?
Once dismissed, the tool stops and does not complete the rest of the file output.

I know the error. It means what it says. There is some reference to an image that I had not seen before in the database so the script is not equipped to handle it. Did the log output the path that caused this? It should be the last line. If not, I’ll provide an update tonight that will split out the error so I can try to fix it.

Last line of log is not an error… just tells me “file already exists” like many, many lines above.
Then says “Finished Processing:Library Name
Yet there are folders with .mp4 files that have no images in them, so no logged error, but data not written.

Once again, thank you, and no rush on my part. Just something I’d like to solve at your convenience.

You know what… I just went in and deleted the folder containing the file in the last log file entry, updated the library in Plex, emptied the trash (created by the now missing folder), and re-ran your tool.

Completed without error and wrote all files to all folders, including those past the removed folder.

Huh… Problem solved, but couldn’t tell you why that particular database entry caused the hiccup.

Don’t worry about this… I can live without that folder for now, and may just do some more sleuthing on my own.

I’ll do some investigating too. Maybe the database structure changed again.

@MovieFan.Plex, I am getting an “Error has occurred” message when I try to export 3 of my Playlists (the other 3 work, all 6 are music playlists). Turning on debug mode isn’t capturing anything either… any thoughts on what I could try?