Kodi Community Forum
Release WatchedList - service to automatically save/restore watched state - Printable Version

Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Service Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=152)
---- Thread: Release WatchedList - service to automatically save/restore watched state (/showthread.php?tid=164652)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24


RE: WatchedList - service to automatically save/restore watched state - schapplm - 2019-04-17

(2019-04-17, 05:30)micahg Wrote: I observe that the imdbnumber for a show changes depending on the system. For my laptop (ubuntu) and my mi box (android), for example, "The Good Fight" has an ID of 69158.  However, on my firestick, the same show has an imdbnumber of 320766.
I think your firestick is right and the other two are wrong. If I do a search on tvdb for 320766, I get "The Good Fight" and the search for 69158 gives no results.
I would suggest re-scraping the folder with the media and settings debug verbosity in the advanced settings to high, to see where the wrong number comes from.


RE: WatchedList - service to automatically save/restore watched state - micahg - 2019-04-17

(2019-04-17, 20:14)schapplm Wrote:
(2019-04-17, 05:30)micahg Wrote: I observe that the imdbnumber for a show changes depending on the system. For my laptop (ubuntu) and my mi box (android), for example, "The Good Fight" has an ID of 69158.  However, on my firestick, the same show has an imdbnumber of 320766.
I think your firestick is right and the other two are wrong. If I do a search on tvdb for 320766, I get "The Good Fight" and the search for 69158 gives no results.
I would suggest re-scraping the folder with the media and settings debug verbosity in the advanced settings to high, to see where the wrong number comes from.  
Thanks @schapplm ,

I dug into this a little further. The firestick was, for reasons unknown to me, using a different database: The Movie Database (tmdb).

Those id's are provider specific... maybe that isn't a great key to use -- or maybe we could do a secondary match on name if we don't find a match on imdbnumber.  I had a look at the JSON RPC code, and although the kodi db tracks where the id came from, json rpc doesn't expose it. My initial though was that perhaps we should include that along with the show id.

We could probably submit a patch to expose it if we can't think of a better way to correct this in the addon.

Did we always use the json rpc or did we used to go right to the db files with sqlite?


RE: WatchedList - service to automatically save/restore watched state - HeresJohnny - 2019-04-17

I would like to add some observations related to the imdb ID.

When there is no IMDB no. and debug logging is on, errors to the effect of "Movie xy doesn't have an IMDB no., please try re-scraping" are logged. Unfortunately, the default scrapers in Kodi for movies and tv shows are now set to TMDB. As I already commented in the TMDB scraper thread, items which are scraped with that scraper have existing IMDB nos. forcibly removed and only the TMDB no. is added/kept in the db. The Universal Movie scraper on the other hand doesn't add the TMDB ID.

This also seems to affect the WatchedList add-on. All moves which have been scraped with the TMDB scraper exhibit the behaviour described in the beginning (log item). Maybe someone more tech-savvy than me could make a suggestion to the maintainer of the scraper how to rectifiy this situation. They said there isn't a way to find the IMDB no. via the TMDB but an existing IMDB no. should never be removed, IMHO.

There is another add-on called "Light IMDB ratings update" which has a very useful function of adding IDs from several services. @axlt2002 - maybe that functionality could be expanded to look up missing IDs and help some other add-ons like this one along the way?


RE: WatchedList - service to automatically save/restore watched state - schapplm - 2019-04-18

(2019-04-17, 21:05)micahg Wrote: Those id's are provider specific... maybe that isn't a great key to use -- or maybe we could do a secondary match on name if we don't find a match on imdbnumber. I had a look at the JSON RPC code, and although the kodi db tracks where the id came from, json rpc doesn't expose it. My initial though was that perhaps we should include that along with the show id.

We could probably submit a patch to expose it if we can't think of a better way to correct this in the addon.
I think for correcting these scraper related issues, the WatchedList addon is not the right place. I would also favor for fixing the json output or adding keys. The main problem seems to me, like you mentioned, that different ids are stored in the same field in the database. The match on name would also pose some issues: e.g. names for shows/movies scraped in different languages (I guess many users have English media and media in another language).
(2019-04-17, 21:05)micahg Wrote: Did we always use the json rpc or did we used to go right to the db files with sqlite?
From what I remember, it was always json. This was promoted very early as the cleanest access on the database (and also independent of the sqlite/mysql implementation of the video db).
(2019-04-17, 21:40)HeresJohnny Wrote: When there is no IMDB no. and debug logging is on, errors to the effect of "Movie xy doesn't have an IMDB no., please try re-scraping" are logged. [...]
This also seems to affect the WatchedList add-on. All moves which have been scraped with the TMDB scraper exhibit the behaviour described in the beginning (log item). Maybe someone more tech-savvy than me could make a suggestion to the maintainer of the scraper how to rectifiy this situation.
I always wondered, where that came from. But this perfectly makes sense. As for the tv shows I also support this to be done on scraper/database/json-API-level.


RE: WatchedList - service to automatically save/restore watched state - bobrap - 2019-04-18

Thanks for responding.  That option doesn't work for me.  The nfo that is exported isn't compatible with the media manager I use.  Was looking for something that just writes the watched state to the nfo.  There is an add-on that does that (nfo watched state updater), but, it is no longer maintained and it's not always reliable.  Thanks.


RE: WatchedList - service to automatically save/restore watched state - trogggy - 2019-04-18

(2019-04-17, 17:51)bobrap Wrote: I know this is probably a way out and possibly not doable request.  Any chance of getting the watched state written to the nfo?  Really helps those of us who use media managers (ex. Media Companion).  Thanks for maybe considering this.
I honestly can't see what advantage there is in having watched status in an .nfo - personally I'd prefer that the only application that touches (writes to) my .nfo's is Media Companion. Restoring watched status from a single file on a new install is fairly trivial, so what am I missingHuh


RE: WatchedList - service to automatically save/restore watched state - bobrap - 2019-04-18

Doing a refresh in Media companion will update the watched status if it is written to the nfo.  Or I can go into MC and manually set the watched state for each episode/movie.  Exporting from Kodi is not really compatible with the info in the MC generated nfos.  If I only cared about the watched state in Kodi...no problem.  What I'm wanting to do is keep MC watch state updated.  Guess I could switch to Ember media, but, I prefer MC.  Makes a little sense?  Probably a bit anal Laugh .


RE: WatchedList - service to automatically save/restore watched state - schapplm - 2019-04-19

I am not sure if it is reasonable for an addon to write the nfo files in the first place. It would mean "hacking" the Kodi video database somehow.
The addon right now only gets the media information without relation to the files via the json API.
(2016-06-11, 10:41)schapplm Wrote:
Code:
http://localhost:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"properties": ["title", "year", "imdbnumber", "lastplayed", "playcount"], "sort": { "order": "ascending", "method": "title" } }, "id": 1}
Code:
...,{"imdbnumber":"tt2294449","label":"22 Jump Street","lastplayed":"2014-12-13 22:46:05","movieid":945,"playcount":1,"title":"22 Jump Street","year":2014},...
It would be possible to add the property "file" and then figure out the nfo file and manually change it with this addon.
I originally designed the addon to have the scope of save/restore/synchronize the watched state of the media between the Kodi database and an addon database.

Keeping the Kodi watched state synchronized with the nfo file is a function, that is already included in Kodi itself via the export video library into single files feature, and would be some kind of redundant. For this, it would be better to have an addon like "export the video library every day into single files".
(2019-04-18, 15:53)bobrap Wrote: That option doesn't work for me.  The nfo that is exported isn't compatible with the media manager I use.
If the request is to write a feature, that exports the state in a format, that is specific for media companion, then I would say there should be a distinguished addon or a simple conversion script for this.


RE: WatchedList - service to automatically save/restore watched state - trogggy - 2019-04-19

(2019-04-18, 21:29)bobrap Wrote: Doing a refresh in Media companion will update the watched status if it is written to the nfo.  Or I can go into MC and manually set the watched state for each episode/movie.  Exporting from Kodi is not really compatible with the info in the MC generated nfos.  If I only cared about the watched state in Kodi...no problem.  What I'm wanting to do is keep MC watch state updated.  Guess I could switch to Ember media, but, I prefer MC.  Makes a little sense?  Probably a bit anal Laugh .
I guess I'm struggling with why keeping watched state in MC is better than keeping it in a separate file.  Or better enough to care about.  I have enough peculiarities in my own setup that most people would probably roll their eyes at though.
Given MC uses a non-standard .nfo maybe a separate script to extract watched status - whether direct from the database, from this addon or elsewhere - and update the .nfo's would be the way to go.  That sounds doable.


RE: WatchedList - service to automatically save/restore watched state - Milhouse - 2019-04-19

(2019-04-19, 10:45)trogggy Wrote: maybe a separate script to extract watched status - whether direct from the database, from this addon or elsewhere - and update the .nfo's would be the way to go.  That sounds doable.

texturecache.py is a script (see sig) that already supports backup and restore of watched status, playcount and resume points. It uses JSON-RPC, and supports movies and tvshows. It doesn't write anything to the nfo, but instead stores the watched status/playcount/resume point information in any file the user wishes, which can then be restored at a later date or to a different Kodi client.


RE: WatchedList - service to automatically save/restore watched state - trogggy - 2019-04-19

(2019-04-19, 17:07)Milhouse Wrote:
(2019-04-19, 10:45)trogggy Wrote: maybe a separate script to extract watched status - whether direct from the database, from this addon or elsewhere - and update the .nfo's would be the way to go.  That sounds doable.

texturecache.py is a script (see sig) that already supports backup and restore of watched status, playcount and resume points. It uses JSON-RPC, and supports movies and tvshows. It doesn't write anything to the nfo, but instead stores the watched status/playcount/resume point information in any file the user wishes, which can then be restored at a later date or to a different Kodi client. 

That's what I use (thankyou, it's a fantastic resource!!!).  I'm more than happy storing stuff separately - if anything I prefer it as if nothing's writing to my .nfo's there's less scope for errors.  I probably phrased it badly - bobrap wants something that extracts watched data and writes it to .nfo files.  This addon and your script do the first (more difficult) part.


RE: WatchedList - service to automatically save/restore watched state - HeresJohnny - 2019-05-01

When debug log is enabled, the addon spams the SQL password in cleartext, please correct.
Code:

2019-05-01 21:31:37.797 T:5304 DEBUG: service.watchedlist: mysql_user = xxxxx
2019-05-01 21:31:37.797 T:5304 DEBUG: service.watchedlist: mysql_pass = xxxxx

(xxxxx inserted by me)


RE: WatchedList - service to automatically save/restore watched state - Tobby - 2019-06-05

Hi. Every time I run WatchedList on one of my TVs I get this error "WatchedList Error: Doing a database backup (Invalid argument)" and it doesn't create a new backup zip. Is this a known issue? Couldn't find anything in the thread about it.

Here's a log: ibokevequp.kodi (paste) (see line 129-130)


RE: WatchedList - service to automatically save/restore watched state - schapplm - 2019-06-22

(2019-06-05, 17:39)Tobby Wrote: Hi. Every time I run WatchedList on one of my TVs I get this error "WatchedList Error: Doing a database backup (Invalid argument)" and it doesn't create a new backup zip. Is this a known issue? Couldn't find anything in the thread about it.
The first one is only the displayed message in Kodi. In the log, you have
 
Code:
2019-06-05 17:27:41.642 T:9706 ERROR: service.watchedlist: database_backup: Error creating database backup /storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/userdata/addon_data/service.watchedlist/dbcopy/20190605_172741-watchedlist.db.zip: (22) Invalid argument
In the code for creating the zip file, this error is raised either as ValueError (e.g. "timestamps before 1980") or IOError (e.g. "permission denied"). Can you please check, if you have write permission on the Android device and if you have files with time stamp before 1980?


RE: WatchedList - service to automatically save/restore watched state - Tobby - 2019-06-23

(2019-06-22, 08:32)schapplm Wrote:
(2019-06-05, 17:39)Tobby Wrote: Hi. Every time I run WatchedList on one of my TVs I get this error "WatchedList Error: Doing a database backup (Invalid argument)" and it doesn't create a new backup zip. Is this a known issue? Couldn't find anything in the thread about it.
The first one is only the displayed message in Kodi. In the log, you have
 
Code:
2019-06-05 17:27:41.642 T:9706 ERROR: service.watchedlist: database_backup: Error creating database backup /storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/userdata/addon_data/service.watchedlist/dbcopy/20190605_172741-watchedlist.db.zip: (22) Invalid argument
In the code for creating the zip file, this error is raised either as ValueError (e.g. "timestamps before 1980") or IOError (e.g. "permission denied"). Can you please check, if you have write permission on the Android device and if you have files with time stamp before 1980?

The only permission Kodi lists on my TV is Storage, which it has access too.