Create a Buddha Radio Addon?
#16
(2016-09-14, 23:37)MetalChris Wrote: I'll look into adding an abort command and see if that will kill the timer if the stream is stopped.

Having given this a little more thought, I think I see what is actually happening here. The add-on checks the state of xbmc.Player, and if the player is playing (anything) it scrapes the song info, displays the notification, and then starts a timer to control when the notification is displayed again. The timer would run for 60 seconds. If you stop the stream, the timer would continue running until the 60 seconds were up, it would then display the notification, and then check the state of xbmc.Player again. As long as the player was playing anything, the add-on did not care if you were still playing the Buddha stream, or if you had started playing something else. So if you stopped the Buddha stream and then started playing a video or another audio stream before the timer had run out, the notification would continue to display every 60 seconds. So I've changed the way the timer runs. Instead of running for 60 seconds, the timer will run for 1 second inside a loop that repeats 60 times. In this way, the add-on will check the state of xmbc.Player every second. If you happen to be fast enough to stop the Buddha stream, and then start playing a video or another audio stream all within 1 second, the notification will continue to display every 60 seconds. I don't think most people will be able to do this, so version 1.0.3 should solve the issue of the notification continuing after the Buddha stream has been stopped.

Give it a try and see if this works for you. I believe I could actually set the timer to run in fractions of a second, but I do not think that will be necessary.

Buddha Radio v - 1.0.3

(2016-09-15, 08:04)peppe_sr Wrote: thanks, really appreciated.
could i do a "cosmetic" request? during the reproduction of music instead of "playlist" could be displayed the name of the station?
thanks again.
Peppe

Yep, this bugs me too. I've tried a couple of ways to get the add-on to display 'Buddha Radio' instead of 'playlist.m3u8', but it seems Kodi overrides each method I've tried. I'll keep trying, and hopefully I'll figure it out soon.
Kodi 17.6 on Dell Optiplex 980 Lubuntu 18.04 | Kodi 19 on HTPC Lubuntu 20.04 | My Add-ons | Legacy Repo | Matrix Repo
Reply
#17
Why not use a loop like
PHP Code:
while xbmc.Player().isPlayingAudio():
    do 
addon stuff() 


That way, when Kodi stops playing the audio stream, the add-on will exit that while loop and you can do any clean-up necessary and exit cleanly. Better than looping on a timer I would have thought.
Learning Linux the hard way !!
Reply
#18
(2016-09-18, 10:07)black_eagle Wrote: Why not use a loop like
PHP Code:
while xbmc.Player().isPlayingAudio():
    do 
addon stuff() 


That way, when Kodi stops playing the audio stream, the add-on will exit that while loop and you can do any clean-up necessary and exit cleanly. Better than looping on a timer I would have thought.

In a way, I am doing what you are suggesting. I did not want the notification to display constantly (it really detracts from visualizations), and also did not want to continuously hammer the website for the song info so I used the timer to create the interval. However, I did not realize that with .isPlaying() the media type could be specified. I can see how there would be advantages to doing so though, and will incorporate this in future versions (and possibly other add-ons as well).

Thanks for the tip! Smile

The notification would be unnecessary if I could get the add-on to display the song info instead of 'playlist.m3u8' on screen. I think what I need to do there though, is similar to what is being attempted in this thread - get the add-on to access the OSD in the skin directly and replace the file info with the actual song info. I imagine this can be done somehow, but I've extremely limited experience with skinning, and will need to do some more tinkering before I can get there.
Kodi 17.6 on Dell Optiplex 980 Lubuntu 18.04 | Kodi 19 on HTPC Lubuntu 20.04 | My Add-ons | Legacy Repo | Matrix Repo
Reply
#19
I actually have written an add-on that does exactly that for ICY and Shoutcast streams where the artist and track info is embedded into the stream. You could do a similar thing as you are scraping their website to get the artist/track info. Just set a couple of window properties and change the appropriate skin .xml files to match.

Thread is here and source code on github is here.

Unfortunately, I don't see a way to do this without editing a skin Sad
Learning Linux the hard way !!
Reply



Logout Mark Read Team Forum Stats Members Help
Create a Buddha Radio Addon?0
This forum uses Lukasz Tkacz MyBB addons.