Import-export library: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
m (Updated for v20)
 
(72 intermediate revisions by 12 users not shown)
Line 1: Line 1:
{{cleanup}}
{|class="infobox" style="width:200px"
{{XBMC faq toc Inline}}
! Import-Export Contents
XBMC 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.
|-
|
* '''[[Import-export_library|Import-Export]]'''
** '''[[Import-export_library/Music|Music Library]]'''
** '''[[Import-export_library/Video|Video Library]]'''
* '''[[HOW-TO:Create_Music_Library|Return to Music Guide]]'''
* '''[[HOW-TO:Create_Video_Library|Return to Video Guide]]'''
|}


==Import / Export options==
{{mininav|[[Video_library|Video Library]]{{l2|[[Music_library|Music Library]]}}}}
The Import / Export options can be found in Relevant [[Music Settings|Music]] / [[Videos Settings|Videos]] Settings.
{{see also|NFO files|Artwork|Backup}}


'''Video Library:'''<br />
;Export Video Library
:Exports the Library [[The XBMC Database|database]] to either one, or multiple XML files. When you initiate an export, XBMC will ask if you want to export to separate or a single file.
# When exporting to a single file XBMC will bring up a browser dialog where you select where you want it exported. XBMC will then create a subdirectory with the resulting xml file plus all [[thumbnails]] and [[fanart]], watched status will be exported to the xml 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 file and associated image files will then be exported to the location of the corresponding video files.


;Import Video Library
:Imports an 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.


* '''Note:''' 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.
= Introduction =
<section begin="intro" />Kodi has the option to Export and Import the library databases. These options may be used for a number of reasons including the following more popular ones:
*Perform database backup and recovery
*Reorganization of data or eliminate database fragmentation {{resize|0.8em|(export, clean/remove database, re-import)}}
*Move data between Kodi databases on different platforms {{resize|0.8em|(eg Widows to Linux)}}<section end="intro" />


'''Music Library:'''<br />
;Export Music Library
:Exports the Library [[The XBMC Database|database]] to either one, or multiple XML files. When you initiate an export, XBMC 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.
;Import Music / Video Library
:Imports a XML file into the Library database. If the entry does not exist it is skipped.
:If it exists:
# It removes all current info for that entry from the database.
# 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 .nfo Files==
= Music Library =
Nfo files can be used to provide data for a video file in XBMC 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 page details how to Import and Export the Music Library.


By default at the time of scanning, if the media folder contains a correctly named *.nfo file, then XBMC 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 XBMC 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.
'''''See: [[Import-export_library/Music| Import-Export Music lIbrary]]'''''


===Video .nfo Files containing XML data===
1. The *.nfo file is an XML file containing the data for inclusion in the library.


====Movies====
movie.nfo will override all and any .nfo files in the same folder as the media files if you use the "Use foldernames for lookups" setting. If you don't, then moviename.nfo is used.
If there is only one .nfo file in a folder, The scraper will use it for all media files in that folder. If there are multiple media files in a folder, the *.nfo should be named exactly the same as the video file it is representing (ie. '''moviename.avi''' and '''moviename.nfo'''). In the case of multi-part (stacked) video [[File Stacking|stacking]], name the file either '''moviename.nfo''' or '''moviename-CD1.nfo''' where the first filename is '''moviename-CD1.avi'''. Note, if your movie is ripped as VOB's and stored in a 'VIDEO_TS' folder, you will have to name the file 'VIDEO_TS.nfo' and place it in the same directory with the VIDEO_TS.ifo file.


Additionally the 'set' tag can be used to help sort movies that are [[Movie Sets|part of a series or collection]] (ie Harry Potter, James Bond films). This sort of collection tagging must be done in the .NFO file before the movie is scanned into the library.
= Video Library =
This page details how to Import and Export the Video Library which consists of:
*'''Movies'''- Metadata and artwork
*'''TV Shows'''- Metadata and artwork
*'''Music Videos'''- Metadata and artwork


<source lang="xml">
'''''See: [[Import-export_library/Video| Import-Export Video lIbrary]]'''''
    <movie>
        <title>Who knows</title>
        <originaltitle>Who knows for real</originaltitle>
        <sorttitle>Who knows 1</sorttitle>
        <set>Who knows trilogy</set>
        <rating>6.100000</rating>
        <year>2008</year>
        <top250>0</top250>
        <votes>50</votes>
        <outline>A look at the role of the Buckeye State in the 2004 Presidential Election.</outline>
        <plot>A look at the role of the Buckeye State in the 2004 Presidential Election.</plot>
        <tagline></tagline>
        <runtime>90</runtime> //runtime in minutes
        <thumb>http://ia.ec.imdb.com/media/imdb/01/I/25/65/31/10f.jpg</thumb>
        <mpaa>Not available</mpaa>
        <playcount>0</playcount><!-- setting this to > 0 will mark the movie as watched if the "importwatchedstate" flag is set in advancedsettings.xml -->
        <id>tt0432337</id>
        <filenameandpath>c:\Dummy_Movie_Files\Movies\...So Goes The Nation.avi</filenameandpath>
        <trailer></trailer>
        <genre></genre>
        <credits></credits>
        <fileinfo>
            <streamdetails>
                <video>
                    <codec>h264</codec>
                    <aspect>2.35</aspect>
                    <width>1920</width>
                    <height>816</height>
                </video>
                <audio>
                    <codec>ac3</codec>
                    <language>eng</language>
                    <channels>6</channels>
                </audio>
                <audio>
                    <codec>ac3</codec>
                    <language>spa</language>
                  <channels>2</channels>
                </audio>
                <subtitle>
                    <language>spa</language>
                </subtitle>
            </streamdetails>
        </fileinfo>
        <director>Adam Del Deo</director>
        <actor>
            <name>Paul Begala</name>
            <role>Himself</role>
        </actor>
        <actor>
            <name>George W. Bush</name>
            <role>Himself</role>
        </actor>
        <actor>
            <name>Mary Beth Cahill</name>
            <role>Herself</role>
        </actor>
        <actor>
            <name>Ed Gillespie</name>
            <role>Himself</role>
        </actor>
        <actor>
            <name>John Kerry</name>
            <role>Himself</role>
        </actor>
    </movie>
</source>


====TV Shows====
The filename of the NFO should be <code>tvshow.nfo</code> (Exact, NOT the name of the actual TV show) and it should be in the root folder of the TV show.<br />
The .nfo .xml file may contain a valid <code><episodeguideurl></code> to allow online updates. If not, only episodes with .nfo files will be added.


<source lang="xml">
'''Note:''' You cannot selectively Import or Export parts of the database.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<tvshow>
    <title>MythBusters</title>
    <rating>9.300001</rating>
    <year>0</year>
    <top250>0</top250>
    <season>-1</season>
    <episode>143</episode>
    <displayseason>-1</displayseason>
    <displayepisode>-1</displayepisode>
    <votes></votes>
    <outline></outline>
    <plot>So exactly how hard is it to find a needle in a haystack, anyway? And can water dripping on your forehead really drive you nuts? Those are the kinds of questions, myths and urban legends that are put to the test in this humorous series to find out which ones hold water (and keep it from dripping on your forehead and driving you insane).</plot>
    <tagline></tagline>
    <runtime></runtime>
    <thumb>http://thetvdb.com/banners/graphical/73388-g3.jpg</thumb>
    <thumb>http://thetvdb.com/banners/graphical/73388-g2.jpg</thumb>
    <thumb type="season" season="1">http://thetvdb.com/banners/seasons/73388-1.jpg</thumb>
    <thumb type="season" season="0">http://thetvdb.com/banners/seasons/73388-0.jpg</thumb>
    <thumb type="season" season="2">http://thetvdb.com/banners/seasons/73388-2.jpg</thumb>
    <thumb type="season" season="-1">http://thetvdb.com/banners/posters/73388-1.jpg</thumb>
    <fanart url="http://thetvdb.com/banners/">
        <thumb dim="1920x1080" colors="|183,185,161|51,51,51|206,205,185|" preview="_cache/fanart/original/73388-6.jpg">fanart/original/73388-6.jpg</thumb>
        <thumb dim="1280x720" colors="|255,255,240|101,141,117|129,132,123|" preview="_cache/fanart/original/73388-1.jpg">fanart/original/73388-1.jpg</thumb>
    </fanart>
    <mpaa>TV-PG</mpaa>
    <playcount>0</playcount><!-- setting this to > 0 will mark the movie as watched if the "importwatchedstate" flag is set in advancedsettings.xml -->
    <lastplayed></lastplayed>
    <episodeguide>
        <url cache="73388.xml">http://www.thetvdb.com/api/1D62F2F90030C444/series/73388/all/en.zip</url>
    </episodeguide>
    <id>73388</id>
    <genre>Reality</genre>
    <set></set>
    <credits></credits>
    <director></director>
    <premiered>2003-01-23</premiered>
    <status></status>
    <code></code>
    <aired></aired>
    <studio>Discovery</studio>
    <trailer></trailer>
    <actor>
        <name>Robert Lee</name>
        <role>USA Narrator</role>
        <thumb></thumb>
    </actor>
    <actor>
        <name>Adam Savage</name>
        <role></role>
        <thumb></thumb>
    </actor>
    <artist></artist>
</tvshow>
</source>


====TV Episodes====
The *.nfo must be named exactly as the episode filename (i.e. '''episodename.avi''' and '''episodename.nfo''') and in the same folder, allowing multiple episode and *.nfo files within the same folder. Episode names must still follow the [[TV Shows (Video Library)#TV Show files naming conventions|naming convention]] even though you are using a custom NFO file.


For multi-part episodes, simply add multiple <code><episodedetails></code> XML blocks in succession.


<source lang="xml">
= A Note on Artwork =
    <episodedetails>
        <title>My TV Episode</title>
        <rating>10.00</rating>
        <season>2</season>
        <episode>1</episode>
        <plot>he best episode in the world</plot>
        <thumb>http://thetvdb.com/banners/episodes/164981/2528821.jpg</thumb>
        <playcount>0</playcount>
        <lastplayed></lastplayed>
        <credits>Writer</credits>
        <director>Mr. Vision</director>
        <aired>2000-12-31</aired>
        <premiered>2010-09-24</premiered>
        <studio>Production studio or channel</studio>
        <mpaa>MPAA certification</mpaa>
        <epbookmark>200</epbookmark>  <!-- For media files containing multiple episodes,
                                        where value is the time where the next episode begins in seconds  -->
        <displayseason>3</displayseason>  <!-- For TV show specials, determines how the episode is sorted in the series  -->
        <displayepisode>4096</displayepisode>
        <actor>
          <name>Little Suzie</name>
          <role>Pole Jumper/Dancer</role>
        </actor>
        <fileinfo>
          <streamdetails>
            <audio>
              <channels>6</channels>
              <codec>ac3</codec>
            </audio>
            <video>
              <aspect>1.778</aspect>
              <codec>h264</codec>
              <durationinseconds>587</durationinseconds>
              <height>720</height>
              <language>eng</language>
              <longlanguage>English</longlanguage>
              <scantype>Progressive</scantype>
              <width>1280</width>
            </video>
          </streamdetails>
        </fileinfo>
    </episodedetails>
</source>


====Music Videos====
Cached artwork is an optimized version of the original image and this is what {{kodi}} exports, rather than the original full-quality image, so it is best to avoid exporting artwork if at all possible.
The filename of the NFO should be the same as the music video file, only replacing the original extension with .nfo.<br />
i.e. '''Bestartistintheworld - Bestsongintheworld.avi''' should have the corresponding .nfo filename '''Bestartistintheworld - Bestsongintheworld.nfo'''.


<source lang="xml">
To download original artwork to save locally use one of the following addons...
    <musicvideo>
* '''[https://forum.kodi.tv/showthread.php?tid=360078 Artwork Dump]'''- for v19 and later
        <title>Bestsongintheworld</title>
* '''[https://forum.kodi.tv/showthread.php?tid=258886 Artwork Beef]'''- for v18 and earlier
        <artist>Bestartistintheworld</artist>
        <album>Me</album>
        <genre>Pop</genre>
        <runtime>3:20</runtime>
        <plot>Scantly clad women hoing about</plot>
        <year>2000</year>
        <director>and I</director>
        <studio>Ego prod.</studio>
    </musicvideo>
</source>


===Video .nfo files containing an URL===
An explanation of the effects of these optimizations can be located in the [https://forum.kodi.tv/showthread.php?tid=315806&pid=2599318#pid2599318 forum here].
2. The *.nfo file contains a URL of the information page to scrape.
The file can include other information (i.e. scene info), XBMC will scan through it and use a relevant URL if a match is found.


The scraper tries to match url's to all scrapers of the content type a dir is set to. E.g. if you set the content type to movies all movie scrapers check .nfo files for a matching url. This means that .nfo's override the scraper setting. I.e. a directory is set to use the imdb scraper but you have a German movie in it. Simply create a .nfo for that movie with the ofdb link in it and you are sorted!


====Movies====
* <code>Moviename.nfo</code> placed next to Moviename.avi where Moviename is the name of the movie file.


* <code>movie.nfo</code> if you use the "Use Foldername for Lookups" option, movie.nfo takes priority over any other .nfo files.


If you use the "Use Foldername for Lookups" [[Set Contents (Video Library)#Options After Selecting Scraper|scraper setting]] XBMC will use the first nfo file it finds in the folder (other than the .nfo files described above) and apply it to any valid video file it finds in the same folder.
{{top}}
{{updated|20}}


====TV Shows====
[[Category:Karellen]]
Filename should be <code>tvshow.nfo</code> (Exact, NOT the name of the TV show) in the root folder of the TV Show that points to a show on [[TheTVDB.com (Video Library)|TheTVDB.com]].
[[Category:Music library]]
<nowiki>http://thetvdb.com/index.php?tab=series&id=73545</nowiki>
[[Category:Video library]]
 
====TV Episodes====
Episodename.nfo where Episodename is the name of the episode file.<br />
'''Not currently supported!'''
<nowiki>http://thetvdb.com/?tab=episode&seriesid=73545&seasonid=5950&id=117847&lid=7</nowiki>
 
====Music Videos====
Mvideo.nfo where Mvideo is the name of the music video file that points to a music video on MTV.com
<nowiki>http://www.mtv.com/overdrive/?artist=983&vid=222165</nowiki>
 
===Video .nfo files containing a mix of XML and URL===
You can also create .nfo files that contain both XML data and an URL.
This is useful for instance, if you want the entry in your database to have another name than the one officially provided by the scraper, for the movie to sort differently or the movie to be a part of a movie set.
 
Example:
<source lang="xml">
    <movie>
        <title>Sin City (Recut, Extended, Unrated)</title>
        <runtime>147 min.</runtime>
    </movie>
    http://www.imdb.com/title/tt0401792/
</source>
 
 
<source lang="xml">
    <movie>
        <title>Star Wars (1977 Original Theatrical Release)</title>
        <runtime>121 min.</runtime>
        <set>Star Wars Saga</set>
        <sorttitle>Star Wars1</sorttitle>
    </movie>
    http://www.imdb.com/title/tt0076759/
</source>
 
By default the xml entry is '''added''' to the scraped entry in the database and may result in some duplicates. If you want to completely override the scraped result you need to set a clear attribute for the relevant xml tag in the .nfo file.
 
Example:
<source lang="xml">
<movie>
    <genre clear="true">Action</genre>
    <genre>Horror</genre>
    <genre>Thriller</genre>
    <director clear="true">Frank Miller</director>
    <director>Robert Rodriguez</director>
    <director>Quentin Tarantino</director>
</movie>
http://www.imdb.com/title/tt0401792/
</source>
 
Currently supported tags for the clear attribute are genre, director, studio, actor, credits and artist for Music Videos.
 
==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 XBMC in the same way as XBMC's own XML formatted NFO files are scanned/scraped.
 
XBMC 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.
 
==Music .nfo files==
 
===Music .nfo Files containing XML data===
 
====Artists====
Artist.nfo in the artist folder containing:
 
<source lang="xml">
 
<artist>
  <name>Artist/Band Name</name>
  <genre clear=true>First Genre</genre>
  <genre>Second Genre</genre>
  ...
  <genre>Nth Genre</genre>
  <style clear=true>First Style</style>
  <style>Second Style</style>
  ...
  <style>Nth Style<style>
  <mood clear=true>First Mood</mood>
  <mood>Second Mood</mood>
  ...
  <mood>Nth Mood</mood>
  <yearsactive clear=true>First year active (1993)</yearsactive>
  <yearsactive>Second year active (1995)</yearsactive>
  ...
  <yearsactive>Nth year active (2000)</yearsactive>
  <born>Birth date of artist</born>
  <formed>Date band formed</formed>
  <instruments>Musical instruments used by artist/band</instruments>
  <biography>Artist/Band biography text</biography>
  <died>Date artist died</died>
  <disbanded>Date band broke up<disbanded>
  <thumb>/path/to/unix/style/artist/thumb1.tbn</thumb>
  <thumb>C:\path\to\win32\style\artist\thumb2.png</thumb>
  <thumb>http://path.to/www/remote/artist/thumb3.jpg</thumb>
  <thumb>smb://path/to/smb/remote/artist/thumbN.tbn</thumb>
  <album>
    <title>First Album Title</title>
    <year>Release year of first album</year>
  </album>
  ...
  <album>
    <title>Nth Album Title</title>
    <year>Release year of Nth album</year>
  </album>
</artist>
 
 
</source>
 
NOTE: Where indicated, tags can accept an optional "clear" boolean (true/false) attribute which clears corresponding scraped data and all values of similar tags up to that point.
 
====Albums====
Album.nfo in the album folder containing:
<source lang="xml">
 
<album>
  <title>The Album Title</title>
  <artist clear=true>First Artist</artist>
  <artist>Second Artist</artist>
  ...
  <artist>Nth Artist</artist>
  <genre clear=true>First Genre</genre>
  <genre>Second Genre</genre>
  ...
  <genre>Nth Genre</genre>
  <style clear=true>First Style</style>
  <style>Second Style</style>
  ...
  <style>Nth Style<style>
  <mood clear=true>First Mood</mood>
  <mood>Second Mood</mood>
  ...
  <mood>Nth Mood</mood>
  <theme clear=true>First Theme</theme>
  <theme>Second Theme</theme>
  ...
  <theme>Nth Theme</theme>
  <review>Album review text</review>
  <releasedate>Album release date</releasedate>
  <label>Record label the album was released under</label>
  <type>Erm...EP/LP? CD,Vinyl,DVDA,etc? I dunno</type>
  <year>Year album was released</year>
  <rating>Rating out of 5?<rating>
  <thumb>/path/to/unix/style/album/thumb1.tbn</thumb>
  <thumb>C:\path\to\win32\style\album\thumb2.png</thumb>
  <thumb>http://path.to/www/remote/album/thumb3.jpg</thumb>
  ...
  <thumb>smb://path/to/smb/remote/thumbN.tbn</thumb>
  <track>
    <position>Track Number (1)</position>
    <title>Title of first track</title>
    <duration>Length of first track (XXX min, MM:SS)</duration>
  <track>
  ...
  <track>
    <position>Track Number (N)</position>
    <title>Title of Nth track</title>
    <duration>Length of Nth track</duration>
  <track>
</album>
 
</source>
 
NOTE: Where indicated, tags can accept an optional "clear" boolean (true/false) attribute which clears corresponding scraped data and all values of similar tags up to that point.
 
===Music .nfo files containing an URL===
 
====Artists====
Artist.nfo in the artist folder that points to the corresponding artist page on a supported scraper site, such as [http://www.allmusic.com Allmusic.com] or [http://www.discogs.com Discogs].
<nowiki>http://www.allmusic.com/cg/amg.dll?p=amg&sql=11:gifoxqwkldae</nowiki>
Artist.nfo assumes an artist/album directory layout
 
====Albums====
Album.nfo in the album folder that points to the corresponding album page on a supported scraper site, such as [http://www.allmusic.com Allmusic.com] or [http://www.discogs.com Discogs].
<nowiki>http://www.allmusic.com/cg/amg.dll?p=amg&sql=10:kifoxqualdde</nowiki>
 
==Additional information==
Additional information on how to add format-tags for text and labels (Eg. '''Bold''', ''Italic'') can be found under [[Label Formatting]]
 
[[Category:Scraper]]
[[Category:To-Do]]
[[Category:Video Library]]
[[Category:Music Library]]

Latest revision as of 21:58, 7 February 2023

Import-Export Contents
Home icon grey.png   ▶ Video Library
▶ Music Library
▶ Import-export library


Introduction

Kodi has the option to Export and Import the library databases. These options may be used for a number of reasons including the following more popular ones:

  • Perform database 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)


Music Library

This page details how to Import and Export the Music Library.

See: Import-Export Music lIbrary


Video Library

This page details how to Import and Export the Video Library which consists of:

  • Movies- Metadata and artwork
  • TV Shows- Metadata and artwork
  • Music Videos- Metadata and artwork

See: Import-Export Video lIbrary


Note: You cannot selectively Import or Export parts of the database.


A Note on Artwork

Cached artwork is an optimized version of the original image and this is what Kodi exports, rather than the original full-quality image, so it is best to avoid exporting artwork if at all possible.

To download original artwork to save locally use one of the following addons...

An explanation of the effects of these optimizations can be located in the forum here.



Return to top