Req Profile specific bookmarks
#1
Hey guys, I hope the headline is descriptive enough Big Grin
But of course I'll explain what I mean Wink

I have 3 xbmc setups for two different users that looks the same movies / tv series. We love the bookmark feature - sitting in the living room "oh I'm getting tired, but no problem, I'll watch the rest from bed., xbmc ftw".
But it gets annoying when user 2 'destroys' users 1 bookmarks.
Means: User1 watched a movie until 30 minutes and then pause until the next day. Later on the same day user2 watches the same movie up to the 50th Minute. The next day User1 wants to continue watching from minute 30 - but his bookmark is gone.

It would be cool if there was an setting for profiles that enables/disables to share bookmarks with other profiles. Also it would be cool to not allow profiles of the same name (even if the user directory differs), at least for a MySQL setup.

Currently I'm trying to programm it on my own but until now I did not found the right place for it in the sourcecode - I'll check that at the weekend.
I've created a column 'user' in the table bookmark and edited all select/update/insert calls to the bookmark table in videodatabase.cpp with some where statements etc but this isn't enough. Maybe you have some hints for me where to look.

Best regards bakslash Smile

[EDIT]
Of course I could use two databases. But that's kinda an ugly solution.
After some research I found this thread. But it leads to sql triggers which clones the database without the boomarks.
That is indeed possible but it's kinda hacky and waste of space.
Reply
#2
UPDATE
I use this with Frodo 12.2 - I do not know if this will run on future versions.

I have a really simple SQL workaround that consider the sql login. That means you need to have more than one login to your SQL-Server (e.g. xbmc1, xbmc2, ..., xbmcN).
You can have now profiles with different resume bookmarks.
For "real" Bookmark this will not work, but the resume bookmarks are now divided by SQL login. I think this is pretty cool! Cool (Although it was solved with triggers)

Thanks to Kib for giving me some input Smile

*removed old code*

Always newest code is on my github repo
Reply
#3
Hi will this keep separate watched status as well? or just resume bookmarks?
Reply
#4
(2014-04-04, 18:54)dtdickman Wrote: Hi will this keep separate watched status as well? or just resume bookmarks?

Short answer: Yep Big Grin
Reply
#5
Awesome! This is exactly what I was looking for. I ran the script against my MyVideos75 db and it returned an error. Any ideas?

SQL query: Documentation

/* Trigger der den Playcount etc überträgt
*/
DELIMITER |
DROP TRIGGER IF EXISTS `bu_files`;
CREATE TRIGGER `bu_files` BEFORE UPDATE ON `files`
FOR EACH ROW BEGIN
DELETE FROM filestate WHERE filestate.idFile = new.idFile AND filestate.sqlUser = SUBSTRING_INDEX(USER(),'@',1);
INSERT INTO filestate (idFile, lastPlayed, playCount, sqlUser) VALUES(new.idFile, new.lastPlayed, new.playCount, SUBSTRING_INDEX(USER(),'@',1));
END;

/* Erzeugt die movieview neu.
* Enthält auch Änderungen für die RESUME bookmarks
*/
DROP VIEW IF EXISTS `movieview`;
CREATE VIEW `movieview` AS
SELECT movie.*, sets.strSet AS strSet, files.strFileName AS strFileName, path.strPath AS strPath,
filestate.playCount AS playCount, filestate.lastPlayed AS lastPlayed, files.dateAdded AS dateAdded,
bookmark_orig.timeInSeconds AS resumeTimeInSeconds, bookmark_orig.totalTimeInSeconds AS totalTimeInSeconds
FROM movie
LEFT JOIN sets ON sets.idSet = movie.idSet
[...]

MySQL said: Documentation

#1064 - 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 'CREATE TRIGGER `bu_files` BEFORE UPDATE ON `files`
FOR EACH ROW BEGIN
DELE' at line 3
Reply
#6
Please use HeidiSQL. HeidiSQL works under Windows and Linux with Wine (prolly even under osx)
Reply
#7
Hello,

Did you already try to update to XBMC v13 (Gotham)?

Tim
Reply
#8
Hi DJTim.
It is not possible to update to version 13. But it works with version 13. So you can delete your database, let XBMC create the new database and reinstall the script.
It isn't too much effort to backup your bookmarks etc and reinsert them - I'm currently working on a script that does that for you.
Reply
#9
Can this be used on a existing database installation or do I still need to start from scratch?
Running Gotham with a shared database installed on my Synology NAS which is using mysql/mariadb.
Reply
#10
(2014-06-01, 15:46)schumi2004 Wrote: Can this be used on a existing database installation or do I still need to start from scratch?
Running Gotham with a shared database installed on my Synology NAS which is using mysql/mariadb.

You can use this on an existing database.

Just backup your database before using the hack.

Code:
mysqldump -u root -p MyVideos75 > backup.sql
Reply
#11
(2014-06-01, 17:44)bakslash Wrote:
(2014-06-01, 15:46)schumi2004 Wrote: Can this be used on a existing database installation or do I still need to start from scratch?
Running Gotham with a shared database installed on my Synology NAS which is using mysql/mariadb.

You can use this on an existing database.

Just backup your database before using the hack.

Code:
mysqldump -u root -p MyVideos75 > backup.sql

Okay thanks.
1 question left.
Is your method different then from bohdans mentioned here?

If I'm not allowed to update database with User1 then I need to find a way to prevent automatic database update triggers being launched (third party apps) when User1 is logged on.
Reply
#12
Yep, it's a complete different approach.
My method use a single database. Bohdans method uses two database. According to my experience bohdans method won't work in any case since it used named databases, see here: http://wiki.xbmc.org/index.php?title=MyS...C#Name_tag

"The <name> tag is not required and it is recommended to not include it, as some users have reported problems/bugs when it was included"
Reply
#13
(2014-06-01, 23:31)bakslash Wrote: Yep, it's a complete different approach.
My method use a single database. Bohdans method uses two database. According to my experience bohdans method won't work in any case since it used named databases, see here: http://wiki.xbmc.org/index.php?title=MyS...C#Name_tag

"The <name> tag is not required and it is recommended to not include it, as some users have reported problems/bugs when it was included"
Thanks for explaining. I have read about the name tag also that it doesn't work, had some bad experience with it myself when I tried to use it with Eden.
I'll try your method tomorrow.
Reply
#14
@bakslash

Do you know a method to test code before executing it?
Synology runs MariaDB and i'm unable to run HeidiSQL

/edit
I ran it against a old database but MariaDB is giving issues like mentioned before.

Code:
Error
SQL query: Documentation


DROP VIEW IF EXISTS `artistview`
CREATE VIEW `artistview` AS
    SELECT DISTINCT  
        artist.idArtist AS idArtist, strArtist,   strBorn, strFormed, artistinfo.strGenres,  
        artistinfo.strMoods, artistinfo.strStyles, strInstruments,   strBiography, strDied, strDisbanded,  
        strYearsActive, artistinfo.strImage, strFanart
    FROM artist  
    LEFT OUTER JOIN artistinfo ON    artist.idArtist = artistinfo.idArtist
    JOIN album ON album.strArtists = artist.strArtist
MySQL said: Documentation

#1064 - 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 'CREATE VIEW `artistview` AS
    SELECT DISTINCT  
        artist.idArtist AS idArtist, ' at line 2

/edit:
I added code by removing all spaces and MariaDB still doesn't like it
Code:
#1064 - 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 'CREATE VIEW `artistview` AS
SELECT DISTINCT  
artist.idArtist AS idArtist,strA' at line 2

Any other way to accomplish same behaviour?
Reply
#15
After some trouble shooting with @bakslash the issues seems to be a filled database.
To get this perfectly working i removed my databases and let XBMC create them again (empty)!
Since my DB is installed on a Synology i downloaded HeidiSQL (portable if wanted) on my Windows machine and applied mod/patch.
Don't care about the warnings.
Then rescan your media and if you were smart in the beginning TraktTV addon will update your watched statuses again Wink

Voila, project done.

In my case i needed to get the current watched statuses for profile1 to be the same as master so i re-enabled TrakTV addon for profile1 until it was synched and then disabled it.
Reply



Logout Mark Read Team Forum Stats Members Help
Profile specific bookmarks0
This forum uses Lukasz Tkacz MyBB addons.