robweber / cronxbmc

A simple Cron-like service for Kodi
MIT License
19 stars 19 forks source link

Help automatically playing a channel w/ time trigger #21

Open paradoxgrowth opened 2 years ago

paradoxgrowth commented 2 years ago

Thank you so much for making this addin!! This is exactly what I need. I have looked through the documentation you supplied on this site. It seems a bit over my head. Could you help me build a script that would automatically play a specific channel from PVR (via PlayPvrTV) that pulls from my HDHomeRun? Thanks so much again for your addin and help!

robweber commented 2 years ago

I can try and help - just to confirm what you're looking for is a way to play a specific PVR channel at a specific time of day right? Something like at 30 6 * * 1-5 (every weekday at 6:30am) play Channel 10?

The Kodi command you'll need can be found by looking at the PlayMedia() function; but you'll have to find the media string for the channel you want. They're all something like pvr://channels/tv/..... I have a PVR system too so I wonder if there is a way to extract a list of the paths you'd need? This will at least get you on the right track, if I figure out the media paths I'll post that here too.

paradoxgrowth commented 2 years ago

I can try and help - just to confirm what you're looking for is a way to play a specific PVR channel at a specific time of day right? Something like at 30 6 * * 1-5 (every weekday at 6:30am) play Channel 10?

The Kodi command you'll need can be found by looking at the PlayMedia() function; but you'll have to find the media string for the channel you want. They're all something like pvr://channels/tv/..... I have a PVR system too so I wonder if there is a way to extract a list of the paths you'd need? This will at least get you on the right track, if I figure out the media paths I'll post that here too.

Hi robweber, thanks so much for your help!! That is correct, I would like to play channel 12.1 every day of the week at 6am. How do I extract the paths? I guess I am not sure where to go, all thumbs. :( thanks again!

robweber commented 2 years ago

So looking into this a bit more there isn't a super straightforward way to accomplish this - at least not without a lot of leg work, which seems stupid. Using the JSON-RPC method calls you could do this easily; however this addon only calls built in functions right now.

Extending things to also allow for JSON RPC methods, which would be far more useful, would accomplish this. I'm going to add this and then follow up with you.

robweber commented 2 years ago

I think I have it all working to allow what you're asking. You'll need to download the most current version 0.1.5 as that includes support for JSON-RPC commands. This will allow you to play a PVR channel directly.

When setting up the command you'll want to choose JSON Command and then use the following string as the command:

{"jsonrpc": "2.0", "id": 1, "method": "Player.Open", "params": {"item": {"channelid": 6}}}

The only thing you'll need to modify is the channelid value. 6 is a random channel on my PVR. These values don't correspond to actual channel numbers, but how they're identified by Kodi. The easiest way I could find to get a channel id was to open the web interface for your Kodi system, select PVR, and hover over each channel. The last part of the URL is the channel ID. You could also just try values, starting at 1 and counting up until you get the right one.

Hopefully this is what you're looking for.

paradoxgrowth commented 2 years ago

Hi Robweber,

This is awesome! Thank you so much for putting this together. I will try to load this into the addin shortly and check back in.

paradoxgrowth commented 2 years ago

I think I have it all working to allow what you're asking. You'll need to download the most current version 0.1.5 as that includes support for JSON-RPC commands. This will allow you to play a PVR channel directly.

When setting up the command you'll want to choose JSON Command and then use the following string as the command:

{"jsonrpc": "2.0", "id": 1, "method": "Player.Open", "params": {"item": {"channelid": 6}}}

The only thing you'll need to modify is the channelid value. 6 is a random channel on my PVR. These values don't correspond to actual channel numbers, but how they're identified by Kodi. The easiest way I could find to get a channel id was to open the web interface for your Kodi system, select PVR, and hover over each channel. The last part of the URL is the channel ID. You could also just try values, starting at 1 and counting up until you get the right one.

Hopefully this is what you're looking for.

Hi Robweber, Thank you again for helping with the script. Unfortunately it does not seem to be working. I wonder if I didn't input it in correctly. Is your script meant to be put in via kodi UI or by editing the .xml file? I copy and pasted into the KODI UI. I waited to see if anything happened when the script was set to go off and nothing. By the way I did upgrade the version to 1.5. Anything else?

Thanks again!

robweber commented 2 years ago

That should really be about it, although your channel ID will be different than the example I had. Cutting/pasting into the GUI should work, that's how I did mine. Would help if you had some kind of log info on what it is actually trying to execute.