[RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27) +---- Forum: Service Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=152) +---- Thread: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) (/showthread.php?tid=151011) |
RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - KenV99 - 2015-05-15 (2015-05-15, 14:05)masinad Wrote: Is there some way to detect if kodi is in Kiosk mode? Like to disable automatic shutdown when chrome launcher is started. I do not see any way of doing this as you mention. Kiosk mode is not directly discoverable via the Kodi api (see the pydocs) or via JSON, as far as I can tell. You would need to hack the code of the chrome launcher itself. RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - tomrey - 2015-05-16 (2015-05-10, 17:44)tekno Wrote: I agree with tomrey. SHutdown script is needed. I want to use the shutdown script so a user can select a different remote.Hi tekno, the following construction is now working for me. I found it through a similar solution for VLC. It's a shell script completely outside Kodi: Code: #!/bin/sh So instead of my curl statements you could call any other script and you have a "run before and run after" solution. Should help with your remote selection challenge... Regards RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - KenV99 - 2015-05-16 Also, I'm confused about the 'need' for a shutdown script... Is this not working for you? RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - tomrey - 2015-05-16 (2015-05-16, 14:22)KenV99 Wrote: Also, I'm confused about the 'need' for a shutdown script...Thanks Ken, you are absolutely right. I should have installed your script before asking. I had read further up this thread, that there was no stop-action. Working perfectly calling an independent script. In my case a simple http call would be enough but this option does not work here as the http-command-line is not editable What am I doing wrong or is that function not yet enabled? Regards RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - KenV99 - 2015-05-16 It's editable for me. Just choose http then a line appears for you to enter the text: RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - tomrey - 2015-05-16 Not for me, if I klick to the http-field a new window opens: hmm I cannot add the screenshot here... it is the standard-kodi window screen-keyboard but without any letters in the fields and the http-field cannot be accessed... RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - KenV99 - 2015-05-16 (2015-05-16, 18:06)tomrey Wrote: Not for me, if I klick to the http-field a new window opens: That sounds like a skin issue. Can you try setting it up in Confluence and then switching back. On Kodi 14.2 on windows 7 x64 and Confluence a keyboard opens properly. RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - ReplayHarry - 2015-05-23 (2015-01-23, 04:20)ReplayHarry Wrote: I saw this service addon script and it gave me a great idea. It works well triggering the starts of video and stops, which is what I wanted. Maybe someone can see what is going on here. My original post tells what I am doing but I have a strange thing with 1 particular show (Good Day, a morning news show that is on at 4:30am, 6am, and 7am). I'm running Win 8.1 with Nextpvr 3.3.8 and Kodi 13.2. With this one show, it never triggers the "onPlaybackStarted" function and my Python script (StartPlay.py) unless the show is still recording or at least still busy by virtue of using Comskip in a postprocessing.bat file. On the start, I record the info about the file and save it to disk so that I can read that info back when "onPlaybackStopped" is triggered. The stop function is triggered fine, but since the original info was never saved, it does nothing. Here is a portion of the long and I see some kind of error that appears to be in the callback2 addon. ------------------------------------ 06:17:26 T:2632 NOTICE: -->Python Interpreter Initialized<-- 06:17:30 T:4888 NOTICE: DVDPlayer: Opening: D:\Recorded TV\News\Good Day\Good Day_20150522_06000700.ts 06:17:30 T:4888 WARNING: CDVDMessageQueue(player):ut MSGQ_NOT_INITIALIZED 06:17:30 T:4428 NOTICE: Thread DVDPlayer start, auto delete: false 06:17:30 T:4428 NOTICE: Creating InputStream 06:17:30 T:4428 NOTICE: Creating Demuxer 06:17:30 T:4428 NOTICE: Opening video stream: 0 source: 256 06:17:30 T:4428 NOTICE: Creating video codec with codec id: 2 06:17:30 T:4428 NOTICE: CDVDVideoCodecFFmpeg::Open() Using codec: MPEG-2 video 06:17:30 T:4428 NOTICE: Creating video thread 06:17:30 T:4428 NOTICE: Opening audio stream: 1 source: 256 06:17:30 T:4428 NOTICE: Finding audio codec for: 86019 06:17:30 T:4428 NOTICE: Creating audio thread 06:17:30 T:1948 NOTICE: Thread DVDPlayerVideo start, auto delete: false 06:17:30 T:1948 NOTICE: running thread: video_thread 06:17:30 T:5100 NOTICE: Thread DVDPlayerAudio start, auto delete: false 06:17:30 T:5100 NOTICE: running thread: CDVDPlayerAudio:rocess() 06:17:30 T:5100 NOTICE: Creating audio stream (codec id: 86019, channels: 2, sample rate: 48000, pass-through) 06:17:30 T:1948 NOTICE: fps: 29.970030, pwidth: 1920, pheight: 1080, dwidth: 1920, dheight: 1080 06:17:30 T:1948 NOTICE: Display resolution ADJUST : 1920x1080@ 59.94 - Full Screen (16) (weight: 0.000) 06:17:30 T:800 NOTICE: 1Channel: Service: Playback started 06:17:31 T:4984 NOTICE: $$$ [xbmc.callbacks2] - Executing command: [C:\Python27\StartPlay.py] for event: onPlaybackStarted 06:17:31 T:4984 NOTICE: $$$ [xbmc.callbacks2] - Command for onPlaybackStarted executed successfully 06:17:31 T:3880 NOTICE: Thread LanguageInvoker start, auto delete: false 06:17:31 T:3880 NOTICE: -->Python Interpreter Initialized<-- 06:17:34 T:4888 NOTICE: CDVDPlayer::CloseFile() 06:17:34 T:4888 NOTICE: DVDPlayer: waiting for threads to exit 06:17:34 T:4428 NOTICE: CDVDPlayer::OnExit() 06:17:34 T:4428 NOTICE: DVDPlayer: closing audio stream 06:17:34 T:4428 NOTICE: Closing audio stream 06:17:34 T:4428 NOTICE: Waiting for audio thread to exit 06:17:34 T:5100 NOTICE: thread end: CDVDPlayerAudio::OnExit() 06:17:34 T:4428 NOTICE: Closing audio device 06:17:34 T:4428 NOTICE: Deleting audio codec 06:17:34 T:4428 NOTICE: DVDPlayer: closing video stream 06:17:34 T:4428 NOTICE: Closing video stream 06:17:34 T:4428 NOTICE: waiting for video thread to exit 06:17:34 T:1948 NOTICE: thread end: video_thread 06:17:34 T:4428 NOTICE: deleting video codec 06:17:34 T:4428 NOTICE: CDVDPlayer::OnExit() deleting demuxer 06:17:34 T:4428 NOTICE: CDVDPlayer::OnExit() deleting input stream 06:17:34 T:4888 NOTICE: DVDPlayer: finished waiting 06:17:34 T:800 NOTICE: 1Channel: Service: Playback Stopped 06:17:34 T:800 NOTICE: 1Channel: Service: Resetting... 06:17:34 T:4984 NOTICE: $$$ [xbmc.callbacks2] - Executing command: [C:\Python27\StartPlay.py] for event: onPlaybackStopped 06:17:34 T:4984 NOTICE: $$$ [xbmc.callbacks2] - Command for onPlaybackStopped executed successfully 06:17:34 T:3076 NOTICE: Thread BackgroundLoader start, auto delete: false 06:17:34 T:4888 NOTICE: CDVDPlayer::CloseFile() 06:17:34 T:4888 NOTICE: DVDPlayer: waiting for threads to exit 06:17:34 T:4888 NOTICE: DVDPlayer: finished waiting 06:17:34 T:4888 NOTICE: CDVDPlayer::CloseFile() 06:17:34 T:4888 NOTICE: DVDPlayer: waiting for threads to exit 06:17:34 T:4888 NOTICE: DVDPlayer: finished waiting 06:17:34 T:3300 NOTICE: Thread LanguageInvoker start, auto delete: false 06:17:35 T:3300 NOTICE: -->Python Interpreter Initialized<-- 06:17:35 T:3300 NOTICE: {'Show dir': 'D:\\Recorded TV\\News\\Good Day\n', 'Title': 'Good Day\n', 'XBMC Event': 'onPlaybackStarted\n', 'XBMC Type': 'TV Show\n', 'Filename': 'D:\\Recorded TV\\News\\Good Day\\Good Day_20150522_06000700.ts\n', 'Date & Time': '05\\22\\2015 0600\n', 'Directory': 'Recorded TV\n'} 06:17:42 T:4888 NOTICE: DVDPlayer: Opening: D:\Recorded TV\News\Good Day\Good Day_20150522_05000600.ts 06:17:42 T:4888 WARNING: CDVDMessageQueue(player):ut MSGQ_NOT_INITIALIZED 06:17:42 T:3780 NOTICE: Thread DVDPlayer start, auto delete: false 06:17:42 T:3780 NOTICE: Creating InputStream 06:17:42 T:3780 NOTICE: Creating Demuxer 06:17:42 T:3780 NOTICE: Opening video stream: 0 source: 256 06:17:42 T:3780 NOTICE: Creating video codec with codec id: 2 06:17:42 T:3780 NOTICE: CDVDVideoCodecFFmpeg::Open() Using codec: MPEG-2 video 06:17:42 T:3780 NOTICE: Creating video thread 06:17:42 T:3780 NOTICE: Opening audio stream: 1 source: 256 06:17:42 T:3780 NOTICE: Finding audio codec for: 86019 06:17:42 T:3780 NOTICE: Creating audio thread 06:17:42 T:3780 NOTICE: Opening Subtitle stream: 0 source: 1024 06:17:42 T:2764 NOTICE: Thread DVDPlayerVideo start, auto delete: false 06:17:42 T:2764 NOTICE: running thread: video_thread 06:17:42 T:2872 NOTICE: Thread DVDPlayerAudio start, auto delete: false 06:17:42 T:2872 NOTICE: running thread: CDVDPlayerAudio:rocess() 06:17:42 T:3780 ERROR: CDVDPlayerSubtitle::OpenStream - Unable to create subtitle parser 06:17:42 T:3780 WARNING: CDVDPlayer::OpenSubtitleStream - Unsupported stream 0. Stream disabled. 06:17:42 T:2872 NOTICE: Creating audio stream (codec id: 86019, channels: 2, sample rate: 48000, pass-through) 06:17:42 T:2764 NOTICE: fps: 29.970030, pwidth: 1920, pheight: 1080, dwidth: 1920, dheight: 1080 06:17:42 T:2764 NOTICE: Display resolution ADJUST : 1920x1080@ 59.94 - Full Screen (16) (weight: 0.000) 06:17:42 T:4984 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<-- - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS! Error Type: <type 'exceptions.TypeError'> Error Contents: cannot concatenate 'str' and 'NoneType' objects Traceback (most recent call last): File "C:\Users\MyHTPC\AppData\Roaming\XBMC\addons\service.xbmc.callbacks2-master\default.py", line 309, in onPlayBackStarted self.onPlayBackStartedEx() File "C:\Users\MyHTPC\AppData\Roaming\XBMC\addons\service.xbmc.callbacks2-master\default.py", line 314, in onPlayBackStartedEx runtimeargs.append('type=' + self.playing_type()) TypeError: cannot concatenate 'str' and 'NoneType' objects -->End of Python script error report<-- 06:17:43 T:800 NOTICE: 1Channel: Service: Playback started 06:17:46 T:4888 NOTICE: CDVDPlayer::CloseFile() 06:17:46 T:4888 NOTICE: DVDPlayer: waiting for threads to exit 06:17:46 T:3780 NOTICE: CDVDPlayer::OnExit() 06:17:46 T:3780 NOTICE: DVDPlayer: closing audio stream 06:17:46 T:3780 NOTICE: Closing audio stream 06:17:46 T:3780 NOTICE: Waiting for audio thread to exit 06:17:46 T:2872 NOTICE: thread end: CDVDPlayerAudio::OnExit() 06:17:46 T:3780 NOTICE: Closing audio device 06:17:46 T:3780 NOTICE: Deleting audio codec 06:17:46 T:3780 NOTICE: DVDPlayer: closing video stream 06:17:46 T:3780 NOTICE: Closing video stream 06:17:46 T:3780 NOTICE: waiting for video thread to exit 06:17:46 T:2764 NOTICE: thread end: video_thread 06:17:46 T:3780 NOTICE: deleting video codec 06:17:46 T:3780 NOTICE: CDVDPlayer::OnExit() deleting demuxer 06:17:46 T:3780 NOTICE: CDVDPlayer::OnExit() deleting input stream 06:17:46 T:4888 NOTICE: DVDPlayer: finished waiting command: [C:\Python27\StartPlay.py] for event: onPlaybackStopped 0606:17:46 T:4984 NOTICE: $$$ [xbmc.callbacks2] - Executing :17:46 T:4984 NOTICE: $$$ [xbmc.callbacks2] - Command for onPlaybackStopped executed successfully RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - KenV99 - 2015-05-23 For some reason I cannot reproduce, it cannot detect what type of video it is and it's returning 'None' I pushed an update that *should* fix that to git: https://github.com/KenV99/service.xbmc.callbacks2/archive/requests.zip you only need to replace the default.py file in your current addon installation from the zip RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - ReplayHarry - 2015-05-23 (2015-05-23, 14:29)KenV99 Wrote: For some reason I cannot reproduce, it cannot detect what type of video it is and it's returning 'None' I must admit it is pretty strange. I will try your update and let you know if that makes a difference. Overall I love this thing and my little Python program with your addon makes things very easy for me and my wife. Film at 11. RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - ReplayHarry - 2015-05-26 Ken: I could try again till this morning as "Good Day" is a Monday - Friday only program. I am attaching the logs. Same thing with your revised "default.py" . It just occurs on a different line. If you look at the logs starting at about 4am, that is when the show starts. It is 4:40am - 5:00am, then 5:00am-6:00am, and then the last time is 6:00am-7:00am. You will see when I watch the shop and stop it before Comskip completes, it triggers the onPlaybackStop fine. But once Comskip has done it's thing, it breaks on the "onPlaybackStart". RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - ReplayHarry - 2015-05-26 (2015-05-26, 00:18)ReplayHarry Wrote: Ken: I could try again till this morning as "Good Day" is a Monday - Friday only program. I am attaching the logs. Same thing with your revised "default.py" . It just occurs on a different line. If you look at the logs starting at about 4am, that is when the show starts. It is 4:40am - 5:00am, then 5:00am-6:00am, and then the last time is 6:00am-7:00am. You will see when I watch the shop and stop it before Comskip completes, it triggers the onPlaybackStop fine. But once Comskip has done it's thing, it breaks on the "onPlaybackStart". Update1: Well, I couldn't attach the log for some reason. I will do a bit of research and try to attach again in a few minutes. Update2: I sure didn't think it would be hard to upload a log. I'll be back when I figure it out. RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - KenV99 - 2015-05-26 Please post it to pastebin and post the link. Mods prefer you do it that way. RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - ReplayHarry - 2015-05-26 (2015-05-26, 00:23)KenV99 Wrote: Please post it to pastebin and post the link. Mods prefer you do it that way. ok, finally figured out how to use pastebin. Thank God for YouTube. here is my log: http://pastebin.com/fta226mu RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - KenV99 - 2015-05-26 (2015-05-26, 02:45)ReplayHarry Wrote:(2015-05-26, 00:23)KenV99 Wrote: Please post it to pastebin and post the link. Mods prefer you do it that way. I pushed another update to the requests branch as before. Kodi is not getting neither a filename nor a title for the video so that seems to be the issue. I hope those are not actually need for whatever script you are running. |