Kodi Community Forum

Full Version: Metadata Editor - Update library + .nfo informations
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
So not only the NFO for just the item, but only the edited values too, cool.

@sualfred could it easily be amended to optionally create an NFO when one doesn't exist? Just thinking to reduce my todo list Smile

But first for music you need to know where any album or artist NFO might be located to check if it exists (or create one). For video lib items you can of course get this from "file" because the item is the media file. Albums and artists are abstract concepts derived from music files, and depending on the users choice of folder structure and music complexity (collaborations, classical music etc.) may not even have a unique physical location.

Just thinking aloud I think the best is to add a "path" property to Audio.Details.Album and Audio.Details.Artist, the art addons may want to know that folder too. Still don't know how to get JSON non-breaking additions into v18, unless we backport the other changes that have happened and I'm not sure all can be done cleanly.
This script is not really meant to be a scraper at all, just an updater of existing .nfo's.
Creating the .nfo if not existing will move my current logic to the garbage can, because I only pass a list of element keys + values to the updater class. I would have to rewrite everything to pass all available data to write every value of it.

How does handle Kodi incomplete .nfo's? For example if only "plot", "premiered" is available without any <cast>, <title> or whatever element. Will the nfo content ignored because there are missing required fields?

It's sometimes a pita that Kodi supports very strange folder structures. I have no clue how to solve this for music. Except forcing artist.nfo and album.nfo in a centralized folder of Kodi itself. But the main usecase of .nfo's are that all clients with .nfo support can benefit from those.
Emby for example supports album + artist.nfo only for this, and in my opinion best, structure:

Code:

\Music
    \Artist Name
        \Album Name
            1- Song.mp3
            2- Song.mp3

I guess the path field has to be an array with all available paths like:
{*centralized kodi nfo storage*, e:\music\madonna, e:\music\partysampler\madonna, etc}
Oh well, I can't off load anything from my todo list then Tongue
 
Quote:How does handle Kodi incomplete .nfo's? For example if only "plot", "premiered" is available without any <cast>, <title> or whatever element. Will the nfo content ignored because there are missing required fields?
I don't know about video, it is more NFO dependant so probably behaves differently. With music for artists and albums there are no required NFO fields, the values get merged into the current data. That merge process prevents missing/empty values in the NFO from clearing some of previously stored data e.g. can't blank a name or a year etc., but the other missing elements will result in an empty value for that field.


Thankfully most users don't have strange folder structures, although Kodi will build a music library from a completely flat set of music files as long as they are accurately tagged. That is pretty clever of it (or rather the guys that implemented it). The problem of course is where to put album and artist art and additional info. Art addons and using NFO files and local art encouraged users to have a folder hierarchy.

Albums are easy, having all the related music files under a unique album folder is easiest for humans to understand and do. You can have disc subfolders beneath that (take a 14 disc boxed set release, you want subfolders). But artists are not so trivial. Simple music collections will divide as you suggest into structures with all the music by an artist, and only that artist, in a unique folder.  But artists collaborate (more than one credited to the album), most classical music has multiple album artists (conductor, orchestra, composer etc.), and you just can't fit that into such a simple structure. For example album X by A, album Y by B, album Z by A and B. What artist folder structure to use?  What about artists with the same name? What about artists that are only make guest appearences or on compilations? Your structure only covers album artists that never collaborate. Also humans like to organise music into different categories, and using folders for that is obvious e.g all my Xmas albums in an Xmas folder, the Kids stuff in another, Jazz separate from Pop etc. and artists cross over categories. Also a large collection needs breaking down more splitting so albums by year and/or genre can make more sense than artist.

So unique album folder yes, unique artist folder no, not guarrenteed. Hence the idea of the Artist Information Folder - a nominated location under which all the artists can have a sub folder each and in that goes their NFO and art (with the music off many other places). When you have artists with same name using part of the mbid is a nice way to differentiate (Kodi only allows same name if it has mbid)
Code:
\MyArtistInfoFolder
        \Artist name 1
              artist.nfo
              folder.jpg
              fanart.jpg...
       \John Williams_8b8a

       \John Williams_53b1
Other software could easily adopt this idea and use same location. Smile
 
Quote:I guess the path field has to be an array with all available paths like:
{*centralized kodi nfo storage*, e:\music\madonna, e:\music\partysampler\madonna, etc}
No, not an array, I don't understand your thinking. Path for an album or artist is the single unique location of the NFO files and artwork.
So path for an album NFO and art could be something like
   "c:\MyMusic\Acoustic Alchemy\Red Dust and Spanish Lace_1983" or
   "...\Pop\1970s\Albums\Deceptive Bends"
  - above the music files of that album (and only it) identified by music file contents not folder name,  and not necessarily under an artist folder

Path for an artist could be "...\MyArtistInfoFolder\John Williams_8b8a2" - showing what how to cover non-unique artist name

In video actors and directors could do with similar handling instead of the repeated data we currently have to use.
Most people prefer having .nfo's stored to their media. That's why I was suggesting an array.
With an array I can update the Kodi centralized .nfo and the one next to the media. If I only can update the centralized ones, the ones of the folders will stay untouched. On a crashed system people will rescan their storage folders and the edited values are lost.

Emby also has a own local storage. .nfo's are only used as "copy". If my server main SDD will die on some day -> I don't care, the .nfo's are still next to the media.

But anyway, I'm not in the position or having the know-how to correctly built a database scheme. Just a skinner that has learned Python by mistake. I'm sure you will find a correct solution. It's your playground and you have more experience with it than I'll ever have Smile
@sualfred 
Just now i manage to do some testing although, since i had a major windows system crash i am rebuilding Kodi from scratch and my tests are on a small video library only with movies.

Everything looks fine to me and the NFO files are updating properly. I cant see any issues so far but like i said it's a small video library. When i am able to do some more extensive testings on bigger scale will let you know.

A couple a questions if i may...

1. The ratings update for all movies/tvshows also updates votes... right?
2. Is there any reason (or it's not yet implemented?) why when you run the script call script.metadata.editor,action=updaterating you don't have the choice to select the source for the update or is using the default source selected in the Editor UI?
3. Are you planning to add more script calls for all items like MPPA ratings & Top250 updates?.

Thank you very much for you work on this and as i read from the discussion so far i am pretty sure it will be... another "Swiss army knife"!.

Cheers
Nessus
I've jumped off the roof and tested my 1000 movies today. And..... it seems nothing is messed up.

1. Yes
2. Not added yet, but no problem.
3. -> MPAA. This is tricky but doable with tmdb, but reaquires an extended API call with a region (and a region setting in the addon). The question is: Why should this be in the rating updater task? The MPAA doesn't really change over the time.
3. -> Top250: Either TMDb nor OMDb is having this information

edit
@nessus 

regarding 2) RunScript(script.metadata.editor) will offer you 3 options. And a cancel option if the updating is configured as background task.
@nessus 

Pushed an update that also updates MPAA.

By the way, because it wasn't mentioned before: TV show status is also updated

Edit:
Don't forget to set the MPAA region in the addon settings. 'US' is always the fallback if no value is found.
(2019-11-12, 23:47)sualfred Wrote: [ -> ]@nessus 

Pushed an update that also updates MPAA.

By the way, because it wasn't mentioned before: TV show status is also updated

Edit:
Don't forget to set the MPAA region in the addon settings. 'US' is always the fallback if no value is found.
@sualfred, what happens if you have an MPAA for a movie that is from a different region than what is configured in the addon? Does it get overwritten in the db and NFO? I would not like this to happen, since I have movies from many countries and thus with MPAA from many different regions.  Please let me know.  Thanks.

Regards,

Bart
@sualfred , I finally took the plunge and updated the ratings for my 660 tv shows.  I found this in the NFO for one of my most recent shows:

xml:

<?xml version='1.0' encoding='UTF-8'?>
<tvshow>
    <title>Seven Worlds, One Planet</title>
    <plot>Millions of years ago, incredible forces ripped apart the EarthΓÇÖs crust creating seven extraordinary continents. This documentary series reveals how each distinct continent has shaped the unique animal life found there.</plot>
    <episodeguide>
        <url cache="auth.json" post="yes">https://api.thetvdb.com/login?{"apikey":"0629B785CE550C8D","id":359251}|Content-Type=application/json</url>
    </episodeguide>
    <id>359251</id>
    <genre>Documentary</genre>
    <genre>Mini-Series</genre>
    <country>United Kingdom</country>
    <studio>BBC One</studio>
    <actor>
        <name>David Attenborough</name>
        <role>Narrator</role>
        <thumb>https://www.thetvdb.com/banners/</thumb>
    </actor>
    <ratings>
        <rating default="false" max="10" name="imdb">
            <value>9.8</value>
            <votes>45</votes>
        </rating>
    </ratings>
    <uniqueid type="unknown">359251</uniqueid>
    <uniqueid type="imdb">tt9805708</uniqueid>
    <unknownid>359251</unknownid>
    <imdbid>tt9805708</imdbid>
</tvshow>

Is writing a uniqueid type of "unknown" an issue with the addon? That ID is obviously a TVDB ID.  Please advise.  Thanks.

Regards,

Bart
You mean if your library is based on different MPAA rating region? Gets overwritten. All I can offer is a option to skip updating MPAA.

Edit:
"Unkown" because you library has a unique ID "unkown" stored. I just update the dict with valid values. The rest are already there.
(2019-11-13, 00:08)sualfred Wrote: [ -> ]You mean if your library is based on different MPAA rating region? Gets overwritten. All I can offer is a option to skip updating MPAA.

Edit:
"Unkown" because you library has a unique ID "unkown" stored. I just update the dict with valid values. The rest are already there.
@sualfred , I mean that my library has MPAA ratings from multiple regions in it.  Yes, please offer an option to skip updating MPAA, as I do not want what I have to be overwritten.  Thanks.

I will have to verify which shows have "unknown" in the uniqueid in my library, that should not be happening.  Thanks.

Regards,

Bart
Added the option. It's disabled by default. / Edit: I mean MPAA updating is enabled by default, the option to disable it is disabled by default.
(2019-11-13, 00:21)sualfred Wrote: [ -> ]Added the option. It's disabled by default. / Edit: I mean MPAA updating is enabled by default, the option to disable it is disabled by default.

Thanks!
I've also noticed that no default rating provider was defined for your example item. I've added a fallback logic that will set one if that is the case.
(2019-11-11, 09:28)sualfred Wrote: [ -> ]@Karellen 

New version pushed.

- fixed exception with empty movie/TV show library
- switched to xml parsing for omdb to get tomatometerallcritics votes. 
- added tomatometeravgcritics and votes
Thanks!

A general comment. For my use case I don't want my NFO files updated. I run a somewhat regular Export every fortnight, so I will ensure the setting to write to nfo files is always disabled. Does this affect any function of the add-on?

Music...
1. Editing the Description seems problematic for me. When there is a long description, I don't know where the cursor is when i start typing. Nothing of what I type is seen onscreen and there is no way to navigate that single description line. Can you turn that single line box into a larger box that can be navigated so users can scroll to points in the description to add or remove text?

2. I think what you have available for editing in Music is much safer now and I defer to daveblake's comments. The only other items I think is safe and should be included is "Disambiguation" in Artists which allows users to add an identifying comment for artists with the same name and "Gender" . Albums and Songs I see no user problems.

Movies...
1. Ratings- If I only have IMDB and TheMovieDB ratings available, should the addon add the metacritic and rottentomatoes ratings as they are not added. I vaguely recall that you needed to write to nfo files for this or was that the episodeguide issue? Actually I cannot update any ratings. Log here... https://paste.kodi.tv/ticaqexago.kodi

2. Same issue as music when editing long text strings such as the movie plot. Also for TV Shows and Episodes


TV Shows
1. Ratings not updated
2. Did you remove the ability to update the <episodeguide>?


Episodes
1. UniqueID values are n/a but values exist in the DB.


Thanks sualfred
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14