User:Karellen/scratchpad01

From Official Kodi Wiki
Jump to navigation Jump to search
Home icon grey.png   ▶ Video library
▶ Music library
▶ Management
 
▶ scratchpad01


NFO files can be used to provide metadata to the library for video and a music files. They are helpful if the metadata fetched from a web site does not match the video or music you have, or if data for that particular file does not exist, such as for home movies. It can also be used to control the search behaviour of scrapers.


What is nfo

nfo is a contraction of Info or Information. It is a Filename Extension - mymovie.nfo and the contents of the file are written in XML. The file itself does nothing except hold information. It is basically a text document with special tags inserted around the information. These tags are recognised by Kodi which enables data importing.

Kodi uses nfo files as one way of importing metadata into the library. It may also be used as a method of exporting the library for various reasons, including backup. See: Import & Export

One of the most considered features of Kodi is the way media is displayed. Gone are the days when choosing a movie to watch or album to listen to involved scrolling through lines of text. Kodi uses Artwork, and Extended Information to display your media. This information includes Actors, Directors, Plots, Taglines, Ratings, Run Times and more. All this data, known as metadata, is stored in the Kodi Library. The Library is a SQLite database.

There are two primary methods to load metadata into your library:

  1. Use the online scraper
  2. Create a nfo file, from which Kodi is able to import the metadata

For information on how to use the online scraper within Kodi:

See: Adding_music_to_the_library
See: Adding_video_sources
See: Set_content_and_scan

The remainder of this wiki topic will provide the required information to create and use nfo files.


Types of nfo

Kodi can use the nfo file in one of two ways depending on the contents of the nfo file. This page primarily deals with the Metadata nfo.


Metadata nfo

This is the most common use of the nfo file. The Metadata nfo contains the metadata for the movie/tv show/music video/album/artist within the file. Kodi will read this file and scrape its contents into the library.


Parsing nfo

A Parsing nfo does not contain any metadata that Kodi can use to scrape into the library. Instead it contains the URL to the movie/tv show/album/artist that you want scraped. As an example, searching for The Mummy on TMDB returns 65 titles. If you are attempting to add one of the more obscure versions to your library, chances are that Kodi will scrape the incorrect title, and trying to navigate to the 65th entry will be problematic. The parsing nfo offers an easy solution to this problem. To create and use the parsing nfo, follow these steps:

  1. Locate the title at the appropriate scraper site
  2. Ensure you have named your files/folder the same as shown on the scraper site and in accordance with the Kodi naming conventions
  3. Open a text editor.
  4. Copy the entire address of the movie at the scraper site from the address bar and paste it into the text editor. No surrounding tags are required. see example after step 6
  5. Save the file in accordance with the naming convention in section 4 below. Ensure the extension is *.nfo and not *.nfo.txt or *.nfo.doc
  6. Run an Update Library. Kodi will parse the URL and locate the title and scrape the correct metadata.
https://www.themoviedb.org/movie/15849-the-mummy 


Creating nfo

The following are the three methods that may be used to create nfo files for Kodi. The simplest method is using a Media Manager.


Media Managers

This is, by far, the simplest method for creating nfo files for your media. The Media Manager can create nfo files in one of three ways:

  1. Scraping- This is the same process as performed by the Kodi scraper. The Media Manager will fetch metadata from the online scraper site and will create the nfo file, unlike Kodi that imports the metadata directly into the library database.
  2. Manual- The Media Manager offers a simple interface that allows you to manually type in the data. This method does not require you to have knowledge of XML tags
  3. Combination- A combination of both methods can be used. If you are not satisfied with the scraped metadata, then simply modify it.

Once the program has been setup and pointed at your media, very little input is required by the user. Select a movie, tv show, album or artist and select scrape. Depending upon your settings, the media manager will scrape the media and create the nfo which is placed in the correct location with the media file. It can also download all artwork for the media. There are a few media managers available. The following managers can be found in the Kodi forum:

Further information, screenshots and guides are available at the websites of the Media Managers.


Kodi Created nfo

This option requires that your library has already been scraped with metadata. Using the built in import/export function of Kodi, you can export the library metadata into individual nfo files which are correctly created and saved. This is useful if you have an existing library and would like to backup the library or to import the library into another Kodi installation.

See: Import & Export


Manual Creation

The more difficult of the three methods. It requires basic knowledge of XML Tags. They can be created using a simple text editor such as Notepad in Windows, or the equivelant in other operating systems. There are dedicated code editors that can also be used. They will not provide the required Kodi tags, but they will avoid glitches when saving the nfo file, which is commonly experienced with text editors. Two common code editors that can be used:

Requirements of the nfo file are as follows:

  1. Each Tag must have an opening tag and a closing tag. eg <title>my movie title</title>. <title> = opening tag, my movie title = metadata, </title> = closing tag
  2. The file must be in Unicode Transformation Format-8 (UTF-8). The file must be saved in this format. The first line of the file must contain the following <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  3. The second line may contain a note detailing the creation time and date. It may also include the name of the media manager, if one was used to create it. This is optional. '
  4. The next line sets the nfo category - <movie>, <tvshow>, <episodedetails>, <artist>, <album> or <musicvideo>
  5. Between the opening and closing category tags are the tags for the media metadata.
  6. Available tags are listed in Section 8

Once created, the file is saved with the nfo extension and placed in the folder as directed in Section 4.

See example nfo files in Section 7


nfo Placement

Correct placement of the nfo file is essential. Failing to save the file in the correct location, as detailed below, will force Kodi to scrape the information from online sources or, if you have Local Info Only set as your scraper, then no entry will be made into the library.

The order of importing metadata is as follows:

  1. nfo file. If no nfo file exists then
  2. online scraper sites

When Kodi locates the nfo file it will load the *.nfo file and attempt to either,

  1. If the nfo file contains XML data (tags), Kodi will import the meta-data directly into the library from the .nfo file or
  2. Will parse the nfo file for a direct URL to the scraper info page.


Movies

Movies require one nfo file as follows:

Naming & Saving conventions for your Movie *.nfo files:

Saved movies as File Name Save Location
BluRay Structure: index.nfo f:\MyMovies\Big Buck Bunny (2008)\BDMV\index.nfo
DVD Structure: VIDEO_TS.nfo f:\MyMovies\Big Buck Bunny (2008)\VIDEO_TS\VIDEO_TS.nfo
Single movie in directory: <MovieFileName>.nfo f:\MyMovies\Big Buck Bunny (2008)\<MovieFileName>.nfo
All movies in single directory: <MovieFileName>.nfo f:\MyMovies\Big Buck Bunny (2008)\<MovieFileName>.nfo


TV Shows

TV Shows require the following nfo files

  1. One nfo file for the TV Show. See the first table below
  2. One nfo file for each Episode. See the second table below

For one TV Show with 10 episodes, you will require 11 nfo files.

Naming & Saving conventions for your TV Show *.nfo files:

Saved TV Show as File Name Save Location
All formats tvshow.nfo f:\MyTVShows\iZombie\tvshow.nfo


Naming & Saving conventions for your TV Episode *.nfo files:

Saved Episodes as File Name Save Location
BluRay Structure: index.nfo f:\MyTVShows\iZombie\iZombie S01E01\BDMV\index.nfo
DVD Structure: VIDEO_TS.nfo f:\MyTVShows\iZombie\iZombie S01E01\VIDEO_TS\VIDEO_TS.nfo
Single Episode file in directory: <EpisodeFileName>.nfo f:\MyTVShows\iZombie\iZombie S01E01\<EpisodeFileName>.nfo
All episodes in TV Show directory: <MovieFileName>.nfo f:\MyTVShows\iZombie\<EpisodeFileName>.nfo


Music

Music will fetch additional album and album artist information from nfo files.

For additional album information each album needs to be in its own unique folder, and have a separate album.nfo file located there. See the first table below.

For additional album artist information each artist needs a separate artist.nfo file located in what Kodi determines as the unique common folder for that artist. Kodi does not fetch additional artist data for artists that only feature on songs, either on compilation albums or as guest artists on songs in albums by others, and you do not have any albums by them in your collection.

Note: There are weaknesses in the way that Kodi determines the location of the artist folder. It looks for the folder that is common to all the songs with that album artist, the name of that folder is irrelevent. If you have multiple albums by an artist all under an artist folder then this works perfectly. However the algorithm does not work for collaboration albums, those that have more than one album artist e.g. "Riding with the King" by Eric Clapton and BB King, or classical music with composer, orchestra and conductor given as the album artist. Also if you have not kept all songs by an artist under a unique folder, then the artist directory will probably be mis-identified. The result is that Kodi can find the wrong artist.NFO file, and give the artist some other artist's information, or fail to fine the artist.nfo you created

Naming & Saving conventions for your Music Artist *.nfo files:

Saved Artist as File Name Save Location
Artist\Album\Songs artist.nfo f:\MyMusic\Stevie Nicks\artist.nfo


Naming & Saving conventions for your Music Album *.nfo files:

Saved Album as File Name Save Location
Artist\Album\Songs album.nfo f:\MyMusic\Stevie Nicks\Crystal Visions\album.nfo


Music Videos

Music Videos require one nfo for each music video in the folder. These nfo files need to be named exactly as the Music Video file is named, but with the nfo extension.

Naming & Saving conventions for your Music Videos *.nfo files:

Saved Music Videos as File Name Save Location
All formats <MusicVideoFileName>.nfo f:\MyMusicVideos\<MusicVideoFileName>.nfo


Scraping nfo files

There is no special procedure to scrape nfo files. Performing the usual Library Update will scrape the nfo files into the library. Be aware that nfo files are not easily interchangeable between Movies, TV Shows, Artists and Albums. Although they all share common tags, each also has its own specific tags that won't be recognised in other parts of the library.

After the NFO files are scanned into the library, the NFO file is no longer used and only serves as a backup. If you make changes to the NFO file you will need to refresh that library entry for the changes to be loaded into Kodi.

Kodi also contains a Local-NFO-only mode for when you add videos to the library, but this mode is only required if you want to prevent online-lookups for videos that lack NFO files. See Set content and scan#Local NFO only options for more information on this Local-NFO-only mode.


Advancedsettings.xml

Sample nfo Files

Provided below are sample nfo files to assist with the manual creation process


Movie nfo

Sample Movie nfo file


TV Show nfo

Sample TV Show nfo


TV Show Episode nfo

Sample TV Episode nfo


Music Artist nfo

Sample Music Artist nfo


Music Album nfo

Sample Music Album nfo


Music Video nfo

Sample Music Video nfo


nfo Tags

A list of all available tags that Kodi recognises follows in this section. As mentioned previously, there are many common tags, but there are also specific tags for each part of the library. Ensure you use the correct tags.


Movie Tags

TV Show Tags

TV Show Episode Tags

Music Tags

@Karellen is there any way we can avoid calling the NFO stuff "music tags"? Xml metadata perhaps, or xml tags. The essential "music tags" for the library, the tags Kodi uses etc. are those embedded in the music files themselves using various formats. Users need to be clear that "tagging music" does not mean making NFO files.

@DaveBlake- This is what I am trying to achieve- show all database fields and the Source of the Data (scraper, file tags etc) and nfo tags.

At first I expected that all nfo tags would have a corresponding database field. I did not expect that some tags would have no database field. So not sure how to show that scenario in these tables yet. Any suggestions? Do you know how many there are?

I would like to keep the Music File Tag column, but that is inaccurate as it is only showing the Vorbis tags, and there are four other tagging styles that will need to be included which makes the table too complicated looking. I created the second table (exactly the same) except without the music file tag column. I will refer to the MusicFile Tags via a link. Your thoughts?

The tables will not be on this page. I will modify the Database Table wiki page, and simply place a link to it in this page.

More questions...

  1. How do you know when there is a hierarchy with tags and what will be the best way to document that? eg. You have...
<genre>

and then...

<album>
    <title>Blah</title>
    <year>2017</year>
</album>
  1. Some tags have qualifiers. How do I know when a qualifier can be used...
<userrating max="10">7</userrating>
  1. Some tags come from Music Files, some Tags come from online Scrapers. Makes sense when first building your library. But when you export your library, some of the Music File Tags are entered into the nfo file. Now we have the same Tag information in the music file and in the nfo. When rebuilding your library, which takes precedence? Does nfo files override the music tags?

Do you have any other suggestions on how to document this?

The NFO data should all go to/come from somewhere in the db, just not always a single db field. The source of data field content can be diverse, scanning is not just about reading data but processing it too. Also some fields are initially set from tags and then can be overwritten by nfo data, there is a merge process involved in scraping.

List what is in NFO and I will tell you where it comes from in db, if it is written back on scraping (some stuff is exported to NFO just for reference), and if it overwrites the tag data or is sole source of that data.

You note I keep using the word "tags" and I mean those embedded in music files.

Having a tag name in the table is useful. I tend to use the Vorbis (FLAC) tag names for tags because they are nice and descriptive (except RELEASETYPE which is confusing). Kodi could have its own names for these tags I guess, but may as well use Vorbis. The tag table gives the tag names in other formats no need to duplicate that here.

My solution use vorbis name against DB field, comment somewhere that is what has been done and general link to the table elsewhere that lists the tags in the various formats.

Ah Ok, not for NFO page but for DB page. Fine.

XML tag hierarchy: use examples. So make sure that the example album.nfo on the NFO page has multiple genres, album artists, styles etc., examples of every multiple.

In music the only xml tags with a qualitfiers is rating and user rating, they give the max score that the given rating value is out of. This is quite important as we switched from out of 5 to out of 10 as default for rating and caused lots of user anguish.

There is also this http://kodi.wiki/view/Music_tagging#Data_Kodi_Scrapes

Because my xml sucks I'm finding this method of communication frustrating. So if I have left question unanswered, can we do it on Slack?

Comment on table layout: I find having the related tags useful, Vorbis name fine, so go with table version 1.

Source of data - well if there is a related tag (or tags) then that is always the initial source of that field, and if there is a related xml tag that is where that value is exported and might be imported/scraped from. Rather than a "source of data" column I would have a "Import/overwrite" column: overwrites where having "Prefer online information" setting enabled causes the scraped NFO values to replace that from tags (if it has one. Import says NFO (or scraper) can provide. The rest if there is an NFO tag then that value is for human ref and not scraped/imported into db from NFO.

Genres, Year, Compilation and Label may have been derrived from tag data and these will take prescidence. These values can be overwritten by the scraped values if "Prefer Online Information" setting is enabled.

Then I have tried to edit table, but I hate editing wiki tables!!!!

Database Field Data Type Description Import/Overwrite NFO Tag Music File Tag
idAlbum integer Primary Key
strAlbum varchar(256) Album title Overwrite <title> ALBUM
strMusicBrainzAlbumID text MusicBrainz Album ID (release ID) <musicBrainzAlbumID> MUSICBRAINZ_ALBUMID
strArtists text album artist(s) description (not always a concatenation of names) <artistdesc> Derived from ALBUMARTIST, ALBUMARTISTS
strGenres text Album genres (denormalised concatenation of values in genre table) Overwrite <genre> ^^ GENRE
iYear integer Album release year Overwrite <year> YEAR
idThumb integer [Unused]
bCompilation integer Compilation flag Overwrite <compilation> COMPILATION
strMoods text Album moods Import <mood> ^^
strStyles text Album styles Import <style> ^^
strThemes text Album themes Import <theme> ^^
strReview text Album review Import <review>
strImage text URLs for available remote album images Import <thumb>
strLabel text Album recording label Overwrite <label> LABEL
strType text Album Type e.g. "Soundtrack / Live" Overwrite <type> RELEASETYPE
fRating float Album rating Import <rating max="10">
iUserrating integer Album user rating (out of 10) Import <userrating max="10">
lastScraped text Date/time data scraped from online sources or NFO files
strReleaseType text Internal type - "album" or "single" <releasetype>
iVotes integer Album votes (for rating) Import <votes>

^^ Multiple entries allowed

Music Video Tags

Return to top