Hi there,
I’m new to python development - I’m usually a C# and t-sql dev so i’m still getting my head around the syntax, terminology and structure of python and I would really appreciate some help getting something started here.
I’ve been asked by someone to have a look at developing some additional functionality within their channel which they use - I believe someone else developed it for them using the IPTV channel as a base starter. What he’s asked me to look at is to see whether i can create a new container (? is that the right terminology?) which then has sub-items which are populated from a website. I’ve created an API from that website but that does not contain video files or links. What I then need to do is look those items up as they already exist elsewhere and then create a pointer to them.
So, for example, you have a list of football fixtures on a website which are live today. We have converted them into JSON which can be obtained via a URL. The JSON also contains a list of channel names where these fixtures are being shown. What’s been asked is if we can then look up these channel names in the playlist.m3u file and display a pointer to those channels. They still exist elsewhere in the channel but produces a different view of them.
I’ve looked through some of the documentation, forum posts and examples i’ve found online and tried to write something which i expected to work but the plugin fails to load. Furthermore, I’m struggling to find any reference in the log files to see why. I attempted to tweak the BBC iPlayer plugin as a test as it seems one of the most easily structured channels to see what’s happening in it.
here’s the code i’ve written - at this point, i’ve not even got to trying to look up the channel name so i’m just using a url in the JSON just to get something appearing but with no success. Any guidance or help anyone can offer, i’d be eternally grateful.
@route(PREFIX + '/live')
def Live(title):
oc = ObjectContainer(title2 = title)
json_url = 'http://api.import.io/store/connector/c59fa8cc-1d7a-4823-9d2d-cdc555c1218b/_query?input=webpage/url:http%3A%2F%2Fwww.getyourfixtures.com%2Fall%2Ffixtures%2Ftoday%2Ffootball%2F2-EnglishPremierLeague&&_apikey=75e89fac15d74ce5a75b7af4c3f39a6cfdaaf56ebb7e158a18658686c8894c8e4866df29b5cc8ee566fff1e0317f7daf2069a4c028b546ccbdd19f5e4c01de0f713169d604f3e363046152a3e3b031c7'
fixtures = JSON.ObjectFromURL(json_url)
for fixture in fixtures['results']:
mdo = fixture['OFFICIAL_LINK']
mdo.title = fixture['HOME_VALUE']
oc.add(mdo)
# for channel_id in content.ordered_tv_channels:
# channel = content.tv_channels[channel_id]
#
# if channel.has_live_broadcasts():
# try:
# mdo = URLService.MetadataObjectForURL(channel.live_url())
# mdo.title = channel.title + " - " + mdo.title
# oc.add(mdo)
#
# except:
# pass # Live stream not currently available
if len(oc) < 1:
return NoProgrammesFound(oc, title)