Difference between revisions of "HOW-TO:Backup the video library"

From Official Kodi Wiki
Jump to: navigation, search
(Page cleared and redirected)
 
Line 1: Line 1:
<span style="float:right">{{Icon-backup}}</span>
+
#REDIRECT [[Backup]]
{{mininav| [[Video library]] {{l2| [[Backup]] }} }}
 
{{outdated|This page has some inaccuracies and requires rewriting.}}
 
 
 
<section begin="intro" />This guide will show you how to backup the '''[[video library]]''' using '''[[NFO files]]''' and local images. These NFO files are little text files that save all the "metadata" (summaries, credits, playcount, and other library data) for each individual video that are then placed along side the actual video files. These act as a backup for each entry, and can also be used as a way of changing library information or for scanning files that are not recognized by a [[scraper]] website. This also saves any changes you've made in Kodi, such as changing the title, sort title, selecting specific images/artwork, [[movie sets]], [[video library tags]], watched history, and resume points.
 
 
 
Backing up the video library is a good idea for several reasons: rebuilding your library in case of damage to your main HTPC, mistakenly removed library entries, duplicate the same library on other Kodi installs, or let you to easily move your video files without losing special changes or your watched history. It also allows for off-line library scanning or if a scraper website goes away.<section end="intro" />
 
 
 
== Moving the library ==
 
The steps in this guide include how to use the backup to move video files to a new location.
 
 
 
When you scan video files into the [[video library|library]], Kodi will remember the exact location of the files used. If you'd like to move the video files, say from a local hard drive to a [[NAS]] or changing the [[file sharing]] protocol you use, then you will need to update paths stored in Kodi's library. Exporting NFO files will preserve your Kodi library when you move the location of your video files and ensure that all of the "metadata" (summaries, credits, etc) is preserved, along with your watched history and resume points.
 
 
 
== Steps ==
 
{{how-to
 
| Step1-title = Backing up
 
| Step1 = Export the video library to individual [[NFO files]] and local images.
 
{{Note|If you've already [[export]]ed your library (or created NFO files with another program) then you will still need to re-export and tell Kodi to overwrite old files. This will make sure that your watched history, resume points, and any other changes you've made gets saved. However, in that situation you can probably skip re-exporting images.}}
 
# In Kodi go to {{highlight|bordered=yes|[[Settings/Media/Library#Video_Library|Settings -> Media -> Library]]}} and select '''Export library'''. Various pop-up windows will show up:
 
# Say '''"multiple files"''' when asked how you would like to export.
 
# Say '''"Yes"''' when asked about exporting thumbnails and fanart.
 
# Say '''"Yes"''' when asked about actor thumbnails. <ref name="actors">'''Actor thumbnails -''' You can say say no if you don't really care about pictures for actors. Plus Kodi exports actor thumbnails in a weird way that causes it to take up more drive space than necessary, since it will save actor images per TV show. It's not a lot of space, but still kind of annoying. If you don't export actor thumbnails, then when you later "import"/scan those files Kodi will redownload the images from the internet ''unless'' you turn off actor thumbs under Settings -> Videos -> Library.</ref>
 
# Say '''"Yes"''' when asked if you want to overwrite old files.
 
# Kodi will now export the library, which may take a while depending on your library size and speed of your HTPC and/or network.
 
 
 
| Step2-title = Restoring
 
| Step2 = If you only wish to backup your library then you don't need to go any further. The rest of the steps will show you how to rebuild your library using the NFO files and local images you just saved.
 
 
 
| Step3 = Close Kodi.
 
 
 
| Step4-title = ''Optional''
 
| Step4 = If you are moving the library then you can now move those video files to their new location.
 
 
 
| Step5 = You'll want to add the import watch and resume tags to an [[advancedsettings.xml]] file.
 
 
 
# Create a '''plain text file''' (no rich text formatting, don't use .doc, etc) and save it as '''advancedsettings.xml'''. Make sure that the file extension is ".xml" and {{color|red|'''not'''}} ".txt" or ".xml.txt".
 
# Cut and paste this into your new plain text file:
 
#: <syntaxhighlight lang="xml" enclose="div">
 
<advancedsettings>
 
  <videolibrary>
 
    <importwatchedstate>true</importwatchedstate>
 
    <importresumepoint>true</importresumepoint>
 
  </videolibrary>
 
</advancedsettings>
 
</syntaxhighlight>
 
# Save this file in your [[userdata folder]]:
 
{{Collapse top|1=[[userdata folder]] location:}}
 
{{#lst:userdata|location all}}
 
{{Collapse bottom}}
 
 
 
::If you have an existing advancedsettings.xml file then make sure the tags are between the main <code><advancedsettings></advancedsettings></code> tags.
 
 
 
| Step6 = Move all of your "MyVideos".db files and your sources.xml file out of '''[[userdata]]/Database/''' {{small|(see step 5.3 for location)}} so that Kodi will create a new blank database. Don't delete the files just yet, in case something goes wrong. If you are using MySQL then use the "<code>DROP</code>" command from the MySQL command line tool.
 
 
 
| Step7 = Open Kodi. If Kodi is already running then restart it so that the changes you've made will take effect.
 
 
 
| Step8 = Add the new source in Kodi and '''[[set content]]''' for your TV shows and movies folders. {{note|You will likely want to choose a scraper rather than "local info", so that you can continue to add new files to your library. NFO files and local images will always take precedence over internet data.}}
 
 
 
| Step9 = Scan the library back in. For every NFO file and local image that Kodi finds, that data will be used instead of redownloading it from the internet. This will also restore your watched history and resume points. The NFO files and images are only used at the time of the library scan. If you'd like to use the NFO files to make changes in the future then you will need to '''[[refresh]]''' that entry to rescan the NFO changes.
 
 
 
| Step10 = If everything seems to have gone well, you can now delete the old "MyVideos" database files.
 
}}
 
 
 
== What is not backed up ==
 
{{Main|Backup}}
 
This guide only covers the information stored for the video library. It doesn't include the following, which is covered in [[Backup]]:
 
* Kodi itself and general [[settings]] for the GUI, audio/video, hardware, etc.
 
* [[Playlists]]
 
* [[Add-ons]] and their settings
 
* Passwords are not saved in any NFO file, even if stored on a password protected file server.
 
 
 
== Why "multiple files" and not single-file export? ==
 
You can use a single-file export for backup or library migration, but there are some added complication involving images:
 
 
 
{{collapse top|Click the "Expand" button for details -->}}
 
When images are downloaded from the internet during a library scan, Kodi saves those images locally in a cache (the thumbnails folder in the [[userdata folder]]). If the images are missing, like they would be on a new Kodi device added to an existing [[MySQL]] setup, or if an image became corrupted/missing, then Kodi looks for a URL to download the image again. When importing from the '''"single file"''' (which is a single XML file inside a folder with images), the image URL replaces the online URL with a path that points to the exported folder.
 
 
 
So instead of <code><nowiki>http://scraperwebsite.com/something/dvdcover.jpg</nowiki></code>, we get something like <code><nowiki>D:\Folder\Exported folder\Images\dvdcover.jpg</nowiki></code> or whatever file path it was loaded with.
 
 
 
A new Kodi instance would be confused, because it probably doesn't have that folder in the same location, or because the user deleted this folder after importing. You can get around this by doing your import step by using a network source, like an SMB share where the video files are, so the URL works from all the computers. It would make the path something like <code>smb://server/folder/Exported_folder/images/dvdcover.jpg</code>, and then there would be no issue.
 
 
 
Once the images are cached/saved locally on each Kodi device, the exported image copies are only used if something happens to the local copies (or if a new Kodi instance is added to a [[MySQL]] setup).
 
 
 
Alternatively, you could do a single-file export without exporting images, and the image URL shouldn't be touched at all. The big reason for not suggesting that is some people have very old libraries and their image URLs no longer work (the scrapers sometimes change the URLs or delete specific versions of an image, maybe the user changed a DVD cover with an image they made, etc). Because of that we encourage people to use an export/import step that uses the images they already have on their original library, since we can't be certain those images still exist online.
 
 
 
 
 
'''For [[MySQL]]:'''<br />
 
As for why images aren't directly shared across Kodi instances, this is for a few reasons. The biggest is performance/speed. Images are much larger than text movie summaries, so we can normally get away with a central text database, but images make a much more noticeable impact for some libraries. Another reason is that individual Kodi devices can have their own settings for the resolution of the images. For example, the Raspberry Pi will save images at a lower quality/size in order to compensate for the slower CPU, but on more powerful Kodi devices we don't have that issue and we want to show the higher quality versions of the images when we can.
 
 
 
There are additional technical reasons for not sharing the image cache. The basic gist is that Kodi doesn't anticipate sharing images with other Kodi instances and it can cause various errors.
 
{{collapse bottom}}
 
 
 
== Notes ==
 
<references />
 
 
 
== See also ==
 
* [[Backing up Kodi]]
 
* [[Import-export library]]
 
* [[NFO files]]
 
* [[Syncing and sharing]]
 
* [[Video management]]
 
* [[advancedsettings.xml]]
 
* [[Path substitution]] - a less recommended way of changing library file paths.
 
 
 
{{Updated|17}}
 
 
 
[[Category:How-to]]
 
[[Category:Video library]]
 
[[Category:Manual]]
 

Latest revision as of 02:23, 16 February 2020

Redirect to: