def BuildCurrentAndNextItemsForLoadedPagesDict(self, sourceItem, pagesDict): currentItem = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP) currentItem.SetLabel(sourceItem.GetLabel()) currentItem.SetPath(sourceItem.GetPath()) if pagesDict.has_key("paging"): currentItem.SetTitle(pagesDict["paging"]) if pagesDict.has_key("search"): currentItem.SetProperty("search", pagesDict["search"]) if sourceItem.GetProperty("isSearch"): currentItem.SetProperty("isSearch", "true") mc.LogInfo("current item: %s %s" % (currentItem.GetTitle(), currentItem.GetPath())) if pagesDict.has_key("next"): nextItem = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP) nextEXItem = pagesDict["next"] nextItem.SetLabel(sourceItem.GetLabel()) nextItem.SetPath(nextEXItem["path"]) nextItem.SetTitle(nextEXItem["name"]) if nextEXItem.has_key("isSearch"): nextItem.SetProperty("isSearch", "true") mc.LogInfo("next item: %s %s" % (nextItem.GetTitle(), nextItem.GetPath())) return currentItem, nextItem else: return currentItem, None
def OnShowVideoResumeDialog(self, playItem, referenceItem, isPlaylist): self.playItem = playItem self.isPlaylistActive = isPlaylist timeToResumeInSeconds = 0 if referenceItem.GetProperty("timeToResume"): timeToResumeInSeconds = float( referenceItem.GetProperty("timeToResume")) mc.ActivateWindow(self.WINDOW_ID) actionItems = mc.ListItems() # first (default) iyem represents "continue from ..." actionItem = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) #timeStr = time.strftime("%H:%M:%S", timeToResumeInSeconds) #timeStr = datetime.timedelta(seconds=timeToResumeInSeconds) actionItem.SetLabel( mc.GetLocalizedString(12022) % self.GetInHMS(timeToResumeInSeconds)) actionItems.append(actionItem) # second item is "start from the beginning" actionItem = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) actionItem.SetLabel(mc.GetLocalizedString(12021)) actionItems.append(actionItem) self.GetList().SetItems(actionItems)
def createTVList(update=False): global tv_list, config, ipaddress # create new list itemList = mc.ListItems() epg_list = loadTVEpg(True) # iterate services for service in epg_list: item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_OTHER) item.SetPath("http://" + ipaddress + ":8001/" + service['reference']) label = service['servicename'] try: label += " - " + datetime.fromtimestamp(float( service['start'])).strftime("%H:%M") label += " " + service['title'] item.SetDescription( service['description'] + ' ' + service['descriptionextended'], False) except ValueError: print "DREAMBOXEE: no descriptin aviable for: " + service[ 'servicename'] item.SetLabel(label) itemList.append(item) tv_list = itemList return tv_list
def getPhotoList(self, listItem): #photoUrl = self.getUrl(self.getRootUrl(), fullUrl) url = self.getUrl(self.getRootUrl(), listItem.GetProperty('parentKey')) data = mc.Http().Get(url+'/children') if data: list = mc.ListItems() tree = ElementTree.fromstring(data) for photoNode in tree.findall("Photo"): title = photoNode.attrib.get("title", "Plex Photo") key = photoNode.attrib.get('key') for part in photoNode.findall("Media/Part"): li = mc.ListItem(mc.ListItem.MEDIA_PICTURE) li.SetProperty('key',key) li.SetTitle(title) li.SetLabel(title) li.SetPath(self.getUrl(self.getRootUrl(), key)) li.SetProperty('rotation','') li.SetProperty('zoom','') #Resize images li.SetImage(0, self.getThumbUrl(part.attrib.get('key'),1280,1280)) #li.SetImage(0, self.getUrl(self.getRootUrl(), part.attrib.get('key'))) list.append(li) return list else: return None
def load_ui(): global params, APP, CONFIG_WINDOW # Initialize LOG items = mc.ListItems() item = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) item.SetLabel(VERSION) items.append(item) CONFIG_WINDOW.GetList(700).SetItems(items) params = APP.GetLaunchedWindowParameters() CONFIG_WINDOW.GetEdit(9001).SetText(params['client_address']) CONFIG_WINDOW.GetEdit(9002).SetText(params['client_user']) CONFIG_WINDOW.GetEdit(9003).SetText(params['client_pass']) CONFIG_WINDOW.GetControl(7000).SetVisible(True) CONFIG_WINDOW.GetControl(3000).SetVisible(False) items = mc.ListItems() if params['client_name']: auth = params['client_user'] != '' item = create_client_item(params['client_name'], params['client_address'], auth) item.SetProperty('username', params['client_user']) item.SetProperty('password', params['client_pass']) items.append(item) else: item = create_client_item('Unknown', 'localhost', False) items.append(item) CONFIG_WINDOW.GetList(200).SetItems(items)
def CreateHTMLListItem(url): #mc.ShowDialogOk("Debug", "Creating HTMLListItem") uri = urlparse.urlparse(url) if not uri[0]: url = "http://" + urlparse.urlunparse(uri) uri = urlparse.urlparse(url) domain = uri[1] domain = domain.split('.') if len(domain) > 2: domain = domain[-2:] domain = ".".join(domain) badUrl = False http = mc.Http() if not http.Get(url): badUrl = True if not badUrl: item = mc.ListItem() item.SetLabel("Navi-X Browser") item.SetAddToHistory(False) item.SetReportToServer(False) item.SetContentType("text/html") item.SetPath(url) #return item return {"code":0,"data":item} else: #mc.ShowDialogOk("Error: html", "The address does not exist or cannot be displayed through the browser.") return {"code":1,"data":"The address does not exist or cannot be displayed through the browser."}
def ShowItems(list_items, data, regex, title, label): if title == "": title = label label = "" # get show info info = re.compile(REGEX_ITEM_INFO, re.DOTALL + re.IGNORECASE + re.M).search(data) # get show thumb thumb = re.compile(REGEX_ITEM_THUMB, re.DOTALL + re.IGNORECASE + re.M).search(data) # get items results = re.compile(regex, re.DOTALL + re.IGNORECASE + re.M).findall(data) # specify thumb try: if thumb.group(1): thumbUri = thumb.group(1) except: thumbUri = '' # loop through items for result in results: list_item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP) # set label list_item.SetLabel(str(uzgf.unescape(result[1]).encode('utf-8').replace("()", "(onbekende datum)"))) # set description list_item.SetDescription(str(uzgf.unescape(info.group(1).replace("\n", " ").strip()).encode('utf-8'))) # set thumb list_item.SetThumbnail(str(thumbUri.encode('utf-8'))) # set the path for doAction list_item.SetPath("feed://play/"+base64.b64encode(result[0], "_;")) list_item.SetProperty("title", title) list_item.SetProperty("subtitle", label) # add the item to the list items container list_items.append(list_item) # return it return list_items
def favoriteTeams(): try: mc.ShowDialogWait() data = getJson( 'http://mlb.mlb.com/lookup/json/named.team_all.bam?sport_code=%27mlb%27&active_sw=%27Y%27&all_star_sw=%27N%27' ) data = data.get('team_all').get('queryResults').get('row') teamList = mc.ListItems() for team in data: item = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) item.SetLabel(str(team.get('name_display_full'))) item.SetThumbnail( ('http://mlb.mlb.com/images/logos/200x200/200x200_%s.png' % str(team.get('name_abbrev')))) item.SetProperty('team-id', str(team.get('team_id'))) item.SetProperty('team-abbrev', str(team.get('team_abbrev'))) teamList.append(item) favList = [] for ( index, team, ) in enumerate(teamList): if ((team.GetProperty('team-id') in favList) and teamList.SetSelected(index, True)): pass mc.HideDialogWait() return teamList except Exception, e: raiseError(log='favoriteteams', error=e)
def RestoreFromDefaults(self): stringRep = mc.GetApp().GetLocalConfig().GetValue("history-items") if len(stringRep) > 0: #mc.LogInfo("string representation of items: %s" % stringRep) listLoaded = pickle.loads(stringRep) list = [] for item in listLoaded: type = mc.ListItem.MEDIA_VIDEO_FEATURE_FILM playItem = mc.ListItem(type) playItem.SetThumbnail(item["image"]) playItem.SetTitle(item["title"]) playItem.SetDescription(item["description"]) playItem.SetLabel(item["title"]) playItem.SetPath(item["path"]) if item.has_key("timeToResume"): playItem.SetProperty("timeToResume", item["timeToResume"]) if item.has_key("lastViewedEpisodeIndex"): playItem.SetProperty("lastViewedEpisodeIndex", item["lastViewedEpisodeIndex"]) if item.has_key('folder'): playItem.SetProperty('folder', item['folder']) list.append(playItem) return list else: return []
def getFeaturedMixes(count): mc.ShowDialogWait() featured_url = "http://8tracks.com/mixes.json?api_key=a07ee2f7cc1577f749ed10d2c796fc52515243cc&api_version=2&per_page=%s&page=1" % count fd = urllib.urlopen(featured_url) mix_sets = simplejson.loads(fd.read()) listItems = mc.ListItems() for mix in mix_sets["mixes"]: item = mc.ListItem(mc.ListItem.MEDIA_AUDIO_OTHER) item.SetArtist(str(mix["user"]["login"])) year = mix['first_published_at'][1:4] month = mix['first_published_at'][6:7] day=mix['first_published_at'][9:10] item.SetDate(int(year), int(month), int(day)) name = mix["name"].replace(u'\xbd', '') item.SetLabel(str(name)) item.SetThumbnail(str(mix['cover_urls']['original'])) item.SetIcon(str(mix['cover_urls']['sq100'])) # get the real track url, so default actions like play would work # this should not be here! trackD = urllib.urlopen("http://8tracks.com/sets/460486803/play.json?mix_id=%s&api_key=a07ee2f7cc1577f749ed10d2c796fc52515243cc&api_version=2" % mix["id"]) trackInformation = simplejson.loads(trackD.read()) item.SetPath(str(trackInformation['set']['track']['url'])) item.SetProperty("id", str(mix['id'])) listItems.append(item) mc.GetWindow(14000).GetList(201).SetItems(listItems) mc.GetWindow(14000).GetList(201).Refresh() mc.GetWindow(14000).GetList(201).SetFocusedItem(0) mc.HideDialogWait()
def OnRecentlyViewed(self): if not self.IsRecentlyViewedActive(): listItem = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP) listItem.SetLabel(self.localizedString("Recently Viewed")) listItem.SetPath("history://") self.SaveWindowState() self.StartNavNewSection(listItem.GetLabel(), listItem, None) self.ReloadRecentlyViewedSection()
def createItem(dict): listItem = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) try: listItem.SetLabel(dict['label'].encode('utf-8')) except: try: listItem.SetLabel(dict['label']) except: pass try: listItem.SetProperty('label2', dict['label2'].encode('utf-8')) except: try: listItem.SetProperty('label2', dict['label2']) except: pass try: listItem.SetProperty('action', dict['action']) except: pass try: listItem.SetProperty('state', dict['state']) except: pass try: listItem.SetProperty('handle', dict['handle']) except: pass try: listItem.SetThumbnail(str(dict['thumbnail'])) except: pass try: listItem.SetIcon(str(dict['icon'])) except: pass try: listItem.SetTitle(dict['title'].encode('utf-8')) except: try: listItem.SetTitle(dict['title']) except: pass try: listItem.SetArist(dict['artist'].encode('utf-8')) except: try: listItem.SetArist(dict['artist']) except: pass try: listItem.SetAlbum(dict['album'].encode('utf-8')) except: try: listItem.SetAlbum(dict['album']) except: pass return listItem
def getSubtitles(self, fullUrl): """ Return list of subtitles Jinxo: Only the default - and any SRT files are supported at present """ subItems = mc.ListItems() subItem = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) subItem.SetLabel("None") subItem.SetPath("") subItems.append(subItem) videoUrl = self.getUrl(self.getRootUrl(), fullUrl) data = mc.Http().Get(videoUrl) if data: tree = ElementTree.fromstring(data) videoNode = tree[0] foundDefault = False for stream in videoNode.findall("Media/Part/Stream"): if stream.attrib.get("streamType","0") != "3": continue subItem = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) language = stream.attrib.get("language","Unknown") format = stream.attrib.get("format","?") path = stream.attrib.get("key","") source = "File" if path != "": subItem.SetPath(self.getUrl(self.getRootUrl(), path)) else: #Jinxo: Only default supported at the moment, as I haven't been able to switch to another.... source = "Embedded" default = stream.attrib.get("default","") if default == "": continue if foundDefault: continue foundDefault = True #Jinxo: The value doesn't matter - just enter something subItem.SetPath("1"); label = language + " (" + format.upper() + ":" + source + ")" subItem.SetLabel(label.encode('utf-8')) subItems.append(subItem) return subItems;
def AddToDir(label = "", desc = "", link = "", thumb = "", properties = {}, type = mc.ListItem.MEDIA_VIDEO_CLIP): list_item = mc.ListItem(type) list_item.SetLabel(str(label.encode('utf-8','ignore'))) list_item.SetThumbnail(str(thumb.encode('utf-8','ignore'))) list_item.SetDescription(str(desc.encode('utf-8','ignore'))) for naam, value in properties.items(): list_item.SetProperty(str(naam.encode('utf-8','ignore')), str(value.encode('utf-8','ignore'))) list_item.SetPath(str(link.encode('utf-8','ignore'))) dir.append(list_item)
def EmptyEpisode(): targetcontrol = 52 targetwindow = 14000 list = mc.GetWindow(targetwindow).GetList(targetcontrol) list_items = mc.ListItems() list_item = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) list_item.SetLabel('') list_item.SetPath('') list_items.append(list_item) list.SetItems(list_items)
def create_item_from_torrent(self, torrent): ''' Creates a ListItem from a torrent dict. Used when adding torrents to the list. ''' item = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) item.SetLabel(torrent['label']) item = self.update_item_from_torrent(item, torrent) self.refresh_list = True return item
def loadFavorites(): try: mc.ShowDialogWait() mc.GetActiveWindow().PushState() if isLoggedIn(): response = callService('teams') data = json.loads(response) data = data.get('teams') division = { '200': mc.ListItems(), '201': mc.ListItems(), '202': mc.ListItems(), '203': mc.ListItems(), '204': mc.ListItems(), '205': mc.ListItems() } for team in data: item = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) item.SetLabel(str(team.get('title'))) item.SetThumbnail(str(team.get('thumb'))) item.SetProperty('team-id', str(team.get('team-id'))) item.SetProperty('team-abbrev', str(team.get('team-abbrev'))) item.SetProperty('team-leauge', str(team.get('team-leauge'))) item.SetProperty('team-division', str(team.get('team-division'))) item.SetProperty('team-fav', str(team.get('team-fav'))) div = str(team.get('team-division')) division[div].append(item) for div in division: mc.GetActiveWindow().GetList(int(div)).SetItems(division[div]) list = mc.GetActiveWindow().GetList(int(div)) for ( i, v, ) in enumerate(list.GetItems()): if ((v.GetProperty('team-fav') == '1') and list.SetSelected(i, True)): pass mc.GetActiveWindow().GetControl(3000).SetVisible(True) mc.GetActiveWindow().GetList(200).SetFocusedItem(0) mc.GetActiveWindow().GetControl(200).SetFocus() mc.GetActiveWindow().GetList(200).SetFocusedItem(0) else: return raiseError( 'You must be logged in to access your favorite teams!') mc.HideDialogWait() except Exception, e: mc.GetActiveWindow().PopState() return raiseError( 'An error occured while accessing your favorite team settings. Are you logged in?', log='loadfavorites', error=e)
def loadSports(): mc.ShowDialogWait() sportsList = mc.GetActiveWindow().GetList(9000) sportsItems = mc.ListItems() for sport in SPORTS: sportItem = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) sportItem.SetLabel(sport.get('title', 'Unknown')) sportItem.SetProperty("id", str(sport.get('id', -1))) sportsItems.append(sportItem) sportsList.SetItems(sportsItems) mc.HideDialogWait()
def OnDialogLoad(self): # external caller is responsible to prepare shared boxee video playlist # before show this dialog videoPlaylist = mc.PlayList(mc.PlayList.PLAYLIST_VIDEO) videos = mc.ListItems() for i in range(videoPlaylist.Size()): playlistItem = videoPlaylist.GetItem(i) item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_EPISODE) item.SetLabel(playlistItem.GetLabel()) item.SetDescription(playlistItem.GetDescription()) item.SetPath(playlistItem.GetPath()) videos.append(item) self.GetPlaylistList().SetItems(videos) index = exPlayer.GetPlayer().GetLastViewedEpisodeIndexInPlaylist() self.GetPlaylistList().SetFocusedItem(index) self.GetPlaylistList().SetSelected(index, True) dialogTitle = mc.GetLocalizedString(559) + ": " + videoPlaylist.GetItem(0).GetTitle() self.GetDialogTitleLabel().SetLabel(dialogTitle) mc.LogInfo("Playlist thumbnail: %s" % videoPlaylist.GetItem(0).GetThumbnail()) self.GetFineArtImage().SetTexture(videoPlaylist.GetItem(0).GetThumbnail()) # fill up actions buttons list actionItems = mc.ListItems() actionItem = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) # localize with 'more info' # actionItem.SetLabel(mc.GetLocalizedString(53710)) actionItem.SetLabel(exlocalizer.GetSharedLocalizer().localizedString('Info')) actionItem.SetThumbnail('action_more.png') actionItems.append(actionItem) actionItem = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) # localize with 'add to favorites' #actionItem.SetLabel(mc.GetLocalizedString(53729)) actionItem.SetLabel(exlocalizer.GetSharedLocalizer().localizedString('Add to Favorites')) actionItem.SetThumbnail('action_queue_add.png') actionItems.append(actionItem) self.GetActionsList().SetItems(actionItems) mc.LogInfo("Select playlist window is loaded")
def createListItem(self, url, song, url2): listItem = mc.ListItem(mc.ListItem.MEDIA_AUDIO_MUSIC) listItem.SetTitle(song.name.encode('utf-8')) listItem.SetThumbnail(str(song.coverart)) listItem.SetIcon(str(song.coverart)) listItem.SetAlbum(song.albumName.encode('utf-8')) listItem.SetArtist(song.artistName.encode('utf-8')) listItem.SetProperty('action', 'songs') listItem.SetContentType('audio/mpeg') listItem.SetProperty('info', str(url2)) listItem.SetPath(str(url)) return listItem
def _createListItem(self, element, fullUrl): # Important Properties listItem = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) listItem.SetProperty("itemtype", element.tag) listItem.SetProperty("machineidentifier", util.cleanString(self.machineIdentifier)) if element.attrib.has_key("key"): listItem.SetPath(self.getUrl(fullUrl, element.attrib["key"])) # Copy everything for attribute in element.attrib: #print util.cleanString(attribute), util.cleanString(element.attrib[attribute]) listItem.SetProperty( util.cleanString(attribute).lower(), util.cleanString(element.attrib[attribute])) # Extra information genreNode = element.find("Genre") if genreNode: listItem.SetProperty( "genre", util.cleanString(genreNode.attrib.get("tag", ""))) if element.attrib.has_key("duration"): listItem.SetProperty( "durationformatted", str( datetime.timedelta( milliseconds=int(element.attrib["duration"])))) if element.attrib.has_key("rating"): listItem.SetProperty( "roundedrating", str(int(round(float(element.attrib["rating"]))))) # Image paths if element.attrib.has_key("art"): listItem.SetProperty("artpath", self.getUrl(fullUrl, element.attrib['art'])) if element.attrib.has_key("thumb"): listItem.SetImage( 0, self.getThumbUrl(element.attrib["thumb"], PlexServer.THUMB_WIDTH, PlexServer.THUMB_HEIGHT)) return listItem
def OnDialogLoad(self): items = mc.ListItems() items.append(self.playItem) self.GetItemList().SetItems(items) self.GetItemList().SetFocusedItem(0) # fill up actions buttons list actionItems = mc.ListItems() actionItem = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) # localize with 'add to favorites' #actionItem.SetLabel(mc.GetLocalizedString(14086)) actionItem.SetLabel(exlocalizer.GetSharedLocalizer().localizedString('Playback')) actionItem.SetThumbnail('action_play.png') actionItems.append(actionItem) actionItem = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) # localize with 'add to favorites' actionItem.SetLabel(exlocalizer.GetSharedLocalizer().localizedString('Add to Favorites')) actionItem.SetThumbnail('action_queue_add.png') actionItems.append(actionItem) self.GetActionsList().SetItems(actionItems)
def UpdatePagesPanelWithSearchResults(self, query, pagesDict): listItems = exc.BuildPanelItemsList(pagesDict) listItem = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP) listItem.SetLabel(mc.GetLocalizedString(283) + ': ' + query) listItem.SetPath(pagesDict["url"]) listItem.SetProperty("isSearch", "true") currentNavItem, nextNavItem = self.BuildCurrentAndNextItemsForLoadedPagesDict( listItem, pagesDict) # start new section for search self.SaveWindowState() self.StartNavNewSection(listItem.GetLabel(), currentNavItem, nextNavItem) self.GetPagesPanel().SetItems(listItems)
def BuildPanelItemsList(self, pagesDict): listItems = mc.ListItems() for page in pagesDict["pages"]: item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_OTHER) item.SetLabel(page["name"]) item.SetPath(page["path"]) item.SetThumbnail(page["image"]) if page.has_key("isSearch"): item.SetProperty("isSearch", "true") if pagesDict.has_key("url"): item.SetProperty("panelurl", pagesDict["url"]) listItems.append(item) return listItems
def ShowPlay(url): mc.ShowDialogWait() player = mc.GetPlayer() data = GetCached(url, 3600).decode('utf-8') playurl = re.compile( '<a class="wmv-player-holder" href="http://asx.sbsnet.nl/(.*?)"></a>', re.DOTALL + re.IGNORECASE).search(data).group(1) list_item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP) list_item.SetPath("mms://pssbswm.fplive.net/pssbswm/w/" + str(playurl)) list_item.SetReportToServer(True) list_item.SetAddToHistory(True) mc.HideDialogWait() player.Play(list_item)
def standings(league): try: mc.ShowDialogWait() if (league == 'national'): league = 0 elif (league == 'american'): league = 1 data = getJson( 'http://mlb.mlb.com/lookup/json/named.standings_all_league_repeater.bam?sit_code=%27h0%27&league_id=104&league_id=103&season=2010' ) data = data.get('standings_all_league_repeater').get( 'standings_all')[league] stand = data.get('queryResults').get('row') east = mc.ListItems() west = mc.ListItems() central = mc.ListItems() for team in stand: item = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) item.SetLabel(str(team.get('team_short'))) item.SetThumbnail( ('http://mlb.mlb.com/images/logos/200x200/200x200_%s.png' % str(team.get('team_abbrev')))) item.SetProperty('games-back', str(team.get('gb'))) item.SetProperty('wild-card', str(team.get('wild_card'))) item.SetProperty('elim-wildcard', str(team.get('elim_wildcard'))) details = ((( ((((((((((((('Steak (' + team.get('streak')) + '), Home (') + team.get('home')) + '), Away (') + team.get('away')) + '), Vs Division (') + team.get('vs_division')) + '), Last Ten (') + team.get('last_ten')) + ')[CR]Winning Percentage (') + team.get('pct')) + '%), Wildcard (') + team.get('wild_card')) + '), Elimination Wildcard (') + team.get('elim_wildcard')) + ')') item.SetDescription(str(details)) division = str(team.get('division')) if (('East' in division) and east.append(item)): pass mc.GetActiveWindow().GetList(3002).SetItems(west) mc.GetActiveWindow().GetList(3003).SetItems(central) mc.GetActiveWindow().GetList(3004).SetItems(east) mc.HideDialogWait() except Exception, e: return raiseError( message= 'There was a problem accessing standings. Please try again later.', log='league', error=e)
def GetPlayableItemForItemInDict(self, item, playDict): mc.LogInfo("Flow: Created item of type MEDIA_VIDEO_CLIP") #mc.LogInfo("playDict image: %s" % playDict["image"]) type = mc.ListItem.MEDIA_VIDEO_CLIP playItem = mc.ListItem(type) playItem.SetThumbnail(playDict["image"]) #playItem.SetIcon(playDict["image"]) #playItem.SetImage(0, playDict["image"]) playItem.SetTitle(playDict["title"]) playItem.SetDescription(playDict["description"]) playItem.SetLabel(playDict["title"]) playItem.SetPath(item["path"]) playItem.SetAddToHistory(True) playItem.SetProviderSource('www.ex.ua') return playItem
def Shows(list_items, data, regex, title, subtitle): # Get show for zender results = re.compile(regex, re.DOTALL + re.IGNORECASE + re.M).findall(data) if len(results) > 0: for result in results: list_item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP) # set everything in the list item list_item.SetProperty("title", title) list_item.SetProperty("subtitle", subtitle) list_item.SetLabel(str(uzgf.unescape(result[1]).encode('utf-8'))) list_item.SetDescription("Bekijk uitzendingen van " + str(uzgf.unescape(result[1]).encode('utf-8'))) # set the path for doAction list_item.SetPath("feed://shows/"+base64.b64encode(result[0], "_;")) # add the item to the list items container list_items.append(list_item) return list_items
def launchWithItem(args): try: item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_OTHER) item.SetLabel(args['title'][0]) item.SetDescription(args['description'][0]) item.SetThumbnail(args['thumbnail'][0]) item.SetProperty('alt-label', args['alt-label'][0]) item.SetProperty('event-id', args['event-id'][0]) item.SetProperty('content-id', args['content-id'][0]) item.SetProperty('bx-ourl', args['bx-ourl'][0]) item.SetProperty('audio-stream', args['audio-stream'][0]) item.SetProperty('media-state', args['media-state'][0]) playItem(mlbList=0, playFromListItem=item) except Exception, e: return raiseError( 'Unable to play requested stream. If this continues please contact [email protected]', 'launchWithItem', e)
def categories(): mc.ShowDialogWait() list = mc.ListItems() categories = playkanalerna.getCategories() for category in categories: item = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) item.SetLabel(str(category['name'].encode('utf-8', 'ignore'))) item.SetPath(str(category['url'].encode('utf-8', 'ignore'))) list.append(item) mc.ActivateWindow(14000) window = mc.GetWindow(14000) window.GetList(51).SetItems(list) mc.HideDialogWait()