Release - WatchedList - service to automatically save/restore watched state

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
schapplm Offline
Junior Member
Posts: 28
Joined: Apr 2013
Reputation: 0
Brick  WatchedList - service to automatically save/restore watched state
Post: #1
I know this topic has been discussed by quite a few Threads and addons.
As there is no working solution available for Frodo (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.
Project page with zip-download:
http://code.google.com/p/xbmc-addon-serv...loads/list
Wiki-Page with installation manual:
http://code.google.com/p/xbmc-addon-serv...dListHowTo

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


Screenshots:
the script only communicates with notifications. More pictures in the wiki.
[Image: service_watchedlist_doc_notification_start.png][Image: service_watchedlist_doc_notification_set...pisode.png]

Participation
This addon was only tested under Frodo 12.1 on two clients. Feedback would be great:
http://code.google.com/p/xbmc-addon-serv...ssues/list
If this works I plan to add it to the official repository.

My addon: service.watchedlist
My HTPC: XBMC 13.2; Ubuntu 14.04 LTS x64; AMD A6-6400K; MSI FM2-A55M-E33; 4GB Kingston HyperX RAM; Digital Devices Cine CT V6 DVB-C; Streacom FC8B Evo with 120W picoPSU
find quote
ezechiel1917 Offline
Aeon Group
Posts: 730
Joined: Jun 2005
Location: Czech Republic
Post: #2
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.

XBMCbuntu 13.0 | XBMC PRE-14.0 | VDR + VNSI @ Technotrend CT-3650 CI | Transparency! skin | trakt.tv
find quote
schapplm Offline
Junior Member
Posts: 28
Joined: Apr 2013
Reputation: 0
Post: #3
(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...pid1401643)
there you have to start the backup/restore manually

My addon: service.watchedlist
My HTPC: XBMC 13.2; Ubuntu 14.04 LTS x64; AMD A6-6400K; MSI FM2-A55M-E33; 4GB Kingston HyperX RAM; Digital Devices Cine CT V6 DVB-C; Streacom FC8B Evo with 120W picoPSU
find quote
MeMeMe Offline
Senior Member
Posts: 171
Joined: Sep 2011
Reputation: 5
Post: #4
Very promising. Does this support multiple user profiles, each with their own database of watched programs?
find quote
Milhouse Online
Team-Kodi Member
Posts: 3,820
Joined: Jan 2011
Reputation: 89
Post: #5
(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...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).

Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
find quote
schapplm Offline
Junior Member
Posts: 28
Joined: Apr 2013
Reputation: 0
Post: #6
(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.

My addon: service.watchedlist
My HTPC: XBMC 13.2; Ubuntu 14.04 LTS x64; AMD A6-6400K; MSI FM2-A55M-E33; 4GB Kingston HyperX RAM; Digital Devices Cine CT V6 DVB-C; Streacom FC8B Evo with 120W picoPSU
find quote
huzz456 Offline
Senior Member
Posts: 113
Joined: Dec 2012
Reputation: 0
Post: #7
Hey, long shot here Smile dont suppose there could be a way to sync with a plex media server is there?
find quote
schapplm Offline
Junior Member
Posts: 28
Joined: Apr 2013
Reputation: 0
Post: #8
(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

My addon: service.watchedlist
My HTPC: XBMC 13.2; Ubuntu 14.04 LTS x64; AMD A6-6400K; MSI FM2-A55M-E33; 4GB Kingston HyperX RAM; Digital Devices Cine CT V6 DVB-C; Streacom FC8B Evo with 120W picoPSU
find quote
gmc99 Offline
Member
Posts: 56
Joined: Nov 2011
Reputation: 2
Post: #9
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
find quote
schapplm Offline
Junior Member
Posts: 28
Joined: Apr 2013
Reputation: 0
Post: #10
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

My addon: service.watchedlist
My HTPC: XBMC 13.2; Ubuntu 14.04 LTS x64; AMD A6-6400K; MSI FM2-A55M-E33; 4GB Kingston HyperX RAM; Digital Devices Cine CT V6 DVB-C; Streacom FC8B Evo with 120W picoPSU
(This post was last modified: 2013-09-27 17:47 by schapplm.)
find quote
gmc99 Offline
Member
Posts: 56
Joined: Nov 2011
Reputation: 2
Post: #11
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
find quote
gmc99 Offline
Member
Posts: 56
Joined: Nov 2011
Reputation: 2
Post: #12
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
find quote
gmc99 Offline
Member
Posts: 56
Joined: Nov 2011
Reputation: 2
Post: #13
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
find quote
gmc99 Offline
Member
Posts: 56
Joined: Nov 2011
Reputation: 2
Post: #14
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.
find quote
pigeldi Offline
Member
Posts: 98
Joined: Sep 2010
Reputation: 0
Post: #15
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?
find quote
Post Reply