KODI/RaspberryPi video module
novoid opened this issue · 11 comments
I'd like to have a tool for KODI/RaspberryPi which logs the names of the video files and the start+end time-stamp of playback to Memacs.
I would love such a feature and I looked a bit into this. I did not find any log file or anything similar which included information about the playback. However there are ways to ask Kodi while it is running for its playback status, so one would be able to create a simple daemon which would run on the computer on which Kodi is running and periodically (like every second) ask for the current status and log it to some file. However this daemon would be very different from the rest of the Memacs modules ( as it would have to run all the time).
I therefore would suggest to implement such a tool separate from Memacs (best way would be to write a Kodi addon) and then use Memacs' csv module to read in the output of this tool.
I also looked whether or not I could extract played files from any log and did not find any. You rationale is perfectly understandable. My KODI runs on LibreELEC GNU/Linux. Maybe someone volunteers for this so that we can link this separate repository.
I played a bit with it and got to work a very simple addon which just logs all starts, pauses and ends of any media played with title, artist, filename etc.
Do you want any other information?
Possible would be:
- current position in the movie/audio track
- when ended (duration since started)
I'm open for other ideas
I, personally, am interested in Org mode entries like:
** <2018-09-29 Sat 16:46-18:58> 2009 Avatar -- english.avi
for any video (start/end time + file name)
From your comment above, I do assume that your end result consists of multiple separate Org mode headings for one movie, correct?
I did not make up my mind whether or not I am interested in audio logs as well.
Yes multiple sperate Org mode headings would be the easiest solution. But I agree with you that a time range in Org would be nice. I would appreciate your advice on two points:
- How to deal with breaks in which the move is paused. Maybe use a minimum duration for breaks.
- Should this complexity ( compute start and end and determine breaks) be inside the Kodi addon? Then one could just use the Memacs csv module to read in the data. The other alternative would be to keep the Kodi addon simple and stupid and let it log all the events and then create a dedicated Memacs module for importing the Kodi data.
Finally video or audio logs are nearly the same (only the metadata is different), so I will include both but obviously the user can toggle both on or off.
Good question on "put complexity in KODI or CSV part". I don't have a strong opinion on that. With simplephonelogs I had a similar issue but the answer was quite easy to find: either put login into Tasker (hard to code/maintain) or into the Memacs module (much easier to do). With KODI, it's a different story. Probably I'd choose Python/Memacs just because I do feel more comfortable compared to the KODI environment.
Breaks: my approach would be: if the pause is less than 15(?) minutes, ignore it and handle it like no pause happened.
Audio/video: I'd love to see different settings (artist, file name, ...) because with music I actually would prefer more meta-data in contrast to movies where the only meta-data that makes sense is the file name on my setup. However, I can't tell whether KODI tries to get more meta-data (potential wrong ones) from the web or if the files contain more meta-data which I don't care.
I chose the Simple stupid Addon solution:
Here is a prototype.
You can download the zip file and install it in Kodi. In the settings you have to provide a folder in which to save the logs. Video and Audio logs are separated.
Currently it saves
- Timestamp
- event (play|pause|resume|stop)
- time point in track
- total time of track
- filename
- title
plus in the audio case
- Artist
- Album
and in the video case
- video type (movie|episode)
- TV Show Title (blank if movie)
- Season (-1 if movie)
- Episode Number (-1 if movie)
At the end of the month I might have time to work on the Memacs module
Verzeihung!
Somehow, I was losing touch with this issue for way too long. Will soon spend some time trying out this code and give feedback.
All this lost playback log data of mine since Oct 2018 😩
https://github.com/DerBeutlin/KodiPlayEventLogger/releases successfully tested on my old LibreELEC 8.2.2 with Kodi 17.6. I will most probably re-flash to the newest LibreELEC 9.2 with Kodi 18.5 in the next weeks.
And I need to test the Memacs module as well, of course. So I need to gather some playback log data first. ;-)
I have actually totally forgotten about this but might try it out again in the next weeks, thanks for testing it!
I'll consider this issue as solved although I personally am "blocked" by the issue DerBeutlin/KodiPlayEventLogger#1 which is tracked at the Kodi add-on (as it should be).
I'm very thankful for the module so far and the logging method on Kodi!