Posts: 21,164
Joined: Apr 2017
Reputation:
1,469
Simply saving a single tag and value to an nfo file and then expect to scan it back to the library won't work with Kodi.
Posts: 4,528
Joined: Jan 2011
Reputation:
152
DaVu
Team-Kodi Member
Posts: 4,528
If a userrating was set via GUI from the movie information screen and if you then export the movie(s) to nfo file(s), then this will be exported as well. Just tested that.
All the other tags are also needed if you import the nfo file again. Kodi doesn't scrape parts of the nfo only. So you need all the information. The other tags inside this nfo file are coming from the scraper which are written into your database. By exporting all the entries (title, plot, mpaa rating, user rating and what not) are read from the database and written to the nfo file.
Posts: 225
Joined: Mar 2016
Reputation:
2
2019-11-28, 00:49
(This post was last modified: 2019-11-28, 05:48 by firewater.)
My problem then is that exporting .nfo files with Kodi names them not "movie.nfo", but "2001 - A Space Odyssey.nfo", and that it appends the aforementioned empty tags. I can live with the second, but the first complicates my setup.
I'm now looking for to how to create a python script that writes a line (<userrating>NUMBER</userrating>) to the movie.nfo of the selected item. The line can be entirely static, it doesn't have to actually read the userrating because I will call it with different keymaps (keymap 1 will write <userrating>1</userrating>, keymap 2 will write <userrating>2</userrating>, and so on). Hoping someone can guide me here...
edit: rewrote it all
Posts: 4,528
Joined: Jan 2011
Reputation:
152
DaVu
Team-Kodi Member
Posts: 4,528
ok, if you can't deal with the fact that Kodi uses "<moviename>.nfo" instead of what you want, then I can't help you anymway. Generally I woudn't use "movie.nfo" as I like to know which nfo belongs to which movie by its name. Sure, they are separated in subfolders, but still.
But that's ofc your decision then
Posts: 5,442
Joined: Jul 2012
Reputation:
378
As far as saving a rating to file, it seems to me better to change the rating in Kodi, then export the library value. Since you don't want to export the whole library (I often do it when exiting Kodi and at least for 500 movies I don't find it that time consuming), yes you could create a private addon that you could invoke for the current playing movie or current focused item in a movie library list. The general approach I considered is to get the media path from Kodi and open the movie.nfo file using the Elementree Module features in Python. If movie.nfo doesn't exist I would maybe just exit with a notification. If it does exist I would look for existing <userrating> in the file and update it, or add the <userrating> if it doesn't exist, then save the file. Getting into more details probably need to determine if it is for Leia (Python 2) or Matrix (Python 3).
scott s.
.
Posts: 225
Joined: Mar 2016
Reputation:
2
Thanks for taking the time to think about it. I think the most promising lead, from the addon thread previously mentioned, is that (I believe) the developer is working on a function that would update individual .nfo fields through a command. Could have far greater use than my niche petition... hope it happens.