def playlist(parent): return [ MediaObj( key=Key(type=PLAYLIST, id=parent.id, view=RELEVANT, arg=parent.arg), #title = 'Aktuelt', title=lang(30201), thumbnail=os.path.join(rpath, 'news-icon.png')), MediaObj( key=Key(type=PLAYLIST, id=parent.id, view=TOP_TOTAL, arg=parent.arg), #title = 'Mest sett totalt', title=lang(30202), thumbnail=os.path.join(rpath, 'stats-icon.png')), MediaObj( key=Key(type=PLAYLIST, id=parent.id, view=TOP_THIS_MONTH, arg=parent.arg), #title = 'Mest sett denne maned', title=lang(30204), thumbnail=os.path.join(rpath, 'stats-icon.png')), MediaObj( key=Key(type=PLAYLIST, id=parent.id, view=TOP_THIS_WEEK, arg=parent.arg), #title = 'Mest sett denne uken', title=lang(30203), thumbnail=os.path.join(rpath, 'stats-icon.png')) ]
def program(parent, resource_path=rpath): return [ MediaObj( key=Key(id=None, type=PROGRAM, view=BY_CHAR), #title = 'Vis alfabetisk', title=lang(30208), parent=parent, thumbnail=os.path.join(resource_path, 'char-icon.png')), MediaObj( key=Key(id='@', type=PROGRAM, view=VIEW_ALL), #title = 'Vis alle', title=lang(30207), parent=parent, thumbnail=os.path.join(resource_path, 'all-icon.png')), MediaObj( key=Key(type=PROGRAM, view=BY_THEME), #title = 'Vis tema liste', title=lang(30209), parent=parent, thumbnail=os.path.join(resource_path, 'theme-icon.png')), MediaObj( key=Key(type=PROGRAM, id=3650, view=TOP_TOTAL), #title = 'Mest sett totalt', title=lang(30202), parent=parent, thumbnail=os.path.join(resource_path, 'stats-icon.png')), MediaObj( key=Key(type=PROGRAM, id=31, view=TOP_THIS_MONTH), #title = 'Mest sett denne maned', title=lang(30204), parent=parent, thumbnail=os.path.join(resource_path, 'stats-icon.png')), MediaObj( key=Key(type=PROGRAM, id=7, view=TOP_THIS_WEEK), #title = 'Mest sett denne uken', title=lang(30203), parent=parent, thumbnail=os.path.join(resource_path, 'stats-icon.png')), MediaObj( key=Key(type=PROGRAM, id=0, view=TOP_BY_INPUT), #title = 'Mest sett siste X dager', title=lang(30218), parent=parent, thumbnail=os.path.join(resource_path, 'input.png')), MediaObj( key=Key(type=PROGRAM, view=RECOMMENDED), #title = 'Anbefalte programmer', title=lang(30217), parent=parent, thumbnail=os.path.join(resource_path, 'favorites.png')), MediaObj( key=Key(type=PROGRAM, view=ARTICLES), #title = 'Artikler', title=lang(30219), parent=parent, thumbnail=os.path.join(resource_path, 'article.png')) ]
def parse_main_directory(self): if self.verbose: print 'list main feed directory' ok = True; index = 0 for lbl, id in FeedInfo(): prefix, type, id = ('nrkbeta', 'feed', index) url = Key.build_url( prefix, type=type, id=id ) li = self.entry( lbl, iconImage = self.RSSICO, thumbnailImage = self.RSSICO ) ok = self.add( self.hndl, url = url, listitem = li, isFolder = True ) index += 1 if self.verbose: print 'added %d entries. success: %s' % ( index, repr(ok) ) if ok: #tell end of directory self.eod( self.hndl )
def __init__(self): self.key = Key( sys.argv[2] ) #self.settings = {} if self.key.action == 'download': self.download()
def show(data): istack = [] for m in re.finditer(regex.show, data): item = MediaObj() item.title = m.group('title') item.plot = m.group('plot') if m.group('type') == 'folder': item.defntion = 'katalog' type = SHOW_FOLDER item.icon = folder_icon elif m.group('type') == 'sound': item.defntion = 'lyd/wma' item.icon = sound_icon elif m.group('type') == 'video': item.defntion = 'video/wmv' item.icon = sound_icon if m.group('type') == 'video' or m.group('type') == 'sound': item.isPlayable = True type = SHOW_CLIP item.key = Key() item.key.type = type item.key.id = int(m.group('id')) if m.group('exp') == 'noexpand' and item.key.type == SHOW_FOLDER: continue istack.append(item) return istack
def _get_intro(self, id, arg=None): if True == True: if id == REGION: name = NEWS img = 'news.png' elif id == NEWS: name = NEWS img = 'news.png' elif id == SPORT: name = SPORT img = 'sport.png' elif id == SUPER: name = SUPER img = 'kids.png' elif id == NATURE: name = NATURE img = 'ntur.png' else: name = NEWS img = 'news.png' title = '%s %s' % (name, 'hovedvignett') img = Plugin.image(img) key = Key('new', type=PLAYLIST_VIGNETE) istart = MediaObj(title=title, thumbnail=img, key=key) istart.isPlayable = True istart.isFolder = False istart.url = Plugin.videopath(name + '_intro_main.avi') title = '%s %s' % (name, 'vignett') key = Key('new', type=PLAYLIST_VIGNETE) imid = MediaObj(title=title, thumbnail=img, key=key) imid.isPlayable = True imid.isFolder = False imid.url = Plugin.videopath(name + '_intro.avi') return istart, imid, istart else: url = uri.playlist(loop=id, type=arg) data = self.dman.get_data(url) if data: tmp_list = extract.playlist(data) return tmp_list[0], tmp_list[2], tmp_list[-1]
def __getattr__(self, key): if self.views.has_key(key): lbl, ico = self.views[key] ico = os.path.join(rpath, ico) vkey = Key(type=PLAYLIST, id=self.parent.id, view=key, arg=self.parent.arg) return MediaObj(key=vkey, title=lbl, thumbnail=ico)
def add(self, label, url=None, image='', ident=None, isdir=True): if ident and not url: url = Key.build_url('webradio', id=ident, image=image) li = ListItem(label, thumbnailImage=image) ok = addDirectoryItem(self.handle, url=url, listitem=li, isFolder=isdir) return ok
def __init__(self): self.hndl = int(sys.argv[1]) key = Key(sys.argv[2]) if key.id == None: self.parse_main_directory() else: self.parse_feed(key)
def __init__(self): key = Key(sys.argv[2]) self.hndl = int(sys.argv[1]) self.success = True if not key.id: self.parse_channels() else: self.get_stream(key.id)
def __init__(self): self.hndl = int(sys.argv[1]) self.add(lang(30250), nrk.PROGRAM, nrk.PROGRAM, img='program-icon.png') self.add(lang(30251), nrk.PROGRAM, nrk.LIVE, img='live-icon.png') self.add(lang(30252), nrk.CHANNELS, nrk.CHANNELS, img='channels-icon.png') self.add(lang(30253), nrk.PROGRAM, nrk.PLAYLIST, 'sport', 'sports-icon.png') self.add(lang(30254), nrk.PROGRAM, nrk.PLAYLIST, 'nyheter', 'news-icon.png') self.add(lang(30255), nrk.PROGRAM, nrk.PLAYLIST, 'distrikt', 'regions-icon.png') #self.add('Barn', nrk.PROGRAM, nrk.PLAYLIST, 'super', 'children-icon.png') self.add(lang(30256), nrk.PROGRAM, nrk.PLAYLIST, 'natur', 'nature-icon.png') self.add(lang(30257), 'nrkbeta', 'feed', img='nrkbeta.png') self.add(lang(30258), 'webradio', 'webradio', img='speaker-icon.png') self.add(lang(30260), 'podcast', 'video', img='video-podcast.png') self.add(lang(30259), 'podcast', 'sound', img='audio-podcast.png') commands = [] commands.append(( lang(30800), 'XBMC.RunPlugin(%s)' % ( Key.build_url('teletext', page=101)), )) commands.append(( lang(30801), 'XBMC.RunPlugin(%s)' % ( Key.build_url('teletext', page=131)), )) commands.append(( lang(30802), 'XBMC.RunPlugin(%s)' % ( Key.build_url('teletext', page=200)), )) commands.append(( lang(30803), 'XBMC.RunPlugin(%s)' % ( Key.build_url('teletext', page=300)), )) commands.append(( lang(30804), 'XBMC.RunPlugin(%s)' % ( Key.build_url('teletext', page=590)), )) self.add( lang(30261), 'teletext', 'teletext', img='ttv-icon.png', isdir=False, commands=commands) # Only add the entry for Favourites if the xml file containing favourites exists already. if os.path.isfile(FAV_PATH): self.add(lang(30262), 'favorites', 'favorites', img='favorites.png') endOfDirectory(self.hndl)
def by_char(): import string items = [] for c in string.ascii_uppercase: item = MediaObj( #title = 'Vis bokstav "%s"' % c, title=lang(30206) % c, thumbnail=os.path.join(rpath, '%s.png' % c), key=Key(id=c, type=PROGRAM, view=BY_CHAR)) items.append(item) return items
def chapters(cstring): clist = [] for chapter in re.findall(nrk.regex.show_clip_index, cstring): citem = MediaObj(title=chapter[0], time=chapter[1]) if chapter[2]: citem.thumbnail = chapter[2] citem.thumbnail = nrk.video_index_icon citem.key = Key(type=SHOW_CLIP_INDEX) clist.append(citem) return clist
def add(self, label, id, type='channel', prefix='kanalene', img='', icon='', isdir=False): url = Key.build_url(prefix, type=type, id=id) li = ListItem(label, iconImage=icon, thumbnailImage=img) li.setProperty('IsPlayable', 'true') ok = addDirectoryItem(self.hndl, url=url, listitem=li, isFolder=isdir) return ok
def add(self, label, prefix, type, id=None, img='', icon='', isdir=True, commands=None): # Make full path for where to look for specified image if img != '': img = os.path.join(self.rpath, img) url = Key.build_url(prefix, type=type, id=id) li = ListItem(label, iconImage=icon, thumbnailImage=img) if commands: li.addContextMenuItems( commands, True ) ok = addDirectoryItem(self.hndl, url=url, listitem=li, isFolder=isdir) return ok
def articles(data): istack = [] for m in re.finditer(regex.recommended, data): item = MediaObj() plot = m.group('plot').decode('iso-8859-1') item.plot = decode_htmlentities(plot) item.title = m.group('title') item.thumbnail = m.group('image').encode('ascii', 'ignore') #State identifiers item.key = Key() item.key.id = int(m.group('id')) item.key.type = m.group('type').encode('ascii', 'ignore') istack.append(item) return istack
def __init__(self): self.handle = int(sys.argv[1]) key = Key(sys.argv[2]) catalog = os.path.join(os.getcwd(), 'resources', 'webradio.xml') self.parser = xml.sax.make_parser() self.folder = Radio() self.parser.setContentHandler(self.folder) self.parser.parse(catalog) if not key.id: self.parse_channels() else: self.parse_streams(key.id, key.image)
def __init__(self, *args, **kwargs): if Key(sys.argv[2]).page: page = key.page else: page = 100 self.action = None self.buttons = {} self.ttv = TTV(cache=True) self.ttv.page = page self.ttv.savepath = Plugin.get_cachepath() bg = self.ttv.create_background() xbmc.executebuiltin("Skin.SetString(bgimg, %s)" % bg) self.image = LOADING_IMG self.pref = ''
def get_casts(self, xml_filename): if self.verbose: print 'listing podcasts from xml file: %s' % xml_filename ok = True castcount = 0 catalog = os.path.join( self.resrspath, xml_filename ) parser = xml.sax.make_parser( ) folder = Podcasts( ) parser.setContentHandler( folder ) parser.parse( catalog ) for cast in folder.entries: #iterate and add to directory pfx = 'podcast'; type = self.FEED img = cast.image; link = cast.link lbl = cast.title.encode('utf-8', 'replace') if not img: #set default thumbnail if no image img = self.default_image #generate key for item url = Key.build_url( pfx, type=type, feed=link, image=img ) listitem = self.entry( lbl, thumbnailImage=img, path=url ) #add listitem to directory ok = self.add( self.hndl, url = url, listitem = listitem, isFolder = True ) castcount += 1 if self.verbose: print 'added %d feed entries' % castcount, print 'success: %s' % repr( ok ) #Tell end of directory listing self.eod( self.hndl, ok, False, False )
def __init__(self): Plugin.__init__(self) if self.state.refresh == True: self.state.refresh = False key = Key.build_url('program', words=self.state.__dict__) xbmc.executebuiltin("ReplaceWindow(Programs,%s)" % key) return self.stack = [] self.__set_settings() self.__map_functions() self.open() self.close() Session().close()
def get_casts(self, xml_filename): if self.verbose: print 'listing podcasts from xml file: %s' % xml_filename ok = True castcount = 0 catalog = os.path.join(self.resrspath, xml_filename) parser = xml.sax.make_parser() folder = Podcasts() parser.setContentHandler(folder) parser.parse(catalog) for cast in folder.entries: #iterate and add to directory pfx = 'podcast' type = self.FEED img = cast.image link = cast.link lbl = cast.title.encode('utf-8', 'replace') if not img: #set default thumbnail if no image img = self.default_image #generate key for item url = Key.build_url(pfx, type=type, feed=link, image=img) listitem = self.entry(lbl, thumbnailImage=img, path=url) #add listitem to directory ok = self.add(self.hndl, url=url, listitem=listitem, isFolder=True) castcount += 1 if self.verbose: print 'added %d feed entries' % castcount, print 'success: %s' % repr(ok) #Tell end of directory listing self.eod(self.hndl, ok, False, False)
def catalog(data, arg=None, parent=None, ext=None): istack = [] for m in re.finditer(regex.catalog, data): item = MediaObj() item.plot = m.group('plot') item.title = m.group('title') item.thumbnail = m.group('image').encode('ascii', 'ignore') #State identifiers item.key = Key() item.key.id = int(m.group('id')) if arg: item.key.arg = arg if parent: item.key.parent = parent item.key.type = m.group('type').encode('ascii', 'ignore') if ext: item = ext(item) istack.append(item) return istack
def __init__(self): key = Key(sys.argv[2]) self.hndl = int(sys.argv[1]) self.default_image = os.path.join(self.imagepath, self.PODICO) self._get_settings() #what to do next? ask the mighty key if key.type == self.VIDEO and key.feed == None: self.get_casts(self.VIDEOPOD_XML) elif key.type == self.AUDIO and key.feed == None: self.get_casts(self.AUDIOPOD_XML) elif key.type == self.FEED and key.feed: self.parse_feed(key.feed, key.image) if self.verbose: print 'end of plugin_podcast.MAIN()'
def search(data): search = [] #Iterate through the search result and append to stack for m in re.finditer(regex.search, data): item = MediaObj() type = m.group('type').encode('ascii') item.key = Key(type=type, id=m.group('id')) if item.key.type == SHOW_CLIP_INDEX: item.icon = video_index_icon item.isPlayable = True elif item.key.type == SHOW_CLIP: item.icon = video_icon item.isPlayable = True item.title = m.group('title') item.plot = m.group('plot') search.append(item) return search
def playlist(data, vignetes=True): plist = [] for match in re.finditer(regex.playlist_xml, data): item = MediaObj() item.url = match.group('url').replace('&', '&') item.title = match.group('title') #item.defntion = match.group('type') item.defntion = 'video/mp4' item.isFolder = False item.isPlayable = True item.key = Key() if item.title.endswith(PLAYLIST_VIGNETE): item.key.type = PLAYLIST_VIGNETE else: item.key.type = PLAYLIST_ITEM if item.key.type == PLAYLIST_VIGNETE and vignetes == False: continue else: plist.append(item) return plist
def parse_main_directory(self): if self.verbose: print 'list main feed directory' ok = True index = 0 for lbl, id in FeedInfo(): prefix, type, id = ('nrkbeta', 'feed', index) url = Key.build_url(prefix, type=type, id=id) li = self.entry(lbl, iconImage=self.RSSICO, thumbnailImage=self.RSSICO) ok = self.add(self.hndl, url=url, listitem=li, isFolder=True) index += 1 if self.verbose: print 'added %d entries. success: %s' % (index, repr(ok)) if ok: #tell end of directory self.eod(self.hndl)
def regions(resource_path=rpath): return [ MediaObj( #title = 'More og Romsdal', title=lang(30150), thumbnail=os.path.join(resource_path, 'ndmr.gif'), key=Key(id=REGION, arg='ndmr', type=PLAYLIST)), MediaObj( #title = 'Hordaland', title=lang(30151), thumbnail=os.path.join(resource_path, 'ndho.gif'), key=Key(id=REGION, arg='ndho', type=PLAYLIST)), MediaObj( #title = 'Nord-Norge', title=lang(30152), thumbnail=os.path.join(resource_path, 'ndno.gif'), key=Key(id=REGION, arg='ndno', type=PLAYLIST)), MediaObj( #title = 'Rogaland', title=lang(30153), thumbnail=os.path.join(resource_path, 'ndro.gif'), key=Key(id=REGION, arg='ndro', type=PLAYLIST)), MediaObj( #title = 'Sogn og Fjordane', title=lang(30154), thumbnail=os.path.join(resource_path, 'ndsf.gif'), key=Key(id=REGION, arg='ndsf', type=PLAYLIST)), MediaObj( #title = 'Sorlandet', title=lang(30155), thumbnail=os.path.join(resource_path, 'ndsl.gif'), key=Key(id=REGION, args='ndsl', type=PLAYLIST)), MediaObj( #title = 'Trondelag', title=lang(30156), thumbnail=os.path.join(resource_path, 'ndtl.gif'), key=Key(id=REGION, arg='ndtl', type=PLAYLIST)), MediaObj( #title = 'Ostafjells', title=lang(30157), thumbnail=os.path.join(resource_path, 'ndtt.gif'), key=Key(id=REGION, arg='ndtt', type=PLAYLIST)), MediaObj( #title = 'Ostfold', title=lang(30158), thumbnail=os.path.join(resource_path, 'ndos.gif'), key=Key(id=REGION, arg='ndos', type=PLAYLIST)), MediaObj( #title = 'Ostlandssendingen', title=lang(30159), thumbnail=os.path.join(resource_path, 'ndoa.gif'), key=Key(id=REGION, arg='ndoa', type=PLAYLIST)), MediaObj( #title = 'Hedmark og oppland', title=lang(30160), thumbnail=os.path.join(resource_path, 'ndop.gif'), key=Key(id=REGION, arg='ndop', type=PLAYLIST)) ]
def create_directory(self): if self.state.type == nrk.PLAYLIST: self.player = utils.PluginPlayer() Log.notice('PLUGIN::SPAM -> Set plugin dir content "%s"' % self.content) self.dir.set_content(self.content) if self.settings['fetch_path']: if (self.state.type == nrk.SHOW or self.state.type == nrk.SHOW_FOLDER): self.category = self.api.get_path(self.state.id, self.state.type) self.set_category() else: self.set_category() for i in self: li = ListItem(i.title, thumbnailImage=i.thumbnail) overlay = ( xbmcgui.ICON_OVERLAY_UNWATCHED, xbmcgui.ICON_OVERLAY_WATCHED,)[ self.session.data_objects['watched'].has_key(i.key.id)] if i.isPlayable is True: li.setProperty('IsPlayable', 'true') li.setInfo( 'video', { 'plot': i.plot, 'title': i.title, 'overlay': overlay } ) try: li.setLabel2(self.type_dict[i.key.type]) except: pass if self.state.type == nrk.PLAYLIST and self.state.view: self.player.queue(i.url, li) commands = [] commands.append(( lang(30300), 'XBMC.RunPlugin(%s)' % ( Key.build_url( 'program', words = self.state.__dict__, refresh = True )), )) if i.key.type == nrk.SHOW: commands.append(( lang(30301), 'XBMC.RunPlugin(%s)' % ( Key.build_url( 'favorites', action = 'add', name = i.title, thumb = i.thumbnail, id = i.key.id )), )) elif i.defntion == 'video/mp4': commands.append(( lang(30302), 'XBMC.RunPlugin(%s)' % ( Key.build_url( 'nogui', action = 'download', name = i.title, thumb = i.thumbnail, url = i.url )), )) li.addContextMenuItems( commands ) if i.key.type != nrk.VIGNETE: ok = self.dir.add(i.url, li, i.isFolder, int(sys.argv[1])) if ok == False: break if self.state.type == nrk.PLAYLIST and self.state.view: if self.settings.autoplay_playlist == True: self.player.playQueue()
def create_directory(self): if self.state.type == nrk.PLAYLIST: self.player = utils.PluginPlayer() Log.notice('PLUGIN::SPAM -> Set plugin dir content "%s"' % self.content) self.dir.set_content(self.content) if self.settings['fetch_path']: if (self.state.type == nrk.SHOW or self.state.type == nrk.SHOW_FOLDER): self.category = self.api.get_path(self.state.id, self.state.type) self.set_category() else: self.set_category() for i in self: li = ListItem(i.title, thumbnailImage=i.thumbnail) overlay = ( xbmcgui.ICON_OVERLAY_UNWATCHED, xbmcgui.ICON_OVERLAY_WATCHED, )[self.session.data_objects['watched'].has_key(i.key.id)] if i.isPlayable is True: li.setProperty('IsPlayable', 'true') li.setInfo('video', { 'plot': i.plot, 'title': i.title, 'overlay': overlay }) try: li.setLabel2(self.type_dict[i.key.type]) except: pass if self.state.type == nrk.PLAYLIST and self.state.view: self.player.queue(i.url, li) commands = [] commands.append(( lang(30300), 'XBMC.RunPlugin(%s)' % (Key.build_url( 'program', words=self.state.__dict__, refresh=True)), )) if i.key.type == nrk.SHOW: commands.append(( lang(30301), 'XBMC.RunPlugin(%s)' % (Key.build_url('favorites', action='add', name=i.title, thumb=i.thumbnail, id=i.key.id)), )) elif i.defntion == 'video/mp4': commands.append(( lang(30302), 'XBMC.RunPlugin(%s)' % (Key.build_url('nogui', action='download', name=i.title, thumb=i.thumbnail, url=i.url)), )) li.addContextMenuItems(commands) if i.key.type != nrk.VIGNETE: ok = self.dir.add(i.url, li, i.isFolder, int(sys.argv[1])) if ok == False: break if self.state.type == nrk.PLAYLIST and self.state.view: if self.settings.autoplay_playlist == True: self.player.playQueue()
def by_theme(resource_path=rpath): return [ MediaObj( #title = 'Barn', title=lang(30100), thumbnail=os.path.join(resource_path, 'kids.png'), key=Key(id=2, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Natur', title=lang(30101), thumbnail=os.path.join(resource_path, 'ntur.png'), key=Key(id=7, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Drama', title=lang(30102), thumbnail=os.path.join(resource_path, 'drma.png'), key=Key(id=3, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Sport', title=lang(30103), thumbnail=os.path.join(resource_path, 'sprt.png'), key=Key(id=10, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Fakta', title=lang(30104), thumbnail=os.path.join(resource_path, 'fact.png'), key=Key(id=4, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Livssyn', title=lang(30105), thumbnail=os.path.join(resource_path, 'life.png'), key=Key(id=9, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Mat', title=lang(30106), thumbnail=os.path.join(resource_path, 'food.png'), key=Key(id=6, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Nyheter', title=lang(30107), thumbnail=os.path.join(resource_path, 'news.png'), key=Key(id=8, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Samisk', title=lang(30108), thumbnail=os.path.join(resource_path, 'sami.png'), key=Key(id=19, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Ung', title=lang(30109), thumbnail=os.path.join(resource_path, 'teen.png'), key=Key(id=21, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Tegnspraak', title=lang(30110), thumbnail=os.path.join(resource_path, 'sign.png'), key=Key(id=22, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Underholdning', title=lang(30111), thumbnail=os.path.join(resource_path, 'entn.png'), key=Key(id=11, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Dokumentar', title=lang(30112), thumbnail=os.path.join(resource_path, 'docu.png'), key=Key(id=20, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Kultur', title=lang(30113), thumbnail=os.path.join(resource_path, 'cult.png'), key=Key(id=5, type=PROGRAM, view=BY_THEME)), MediaObj( #title = REGION, title=lang(30114), thumbnail=os.path.join(resource_path, 'rgns.png'), key=Key(id=13, type=PROGRAM, view=BY_THEME)) ]
class views: search = MediaObj( #title = 'Sok', title=lang(30205), defntion='folder/perspektiv', isFolder=True, thumbnail=os.path.join(rpath, 'search-icon.png'), key=Key(id=1, type=SEARCH)) archive = MediaObj( #title = 'Arkiv', title=lang(30200), defntion='folder/perspektiv', isFolder=True, thumbnail=os.path.join(rpath, 'archive-icon.png'), key=Key(id=REGION, type=PLAYLIST, view=PROGRAM, arg=PROGRAM)) @staticmethod def by_char(): import string items = [] for c in string.ascii_uppercase: item = MediaObj( #title = 'Vis bokstav "%s"' % c, title=lang(30206) % c, thumbnail=os.path.join(rpath, '%s.png' % c), key=Key(id=c, type=PROGRAM, view=BY_CHAR)) items.append(item) return items @staticmethod def playlist(parent): return [ MediaObj( key=Key(type=PLAYLIST, id=parent.id, view=RELEVANT, arg=parent.arg), #title = 'Aktuelt', title=lang(30201), thumbnail=os.path.join(rpath, 'news-icon.png')), MediaObj( key=Key(type=PLAYLIST, id=parent.id, view=TOP_TOTAL, arg=parent.arg), #title = 'Mest sett totalt', title=lang(30202), thumbnail=os.path.join(rpath, 'stats-icon.png')), MediaObj( key=Key(type=PLAYLIST, id=parent.id, view=TOP_THIS_MONTH, arg=parent.arg), #title = 'Mest sett denne maned', title=lang(30204), thumbnail=os.path.join(rpath, 'stats-icon.png')), MediaObj( key=Key(type=PLAYLIST, id=parent.id, view=TOP_THIS_WEEK, arg=parent.arg), #title = 'Mest sett denne uken', title=lang(30203), thumbnail=os.path.join(rpath, 'stats-icon.png')) ] @staticmethod def program(parent, resource_path=rpath): return [ MediaObj( key=Key(id=None, type=PROGRAM, view=BY_CHAR), #title = 'Vis alfabetisk', title=lang(30208), parent=parent, thumbnail=os.path.join(resource_path, 'char-icon.png')), MediaObj( key=Key(id='@', type=PROGRAM, view=VIEW_ALL), #title = 'Vis alle', title=lang(30207), parent=parent, thumbnail=os.path.join(resource_path, 'all-icon.png')), MediaObj( key=Key(type=PROGRAM, view=BY_THEME), #title = 'Vis tema liste', title=lang(30209), parent=parent, thumbnail=os.path.join(resource_path, 'theme-icon.png')), MediaObj( key=Key(type=PROGRAM, id=3650, view=TOP_TOTAL), #title = 'Mest sett totalt', title=lang(30202), parent=parent, thumbnail=os.path.join(resource_path, 'stats-icon.png')), MediaObj( key=Key(type=PROGRAM, id=31, view=TOP_THIS_MONTH), #title = 'Mest sett denne maned', title=lang(30204), parent=parent, thumbnail=os.path.join(resource_path, 'stats-icon.png')), MediaObj( key=Key(type=PROGRAM, id=7, view=TOP_THIS_WEEK), #title = 'Mest sett denne uken', title=lang(30203), parent=parent, thumbnail=os.path.join(resource_path, 'stats-icon.png')), MediaObj( key=Key(type=PROGRAM, id=0, view=TOP_BY_INPUT), #title = 'Mest sett siste X dager', title=lang(30218), parent=parent, thumbnail=os.path.join(resource_path, 'input.png')), MediaObj( key=Key(type=PROGRAM, view=RECOMMENDED), #title = 'Anbefalte programmer', title=lang(30217), parent=parent, thumbnail=os.path.join(resource_path, 'favorites.png')), MediaObj( key=Key(type=PROGRAM, view=ARTICLES), #title = 'Artikler', title=lang(30219), parent=parent, thumbnail=os.path.join(resource_path, 'article.png')) ] theme_title = { 2: 'Barn', 7: 'Natur', 20: 'Dokumentar', 10: 'Sport', 4: 'Fakta', 9: 'Livssyn', 6: 'Mat', 8: 'Nyheter', 22: 'Tegnsprak', 21: 'Ung', 19: 'Samisk', 11: 'Underholdning', 3: 'Drama', 5: 'Kultur', 12: 'Distrikt' } @staticmethod def by_theme(resource_path=rpath): return [ MediaObj( #title = 'Barn', title=lang(30100), thumbnail=os.path.join(resource_path, 'kids.png'), key=Key(id=2, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Natur', title=lang(30101), thumbnail=os.path.join(resource_path, 'ntur.png'), key=Key(id=7, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Drama', title=lang(30102), thumbnail=os.path.join(resource_path, 'drma.png'), key=Key(id=3, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Sport', title=lang(30103), thumbnail=os.path.join(resource_path, 'sprt.png'), key=Key(id=10, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Fakta', title=lang(30104), thumbnail=os.path.join(resource_path, 'fact.png'), key=Key(id=4, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Livssyn', title=lang(30105), thumbnail=os.path.join(resource_path, 'life.png'), key=Key(id=9, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Mat', title=lang(30106), thumbnail=os.path.join(resource_path, 'food.png'), key=Key(id=6, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Nyheter', title=lang(30107), thumbnail=os.path.join(resource_path, 'news.png'), key=Key(id=8, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Samisk', title=lang(30108), thumbnail=os.path.join(resource_path, 'sami.png'), key=Key(id=19, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Ung', title=lang(30109), thumbnail=os.path.join(resource_path, 'teen.png'), key=Key(id=21, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Tegnspraak', title=lang(30110), thumbnail=os.path.join(resource_path, 'sign.png'), key=Key(id=22, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Underholdning', title=lang(30111), thumbnail=os.path.join(resource_path, 'entn.png'), key=Key(id=11, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Dokumentar', title=lang(30112), thumbnail=os.path.join(resource_path, 'docu.png'), key=Key(id=20, type=PROGRAM, view=BY_THEME)), MediaObj( #title = 'Kultur', title=lang(30113), thumbnail=os.path.join(resource_path, 'cult.png'), key=Key(id=5, type=PROGRAM, view=BY_THEME)), MediaObj( #title = REGION, title=lang(30114), thumbnail=os.path.join(resource_path, 'rgns.png'), key=Key(id=13, type=PROGRAM, view=BY_THEME)) ] @staticmethod def regions(resource_path=rpath): return [ MediaObj( #title = 'More og Romsdal', title=lang(30150), thumbnail=os.path.join(resource_path, 'ndmr.gif'), key=Key(id=REGION, arg='ndmr', type=PLAYLIST)), MediaObj( #title = 'Hordaland', title=lang(30151), thumbnail=os.path.join(resource_path, 'ndho.gif'), key=Key(id=REGION, arg='ndho', type=PLAYLIST)), MediaObj( #title = 'Nord-Norge', title=lang(30152), thumbnail=os.path.join(resource_path, 'ndno.gif'), key=Key(id=REGION, arg='ndno', type=PLAYLIST)), MediaObj( #title = 'Rogaland', title=lang(30153), thumbnail=os.path.join(resource_path, 'ndro.gif'), key=Key(id=REGION, arg='ndro', type=PLAYLIST)), MediaObj( #title = 'Sogn og Fjordane', title=lang(30154), thumbnail=os.path.join(resource_path, 'ndsf.gif'), key=Key(id=REGION, arg='ndsf', type=PLAYLIST)), MediaObj( #title = 'Sorlandet', title=lang(30155), thumbnail=os.path.join(resource_path, 'ndsl.gif'), key=Key(id=REGION, args='ndsl', type=PLAYLIST)), MediaObj( #title = 'Trondelag', title=lang(30156), thumbnail=os.path.join(resource_path, 'ndtl.gif'), key=Key(id=REGION, arg='ndtl', type=PLAYLIST)), MediaObj( #title = 'Ostafjells', title=lang(30157), thumbnail=os.path.join(resource_path, 'ndtt.gif'), key=Key(id=REGION, arg='ndtt', type=PLAYLIST)), MediaObj( #title = 'Ostfold', title=lang(30158), thumbnail=os.path.join(resource_path, 'ndos.gif'), key=Key(id=REGION, arg='ndos', type=PLAYLIST)), MediaObj( #title = 'Ostlandssendingen', title=lang(30159), thumbnail=os.path.join(resource_path, 'ndoa.gif'), key=Key(id=REGION, arg='ndoa', type=PLAYLIST)), MediaObj( #title = 'Hedmark og oppland', title=lang(30160), thumbnail=os.path.join(resource_path, 'ndop.gif'), key=Key(id=REGION, arg='ndop', type=PLAYLIST)) ]
def add(self, label, url, type="channel", prefix="kanalene", img="", icon="", isdir=False): url = Key.build_url(prefix, type=type, url=url) li = ListItem(label, iconImage=icon, thumbnailImage=img) li.setProperty("IsPlayable", "true") ok = addDirectoryItem(self.hndl, url=url, listitem=li, isFolder=isdir) return ok