diff --git a/channels/tunein.json b/channels/tunein.json
new file mode 100644
index 00000000..10392cc4
--- /dev/null
+++ b/channels/tunein.json
@@ -0,0 +1,11 @@
+{
+ "id": "tunein",
+ "name": "TuneIn",
+ "active": true,
+ "adult": false,
+ "language": ["all"],
+ "thumbnail": "tunein.png",
+ "banner": "tunein.png",
+ "categories": ["music"],
+ "settings" :[]
+}
diff --git a/channels/tunein.py b/channels/tunein.py
new file mode 100644
index 00000000..e95aefac
--- /dev/null
+++ b/channels/tunein.py
@@ -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
[^"]+)" URL="(?P[^"]+)"'
+ 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[^\("]+)(?:\((?P[^\)]+)\))?" URL="(?P[^"]+)" bitrate="(?P[^"]+)" reliability="[^"]+" guide_id="[^"]+" subtext="(?P[^"]+)" genre_id="[^"]+" formats="(?P[^"]+)" (?:playing="[^"]+" )?(?:playing_image="[^"]+" )?(?:show_id="[^"]+" )?(?:item="[^"]+" )?image="(?P[^"]+)"')
+ 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[^\("]+)(?:\([^\)]+\))?" URL="(?P[^"]+)" (?:guide_id="[^"]+" )?(?:stream_type="[^"]+" )?topic_duration="(?P[^"]+)" subtext="(?P[^"]+)" item="[^"]+" image="(?P[^"]+)"').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[^"]+)" URL="(?P[^"]+)"').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 []
diff --git a/channelselector.py b/channelselector.py
index 36d3a25d..d1a6d166 100644
--- a/channelselector.py
+++ b/channelselector.py
@@ -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'],
diff --git a/platformcode/config.py b/platformcode/config.py
index e22da105..54a59e81 100644
--- a/platformcode/config.py
+++ b/platformcode/config.py
@@ -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
diff --git a/resources/language/English/strings.po b/resources/language/English/strings.po
index 6e55ffd3..c5687e85 100644
--- a/resources/language/English/strings.po
+++ b/resources/language/English/strings.po
@@ -317,6 +317,10 @@ msgctxt "#30138"
msgid "Live"
msgstr ""
+msgctxt "#30139"
+msgid "Music"
+msgstr ""
+
msgctxt "#30151"
msgid "Watch the video"
msgstr ""
diff --git a/resources/language/Italian/strings.po b/resources/language/Italian/strings.po
index 21baec32..b1389ead 100644
--- a/resources/language/Italian/strings.po
+++ b/resources/language/Italian/strings.po
@@ -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"