Aggiunto TuneIn Radio
This commit is contained in:
11
channels/tunein.json
Normal file
11
channels/tunein.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "tunein",
|
||||
"name": "TuneIn",
|
||||
"active": true,
|
||||
"adult": false,
|
||||
"language": ["all"],
|
||||
"thumbnail": "tunein.png",
|
||||
"banner": "tunein.png",
|
||||
"categories": ["music"],
|
||||
"settings" :[]
|
||||
}
|
||||
109
channels/tunein.py
Normal file
109
channels/tunein.py
Normal file
@@ -0,0 +1,109 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# ------------------------------------------------------------
|
||||
# Canale per altadefinizione01
|
||||
# ------------------------------------------------------------
|
||||
|
||||
from core import support
|
||||
from core.item import Item
|
||||
from platformcode import config
|
||||
from xml.dom import minidom
|
||||
|
||||
#impostati dinamicamente da findhost()
|
||||
|
||||
|
||||
host = 'http://api.radiotime.com'
|
||||
headers = [['Referer', host]]
|
||||
|
||||
@support.scrape
|
||||
def mainlist(item):
|
||||
item.url = host
|
||||
action = 'radio'
|
||||
patron = r'text="(?P<title>[^"]+)" URL="(?P<url>[^"]+)"'
|
||||
def itemHook(item):
|
||||
item.thumbnail = support.thumb(thumb='channels_musical.png')
|
||||
return item
|
||||
def itemlistHook(itemlist):
|
||||
itemlist.append(
|
||||
support.Item(
|
||||
channel=item.channel,
|
||||
title=support.typo('Cerca...', 'bold color kod'),
|
||||
url = item.url,
|
||||
action='search',
|
||||
thumbnail=support.thumb(thumb='search.png')))
|
||||
return itemlist
|
||||
return locals()
|
||||
|
||||
|
||||
def radio(item):
|
||||
support.log()
|
||||
itemlist = []
|
||||
data = support.match(item, patron= r'text="(?P<title>[^\("]+)(?:\((?P<location>[^\)]+)\))?" URL="(?P<url>[^"]+)" bitrate="(?P<quality>[^"]+)" reliability="[^"]+" guide_id="[^"]+" subtext="(?P<song>[^"]+)" genre_id="[^"]+" formats="(?P<type>[^"]+)" (?:playing="[^"]+" )?(?:playing_image="[^"]+" )?(?:show_id="[^"]+" )?(?:item="[^"]+" )?image="(?P<thumb>[^"]+)"')
|
||||
if data.matches:
|
||||
for title, location, url, quality, song, type, thumbnail in data.matches:
|
||||
itemlist.append(
|
||||
support.Item(
|
||||
channel = item.channel,
|
||||
title = support.typo(title, 'bold') + support.typo(quality + ' kbps','_ [] bold color kod'),
|
||||
thumbnail = thumbnail,
|
||||
url = url,
|
||||
contentType = 'music',
|
||||
plot = support.typo(location, 'bold') + '\n' + song,
|
||||
action = 'findvideos'
|
||||
)
|
||||
)
|
||||
else:
|
||||
matches = support.match(data.data, patron= r'text="(?P<title>[^\("]+)(?:\([^\)]+\))?" URL="(?P<url>[^"]+)" (?:guide_id="[^"]+" )?(?:stream_type="[^"]+" )?topic_duration="(?P<duration>[^"]+)" subtext="(?P<plot>[^"]+)" item="[^"]+" image="(?P<thumb>[^"]+)"').matches
|
||||
if matches:
|
||||
for title, url, duration, plot, thumbnail in matches:
|
||||
infoLabels={}
|
||||
infoLabels['duration'] = duration
|
||||
itemlist.append(
|
||||
support.Item(
|
||||
channel = item.channel,
|
||||
title = support.typo(title, 'bold'),
|
||||
thumbnail = thumbnail,
|
||||
infolLbels = infoLabels,
|
||||
url = url,
|
||||
contentType = 'music',
|
||||
plot = plot,
|
||||
action = 'findvideos'
|
||||
)
|
||||
)
|
||||
else:
|
||||
matches = support.match(data.data, patron= r'text="(?P<title>[^"]+)" URL="(?P<url>[^"]+)"').matches
|
||||
for title, url in matches:
|
||||
itemlist.append(
|
||||
support.Item(
|
||||
channel = item.channel,
|
||||
title = support.typo(title, 'bold'),
|
||||
thumbnail = item.thumbnail,
|
||||
url = url,
|
||||
action = 'radio'
|
||||
)
|
||||
)
|
||||
return itemlist
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
import xbmc
|
||||
itemlist = []
|
||||
item.action = 'play'
|
||||
urls = support.match(item.url).data.strip().split()
|
||||
for url in urls:
|
||||
item.url= url
|
||||
item.server = 'directo'
|
||||
itemlist.append(item)
|
||||
return itemlist
|
||||
|
||||
|
||||
def search(item, text):
|
||||
support.log(text)
|
||||
item.url = host + '/Search.ashx?query=' +text
|
||||
try:
|
||||
return radio(item)
|
||||
# Continua la ricerca in caso di errore
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
support.logger.error("%s" % line)
|
||||
return []
|
||||
@@ -108,7 +108,7 @@ def getchanneltypes(view="thumb_"):
|
||||
logger.info()
|
||||
|
||||
# Lista de categorias
|
||||
channel_types = ["movie", "tvshow", "anime", "documentary", "vos", "direct", "live"] # , "torrent"
|
||||
channel_types = ["movie", "tvshow", "anime", "documentary", "vos", "direct", "live", "music"] # , "torrent"
|
||||
|
||||
if config.get_setting("adult_mode") != 0:
|
||||
channel_types.append("adult")
|
||||
@@ -407,7 +407,7 @@ def thumb(item_or_itemlist=None, genre=False, thumb=''):
|
||||
'channels_children':['bambini', 'kids'],
|
||||
'horror':['horror'],
|
||||
'lucky': ['fortunato'],
|
||||
'channels_musical':['musical', 'musica', 'music'],
|
||||
'channels_music':['musical', 'musica', 'music'],
|
||||
'channels_mistery':['mistero', 'giallo', 'mystery'],
|
||||
'channels_noir':['noir'],
|
||||
'popular' : ['popolari','popolare', 'più visti'],
|
||||
|
||||
@@ -386,8 +386,10 @@ def get_localized_string(code):
|
||||
def get_localized_category(categ):
|
||||
categories = {'movie': get_localized_string(30122), 'tvshow': get_localized_string(30123),
|
||||
'anime': get_localized_string(30124), 'documentary': get_localized_string(30125),
|
||||
'vos': get_localized_string(30136), 'sub-ita': get_localized_string(70566), 'adult': get_localized_string(30126),
|
||||
'direct': get_localized_string(30137), 'torrent': get_localized_string(70015), 'live': get_localized_string(30138)}
|
||||
'vos': get_localized_string(30136), 'sub-ita': get_localized_string(70566),
|
||||
'adult': get_localized_string(30126), 'direct': get_localized_string(30137),
|
||||
'torrent': get_localized_string(70015), 'live': get_localized_string(30138),
|
||||
'music': get_localized_string(30139) }
|
||||
return categories[categ] if categ in categories else categ
|
||||
|
||||
|
||||
|
||||
@@ -317,6 +317,10 @@ msgctxt "#30138"
|
||||
msgid "Live"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30139"
|
||||
msgid "Music"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30151"
|
||||
msgid "Watch the video"
|
||||
msgstr ""
|
||||
|
||||
@@ -317,6 +317,10 @@ msgctxt "#30138"
|
||||
msgid "Live"
|
||||
msgstr "Live"
|
||||
|
||||
msgctxt "#30139"
|
||||
msgid "Music"
|
||||
msgstr "Musica"
|
||||
|
||||
msgctxt "#30151"
|
||||
msgid "Watch the video"
|
||||
msgstr "Guarda il video"
|
||||
|
||||
Reference in New Issue
Block a user