Kodi Community Forum

Full Version: WatchedList - service to automatically save/restore watched state
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
(2021-01-26, 14:54)michelb2 Wrote: [ -> ]"à vif (2007).mkv"
hangs watchedlist plugin (v1.2.7)  (error report send by plugin)
ascii codec can't decode character u'xe0

edit : plugin is ok with v1.3.2 in kodi 1.90rc1

Most of the bug reports I received via email where due to character encoding, but it is not that often.
Since this is fixed in the new version for Kodi 19 (Matrix), I would leave it like this due to my limited time and wait for the next release. Sorry.
I've used WatchedList for a while now, still great but I wish it was possible for it to sync each time a machine resumes from suspend rather than a cold boot.  (in the same way a library update runs each time you resume when "Update library on startup" option is enabled in Media > Video Library.

For example, I have a few HTPCs around the house.  If I watch something in the living room and then go to bed an hour or so later, when I resume the bedroom HTPC, the episode I watched an hour ago isn't shown as watched.  If I leave the HTPC on for 3 hours or fully power off/on, eventually it'll show as watched.

Edit: Or is there even a way to manually set this to run upon resume (just adding the new changes) without performing the full manual update?
(2019-09-17, 08:06)schapplm Wrote: [ -> ]
(2019-09-15, 10:14)TCCalvin Wrote: [ -> ]Is there anyway to tie in with this?  (so each time your library updates, WatchedList syncs the watched data too).
It should be possible to trigger the update on these events. I put this on the TODO-list on github, but honestly can not say when I will have time for this.

Unfortunately still on the TODO list ...
(2021-02-04, 23:13)schapplm Wrote: [ -> ]
(2019-09-17, 08:06)schapplm Wrote: [ -> ]
(2019-09-15, 10:14)TCCalvin Wrote: [ -> ]Is there anyway to tie in with this?  (so each time your library updates, WatchedList syncs the watched data too).
It should be possible to trigger the update on these events. I put this on the TODO-list on github, but honestly can not say when I will have time for this.

Unfortunately still on the TODO list ...

No worries, it's still great.  I tried experimenting with a central DBrunning with MySQL and MariaDB again recently and they're still too slow/clunky (even running on a well specced server).  I prefer the speed and reliability of a local DB on each HTPC and without WatchedList this would be a nightmare, so cheers. Smile

Edit: one other thing I struggle with is, if I manually mark a show/episode as "unwatched", the other clients mark it back as "watched" again when they update, despite me having "follow user setting watched/unwatched" set to enabled.

Settings below:

Image

Image
(2021-02-05, 09:49)TCCalvin Wrote: [ -> ]one other thing I struggle with is, if I manually mark a show/episode as "unwatched", the other clients mark it back as "watched" again when they update, despite me having "follow user setting watched/unwatched" set to enabled.

This should not be the case. The settings look ok, though. Perhaps it is possible to debug with a detailed log of both clients.
In my tests a few years ago, it worked, but I did not use a central SMB SQLite file. This should not matter, however.
The WatchedList database contains a column `lastChange` which is dedicated to store the timestamp of the "unwatch" event.
This should only be overwritten, if the setting of "watched" on the other client is newer than setting "unwatched" on the first client.
(2021-02-02, 10:49)TCCalvin Wrote: [ -> ]For example, I have a few HTPCs around the house.  If I watch something in the living room and then go to bed an hour or so later, when I resume the bedroom HTPC, the episode I watched an hour ago isn't shown as watched.  If I leave the HTPC on for 3 hours or fully power off/on, eventually it'll show as watched.

@TCCalvin An alternative approach as you are using a local db on each device but want to sync the watched status in real-time between them you can try the add-on below:

https://github.com/watchedsyncforkodi/se...atchedsync

(This is my add-on. Currently in testing however a number of people have confirmed it works for them)
(2021-01-24, 10:10)schapplm Wrote: [ -> ]
(2021-01-09, 21:52)hans.olo Wrote: [ -> ]Error: Writing the WL-database file (2055: Lost connection to MySQL server at 'host:3306', system error: 104 Connection reset by peer)."
If this only occurs sometimes, better to just ignore it, since it does not disturb the overall result of the addon. The databases are synchronized just later.
When running the synchronization in background, this should not be an issue.
Well this happens every day and to make the sync work again I need to restart Kodi. Otherwise it will not track what has been watched.
Are you the author of the add-on? Why wouldn't the addon reconnect when the connection has broken? lets say give up after 3 unsuccessful reconnect retries..
(2021-02-11, 17:27)hans.olo Wrote: [ -> ]Well this happens every day and to make the sync work again I need to restart Kodi. Otherwise it will not track what has been watched.
Are you the author of the add-on? Why wouldn't the addon reconnect when the connection has broken? lets say give up after 3 unsuccessful reconnect retries..
Well, this is not a dedicated design decision, but seems to present an error that did not come up when testing the mySQL feature. I added an issue on GitHub. Can you be more specific? Does this happen in the mode "watch user changes", or after performing a full update of the whole database in the periodic mode?
Hello

I am trying to migrate from SQLite to MariaDB under Kodi 19 after replacing my android device to a Debian base device. I couldn't simply move my user space as one used SMB and the other has NFS mounts and so the files look local. Also the android Kodi 19 combo felt buggy so I didn't want to bring the "android Kodi 19 converted from 18 userspace" to a fresh machine.

And when I connected the two devices to the common sql server after scanning all the media WatchedList was reporting a lot less watched than what was in the .db file. I assumed it was because it started fresh.

I then decided to follow the instructions at https://kodi.wiki/view/Add-on:WatchedLis...l_database

It mostly went without an issue except for SQLite browser using the wrong quotes but except for that the imports went fine and MariaDB is reporting the right amount of information.

But now starting the WatchedList add on if giving me unlimited (one for each watched entry ie thousands) full screen errors asking me to report said errors. I reported 3/4 to help and then killed Kodi. Looking at the logs I am assuming that going from SQLite to MariaDB the column types changed. Can someone tell me what to change ?

Thank you

Here is an extract of the SQL file after the regex replaces "successfully" used:
sql:


DROP DATABASE `WatchedList`;
CREATE DATABASE `WatchedList`;
USE `WatchedList`;
CREATE TABLE IF NOT EXISTS `movie_watched` (
`idMovieImdb` INTEGER,
`playCount` INTEGER,
`lastChange` INTEGER,
`lastPlayed` INTEGER,
`title` TEXT,
PRIMARY KEY(`idMovieImdb`)
);
CREATE TABLE IF NOT EXISTS `episode_watched` (
`idShow` INTEGER,
`season` INTEGER,
`episode` INTEGER,
`playCount` INTEGER,
`lastChange` INTEGER,
`lastPlayed` INTEGER,
PRIMARY KEY(`idShow`,`season`,`episode`)
);
CREATE TABLE IF NOT EXISTS `tvshows` (
`idShow` INTEGER,
`title` TEXT,
PRIMARY KEY(`idShow`)
);
INSERT IGNORE INTO `movie_watched` VALUES (50083,1,FROM_UNIXTIME(1609621468),FROM_UNIXTIME(1609621312),'12 Angry Men (1957)');
INSERT IGNORE INTO `episode_watched` VALUES (152831,5,1,1,FROM_UNIXTIME(1616169501),FROM_UNIXTIME(1616167865));
INSERT INTO `tvshows` VALUES (386465,'Red Dwarf: The First Three Million Years');
COMMIT;

Here are the logs:
kodi.log
(2021-03-20, 20:19)samsquanche Wrote: [ -> ]Hello

I am trying to migrate from SQLite to MariaDB under Kodi 19 after replacing my android device to a Debian base device. I couldn't simply move my user space as one used SMB and the other has NFS mounts and so the files look local. Also the android Kodi 19 combo felt buggy so I didn't want to bring the "android Kodi 19 converted from 18 userspace" to a fresh machine.
...
I looked at the source code at https://github.com/SchapplM/xbmc-addon-s...hedlist.py and am now trying with this SQL:
sql:


DROP DATABASE `WatchedList`;
CREATE DATABASE `WatchedList`;
USE `WatchedList`;
CREATE TABLE IF NOT EXISTS `movie_watched` (
`idMovieImdb` int unsigned NOT NULL,
`playCount` tinyint unsigned DEFAULT NULL,
`lastChange` timestamp NULL DEFAULT NULL,
`lastPlayed` timestamp NULL DEFAULT NULL,
`title` text,
PRIMARY KEY (`idMovieImdb`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `episode_watched` (
`idShow` int unsigned NOT NULL DEFAULT '0',
`season` smallint unsigned NOT NULL DEFAULT '0',
`episode` smallint unsigned NOT NULL DEFAULT '0',
`playCount` tinyint unsigned DEFAULT NULL,
`lastChange` timestamp NULL DEFAULT NULL,
`lastPlayed` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`idShow`,`season`,`episode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tvshows` (
`idShow` int unsigned NOT NULL,
`title` text,
PRIMARY KEY (`idShow`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

It will take a while before I can post an update as there are many steps involved...
(2021-03-20, 20:32)samsquanche Wrote: [ -> ]
(2021-03-20, 20:19)samsquanche Wrote: [ -> ] 
I looked at the source code at https://github.com/SchapplM/xbmc-addon-s...hedlist.py and am now trying with this SQL:

That did it. I suggest you add something to the instruction page.
Hello Again.

So now that I got this sorted out I have now found a new Issue: under Kodi 19 the default scraper is "The Movie Database Python" and it seams to save the movie ID differently and WatchedList in (self.get_watched_xbmc()) sees no imdb-number. See attached log.

Basically the Add-On from a user perspective sees no movies.

What can I do ?

kodi.log
Hello Again.

Changing the scraper from "The Movie Database Python" to "The Movie Database" fixed the issues.

Cheers
(2021-03-21, 00:10)samsquanche Wrote: [ -> ]Changing the scraper from "The Movie Database Python" to "The Movie Database" fixed the issues.

Great. Handling the media id is not completely working in my addon, since depending on the scraper, a different id is stored in a different way.
This seems to be more an issue with tv shows.
(2021-03-20, 21:24)samsquanche Wrote: [ -> ]That did it. I suggest you add something to the instruction page.

Since I do not use MariaDB myself, I rather do not add something in that matter myself.
You can feel free to edit the wiki. Perhaps add a section "MariaDB" after the current " 2.4.1 MySQL" and add a section "Manually create the MariaDB database" after the current "2.4.3 Conversion from SQLite database to mysql database".
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