Jump to content

How to adjust library URLs when moving Emby from Synology to Windows


Go to solution Solved by kurtgschumacher,

Recommended Posts

kurtgschumacher
Posted

Apologies if this has been asked and answered, but the search function generates too many irrelevant links to go through.

I want to move Emby from my Synology NAS to a Windows system that's going to run all my server-type apps (Calibre, Emby, etc). I've read all the posts I could find on this and I know that I have to install Emby on Windows; download the latest Emby backup; and copy the files into the Windows installation. I know that links to libraries will need to be changed from Unix-style (/volume1/Public/EmbyMedia/blahblah) Windows-style (X:\EmbyMedia\blahblah), but I haven't found anything that explains how to do that. Ideally, I would like to make the changes before I copy the backup to the Windows installation. I suspect those setting are in one of more of the .db files in the backup. They appear to be SQLite databases, and I'm pretty familiar with SQL so I should be able to do some "mass change" queries to convert the links. But it would save me a lot of time if someone can tell me which database(s) and table(s) I should be looking at.

Happy2Play
Posted

With the majority of options being db only now you would have to manually attempt to find everything in the db and update but appears to be hit and miss per forum topics.  But everyone uses different feature so it is almost impossible to cover everything.  It will be the library.db

Most of what I have found 

UPDATE "main"."MediaItems" SET "Path" = replace( "Path", 'C:\Users\Media\Desktop\Videos', 'E:\Media' ) WHERE path LIKE 'C:\Users\Media\Desktop\Videos%';
UPDATE "main"."MediaItems" SET "Images" = replace( "Images", 'C:\Users\Media\Desktop\Videos', 'E:\Media' ) WHERE Images LIKE 'C:\Users\Media\Desktop\Videos%';
UPDATE "main"."MediaStreams2" SET "Path" = replace( "Path", 'C:\Users\Media\Desktop\Videos', 'E:\Media' ) WHERE path LIKE 'C:\Users\Media\Desktop\Videos%';
UPDATE "main"."Chapters3" SET "ImagePath" = replace( "ImagePath", 'C:\Users\Media\Desktop\Videos', 'E:\Media' ) WHERE imagepath LIKE 'C:\Users\Media\Desktop\Videos%';
UPDATE "main"."ItemExtradata" SET "Value" = replace( "Value", '"Path":"C:\\Users\\Media\\Desktop\\Videos', '"Path":"E:\\Media' ) WHERE value LIKE '%"Path":"C:\\Users\\Media\\Desktop\\Videos%';

If you filled in Network path on Library setup you will could need to update in options.xml and itemextradata. xml is obsolete in new 4.8+
Cinema Intro plugin paths
If you use AutoOrganizer you will need to update or delete the fileorganization.db
If you applied user images then path will need updated users.db

 

kurtgschumacher
Posted

Thanks, that gives me a starting point! I'll take a look at those, and maybe just do a query on each of the tables looking for the Synology paths. I know that will take a while, but I'm not in a hurry and I can do it in the evening while we're watching TV. And I'll run PowerGrep on the non-database files too. But it might even be easier than that. I opened the library.db file in Notepad++ and found strings like this: "/volume1/Public/EmbyMedia/Movies/Action-Adventure/". So that could quickly tell me where I need to change things.

If I'm successful with this I'll come back here and post what I did to make it work.

  • Like 1
kurtgschumacher
Posted

Okay, I ran PowerGrep on the backup folder and all it found was a lot of paths in old playlist XML files. Since 4.8 doesn't use those I'm sure I can delete those once the conversion is over.

I found a PHP program that will search all the columns in all the rows in all the tables of a database for a string and report them. I'm going to play with that this weekend. Since it's already in the tables anyway, I can change the program to change the column values. If I get that to work I'll post it here. It should work for an any-OS to any-other-OS conversion.

This is going to be a fun weekend, LOL!

 

kurtgschumacher
Posted

I ended up writing the Emby Fixer program from scratch because the one I found was overly complicated. I has to learn a few tricks to work with an SQLite database, but it seems to be working now. Tomorrow I'm going to install Emby on my MediaMaster Windows system, load the modified database over it, Start Emby, and see if it catches fire and explodes.

Once I'm sure everything is working I'll upload the program here. Wish me luck!

  • Thanks 1
  • Solution
kurtgschumacher
Posted

Success! I have Emby running on Windows with all the file paths correctly set to my Windows drives. I've attached the program I wrote to update the file paths in the library.db database. What the program does is: given a list of one or more volumes containing Emby libraries, look for paths in every column of every table of the database and change the volume designation from Unix-style to Windows-style. It should work for converting from Windows to Unix with some minor code changes. The program is written in PHP, and in a departure from current coding standards it contains copious comments!

Suggestion: It would be really, really nice if the Emby developers would provide this function for us!

emby_fixer.zip

  • Thanks 1
Posted

Many, many, many years ago, I found it was easier to set my libraries based on IP Address, so instead of \\Emby\Movies or \\Emby\TV, just used the ip address of 192.168.xxx.xx\Movies and  \\192.168.xxx.xxx\TV so even if I had to change the server and migrate, the only thing I had do was assign the old ip to the new machine.   Save's a lot of trouble, provided you don't have anything else running but working at the IP level was/is way easier than trying to replicate mappings, modifying databases and all that good jazz.

Good work though.

  • Like 1
kurtgschumacher
Posted
1 hour ago, js28194 said:

Many, many, many years ago, I found it was easier to set my libraries based on IP Address, so instead of \\Emby\Movies or \\Emby\TV, just used the ip address of 192.168.xxx.xx\Movies and  \\192.168.xxx.xxx\TV so even if I had to change the server and migrate, the only thing I had do was assign the old ip to the new machine.   Save's a lot of trouble, provided you don't have anything else running but working at the IP level was/is way easier than trying to replicate mappings, modifying databases and all that good jazz.

Good work though.

I never thought of using an IP address. Great idea!

kurtgschumacher
Posted

One more comment on the migration. I read some posts here saying that performance might be impacted by having Emby Server running on Windows with the data files on the Synology NAS. And it was... performance is much better! I think that's because the processor in the new Dell Inspiron is way more powerful than what's in the five year old Synology.

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...