JonathanHolvey / plugin.audio.streaming-radio

A custom internet radio addon for Kodi
GNU General Public License v3.0
5 stars 3 forks source link

No easy way to tell in skin if script is running. #11

Open wyrm65 opened 7 years ago

wyrm65 commented 7 years ago

Jonathan, I'm trying to integrate support for this plugin into my skin but there is no easy way to tell if a stream is playing. Currently I use String.IsEmpty(MusicPlayer.TimeRemaining) to tell that music player is playing something that is not a local file as this $INFO is obviously not set when playing a stream.

Could you please set the following system bool to true when the stream is playing.

Player.IsInternetStream

As this best describes what is happening in a general way and the above listed $INFO string is likely to be true also when a PVR radio station is playing.

Thanks mate Wyrm (AppTV skin writer)

JonathanHolvey commented 7 years ago

Are you trying to detect any internet stream, or just one from my plugin?

Currently, skin support is provided simply by including conditional variables to pull in window properties. Check out the patch files in resources/skins to see how this works for Xperience1080.

wyrm65 commented 7 years ago

General is always better, but yes have checked out your code using conditional variables. Main problem is trying to turn off OSD elements that make no sense for streams, for example progress bars. Checking the time remaining $INFO apart from being hacky is slower than checking a Boolean and besides for some reason does not seem to work consistently across the various skin files.

JonathanHolvey commented 7 years ago

Yes I agree that a general solution is better. I discussed ways of achieving a standard API for updating the OSD on the Kodi forum, but as I was the only one with an interest at the time. Perhaps between us we can come up with a nice solution?

Ultimately I had hoped to provide time remaining for the current track on music stations, as the duration can easily be found online. However, I couldn't find a way of updating the progress bar in the skin, as you can read here.

wyrm65 commented 7 years ago

Jonathan, ok thats a curly one. My python was never the best to start with and its been a long time since I last played with it, but I will throw an idea past you and see if its workable. Can you write values to Kodi system $INFO's? If you can, maybe write to Player.Progress with the percentage played on the track thus far.

Might I ask why you went down the plugin route and not the ordinary script addon? Plugins restrict you to using the supplied skin files that the current skin supplies (along with a number of other restrictions). A ordinary script would allow you access to xbmcgui and then you could supply skin files with your script. If a skin writer decided to skin your script they could override your default skin files with their own, so there would be no need to patch skin files from within your script. While the way you have gone about this is probably ok with the repo guardians, it is still generally frowned upon and best avoided.

JonathanHolvey commented 6 years ago

I'm going to take a look at this when I do some maintenance in the next couple of days. Can you explain what you mean when you say writing to system $INFOs? An example would be handy if you have one.