Kodi Community Forum

Full Version: Play log and time
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Currently, I use MySQL server as a central DB for sharing info to all clients within the subnet.
Just wondering if there a way to log which movies has been played and from which IP address?
Also log how long the client use XBMC to play movies if possible?
You can do this with an add-on. For example my playerlog addon.

This add on will log when a file was started, when paused, when resumed and when stopped to MySQL. I have only done a little testing with Music and Video. I have not tested this with Live TV, but that may as well work depending on the info that XBMC provides.
There is a difference between playing files and playing from the library. When playing files, the title is not available, only the filename is a available.

It's still an early version but it seems to work. You can adapt it as needed.

The add-on only logs the data to MySQL. Further big data processing is up to you Smile
Cool! It works perfectly. Thanks.
Sometimes the program stops logging when onPlayBackEnded is not sent to MySQL server when the movie is finished. If this is the case, the playerlog progam won't send logs to MySQL server afterward even a new movie is played. I need to restart XBMC for it to work again. Actually I don't know when it was happened. Any logs to check? And also, how to enable the program to support UNICODE characters?

Sample Log
=========
nfs://192.168.1.10/home/dev/Movies/Huh/The.Lone.Ranger.2013.1080p.BluRay.DTS.x264-PublicHD.dp.mkv

It can't insert UNICODE(UTF-8) record into MySQL. I have already set Collation to UTF8_general_ci for the database playerlog on MySQL.
I guess the MySQL connection times out after a while. I have updated the code so that it now opens and closes the connection on each insert into the database. Also, I'm now forcing the cursor to UTF-8 which will hopefully fix your UTF-8 problem. I could not really test that.
The add-on logs to the normal xbmc log file (~/.xbmc/temp/xbmc.log). All log entries from the add-on are prefixed by 'service.playerlog'.
You can find the v0.1.1 version here.
I have tried for a few days and it seems like the problem of missing logs is solved.
But still it can't log UTF-8 characters to MySQL.
Ok, one problem solved Smile

Regarding the UTF-8 characters. If an entry contains a UTF-8 character, does the entry appear in the database with the UTF-8 character replaced by a question mark, like:

Code:
| 181 | 2014-06-11 22:44:09 | marcel-VPCF11M1E | Alice       | onPlayBackStarted() | /mnt/multimedia/music/lossless/test_?_test/10-creed-wash_away_those_years.flac

In the above example is, I stored the file in a directory called test_<omega character>_test and the omega character gets replaced by a '?' in MySQL.

Or are they not logged at all?
Update available here. This seems to fix the UTF-8 issue. I can see the omega character in the database now.
Yup it's now working fine. Thank you!
Cool Smile Thanks for your confirmation!