• 1
  • 7
  • 8
  • 9(current)
  • 10
  • 11
  • 35
Release WatchedList - service to automatically save/restore watched state
(2017-01-28, 21:24)rickm Wrote: I think all I have to do is change 3600 to 60 in the "periodic execution" stanza and the interval becomes minutes instead of hours:

Seems logical. Remember though, you would always have to make sure you wait 67 seconds between the end of watching your file to moving your file (if you have hidden progress dialogue). Also depending on how you use your library, if you unwatched anything (ie. tv show, movie set) to re-watch it and keep track of that re-watch, it would also be made watched.

I have no experience with the "follow user setting". I assume you saw this :
Post 36

This has me worried a bit :
(2015-01-25, 19:14)schapplm Wrote: It could take some time between setting something as watched (or unwatched) and the message being displayed, because the addon has to crunch the entire database.

CSC
Reply
CSC,

I wrote a web interface for moving watched shows to my archive. I often do that from my phone or the Kodi box (Minix Android) while still sitting on the couch at the end of a show. I suppose manually running WL from a shortcut might be less stressful than waiting 67 seconds! lol

I could add an SQL command to my file move script to set the watched flag in the Kodi database. That would do it. I kinda like that idea.

I've been wondering if I should do away with my archive folders for Movies and TVShows. I use them for a few reasons. One is that I mirror unwatched shows onto a USB hard drive that I take with me when I go to my cabin for weeks at a time, and the original hard drive was too small for including all videos. I could enhance my mirror script to use Kodi's watched flags to omit them form the USB drive. Other reasons are that I used DLNA/Serviio for years before adding Plex and Kodi servers. Serviio has no watched flag feature (other than last episode watched). We also access shows from outside the house using Plex, which of course has its own set of watched flags that I have ignored so far. Kodi doesn't do a perfect job of dealing with the same show and seasons (but unique episodes) in 2 separate sources. One or the other sometimes shows no metadata, and the "hide watched" toggle in Kodi doesn't always squish out season folders with no unwatched episodes.

But, doing away with the archive folders would make Plex and DLNA access messy. DLNA access to Kodi doesn't set watched flags (I think it will in v17) and, I'm not sure yet, but I don't think Kodi does DLNA transcoding to the degree of success that Serviio does.
Reply
All that is beyond me and my experience, rickm. Can't help you there.
If your idea works, that would indeed be the "easiest to run".

CSC
Reply
(2017-01-26, 23:16)rickm Wrote: Please explain "The detection for mark as unwatched is based on a user inactivity counter." How does this work? There are multiple ways to toggle the watched state (menu items, the remote/keyboard "w" key). Are they all "caught" by WL as user actions?

The option "follow user setting watched/unwatched" reads out the result of xbmc.getGlobalIdleTime(). That means the endless loop in service.py is checking, if the current idle timer is lower than the previous one. That means, that any kind of user interaction has happened (remote control key presses, etc.). A callback function on the change of the watched flag directly is not possible afaik.

(2017-01-28, 21:24)rickm Wrote: I was surprised that the minimum interval to autorun WL is 3 hours. A manual run on my server takes about 3 seconds
[...]
I think all I have to do is change 3600 to 60 in the "periodic execution" stanza and the interval becomes minutes instead of hours
Changing the code like you described would work, but the option mentioned above is supposed to solve the problem that you have. Instead of polling the Kodi movie library every minute, it only polls every 3 hours OR if something could have happened. Normally this sets the movie as watched in the WL database right after you finished watching it and you did your first remote control button press (idle timer goes from 90 minutes to 0, see above). If your script includes removing the movie from the Kodi database while the credits are still running, the described approach might not work, though, since the movie is no longer in the Kodi database.
Problem with polling minutely is, that I think the algorithm to sync the databases is not O(n), since it is not programmed very sophisticated, but more or less brute-force. That means if you double the size of your movies in the database, the sync could take e.g. four times as long and so on.
Reply
(2017-01-26, 23:16)rickm Wrote: So how do I configure machine B? I'm guessing there is a way to set it up such that machine B never scans the database since machine A is doing it? Is this right for machine B?
- Update movies watched state - no
- Update episodes watched state - no
- Start with Kodi (autorun) - yes
- autostart mode - no update
- follow user setting watched/unwatched - yes

Does "autorun" and "autostart" mean the same thing or two different features?
Autorun and Autostart mean the same thing here (I hope this is no translation error).

I assume the behavior you want to have is
  • machine A: Kodi shared mySQL database, common WL database read/write and fully synced to Kodi database
  • machine B: Kodi shared mySQL database, common WL database read-only

This is not implemented in the code, since it is not the normal use-case. You would need to set up a modified version of the addon on machine B and disable the function call for writing in the WL database (write_wl_wdata).

The update user status also includes an update of the Kodi database.
However, the more I am thinking of it, the more I doubt that this all makes sense Huh
Reply
(2017-01-27, 21:03)ColonelSceneCut Wrote: [...]
Krypton 17.0 RC3
[...]
I start WL, it reads and tells me that there are 635 movies and 5986 episodes read from watchedlist file (from an Isengard installation).
It creates the backup.
Tells me there are 0 movies 0 eps read from Kodi
[...]
This could be related to the new Kodi version 17, which you might be the first one to test with my addon. Could you upload a kodi.log with debug options activated?
Reply
(2017-01-29, 11:38)schapplm Wrote: However, the more I am thinking of it, the more I doubt that this all makes sense Huh

Thanks for all your help and replies. I realize now that all I need is to run a cron job once or twice a day to set the watched flag in the Kodi database for every file in the archive folder that doesn't have it set. I believe this just means setting the playCount and lastPlayed fields of the files table.
Reply
(2017-01-29, 11:40)schapplm Wrote: Could you upload a kodi.log with debug options activated?
Will do.
Hope it helps.
Thanks for taking the time.

CSC
Reply
I just upgraded to Kodi 17 and my Kodi database was parsed without errors by WatchedList, so this should not affect all users of Kodi 17.
(2017-01-30, 01:30)ColonelSceneCut Wrote: Here it is:
log
22:44:30.222 T:1542710176 DEBUG: service.watchedlist: get_watched_xbmc: Get all movies from xbmc database
22:44:30.233 T:1542710176 DEBUG: RunQuery took 2 ms for 0 items query: select * from movie_view
22:44:30.235 T:1542710176 DEBUG: service.watchedlist: get_watched_xbmc: Get all episodes from xbmc database
22:44:30.247 T:1542710176 DEBUG: RunQuery took 2 ms for 19 items query: select * from episode_view
NOTICE: service.watchedlist: Notification. WatchedList: 0 movies and 0 episodes read from Kodi-DB

I get:
Quote:18:56:10.606 T:140264553830144 DEBUG: RunQuery took 29 ms for 57 items query: SELECT * FROM tvshow_view
18:56:10.620 T:140264553830144 DEBUG: service.watchedlist: get_watched_xbmc: Get all movies from xbmc database
18:56:10.707 T:140264553830144 DEBUG: RunQuery took 85 ms for 1688 items query: select * from movie_view
18:56:11.162 T:140264553830144 DEBUG: service.watchedlist: get_watched_xbmc: Get all episodes from xbmc database
18:56:11.238 T:140264553830144 DEBUG: RunQuery took 73 ms for 3961 items query: select * from episode_view

It seems that the addon is running fine. Since the addon worked before, I assume you have imdb numbers set for your database entries (but please check again).
You have some tv episodes, but they belong to tv shows that have no ID and are therefore ignored.
The access to the Kodi video library is done via JSON-RPC.
Could you try if these queries show the expected results (your database contents)? Enable the http-control first.
(2016-06-11, 10:41)schapplm Wrote:
Code:
http://localhost:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"properties": ["title", "imdbnumber"], "sort": { "order": "ascending", "method": "title" } }, "id": 1}
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:
http://localhost:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"properties": ["tvshowid", "season", "episode", "playcount", "showtitle", "lastplayed"] }, "id": 1}
Reply
Hello:

I am hvaing a problem and it seems the watchlistdb is not geting updated. new epiosodes are not gettiing marked as watched on mye secondary device. I am running kodi 17. any advice?
Reply
I've been seeing messages similar to the following in my newly updated Kodi 17 box.
Quote:DEBUG: service.watchedlist: get_watched_xbmc: tv show "Battlestar Galactica" has no imdb-number in database. tvshowid=97 Try rescraping.

Ultimately, it would appear that this only occurs for shows that return from the following query (mysql).
Code:
SELECT idShow, c00, uniqueid_value FROM tvshow_view WHERE uniqueid_value IS NULL;

In my specific situation, it's because the tvshow.nfo files exists but contains no value within the <id></id> tags. They were copied over from Windows-based Kodi 17 that I use TMM to manage. I will have to review this further. Anyways, I mention this because the first of the JSON calls provided a few messages ago return blank values for imdbnumber (example follows).
Code:
"tvshows": [
    {
        "imdbnumber": "",
        "label": "24: Legacy",
        "title": "24: Legacy",
        "tvshowid": 1
    }

But when querying the tvshow_view an id appears to be returned.
Code:
mysql> SELECT idShow, c00, uniqueid_value FROM tvshow_view WHERE c00 LIKE '24%';
+--------+------------+----------------+
| idShow | c00        | uniqueid_value |
+--------+------------+----------------+
|     92 | 24: Legacy | 311787         |
+--------+------------+----------------+
1 row in set (0.02 sec)

And '24: Legacy' is not included in my list of 20 shows with the 'no imdb-number in database' messages.
Any thoughts/comments?
Reply
(2017-02-15, 19:32)Motzi Wrote: Hello:

I am hvaing a problem and it seems the watchlistdb is not geting updated. new epiosodes are not gettiing marked as watched on mye secondary device. I am running kodi 17. any advice?

I apologize, but I have to ask, are you running your systems on a shared library database?

CSC
Reply
(2017-02-16, 03:45)dbeetle Wrote: I mention this because the first of the JSON calls provided a few messages ago return blank values for imdbnumber

I get the same results.

(2017-02-11, 20:15)schapplm Wrote: Could you try if these queries show the expected results (your database contents)?

Apart from the first one with blank imdbnumber everything seems fine.

Just to be thorough, my tvshow.nfos have the ID tags set and blank UniqueID tags. My episode.nfos have blank ID tags and have their UniqueID tags set. I use Kodi (TVDB scraper) on a windows machine to build most TV nfos. These two specific shows are homemade nfos, based on the format I got from Kodi.

(2017-02-16, 03:45)dbeetle Wrote: Ultimately, it would appear that this only occurs for shows that return from the following query (mysql).

My first posting on the subject was written after I tried to build my system with mysql. The example I am using now uses local DB only. Don't know if that helps any.
For the time being I can't use mysql on the Pi3 because when I set Kodi to use mysql, it just migrates the data from my Isengard mysql DB. Had to reinstall Isengard on the Pi2 cause my ever so sweet yet sometimes terrifying wife was getting annoyed not having Kodi to use....

CSC
Reply
(2017-02-16, 07:02)ColonelSceneCut Wrote:
(2017-02-15, 19:32)Motzi Wrote: Hello:

I am hvaing a problem and it seems the watchlistdb is not geting updated. new epiosodes are not gettiing marked as watched on mye secondary device. I am running kodi 17. any advice?

I apologize, but I have to ask, are you running your systems on a shared library database?

CSC

thanks for answering, no I am not. I did before on kodi 16, but after I upgraded to kodi 17 I desided to not use shared database
Reply
(2017-02-16, 03:45)dbeetle Wrote: Any thoughts/comments?
First of all, I think relevant is not directly what is inside the tvshow.nfo files (or other nfo files), but the content of the Kodi video library. The nfo files perhaps get scraped once, but you don't know which values are taken into the Kodi database, so you have to look there by mysql-command line, phpmyAdmin, opening the SQLite file or most important: typing the json-query in the address line of your browser.

There seems to be a new table `uniqueid` inside the Kodi database, which contains more detailed information about the kind of unique id that is set for each media file. This is new in Kodi 17 (MyVideos107).
However, this does not affect this addon for now: Since I access the video library via the JSON-RPC interface, I can only access the fields given by JSON. E.g. for movies the list query connected with the the details attribute and equivalent for TV show the list with details.
So the only access to the uniqueid-field is the query of "imdbnumber".

The only possibility for the WatchedList addon to recognize the media is for you to set the uniqueid-field in such a way, that the imdbnumber entry of the JSON-query is set.
You could for example
  • set the id-field in the tvshow.nfo and rescrape or
  • rescrape discarding the nfos or
  • set the uniqueid manually in the video library (not in the view but in the database tables) (I would not recommend this).
Reply
  • 1
  • 7
  • 8
  • 9(current)
  • 10
  • 11
  • 35

Logout Mark Read Team Forum Stats Members Help
WatchedList - service to automatically save/restore watched state3