Best Way To Change Library Path
#1
Hi All,

I have the following setup:

- HTPC Running XBMC
- SERVER Running MYSQL (Which holds my xbmc video and music db)
- OLDNAS Storing all my media content
- NEWNAS Which will eventually hold all my old media content plus more (as i am expanding storage)

Anyway, I dont want to have to re-import and lose all my meta data such as watched flags etc. but will need to change the library path from "\\OLDNAS\TV Shows" to "\\NEWNAS\TV Shows". I am under the impression that changing the library source will cause xbmc to re-import all items essentially duplicating them.

I am comfortable with SQL and my initial thought was to update all the paths in my video library. Then change the library path in xbmc. Would this result in the same thing happening? If so what other options do I have? Thanks for all your help.
Reply
#2
That works - change the path table entries to reflect the new path using sql and change the source path.
System: XBMC HTPC with HDMI WASAPI & AudioEngine - Denon  AVR-3808CI  - Denon DVD-5900 Universal Player  - Denon DCM-27 CD-Changer
- Sony BDP-S580 Blu-Ray  - X-Box 360  - Android tablet wireless remote - 7.1 Streem/Axiom/Velodyne Surround System
If I have been able to help feel free to add to my reputation +/- below - thanks!
Reply
#3
For several questions similar to this, the proposed solution is:

- export db as one XML file
- open XML file and search&replace the old path with the new path
- clear database
- import database from (modified) XML file

Supposedly, that keeps watched status etc. but never tried myself.
Reply
#4
(2012-05-03, 17:46)fungus1487 Wrote: Anyway, I dont want to have to re-import and lose all my meta data such as watched flags etc. but will need to change the library path from "\\OLDNAS\TV Shows" to "\\NEWNAS\TV Shows". I am under the impression that changing the library source will cause xbmc to re-import all items essentially duplicating them.

I strongly recommend you use "smb://newnas/tvshows/" instead of "\\newnas\tvshows". The "smb://" form is XBMC's standard URL for SMB file shares and it's generally more stable.

If you're going to export and import again you need to set <importwatchedstate> to true in advancedsettings.xml. See http://wiki.xbmc.org/?title=Advancedsett...library.3E for details.
Reply
#5
(2012-05-04, 10:21)jhsrennie Wrote:
(2012-05-03, 17:46)fungus1487 Wrote: Anyway, I dont want to have to re-import and lose all my meta data such as watched flags etc. but will need to change the library path from "\\OLDNAS\TV Shows" to "\\NEWNAS\TV Shows". I am under the impression that changing the library source will cause xbmc to re-import all items essentially duplicating them.

I strongly recommend you use "smb://newnas/tvshows/" instead of "\\newnas\tvshows". The "smb://" form is XBMC's standard URL for SMB file shares and it's generally more stable.

If you're going to export and import again you need to set <importwatchedstate> to true in advancedsettings.xml. See http://wiki.xbmc.org/?title=Advancedsett...library.3E for details.

Thank you for the detailed information, this will definately be useful when I re-import the lot. And for clarities sake I'm actually using nfs the example I provided was just meant to generalise it but thanks again.
Reply
#6
My apologies for digging up this "old" thread, but did this solution work out for you fungus1487?

I'm in a similar situation (changing storage device, so have to adjust source paths). The difference is that I use the default DB format (SQLite file in the USERDATA folder).

If I understand correctly the safe way to go about this is:
  • Set <importwatchedstate> to true in advancedsettings.xml
  • Export complete DB as XML file (from within XBMC)
  • Search & replace <OLDPATH> with <NEWPATH>
  • Import DB from XML file (from within XBMC)
  • Update media sources to new path within XBMC

Am I missing something here? Confirmation of the above steps would give me some peace of mind.. Wink
Reply
#7
Yep that's pretty much what I did to the letter, worked like a charm.
Reply
#8
"Search & replace <OLDPATH> with <NEWPATH>"

Which file(s) do you have to search/replace this inHuh (Is it the "path" db file we are talking about?)

And also about this:
"Set <importwatchedstate> to true in advancedsettings.xml"

Is the correct line supposed to read this:
<importwatchedstate>true<importwatchedstate>

And do I have to change all my clients advancedsettings.xml files to reflect the importwatchedstate flag to this before exporting the DB?
Reply
#9
(2012-10-16, 00:06)tormi Wrote: "Search & replace <OLDPATH> with <NEWPATH>"

Which file(s) do you have to search/replace this inHuh (Is it the "path" db file we are talking about?)

You don't need to touch a db file. Export as XML then edit the file (its just text so use notepad) where <OLDPATH> is you old location and <NEWPATH> is your new one. e.g. If you have the following in your xml....

Code:
\\Computer01\Movies\Die Hard\Die Hard.mkv
\\Computer01\Movies\Fightclub\Fightclub.mkv
\\Computer01\Movies\Robocop\Robocop.mkv

You want to do a find replace for....

Code:
"\\Computer01\Movies"


to your new location e.g.

Code:
"\\Computer02\All My Movies"

(2012-10-16, 00:06)tormi Wrote: And also about this:
"Set <importwatchedstate> to true in advancedsettings.xml"

Is the correct line supposed to read this:
<importwatchedstate>true<importwatchedstate>

Almost right, you want (notice the forward slash in the second xml element)....

Code:
<importwatchedstate>true</importwatchedstate>

(2012-10-16, 00:06)tormi Wrote: And do I have to change all my clients advancedsettings.xml files to reflect the importwatchedstate flag to this before exporting the DB?

You want to change it in all your clients you will be importing back into, but no it only affects importing not exporting.
Reply
#10
Hi everybody, the best way is to use a sql tool like HeidiSQL (free) http://www.heidisql.com/download.php and simple change the path with the replace function...

for example for the movie table: (u want to change the movie to a new drive old was c: new is dSmile

UPDATE movie
SET c22=REPLACE (c22,'c:/movies/','d:/movies/');

then go to the path table

UPDATE path
SET StrPath=REPLACE (StrPath,'c:/movies/','d:/movies/');

check with your xbmc client if the movies run again (they should..)

cheers
Reply
#11
(2012-10-20, 12:43)roddyrodman Wrote: Hi everybody, the best way is to use a sql tool like HeidiSQL (free) http://www.heidisql.com/download.php and simple change the path with the replace function...

for example for the movie table: (u want to change the movie to a new drive old was c: new is dSmile

UPDATE movie
SET c22=REPLACE (c22,'c:/movies/','d:/movies/');

then go to the path table

UPDATE path
SET StrPath=REPLACE (StrPath,'c:/movies/','d:/movies/');

check with your xbmc client if the movies run again (they should..)

cheers

Please take a backup before doing any of the above. You dont want to be left with a broken db.
Reply
#12
I'm in the same boat here.
So, if I want to change my storage device but keep watched list, date added (important because I generally list in reverse added order so latest are at top) etc. I can't just edit source within xbmc? I need to 'mess' about with SQL?? Sad
I have a fairly standard install with it running on Win7 and various sources from the NAS.
Reply
#13
I noticed this issue early on with XBMC, so here's what I implemented:

I setup my movie source path to smb://media-svr/Movies/...

Now, there's no such device named on my network. What I did was edited my hosts file and pointed hostname 'media-svr' to the IP address of the current storage device. At any time I can move my movie data to another device and just update the hosts file with the new IP address. Problem solved plain and simple.

FYI- If you do this like I did (with a phantom hostname), when adding the new video source you won't be able to browse out to the share. You'll have to manually type it in.
Reply
#14
(2012-12-13, 10:02)mc33 Wrote: I noticed this issue early on with XBMC, so here's what I implemented:

I setup my movie source path to smb://media-svr/Movies/...

Now, there's no such device named on my network. What I did was edited my hosts file and pointed hostname 'media-svr' to the IP address of the current storage device. At any time I can move my movie data to another device and just update the hosts file with the new IP address. Problem solved plain and simple.

FYI- If you do this like I did (with a phantom hostname), when adding the new video source you won't be able to browse out to the share. You'll have to manually type it in.

Excellent thinking. Outside the box & pretty nifty, I keep forgetting how powerful a file the HOSTS-file actually is.

I currently just beginning to play with NFS-shares, and I suppose I could do the same.

Of course, first I suppose I need to run a path-substitution and change protocol from SMB to NFS.
Reply
#15
If anybody is still here? I did this and it worked... the shows in the new path showed up in the library after I imported it. HOWEVER... Once i choose "clean up library", all the shows in the new path were removed. Sad I tried it twice now with the same results.
Reply

Logout Mark Read Team Forum Stats Members Help
Best Way To Change Library Path0