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
@Karellen 
Thanks for the testing.

- Good to see, that there seem to be no crashes at all. Had the same experience.

Regarding 1)
- TV Shows:
A effective "TV shows" syncing with monitoring is just not a part of service.watchedlist until now. The addon originally focuses only on movies+episodes with it's original functionality.
All expansions i made are based on existing functionality.
I'd love complete inclusion of Tv shows, too, but that's out of scope atm i think. So we'll have to ignore this point for now. The code is just not there at all.
Other stuff:
- Maybe some statements still have to be changed to catch some more situations.
I'll have a look into recreating the exact test scenario(s).
My own test scenarios i made on a Kodi 19 test system today all did result in expected ways (also did some checks with a sql browser)
But i did not test your exact scenario yet so that's what's next.

Regarding 2)
Yes. That's correct. I did not change any log code lines yet. Wanted to see first if it's even worth all the extra work. But: good catch. :-)

Regarding 3)
There is no added process for a scan. All routines are basically the same that existed in the past, just with the extra field for "userrating"


More at a later point. Good work, thanks again! Smile
Running the add-on after update from 1.3.5 returns an error, nothing is done. From the log, the addon fails to create the new table in the database (MySQL/Mariadb):
python:
2022-04-16 09:53:09.669 T:3740 INFO <general>: service.watchedlist: Update Library Manual Run.
2022-04-16 09:53:09.714 T:3740 INFO <general>: service.watchedlist: database_backup: database backup copy created to C:\Users\JPS\AppData\Roaming\Kodi\userdata\addon_data\service.watchedlist\20220416_095309-watchedlist.db.zip
2022-04-16 09:53:09.714 T:3740 ERROR <general>: service.watchedlist: sync_tvshows: SQLite Database error accessing the wl database: no such column: userrating
2022-04-16 09:53:09.714 T:3740 INFO <general>: service.watchedlist: Notification. Watchedlist: Error: Error updating WL database

After adding the missing columns manually to the db, there's still a query error:

python:
2022-04-16 10:35:31.094 T:1752 INFO <general>: service.watchedlist: Update Library Manual Run.
2022-04-16 10:35:31.148 T:1752 ERROR <general>: service.watchedlist: get_watched_wl: MySQL Database error getting the wl database. 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM `movie_watched` ORDER BY `title`' at line 1
2022-04-16 10:35:31.148 T:1752 INFO <general>: service.watchedlist: Notification. Watchedlist: Error: Error loading WL-database
@HeresJohnny 
Thanks for the info. Hard to comment on if the columns have been added manually.

1) What are the results when starting without any old addon data for the addon?
2) What DB type do you use? Standard SQLite DB file?
Kodi blocks me from posting something useful here, so find it at https://paste.kodi.tv/xaxaqixefa
(2022-04-17, 19:35)HeresJohnny Wrote: [ -> ]Kodi blocks me from posting something useful here

Not Kodi, but Cloudflare can be real protective about possible SQL injection queries.
Thanks. So it's an issue using a MySQL server. I'll see if i can set up a test MySQL server to test the corrected queries.
SQLite (standard config) should be fine.


Edit:

New versions here with corrected MySQL queries:
DOWNLOAD: watchedlist/dev/

On a fresh install i had no issues with using a MySQL test server. (Quick tests only)

@HeresJohnny
Thanks for the update but still no go. The test case needs to be creating the DB with 1.3.5 and then update the add-on and see what happens.
Good Day, I am still not having any luck on CoreElec 19.5 rc1. watchlist keeps on crashing. Anyone have any advice as to what is going on this has been like this for me since 19.x on my N2. SQL is on my NAS i had to create the DB so not sure what is going on.
(2021-08-01, 22:53)schapplm Wrote: [ -> ]There now is a patch on github created by fabquenneville.
Can someone who encounters the problem test this? You can either download the code via zip file or via Git. The code is based on the Kodi 19 version of the addon.
In my test case of time zone UTC+2 (Europe) the result was still unclear.

Is there any update on mysql time errors since August 2021? (Error: Writing the WL-database file (1292 (22007): Incorrect datetime value)  I recently upgraded my MariaDB installation from 5 to 10, and that seems to be when my database errors started. Attempting to mark a watched episode as unread results in an error. Since I'm in UTC-5, it tries to set the time to 1969-12-31 19:00:00 which is naturally invalid. I saw the proposed fix for bug 28 as well as the reasons not to use the PR. Since I've been unable to mark the episodes as unread in Kodi, I wound up going to each install in the house, marking the entire series unwatched, then closing Kodi before the watchedlist service could re-mark it as watched. Then I opened the database in phpMyAdmin and searched for the affected idShow. I deleted entries for the episodes I wanted to mark unwatched, then restarted Kodi and manually ran the addon. At the end, all 3 Kodi servers are back to the unwatched state I want.

I don't often want to unwatch an episode or entire series, but when I do it would be a lot more convenient if the add-on could handle this instead of directly manipulating the database.
I came across the same error, MariaDB 10.8.3 here. When setting an episode to "unwatched", the addon wants to reset the time of "lastPlayed" near the minimum supported value, in my case was [1970-01-01 01:00:00]. I am guessing that summertime or time zones in general are messing with the time conversion formula so it tries to reset the field to [1970-01-01 00:00:00] outside the supported value (minimum is [1970-01-01 00:00:01]). The proposed fix referenced above might or might not work but there is a "lazy" fix which in my tests makes the add-on work as expected. Simply set the database fields from TIMESTAMP to DATETIME type. Both datatypes use the same time format so no conversion or other database changes should be necessary and DATETIME can be any given value and thus doesn't trigger the error.
This is exactly what I am looking to do tonight. After hours of work, I have the Kodi database working on my new Snap NAS with MariaDB10. I have my Watchedlist.db running on a MyCloud Ultra. I can view it with the built-in phpMyadmin. Three tables, Episode_Watched, Movie_Watched and TVShows.

I want to migrate it to my new NAS and into MariaDB10.

What would be a clean and easy as possible means of doing that; or is it not that simple from the discourse I am seeing on it.
Tonight I created a WatchedList database with Collation utf8_general-ci.

I then pointed Kodi WatchedList add-on to the database and it seems to have populated the database on my new NAS MariaDB10.

However, the structure is different.

On my SQL setup, under the WatchedList database there is subfolders:

New
episode_watched, with columns and indexes
movie_watched, with columns and indexes
tvshows, with columns and indexes

On my new MariaDB10 there are none of these subfolders. When I click on the WatchedList database, to the right is Table:
episode_watched
movie_watched
tvshows. 

The row counts are not the same, but close.

Did I do it wrong or does MariaDB10 handle the WatchedList structure differently than SQL?
Update. Ok everything was as I descripted last night. 

This morning I login and now the subfolders have been created and the DB structure looks the same as the one on my old WD NAS. Maybe someone can explain how that could be?

Does the subfolder structure build itself with a bit more time?
It would be great if this add-on could be updated to work with Kodi N.
Hi,

awesome addon, I've used it for a while without issue. But just lately after my shield started giving me grief and a few kodi version swaps, I have found that there are movies and tv shows that I have definitely marked watched previously that seem to have fallen off the list.  Unfortunately, i don't have any concise info to share to better understand what may have happened.

But I have a couple of questions that may sound stupid but I'm just trying to rule out the addon may be doing something that i didn't think of or expect.

Is each watchedlist.db file a complete list at the time it was created?  I presume the latest db file is used to create the new file each time the addon is run and the older db files are purely backups, is this correct? If i remove videos from the kodi database, does their watched state remain forever in all the new watchedlist.db files? I am just guessing there are no checks that will later remove any video files from the watched list, timed or scan count etc?

Potentially my issue may be related to trialing multiple kodi versions from v17 to  v19 and the db has been corrupted .??!? I don't know.

thanks in advance for any help given.
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