Update OSD properties after starting stream playback
#16
Well, if enough skinners like your addon, then they will include support for it in their skins.

If you take a look at the skin.helper.service, this sets lots of properties that skinners can use. As it supplies lots of info that you can't otherwise easily get into a skin, lots of skinners support it.

BTW, that station uses LightStreamer to push out its track and artist info. There is a python implementation of a LightStreamer client on github, so it should be perfectly possible to write an addon to do what you want.

I do agree that some standardisation of window properties would be useful, given that various different addons could set the same properties and a skin would only have to implement one set to work with all the addons. As the addons are unofficial I think it would be down to the individual addon devs to create the standard between them and then a skin dev can choose whether or not to support it.

If take up of the addons is reasonably high then skinners will want to support them. If not then it becomes a bit of a niche area and only those particularly interested in said addons will want to fiddle with their skin to add support.

Of course, there is nothing to stop you offering a modded version of a skin along with your addon.
Learning Linux the hard way !!
Reply
#17
(2016-09-05, 10:14)black_eagle Wrote: BTW, that station uses LightStreamer to push out its track and artist info. There is a python implementation of a LightStreamer client on github, so it should be perfectly possible to write an addon to do what you want.

Of course, there is nothing to stop you offering a modded version of a skin along with your addon.

Thanks for the info, it was very useful, however...

I made a few modifications to the skin I'm using to allow me to use window properties to update the OSD information, which worked great. I was thinking that I would probably include a patch and apply it on-the-fly on first use.

All I needed was to pull the track information from Lightstreamer, and the Python example provided on the Lightstreamer GitHub looked promising. However, when trying it out with the Buddha Radio implementation, I received the error Invalid URI..., which, after a quick Google search, I found is caused by the free version of the Lightstreamer server supporting only a few private APIs; HTML/JavaScript, Flash and Node. The generic 'Client Protocol' is only available with the paid editions of the server.

I tried the two Lightstreamer servers that I could find being used on the Buddha Radio website (ls.buddharadio.com.au) and a third part content distributor, RadioApp (ls.stardustradio.com.au), and both seem to be using the free edition of Lightserver (maybe the same server).

I don't know of anywhere else to get this information from, so I may have just hit another wall. Rolleyes
Reply
#18
(2016-09-11, 04:32)jonathan.holvey Wrote:
(2016-09-05, 10:14)black_eagle Wrote: BTW, that station uses LightStreamer to push out its track and artist info. There is a python implementation of a LightStreamer client on github, so it should be perfectly possible to write an addon to do what you want.

Of course, there is nothing to stop you offering a modded version of a skin along with your addon.

Thanks for the info, it was very useful, however...

I made a few modifications to the skin I'm using to allow me to use window properties to update the OSD information, which worked great. I was thinking that I would probably include a patch and apply it on-the-fly on first use.

All I needed was to pull the track information from Lightstreamer, and the Python example provided on the Lightstreamer GitHub looked promising. However, when trying it out with the Buddha Radio implementation, I received the error Invalid URI..., which, after a quick Google search, I found is caused by the free version of the Lightstreamer server supporting only a few private APIs; HTML/JavaScript, Flash and Node. The generic 'Client Protocol' is only available with the paid editions of the server.

I tried the two Lightstreamer servers that I could find being used on the Buddha Radio website (ls.buddharadio.com.au) and a third part content distributor, RadioApp (ls.stardustradio.com.au), and both seem to be using the free edition of Lightserver (maybe the same server).

I don't know of anywhere else to get this information from, so I may have just hit another wall. Rolleyes

@jonathan -

I've been following this thread as I'm trying to do something similar with my Buddha Radio add-on, though my solution is not as elegant as yours. Since I was unable to obtain the song info from the Buddha website, I'm scraping it from the tune-in site and displaying it in a notification. The song info is right there in the html. It sounds like you have the OSD working properly in your add-on already, and just need to obtain the info to display. Couldn't you also just scrape the info from the tunein.com website?
Kodi 17.6 on Dell Optiplex 980 Lubuntu 18.04 | Kodi 18 on HTPC Lubuntu 18.04 | My Add-ons | My Repo
Reply
#19
@jonathan - Got any code that I can look at ? I'm interested in seeing if the lightstreamer part is resolvable as this is a better solution than periodically scraping a website.
Learning Linux the hard way !!
Reply
#20
(2016-09-18, 16:35)MetalChris Wrote: I was unable to obtain the song info from the Buddha website, I'm scraping it from the tune-in site and displaying it in a notification. The song info is right there in the html.

You're right! I was looking at TuneIn last week (amongst various potential sources of track information) and I swear that there was nothing there. I can only assume that it wasn't working when I checked.

(2016-09-18, 17:26)black_eagle Wrote: @jonathan - Got any code that I can look at ? I'm interested in seeing if the lightstreamer part is resolvable as this is a better solution than periodically scraping a website.

I certainly agree that something like Lightstreamer would present a more elegant solution than periodically hitting the TuneIn website, however I'm fairly certain that it's not possible without some kind of JavaScript go-between to work with the available client API.

I used the Python example from the Lightstreamer GitHub, and modified the code from line 399 with some educated guesses for the server URL and the items, fields and adapter variables. These I got from the embedded JavaScript on the Buddha Radio home page.

Code:
# Establishing a new connection to Lightstreamer Server
print("Starting connection")
# lightstreamer_client = LSClient("http://localhost:8080", "DEMO")
lightstreamer_client = LSClient("http://ls.buddharadio.com.au", "NowPlaying")
try:
    lightstreamer_client.connect()
except Exception as e:
    print("Unable to connect to Lightstreamer Server")
    print(traceback.format_exc())
    sys.exit(1)


# Making a new Subscription in MERGE mode
subscription = Subscription(
    mode="MERGE",
    items=["Buddha"],
    fields=["playing"],
    adapter="MONITOR")


# A simple function acting as a Subscription listener
def on_item_update(item_update):
    print("{playing}".format(**item_update["values"]))

# Adding the "on_item_update" function to Subscription
subscription.addlistener(on_item_update)

# Registering the Subscription
sub_key = lightstreamer_client.subscribe(subscription)

wait_for_input()

# Unsubscribing from Lightstreamer by using the subscription key
lightstreamer_client.unsubscribe(sub_key)

# Disconnecting
lightstreamer_client.disconnect()

Upon running this script, I receive an IOError, which dumps the HTML source of http://ls.buddharadio.com.au. From the Lightstreamer forums I interpreted that this is the response you get when the Lightstreamer server doesn't support the Generic Client API.

Let me know if you do manage to get it working - there's a good chance that I overlooked something.

Cheers,
Jon
Reply
#21
Funny, I have been playing with exactly that on and off this morning.

Set my fields up slightly differently (again, from looking at the javascript)

PHP Code:
subscription Subscription(
    
mode="MERGE",
    
items=["Buddha""playing"],
    
fields=["Artist""Title"],
    
adapter="MONITOR"

But, as you say, it throws an IOError before it gets to that point. I guess there are some credentials at work somewhere.
Learning Linux the hard way !!
Reply
#22
Yeah, I think I tried that way as well.

I used Wireshark to sniff out the data that was being sent, and there are no credentials in the request. The response contains some obfuscated JavaScript, which I guess is how they stop you reverse engineering the protocol in order to use other languages.
Reply
#23
Anyway, I now have a basic implementation using track info from Tunein. Take a look at the readme in my develop branch on GitHub if you're interested. If it turns out that Lightstreamer can be used (black_eagle has been looking further into this) then I'll update it later on.

Still lots to do either way.

Cheers,
Jon
Reply
#24
Just a quick update...

The develop branch now has the ability to automatically modify the current skin to display track information using window properties. The idea is that a patch file will be provided for each supported skin, and applied the first time a radio stream is played during a Kodi session. The addon forces Kodi to reload the skin from the patched files, before removing the patch, leaving the skin files intact.

The idea behind this mechanism is that I only need to supply a single small file per skin, which will (hopefully) work across skin version updates. It also means that the addon will work pretty much out of the box, without having to maintain modified skins on every machine it's installed on..

https://github.com/JonathanHolvey/plugin...ee/develop
Reply
#25
(2016-08-13, 06:22)jonathan.holvey Wrote: Hi,

I'm writing an internet radio plugin for Kodi which allows me to specify custom streams, artwork and metadata and present them nicely in Kodi's native interface.

So far I've used xbmcplugin.AddDirectoryItem() to create a list of radio streams in Kodi from sources listed in an xml file. The streams show up correctly, with the artwork and information I've specified.

Image

My next aim is to scrape the current artist and track information from the radio station's website, and update the OSD in Kodi to match. Getting the data should be pretty straightforward, but I don't know where to start with feeding it to Kodi. Is there a method for updating the OSD during playback, or will I need to take more control of the way the stream is played in order to achieve this?

My addon can be found over at GitHub, for reference.

Thanks in advance.

Cheers,
Jon

Hello Jonathan,

How are you?
I found your addon searching the web for a way to add radio station streams. I'm successfully running it on my good'ol Apple TV One but the stream keeps crashing.
Is there any way to increase the cache size for the audio stream? Every tip i search on the net is for increasing video cache size.
I'm trying to repurpose my old apple tv as a movie box when i'm on the mountains lodge and accessing radio stations on the net is a plus.

Thanks for the help buddy

Zeh
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
Update OSD properties after starting stream playback00
This forum uses Lukasz Tkacz MyBB addons.