Kodi Community Forum
Mysql profiles and watched status - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: Mysql profiles and watched status (/showthread.php?tid=81095)

Pages: 1 2 3 4 5 6 7 8


RE: Mysql profiles and watched status - jmh2002 - 2016-09-17

Great, but since you have quoted me, how does that answer my question?


RE: Mysql profiles and watched status - gaxander - 2016-09-17

I'm still using kodi, with all his addons, plus emby as addon
server: ubuntu + emby + NFS
clients: RPi+openelec+emby (nativeplayback mode)


RE: Mysql profiles and watched status - jmh2002 - 2016-09-17

And?

My question was if Emby has been updated so that it can sync watched (and hopefully resume) status between multiple devices for streaming videos played via an addon such as YouTube, PBS, Vimeo, HGTV, DIY Network, GQ, etc, etc, etc?

If the answer is still 'no' (yes I have tested Emby in the past) then this is a major point which makes mySQL more suitable (for me) over Emby.


RE: Mysql profiles and watched status - Ned Scott - 2016-09-18

(2016-09-17, 15:08)jmh2002 Wrote: And?

My question was if Emby has been updated so that it can sync watched (and hopefully resume) status between multiple devices for streaming videos played via an addon such as YouTube, PBS, Vimeo, HGTV, DIY Network, GQ, etc, etc, etc?

If the answer is still 'no' (yes I have tested Emby in the past) then this is a major point which makes mySQL more suitable (for me) over Emby.

No. Emby only syncs up library items and not the full SQLite database.


RE: Mysql profiles and watched status - jmh2002 - 2016-09-18

Thanks Ned. No sense for me to test Emby again if it still doesn't do this.


Mysql profiles and watched status - angelblue05 - 2016-09-21

It's an Emby for Kodi add-on, meaning anything that is not from Emby will never be looked at by the add-on.

The only way to track Kodi content in some way is for example, creating a strm library that contains plugin paths to your legal Kodi add-ons streams, and importing those strm files into Emby. The addon will then import them into your Kodi library. And you'll be able to save the watch status in Emby and share the same strm library to your other Kodi devices.

I've done that for a while with netflixbmc. As long as the plugin (let's say netflixbmc) is installed on Kodi, when you launch the strm file entries, it will launch the proper Kodi add-on and the Emby add-on will track the watched status (not resume point, which is the only set back since Emby has no runtime for the item, a resume point can't be created). It's a different way of doing things, bonus is those strm files are treated like videos in Emby so you are able to assign metadata and artwork in the same process.


Sent from my iPhone


RE: Mysql profiles and watched status - heatl0rd - 2017-07-23

I know this is being necro'ed but has anyone found a solution that isnt dependant on version and can dynamically update? Unfortunately not interested in Emby because it dosnt support archived videos.

is using sql triggers the only solution here?


RE: Mysql profiles and watched status - ramonrue - 2018-06-18

Okay, so for anyone in need for this as well and using Kodi 18:
I updated the script to work with the new database format.
https://pastebin.com/93Wix9Ke

Just replace the string `NewUser` with your username, and let it run.


RE: Mysql profiles and watched status - AplDrm - 2018-08-06

(2018-06-18, 07:37)ramonrue Wrote: Okay, so for anyone in need for this as well and using Kodi 18:
I updated the script to work with the new database format.
https://pastebin.com/93Wix9Ke

Just replace the string `NewUser` with your username, and let it run.
 It only worked for me when I adapted the script to specify the algorithm in creation of all views. This might be needed for some folks using MySQL (I'm running 5.7.23-0 on Ubuntu 18.04). I had to search/replace as following:

Search: CREATE VIEW
Replace with: CREATE ALGORITHM=MERGE VIEW

Search: CREATE OR REPLACE VIEW
Replace with: CREATE OR REPLACE ALGORITHM=MERGE VIEW

Without that change, updating library in Kodi failed, many errors related to database operation in kodi.log, for example:

19:28:50.737 T:21912   ERROR: SQL: [MyVideos110] Undefined MySQL error: Code (1288)
                                            Query: UPDATE files SET dateAdded='2018-07-31 14:26:10' WHERE idFile=1
19:28:54.816 T:21912   ERROR: SQL: [MyVideos110] Undefined MySQL error: Code (1471)
                                            Query: insert into files (idFile, idPath, strFileName) values(NULL, 4, 'somefilename.mkv')

Reason turned out to be: Kodi could not write the into database tables that are accessed through the views. However, manually running these queries in PHPMyAdmin works just fine, with same database and user credentials.  Specifying algorithm in the view creation fixes this.

This thread is describing the same issue:
https://forum.kodi.tv/showthread.php?tid=196821&pid=2458307#pid2458307

More info on MySQL forum:
https://forums.mysql.com/read.php?10,247027,247869#msg-247869
https://dev.mysql.com/doc/refman/8.0/en/view-updatability.html

Updated script: https://pastebin.com/J6exZXVt


RE: Mysql profiles and watched status - ispeaknousa - 2020-01-03

Hello,
Here's yet another update of the script.
For who stumbles upon this message, this allows having a single media repository for multiple Kodi profiles (and clients for that matter), but with separate watch statuses among profiles.

Changes from the previous script:
- database name is now "MyVideos116" instead of "MyVideos110" (to be compatible with Kodi 18.5);
- updated the "files" table logic to also support different "watched" statuses across profiles (instead of only timestamps used for resuming playback).

The database must be handled before creating the new profile in Kodi.
Here are the steps:
1. take this script: https://paste.kodi.tv/upivadokof (mirror: https://pastebin.com/n1ZgLWpv);
2. replace "XXX" with the name of the new profile;
3. run the modified script;
4. create the new profile in Kodi with:
4.1. the name specified at 2.;
4.2. Media info > Separate;
4.2. Media sources > Shares with default (read only).

I repeat: this script is to be run before creating the profiles in Kodi.
The process can be repeated for as many profiles as you need (I'm using it for 7 people / profiles spread across 10 devices).

Happy New Year! Smile


RE: Mysql profiles and watched status - ispeaknousa - 2020-01-03

(2020-01-03, 22:41)ispeaknousa Wrote: Hello,
Here's yet another update of the script.
For who stumbles upon this message, this allows having a single media repository for multiple Kodi profiles (and clients for that matter), but with separate watch statuses among profiles.

Changes from the previous script:
- database name is now "MyVideos116" instead of "MyVideos110" (to be compatible with Kodi 18.5);
- updated the "files" table logic to also support different "watched" statuses across profiles (instead of only timestamps used for resuming playback).

The database must be handled before creating the new profile in Kodi.
Here are the steps:
1. take this script: https://paste.kodi.tv/upivadokof (mirror: https://pastebin.com/n1ZgLWpv);
2. replace "XXX" with the name of the new profile;
3. run the modified script;
4. create the new profile in Kodi with:
4.1. the name specified at 2.;
4.2. Media info > Separate;
4.2. Media sources > Shares with default (read only).

I repeat: this script is to be run before creating the profiles in Kodi.
The process can be repeated for as many profiles as you need (I'm using it for 7 people / profiles spread across 10 devices).

Happy New Year! Smile
(sorry for double post, I can't edit my message)

Actually not needed to have the same profile name as the database name, but instead have the corresponding advancedsettings.xml -> <videodatabase><name/><videodatabase/> tag match the database name. 

For example, the advancedsettings.xml for a profile called John Doe could look like this:
xml:
<advancedsettings>
  <videodatabase>
    <name>John</name>
    <type>mysql</type>
    <host>MYSQL_HOST</host>
    <port>MYSQL_PORT</port>
    <user>MYSQL_KODI_USER</user>
    <pass>MYSQL_KODI_PASS</pass>
  </videodatabase>
  <videolibrary>
    <importwatchedstate>true</importwatchedstate>
    <importresumepoint>true</importresumepoint>
  </videolibrary>
</advancedsettings>
in which case the XXX from the previous post would be replaced by John.