Import-export library: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
No edit summary
Line 3: Line 3:
<section begin="intro" />Kodi offers the capability to import and export data manually into/from the [[Library|Media Library]], as well as importing media info automatically from [[NFO files|.nfo files]].<section end="intro" />
<section begin="intro" />Kodi offers the capability to import and export data manually into/from the [[Library|Media Library]], as well as importing media info automatically from [[NFO files|.nfo files]].<section end="intro" />


== Import / Export options ==
The Import / Export options can be found in Relevant [[Music Settings|Music]] / [[Videos Settings|Videos]] Settings.


'''Video Library:'''<br />
Kodi has the option to both Export and Import its Video and Music database. These options can be used for a number of reasons including the following more popular ones.
=== Export Video Library ===
*Perform database backup and recovery (This is not the only method for backup and recovery)
:Exports the Library [[The Kodi Database|database]] to either one, or multiple XML files. When you initiate an export, Kodi will ask if you want to export to separate or a single file.
*Reorganization of data or eliminate database fragmentation (export, clean/remove database, re-import)
*Move data between Kodi databases on different platforms (eg Widows to Linux)


==== Exporting to one single file ====
When exporting, database objects are dumped to a nfo file which can then be used to import into the same or another Kodi database. The method used to import is dependant upon the export options used.
When '''exporting to a single file''' Kodi will bring up a browser dialog where you select where you want it exported. Kodi will then create a subdirectory with the resulting xml file plus all [[thumbnails]] and [[fanart]], watched status will be exported to the xml file.
{{note|Exporting to a single file is discouraged in Frodo and higher, as there is a big issue with artwork. It changes the artwork location URL to the folder location of the export, which causes problems when you want to redownload the information.}}


==== Exporting to separate files ====
Various options are available to control what objects are exported or imported.
If you choose to '''export to separate files''' you will also be asked if you want to export [[thumbnails]] and [[fanart]] as well.
::The resulting XML .nfo file and associated image files will then be exported to the location of the corresponding video files.
They will be automatically used when scraping for information, you do not need to import anything from this menu.
::{{tip|For more info see '''[[NFO files]]'''}}


=== Import Video Library ===
:Imports an exported single XML file into the Library database. If the entry does not exist it is appended.
:If it exists:
# It removes all current info for that entry from the database.
# Inserts the info for that entry from the XML file.


If you wish to import a movie, TV show, music video or episode into the library, use the corresponding format in the exported xml file and enclose it with the <videodb></videodb> tags. Examples can be seen below, as .nfo files.}}
== Video Library Export / Import ==
The option is accessed via the Settings menu as detailed in the first image.  


=== Music Library: ===
Upon selection of the Export Library setting, you will be required to choose the Export method as depicted in the second image below. Continue reading for an explanation of the options.
==== Export Music Library ====
:Exports the Library [[The Kodi Database|database]] to either one, or multiple XML files. When you initiate an export, Kodi will ask if you want to export to separate or a single file.
:If you choose to export to separate files you will also be asked if you want to export [[thumbnails]] and [[fanart]] as well.
:The resulting XML .nfo files and associated image files will then be exported to the location of the corresponding music files.
{{note|Export will write empty and incomplete XML files if the music source has not been scraped. Only Album and Artist data is exported.  Song data such as rating, play count, and last time played are not included.}}


==== Import Music / Video Library ====
<gallery widths="700" heights="400">
:Imports a XML file into the Library database. If the entry does not exist it is skipped.
File:LibExp01.jpg|Location of setting
:If it exists:
File:LibExp02.png|Select which Export option you require.
# It removes all current info for that entry from the database.
</gallery>
# Inserts the info for that entry from the XML file.


{{note|To import an exported music library you must scrape your music source prior to importing the library.  The music library import will populate the extended meta-data such as artist or album info which is not contained in the music tags.}}


== Video and music .nfo Files ==
=== Export to Separate Files ===
{{Main|NFO files}}
 
Nfo files can be used to provide data for a video file in Kodi or influence the search behaviour of scrapers. In particular they are helpful if the information fetched from a web site does not match the video file, or data for that particular file does not exist.
This option will export the metadata stored in the database and save it into a nfo file alongside the movie file. This is a good example where Movies and TV Show episodes would benefit from being in their own directory.
 
After selecting '''Separate''', you will then be asked if you would like to '''Export thumbnails and fanart?'''. This will export the Fanart, Posters, Banners and Episode Thumbs.
*Choosing '''Yes''' will save a copy of the cached artwork into the Movie, TV Show and TV Show Episode directory alongside the video file and the nfo file.
*Choosing '''No''' will not export the artwork
 
The next option is '''Export Actors Thumbs'''.
*Choosing '''Yes''' will export a copy of the Actors artwork in a directory named ''.actors''
*Choosing '''No''' will not export a copy of the Actors artwork
 
The final option is '''Overwrite Old Files'''.
*Choosing '''Yes''' will overwrite the existing nfo files and artwork. This is useful if you have modified your metadata such as changed the artwork, created or modified movie sets, etc. Any movies/tv shows that were not present since the last Export will have the nfo and artwork exported to their directory.
*Choosing '''No''' will add nfo files and artwork to those movies/tv shows that do not already have them. eg they are new and added after the last export. If you made changes to a movie/tv show that already has an nfo created, these changes will '''not''' be exported.
*If this is the first time this option has been run and/or you have no nfo files and artwork saved in your movie/tv show directories, both choices will have the same result.
 
The Export will commence immediately once the final option is selected. An onscreen progress bar will indicate progress.
 
<gallery widths="500" heights="300">
File:LibExp03.png|Do you want to export Thumbnails and Fanart?
File:LibExp05.jpg|Do you want to export Actors Thumbs?
File:LibExp04.png|Do you want to Overwrite Old Files?
</gallery>
 
 
=== Export to Single File ===
[[File:LibExp06.jpg|400px|right]]
 
 
 
This option will export all metadata and all artwork to a single directory as follows
*The only option available is the save location which you will be prompted and required to enter
*Kodi will create a directory in your selected location named ''xbmc_videodb_yyyy-mm-dd''
*Library metadata will be saved into a single ''videodb.xml'' file within that directory
*Artwork will be saved within multiple sub-directories according to type
*Subsequent exports '''will not''' overwrite existing Single File exports
*Subsequent exports are '''full''' exports. They are '''not''' incremental backups.
 
{{note|Some users may find the single file export problematic in Frodo and higher, due to an issue with artwork. The export process changes the artwork location URL to the folder location of the export, which causes an issue if you need to refresh the image. To fix, you will need to manually source the image in the Information page of the Movie/TV show }}
 
 
 
=== Import ===
 
If you exported your library using the '''Export to Separate Files''' option, then you must use the normal scraping process to re-import the data. {{small see also|Library_update}}
 
If you exported your library using the '''Export to Single File''' option, you will need to use this method to import the data as follows
*Select '''Import''' to commence the import process
*Locate the the directory for your previously saved single file export
*If you have multiple single file exports, ensure you have selected the correct one.
*Select '''Ok'''. A progress bar will be displayed to indicate progress
*Once complete, your library should be functional again
 
Be aware that if you have removed movies or tv shows since the export, the metadata for those movies and tv shows will be re-imported into the library. You will need to run a '''Clean Library''' to remove them. This option is located just above the '''Export''' entry.
 
 
 
== Music Library Export / Import ==
 
The option is accessed via the Settings menu as detailed in the first image. It is on the same page as the Video Export option. You may have to scroll down to locate it.
Upon selection of the Export Library setting, you will be required to choose the Export method as depicted in the second image below. The process is similar to the Video Export and Import instructions above, but there are some slight variances. Continue reading for an explanation of the options.
 
<gallery widths="700" heights="400">
File:LibExp01.jpg|Location of setting
File:LibExp02.png|Select which Export option you require.
</gallery>
 
 
=== Export to Separate Files ===
 
This option will export the metadata stored in the database and save it into a nfo file as follows:
*Artist nfo file and artwork will be saved in the Artist directory
*Album nfo file and artwork will be saved in the Album directory
*If the music source has not been scraped, no nfo file will be written
*Only Album and Artist data is exported.  Song data such as rating, play count, and last time played are not included.
 
After selecting '''Separate''', you will then be asked if you would like to '''Export thumbnails and fanart?'''. This will export the Artist and album artwork.
*Choosing '''Yes''' will export a copy of the cached artwork into the appropriate Artist and Album directory.
*Choosing '''No''' will not export the artwork
 
The final option is '''Overwrite Old Files'''.
*Choosing '''Yes''' will overwrite the existing nfo files and artwork. This is useful if you have modified your metadata such as changed the artwork, created or modified album or artist information. Any Albums/Artists that were not present since the last Export will have the nfo and artwork exported to their directory.
*Choosing '''No''' will add nfo files and artwork to those Albums/Artists that do not already have them. eg they are new and added after the last export. If you have modified data of an Artist or Album that was previously exported, this change will not be exported.
*If this is the first time this option has been run and/or you have no nfo files and artwork saved in your Artist/Album directories, both choices will have the same result.
 
The Export will commence immediately once the final option is selected. An onscreen progress bar will indicate progress.
 
<gallery widths="700" heights="400">
File:LibExp03.png|Do you want to export Thumbnails and Fanart?
File:LibExp04.png|Do you want to Overwrite Old Files?
</gallery>
 
 
=== Export to Single File ===
[[File:LibExp06.jpg|400px|right]]
 
 
 
 
This option will export all metadata to a single file
*Export will write an empty XML file if the music source has not been scraped.
*The only option available is the save location which you will be prompted and required to enter
*Kodi will create a file in your selected location named ''musicdb.xml''
*Artwork will not be saved
*Subsequent exports '''will''' overwrite the existing Single File exports
 
{{note|Using the '''Single File''' export option for music can be problematic when it comes to compilation albums or various artist albums}}
 
 
 
=== Import ===
 
If you exported your library using the '''Export to Separate Files''' option, then you must use the normal scraping process to re-import the data. {{small see also|Library_update}}
 
If you exported your library using the '''Export to Single File''' option, you will need to use this method to import the data as follows
*Select '''Import''' to commence the import process
*Locate the the directory for your previously saved single file export
*Select the ''musicdb.xml'' file
*The '''Import''' process will commence immediately
*Once complete, your library should be functional again
 
Be aware:
*if you have removed Albums or Artists since the export, the metadata for those Albums and Artists will be re-imported into the library. You will need to run a '''Clean Library''' to remove them. This option is located just above the '''Export''' entry.


By default at the time of scanning, if the media folder contains a correctly named *.nfo file, then Kodi will load the *.nfo file and attempt to either, in the case of it containing XML data get the meta-data directly from the .nfo file or will parse it for a direct URL to the scraper info page. This allows Kodi to skip its normal lookup and/or search procedures; this is useful if a file's information is not available on any of the scraper sites or if the file-matching criteria fail for the particular file.


{{tip|See '''[[NFO files|Creating NFO files]]'''}}


== Importing library information from "My Movies" media management software ==
== Importing library information from "My Movies" media management software ==
[http://www.mymovies.dk/ My Movies (www.mymovies.name)] is an online database for profiling DVD-Video movies. [http://www.mymovies.dk/ My Movies] saves an XML file and a poster cover image which with this patch will get scanned by Kodi in the same way as Kodi's own XML formatted NFO files are scanned/scraped.
[http://www.mymovies.dk/ My Movies (www.mymovies.name)] is an online database for profiling DVD-Video movies. [http://www.mymovies.dk/ My Movies] saves an XML file and a poster cover image which with this patch will get scanned by Kodi in the same way as Kodi's own XML formatted NFO files are scanned/scraped.


Kodi has the ability to get the import movie library information from "[http://www.mymovies.dk/ My Movies]" via the mymovies.xml files that it generates, these mymovies.xml are checked after the movie.nfo file.
Kodi has the ability to get the import movie library information from "[http://www.mymovies.dk/ My Movies]" via the mymovies.xml files that it generates, these mymovies.xml are checked after the movie.nfo file.
== Additional information ==
Additional information on how to add format-tags for text and labels (Eg. '''Bold''', ''Italic'') can be found under [[Label Formatting]]
== Watched status ==
Too keep your watched status when importing the library, add this to your [[advancedsettings.xml]] file in the [[userdata folder]]:
<pre>
<advancedsettings>
    <videolibrary>
          <importwatchedstate>true</importwatchedstate>
    </videolibrary>
</advancedsettings>
</pre>




{{Helix updated}}
== Other Options ==
By adding suitable code to ''advancedsettings.xml'', you are able to further modify which data is exported. {{small see also|Advanced_settings}}


[[Category:Scraper]]
<videolibrary>
[[Category:Video library]]
  <exportautothumbs>false</exportautothumbs>  -- export auto-generated thumbs. Defaults to false --
[[Category:Music library]]
  <importwatchedstate>false</importwatchedstate>  -- import previously exported playdate and playcount from .nfo files. Defaults to false --
[[Category:Manual]]
  <importresumepoint>false</importresumepoint>  -- import previously exported resume point from .nfo files. Defaults to false --
[[Category:Advanced topics]]
</videolibrary>

Revision as of 05:17, 13 June 2017

Home icon grey.png   ▶ General topics ▶ Videos
▶ Music/Audio
▶ Management
 
▶ Import-export library

Kodi offers the capability to import and export data manually into/from the Media Library, as well as importing media info automatically from .nfo files.


Kodi has the option to both Export and Import its Video and Music database. These options can be used for a number of reasons including the following more popular ones.

  • Perform database backup and recovery (This is not the only method for backup and recovery)
  • Reorganization of data or eliminate database fragmentation (export, clean/remove database, re-import)
  • Move data between Kodi databases on different platforms (eg Widows to Linux)

When exporting, database objects are dumped to a nfo file which can then be used to import into the same or another Kodi database. The method used to import is dependant upon the export options used.

Various options are available to control what objects are exported or imported.


Video Library Export / Import

The option is accessed via the Settings menu as detailed in the first image.

Upon selection of the Export Library setting, you will be required to choose the Export method as depicted in the second image below. Continue reading for an explanation of the options.


Export to Separate Files

This option will export the metadata stored in the database and save it into a nfo file alongside the movie file. This is a good example where Movies and TV Show episodes would benefit from being in their own directory.

After selecting Separate, you will then be asked if you would like to Export thumbnails and fanart?. This will export the Fanart, Posters, Banners and Episode Thumbs.

  • Choosing Yes will save a copy of the cached artwork into the Movie, TV Show and TV Show Episode directory alongside the video file and the nfo file.
  • Choosing No will not export the artwork

The next option is Export Actors Thumbs.

  • Choosing Yes will export a copy of the Actors artwork in a directory named .actors
  • Choosing No will not export a copy of the Actors artwork

The final option is Overwrite Old Files.

  • Choosing Yes will overwrite the existing nfo files and artwork. This is useful if you have modified your metadata such as changed the artwork, created or modified movie sets, etc. Any movies/tv shows that were not present since the last Export will have the nfo and artwork exported to their directory.
  • Choosing No will add nfo files and artwork to those movies/tv shows that do not already have them. eg they are new and added after the last export. If you made changes to a movie/tv show that already has an nfo created, these changes will not be exported.
  • If this is the first time this option has been run and/or you have no nfo files and artwork saved in your movie/tv show directories, both choices will have the same result.

The Export will commence immediately once the final option is selected. An onscreen progress bar will indicate progress.


Export to Single File

LibExp06.jpg


This option will export all metadata and all artwork to a single directory as follows

  • The only option available is the save location which you will be prompted and required to enter
  • Kodi will create a directory in your selected location named xbmc_videodb_yyyy-mm-dd
  • Library metadata will be saved into a single videodb.xml file within that directory
  • Artwork will be saved within multiple sub-directories according to type
  • Subsequent exports will not overwrite existing Single File exports
  • Subsequent exports are full exports. They are not incremental backups.

Note: Some users may find the single file export problematic in Frodo and higher, due to an issue with artwork. The export process changes the artwork location URL to the folder location of the export, which causes an issue if you need to refresh the image. To fix, you will need to manually source the image in the Information page of the Movie/TV show


Import

If you exported your library using the Export to Separate Files option, then you must use the normal scraping process to re-import the data. See also: Library_update

If you exported your library using the Export to Single File option, you will need to use this method to import the data as follows

  • Select Import to commence the import process
  • Locate the the directory for your previously saved single file export
  • If you have multiple single file exports, ensure you have selected the correct one.
  • Select Ok. A progress bar will be displayed to indicate progress
  • Once complete, your library should be functional again

Be aware that if you have removed movies or tv shows since the export, the metadata for those movies and tv shows will be re-imported into the library. You will need to run a Clean Library to remove them. This option is located just above the Export entry.


Music Library Export / Import

The option is accessed via the Settings menu as detailed in the first image. It is on the same page as the Video Export option. You may have to scroll down to locate it. Upon selection of the Export Library setting, you will be required to choose the Export method as depicted in the second image below. The process is similar to the Video Export and Import instructions above, but there are some slight variances. Continue reading for an explanation of the options.


Export to Separate Files

This option will export the metadata stored in the database and save it into a nfo file as follows:

  • Artist nfo file and artwork will be saved in the Artist directory
  • Album nfo file and artwork will be saved in the Album directory
  • If the music source has not been scraped, no nfo file will be written
  • Only Album and Artist data is exported. Song data such as rating, play count, and last time played are not included.

After selecting Separate, you will then be asked if you would like to Export thumbnails and fanart?. This will export the Artist and album artwork.

  • Choosing Yes will export a copy of the cached artwork into the appropriate Artist and Album directory.
  • Choosing No will not export the artwork

The final option is Overwrite Old Files.

  • Choosing Yes will overwrite the existing nfo files and artwork. This is useful if you have modified your metadata such as changed the artwork, created or modified album or artist information. Any Albums/Artists that were not present since the last Export will have the nfo and artwork exported to their directory.
  • Choosing No will add nfo files and artwork to those Albums/Artists that do not already have them. eg they are new and added after the last export. If you have modified data of an Artist or Album that was previously exported, this change will not be exported.
  • If this is the first time this option has been run and/or you have no nfo files and artwork saved in your Artist/Album directories, both choices will have the same result.

The Export will commence immediately once the final option is selected. An onscreen progress bar will indicate progress.


Export to Single File

LibExp06.jpg



This option will export all metadata to a single file

  • Export will write an empty XML file if the music source has not been scraped.
  • The only option available is the save location which you will be prompted and required to enter
  • Kodi will create a file in your selected location named musicdb.xml
  • Artwork will not be saved
  • Subsequent exports will overwrite the existing Single File exports

Note: Using the Single File export option for music can be problematic when it comes to compilation albums or various artist albums


Import

If you exported your library using the Export to Separate Files option, then you must use the normal scraping process to re-import the data. See also: Library_update

If you exported your library using the Export to Single File option, you will need to use this method to import the data as follows

  • Select Import to commence the import process
  • Locate the the directory for your previously saved single file export
  • Select the musicdb.xml file
  • The Import process will commence immediately
  • Once complete, your library should be functional again

Be aware:

  • if you have removed Albums or Artists since the export, the metadata for those Albums and Artists will be re-imported into the library. You will need to run a Clean Library to remove them. This option is located just above the Export entry.


Importing library information from "My Movies" media management software

My Movies (www.mymovies.name) is an online database for profiling DVD-Video movies. My Movies saves an XML file and a poster cover image which with this patch will get scanned by Kodi in the same way as Kodi's own XML formatted NFO files are scanned/scraped.

Kodi has the ability to get the import movie library information from "My Movies" via the mymovies.xml files that it generates, these mymovies.xml are checked after the movie.nfo file.


Other Options

By adding suitable code to advancedsettings.xml, you are able to further modify which data is exported. See also: Advanced_settings

<videolibrary>
  <exportautothumbs>false</exportautothumbs>  -- export auto-generated thumbs. Defaults to false --
  <importwatchedstate>false</importwatchedstate>  -- import previously exported playdate and playcount from .nfo files. Defaults to false --
  <importresumepoint>false</importresumepoint>  -- import previously exported resume point from .nfo files. Defaults to false --
</videolibrary>