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 25 26 27 28 29 30 31 32 33 34 35


WatchedList - service to automatically save/restore watched state - schapplm - 2013-05-11

I know this topic has been discussed by quite a few Threads and addons.
As there is no working solution available for Kodi (at least I found none) I hope my addon can fill the gap:

service.watchedlist
script that saves and restores the watched state of movies and TV episodes.
Advantages
  1. only clean access of XBMC database with JSON-RPC. No "dirty" manual database opening or reading xml files.
  2. starts as a service in autostart and repeats periodically
  3. automatic backup of addon database
  4. no user interaction needed
  5. addon database (SQLite) is easy to edit, in case wrong watched states are stored

Participation
If you have problems or suggestions, just answer to this thread or write an issue on github, if you know what you are doing.


RE: WatchedList - service to automatically save/restore watched state - ezechiel1917 - 2013-05-12

Looks nice. Is it somehow possible to overcome limitation of using only thetvdb/imdb numbers for identification of items when using json?

What about option to use also titles with combination of thetvdb/imdb numbers? It would help a lot if you use different movie/tvshow titles for different versions.


RE: WatchedList - service to automatically save/restore watched state - schapplm - 2013-05-12

(2013-05-12, 00:35)ezechiel1917 Wrote: Looks nice. Is it somehow possible to overcome limitation of using only thetvdb/imdb numbers for identification of items when using json?
What about option to use also titles with combination of thetvdb/imdb numbers? It would help a lot if you use different movie/tvshow titles for different versions.
I will think of that, however implementing this feature could take a while. There is another addon hidden in the forum which has this ability:
script.watched.states version 1.1.0 from devkid (http://forum.xbmc.org/showthread.php?tid=129448&pid=1401643#pid1401643)
there you have to start the backup/restore manually


RE: WatchedList - service to automatically save/restore watched state - MeMeMe - 2013-09-05

Very promising. Does this support multiple user profiles, each with their own database of watched programs?


RE: WatchedList - service to automatically save/restore watched state - Milhouse - 2013-09-05

(2013-05-12, 09:01)schapplm Wrote:
(2013-05-12, 00:35)ezechiel1917 Wrote: Looks nice. Is it somehow possible to overcome limitation of using only thetvdb/imdb numbers for identification of items when using json?
What about option to use also titles with combination of thetvdb/imdb numbers? It would help a lot if you use different movie/tvshow titles for different versions.
I will think of that, however implementing this feature could take a while. There is another addon hidden in the forum which has this ability:
script.watched.states version 1.1.0 from devkid (http://forum.xbmc.org/showthread.php?tid=129448&pid=1401643#pid1401643)
there you have to start the backup/restore manually

There's also the Texture Cache Maintenance utility which is a script, not an addon, so is quite easy to automate, and can also be run against remote clients (thanks to JSON). This also uses the title/year (movies) and title/episode (tv shows) to match media items when backing up/restoring. Works with both Frodo and Gotham, restoring resume points in the latter (resume points cannot be restored by the former).


RE: WatchedList - service to automatically save/restore watched state - schapplm - 2013-09-05

(2013-09-05, 02:35)MeMeMe Wrote: Very promising. Does this support multiple user profiles, each with their own database of watched programs?

This feature is not implemented in the addon. I don't know if xbmc creates the userdata/addon_data/service.watchedlist directory for each profile.
For a media pc used by several people this will be useful, but I can't test this at the moment since I have only one profile.


RE: WatchedList - service to automatically save/restore watched state - huzz456 - 2013-09-07

Hey, long shot here Smile dont suppose there could be a way to sync with a plex media server is there?


RE: WatchedList - service to automatically save/restore watched state - schapplm - 2013-09-07

(2013-09-07, 12:31)huzz456 Wrote: Hey, long shot here Smile dont suppose there could be a way to sync with a plex media server is there?
Since I don't use plex media server the the effort to implement this would be to big for me. Perhaps there are other ways of syncing such as internet-based addons like trakt.tv?
Any interested developer can take the source code however and implement this function Big Grin


RE: WatchedList - service to automatically save/restore watched state - gmc99 - 2013-09-25

I keep constantly getting an error screen which contains things like "Houston we have a problem" ..... which I guess indicates a fault of some kind.

I have debug mode on and this is what it shows:

14:04:33 T:7448 WARNING: service.watchedlist: get_watched_xbmc: xbmc tv showid 1024 is not in table xbmc-tvshows. Skipping Lark Rise to Candleford S01E01

(and repeated for each episode)

14:04:33 T:7448 WARNING: service.watchedlist: get_watched_xbmc: xbmc tv showid 1024 is not in table xbmc-tvshows. Skipping Lark Rise to Candleford S03E10
14:04:33 T:7448 WARNING: service.watchedlist: get_watched_xbmc: xbmc tv showid 1024 is not in table xbmc-tvshows. Skipping Lark Rise to Candleford S03E11
14:04:33 T:7448 WARNING: service.watchedlist: get_watched_xbmc: xbmc tv showid 1024 is not in table xbmc-tvshows. Skipping Lark Rise to Candleford S03E12
14:04:33 T:7448 ERROR: Traceback (most recent call last):
14:04:33 T:7448 ERROR: File "C:\Users\glenn\AppData\Roaming\XBMC\addons\service.watchedlist\service.py", line 102, in runProgram
14:04:33 T:7448 ERROR: self.watch_user_changes(idletime_old, idletime)
14:04:33 T:7448 ERROR: File "C:\Users\glenn\AppData\Roaming\XBMC\addons\service.watchedlist\service.py", line 753, in watch_user_changes
14:04:33 T:7448 ERROR: if (len(list_old) >= i_n) and (list_old[i_n][7] == mediaid): i_o = i_n # db did not change
14:04:33 T:7448 ERROR: IndexError: list index out of range
14:04:47 T:7460 ERROR: CLocalizeStrings::ClearBlock: Trying to clear non existent block C:\Users\glenn\AppData\Roaming\XBMC\addons\script.module.buggalo

Incidentally, I have had a look at the XBMC database and 1024 is the correct number for this series and it is present in the tvshow table.

I am using the latest version of WatchedList and have previously deleted the database and started from scratch but with no luck.

Is there anything I can do to sort this error out?

Thanks


RE: WatchedList - service to automatically save/restore watched state - schapplm - 2013-09-25

Hello and thanks for participating by giving this feedback.

(2013-09-25, 15:19)gmc99 Wrote: 14:04:33 T:7448 ERROR: if (len(list_old) >= i_n) and (list_old[i_n][7] == mediaid): i_o = i_n # db did not change
14:04:33 T:7448 ERROR: IndexError: list index out of range
I received your error reports and recently updated the addon to version 0.9.5 - which should fix the error you submitted with version 0.9.4.
I finally managed to move the addon to the Super Repository. By installing it with the repository, you don't have to worry about updates. Just follow these instructions (LINK). You may have to remove and reinstall the addon.

(2013-09-25, 15:19)gmc99 Wrote: 14:04:33 T:7448 WARNING: service.watchedlist: get_watched_xbmc: xbmc tv showid 1024 is not in table xbmc-tvshows. Skipping Lark Rise to Candleford S01E01
I don't know why xbmc does this, it could be, that the database accessed by the addon (via JSON-RPC) is different from the 'original' database you manually checked (either sqlite .db-file or mysql-database).
Try entering this in your browser (replace 61111 with the port of your xbmc web server. You may have to configure it first in xbmc settings->services):
Code:
http://localhost:61111/jsonrpc?request={"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"properties": ["title", "imdbnumber"], "sort": { "order": "ascending", "method": "title" } }, "id": 1}
If the output is different from your database, this is the reason. A more plausible explanation could be duplicate entries or wrong tvshow id value for the episdoes. I doubt that the json-db-access in xbmc has a bug.

Hope this helps Smile

EDIT (27.09.2013): The error is not fixed in version 0.9.5, but in version 0.9.6, which will be pulled to superrepo in a few days


RE: WatchedList - service to automatically save/restore watched state - gmc99 - 2013-09-26

Thanks for your help.

I've installed the Super Repository and watchedlist (following an uninstall of previous version) and will see what happens.

Best wishes

Glenn


RE: WatchedList - service to automatically save/restore watched state - gmc99 - 2013-09-28

I'm sorry but I am still getting errors:

12:18:38 T:5236 ERROR: Traceback (most recent call last):
12:18:38 T:5236 ERROR: File "C:\Users\glenn\AppData\Roaming\XBMC\addons\service.watchedlist\service.py", line 102, in runProgram
12:18:38 T:5236 ERROR: self.watch_user_changes(idletime_old, idletime)
12:18:38 T:5236 ERROR: File "C:\Users\glenn\AppData\Roaming\XBMC\addons\service.watchedlist\service.py", line 755, in watch_user_changes
12:18:38 T:5236 ERROR: if (len(list_old) >= i_n-1) and (list_old[i_n][7] == mediaid): i_o = i_n # db did not change
12:18:38 T:5236 ERROR: IndexError: list index out of range
12:37:49 T:8292 NOTICE: Thread XBPyThread start, auto delete: false
12:37:49 T:8292 NOTICE: -->Python Interpreter Initialized<--
13:04:36 T:48 NOTICE: CVideoDatabase::CleanDatabase: Cleaning videodatabase done. Operation took 51:31
13:06:42 T:48 ERROR: CLocalizeStrings::ClearBlock: Trying to clear non existent block C:\Users\glenn\AppData\Roaming\XBMC\addons\script.module.buggalo

I did manage to get rid of the Larkrise To Candleford errors I had previously listed.

They were caused by having the series split over two disks. I merged the files together in one place, copied off the whole series to a disk not included within XBMC.

I then did a database clean and following that, copied the series back.

It is now fine in XBMC and those particular errors have gone away.

I am not sure how the plugin works but it might not cope with series split into two locations.

Having said that I don't think it is related to the actual error I now have.

When the error message displayed, I did get it to send the information to you so hopefully that will contain more details.

Thanks

Glenn


RE: WatchedList - service to automatically save/restore watched state - gmc99 - 2013-10-02

I am still getting numerous errors which I have also sent to you via the addon.

14:58:31 T:9200 NOTICE: service.watchedlist: Notification. WatchedList: running observation of changes of watched states
14:58:31 T:9200 NOTICE: service.watchedlist: wait 10800 seconds until next update
14:58:31 T:9200 NOTICE: service.watchedlist: Notification. WatchedList: next update in 3 hours
14:59:01 T:9200 ERROR: Traceback (most recent call last):
14:59:01 T:9200 ERROR: File "C:\Users\glenn\AppData\Roaming\XBMC\addons\service.watchedlist\service.py", line 102, in runProgram
14:59:01 T:9200 ERROR: self.watch_user_changes(idletime_old, idletime)
14:59:01 T:9200 ERROR: File "C:\Users\glenn\AppData\Roaming\XBMC\addons\service.watchedlist\service.py", line 755, in watch_user_changes
14:59:01 T:9200 ERROR: if (len(list_old) >= i_n-1) and (list_old[i_n][7] == mediaid): i_o = i_n # db did not change
14:59:01 T:9200 ERROR: IndexError: list index out of range
15:00:06 T:4256 ERROR: CLocalizeStrings::ClearBlock: Trying to clear non existent block C:\Users\glenn\AppData\Roaming\XBMC\addons\script.module.buggalo
15:00:11 T:2712 NOTICE: Thread Jobworker start, auto delete: true
15:23:14 T:8496 NOTICE: Previous line repeats 1 times.
15:23:14 T:8496 NOTICE: Thread XBPyThread start, auto delete: false
15:23:14 T:8496 NOTICE: -->Python Interpreter Initialized<--

It is also interesting that on further investigation, the watchedlist database itself appears to be completely empty.

I have uninstalled watchedlist, deleted the appropriate userdata folder as well as the script folder.

I reinstalled the addon from the Super Repository.

Within XBMC it shows the addon running after the 5 minute startup delay but it just flashes up on the screen to indicate when it will next do a check and then after a minute or so, the error message is displayed.

Thanks

Glenn


RE: WatchedList - service to automatically save/restore watched state - gmc99 - 2013-10-04

Rather bizzarely, this has now started to work and data is being written to the database which was previously empty.

It started adding the information about 24 hours after I reinstalled the add-on.


RE: WatchedList - service to automatically save/restore watched state - pigeldi - 2014-03-28

One question: If the service works automatically, how does it know what to sync? E.g.
-The add-on saves all watched states
-I export my library, move it to a different hard drive and import it again
-All watched states are lost
-Now the add-on should sync back all watched states instead of saving all movies as unwatched in its database.

Can it do that?