示例#1
0
    def onClick(self, controlID):

        if controlID == 90:
            if mc.GetPlayer().IsPlayingAudio(): mc.ActivateWindow(12006)
            elif mc.GetPlayer().IsPlayingVideo(): mc.ActivateWindow(12005)

        if controlID == 1001:
            if mlb.isLoggedIn():
                #mc.GetActiveWindow().ClearStateStack()
                mc.ActivateWindow(14003)
            else:
                mc.ShowDialogNotification(
                    "You must be logged in to make changes to your settings.",
                    "mlb-icon.png")

        if controlID == 1002:
            mc.ActivateWindow(14001)

        if controlID == 1003:
            mc.ActivateWindow(14002)

        if controlID == 120:
            mlb.playList(120)

        if controlID == 501:
            mlb.playItem(501)
示例#2
0
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)
示例#3
0
    def onClick(self, controlID):
 
	if controlID == 90:
            if mc.GetPlayer().IsPlayingAudio(): mc.ActivateWindow(12006)
            elif mc.GetPlayer().IsPlayingVideo(): mc.ActivateWindow(12005)

	if controlID == 1001:
            if mlb.isLoggedIn():
                #mc.GetActiveWindow().ClearStateStack()
                mc.ActivateWindow(14003)
            else:
                mc.ShowDialogNotification("You must be logged in to make changes to your settings.", "mlb-icon.png")

	if controlID == 1002:
            #mc.GetActiveWindow().ClearStateStack()
            mc.ActivateWindow(14000)

	if controlID == 120:
            #mc.GetActiveWindow().PushState()

            wait = mc.ShowDialogWait()
            mlb.standings('national')
            mc.GetActiveWindow().GetControl(2000).SetVisible(False)
            mc.GetActiveWindow().GetLabel(3001).SetLabel('National League')
            mc.GetActiveWindow().GetControl(3000).SetVisible(True)
            mc.GetActiveWindow().GetControl(4000).SetFocus()
            mc.GetActiveWindow().GetControl(3002).SetFocus()
            mc.HideDialogWait(wait)

	if controlID == 121:
            #mc.GetActiveWindow().PushState()
            wait = mc.ShowDialogWait()
            mlb.standings('american')
            mc.GetActiveWindow().GetControl(2000).SetVisible(False)
            mc.GetActiveWindow().GetLabel(3001).SetLabel('American League')
            mc.GetActiveWindow().GetControl(3000).SetVisible(True)
            mc.HideDialogWait(wait)
示例#4
0
    def play(self, selected, gsapi, playlist=None):
        if playlist == None:
            playlist = mc.PlayList(mc.PlayList.PLAYLIST_MUSIC)

        song = self.get(selected)
        url = gsapi.getStreamURL(str(song.id))
        url2 = self.defaultUrl(song)

        count = playlist.Size()
        direct = True
        itemnr = 0
        if count > 0:
            for i in range(count):
                item = playlist.GetItem(i)
                if item.GetTitle() == song.name.encode('utf-8'):
                    direct = False
                    itemnr = i
        if direct:
            listItem = self.createListItem(url, song, url2)
            playlist.Clear()
            playlist.Add(listItem)
            mc.GetPlayer().PlaySelected(0)
        else:
            mc.GetPlayer().PlaySelected(itemnr - 1)
示例#5
0
    def __init__(self):
        mc.ShowDialogWait()
        self.useCoverArt = True
        self.player = mc.GetPlayer()
        self.defaultCoverArt = 'default-cover.png'
        self.xbmcPlaylist = mc.PlayList(mc.PlayList.PLAYLIST_MUSIC)
        self.gs = GrooveAPI(enableDebug=__debugging__,
                            cwd=__cwd__,
                            clientUuid=None,
                            clientVersion=None)
        username = __settings__.GetValue("username")
        password = __settings__.GetValue("password")
        self.gs.startSession(username, password)
        self.gs.setRemoveDuplicates(True)
        self._search = None

        self.start()
        mc.HideDialogWait()
示例#6
0
def gameClicked():
    gamesList = mc.GetActiveWindow().GetList(9000)
    selectedItem = gamesList.GetItem(gamesList.GetFocusedItem())

    streams = []
    for stream in selectedItem.GetProperty('streams').split('\n'):
        title, url = stream.split('\t', 1)
        streams.append({'title': title, 'url': url})

    #TODO: conditional for this...
    import xbmcgui
    selection = xbmcgui.Dialog().select(
        "Choose Stream", [stream['title'] for stream in streams])
    #selection = mc.ShowDialogSelect("Choose Stream", [stream['title'] for stream in streams])

    if selection >= 0:
        item = mc.ListItem()
        item.SetPath(streams[selection]['url'])
        mc.GetPlayer().Play(item)
示例#7
0
def onload():
    global myJobManager, rssRoot, adsList, adImage

    #Set Global Lists
    adsList = mc.GetActiveWindow().GetList(120)
    adImage = mc.GetActiveWindow().GetImage(150)

    #Create JobManager
    myJobManager = jobmanager.BoxeeJobManager(1)

    utils.SetScrollAds(adsList, adImage, myJobManager)
    utils.SetBreakingNews(14010, myJobManager)

    #Start Job Manager
    myJobManager.start()

    #Play Video
    item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP)
    item.SetPath('/media/unnamed/1.mp4')
    item.SetContentType('video/mp4')
    mc.GetPlayer().PlayInBackground(item)
示例#8
0
            listItem.SetPath(str(url))
            listItem.SetProperty('info', str(org_url))
            listItem.SetContentType('audio/mpeg')
            listItem.SetTitle(songName)
            listItem.SetThumbnail(image)
            listItem.SetIcon(image)
            listItem.SetAlbum(albumName)
            listItem.SetArtist(artistName)

            print 'GrooveShark: Found stream url: (' + url + ')'
            playlist = mc.PlayList(mc.PlayList.PLAYLIST_MUSIC)
            listItems = []
            append = False
            for i in range(playlist.Size()):
                item = playlist.GetItem(i)
                if item.GetTitle() == songName:
                    append = True
                    listItems.append(listItem)
                elif append: listItems.append(item)
            playlist.Clear()
            for item in listItems:
                playlist.Add(item)
            mc.GetPlayer().PlaySelected(0)
            print 'GrooveShark: ####### Finished'
        else:
            print 'GrooveShark: No stream url returned for song id' 
    else:
        print 'GrooveShark: Unknown command'
except:
    traceback.print_exc()
示例#9
0
    def onClick(self, controlID):
 
        if controlID == 90:
		if mc.GetPlayer().IsPlayingAudio(): mc.ActivateWindow(12006)
		elif mc.GetPlayer().IsPlayingVideo(): mc.ActivateWindow(12005)

        if controlID == 1004:	
		mc.ActivateWindow(14000)

	if controlID == 1005:
		mc.ActivateWindow(14001)

	if controlID == 1006:
		mc.ActivateWindow(14002)

	if controlID == 1007:
		mc.ActivateWindow(14000)

	if controlID == 121:
		mlb.loadFavorites()

	if controlID == 122:
		mlb.updateArchiveSpoiler()
		mc.GetActiveWindow().PushState()
		mc.GetActiveWindow().GetControl(5000).SetVisible(True)
		mc.GetActiveWindow().GetControl(5050).SetFocus()

	if controlID == 123:
		mc.GetActiveWindow().PushState()
		mc.GetActiveWindow().GetControl(5600).SetVisible(True)
		mc.GetActiveWindow().GetControl(5600).SetFocus()

	
	if controlID == 5060:
		mc.GetActiveWindow().PopState()

	if controlID == 5051:
		mlb.saveArchiveSpoiler('F')
		mc.GetActiveWindow().PopState()

	if controlID == 5052:
		mlb.saveArchiveSpoiler('T')
		mc.GetActiveWindow().PopState()

	if controlID == 5660:
		mc.GetActiveWindow().PopState()

	if controlID == 5651:
		mc.GetActiveWindow().PopState()

	if controlID == 5652:
		mc.GetActiveWindow().PopState()

	if controlID == 5653:
		mc.GetActiveWindow().PopState()

	if controlID == 200:
		mlb.selectFavorite(200)

	if controlID == 202:
		mlb.selectFavorite(202)

	if controlID == 201:
		mlb.selectFavorite(201)

	if controlID == 203:
		mlb.selectFavorite(203)

	if controlID == 205:
		mlb.selectFavorite(205)

	if controlID == 204:
		mlb.selectFavorite(204)

	if controlID == 3101:
		mlb.saveFavorites()
		mc.GetActiveWindow().PopState()

	if controlID == 3102:
		mc.GetActiveWindow().PopState()
示例#10
0
    def onClick(self, controlID):
        """start your code"""
        """end your code"""

        if controlID == 91:
            mlb.prevMonth()

        if controlID == 92:
            mlb.nextMonth()

        if controlID == 90:
            if mc.GetPlayer().IsPlayingAudio(): mc.ActivateWindow(12006)
            elif mc.GetPlayer().IsPlayingVideo(): mc.ActivateWindow(12005)

        if controlID == 1001:
            if mlb.isLoggedIn():
                #mc.GetActiveWindow().ClearStateStack()
                mc.ActivateWindow(14003)
            else:
                mc.ShowDialogNotification(
                    "You must be logged in to make changes to your settings.",
                    "mlb-icon.png")

        if controlID == 1003:
            mc.ActivateWindow(14000)

        if controlID == 121:
            clear = mc.ListItems()
            mc.GetActiveWindow().GetList(4002).SetItems(clear)
            list = mc.GetActiveWindow().GetList(121)
            item = list.GetItem(list.GetFocusedItem())
            if item.GetProperty('today'):
                mc.ActivateWindow(14000)
            elif not item.GetProperty('display') or not item.GetDescription():
                mc.ShowDialogNotification('No games available for this day.',
                                          'mlb-icon.png')
            else:
                date = item.GetPath()
                date = date.split(':')
                games = mlb.getGames(date[0], date[1], date[2])
                if games:
                    mc.GetActiveWindow().PushState()
                    mc.GetActiveWindow().GetList(4002).SetItems(games)
                    mc.GetActiveWindow().GetControl(4000).SetVisible(True)
                    mc.GetActiveWindow().GetList(4002).SetFocusedItem(0)
                    mc.GetActiveWindow().GetControl(4002).SetFocus()
                    mc.GetActiveWindow().GetList(4002).SetFocusedItem(0)
                else:
                    mc.ShowDialogOk(
                        "MLB.TV",
                        "To view MLB Post Season content, please disconnect and reconnect your MLB.TV account at http://boxee.tv/services."
                    )
                    item.Dump()

        if controlID == 4002:
            mlb.playList(4002)

        if controlID == 4003:
            mc.GetActiveWindow().PopState()

        if controlID == 501:
            mlb.playItem(501)
示例#11
0
def playItem(mlbList, forceAudioCheck=False, playFromListItem=False):
    if mc.ShowDialogWait():
        play_audio = False
        if playFromListItem:
            window = mc.GetActiveWindow()
            list = window.GetList(mlbList)
            index = list.GetFocusedItem()
            item = list.GetItem(index)
        else:
            item = playFromListItem
        session_id = 'null'
        cf = mc.GetApp().GetLocalConfig()
        if cf.GetValue('sessionid'):
            session_id = cf.GetValue('sessionid')
        if isLoggedIn():
            return raiseError(
                'You must first log in before you can watch this game.')
        video_request_type = 'HTTP_CLOUD_WIRED'
        audio_request_type = 'AUDIO_SHOUTCAST_32K'
        audio_set_shout_protocol = False
        simulate_blackout = False
        simulate_not_authorized = False
        mr_url = 'https://secure.mlb.com/pubajaxws/bamrest/MediaService2_0/op-findUserVerifiedEvent/v-2.1?%s'
        params = {
            'subject': 'LIVE_EVENT_COVERAGE',
            'playbackScenario': video_request_type,
            'eventId': item.GetProperty('event-id'),
            'contentId': item.GetProperty('content-id'),
            'sessionKey': session_id,
            'fingerprint': cf.GetValue('fprt'),
            'identityPointId': cf.GetValue('ipid'),
            'platform': 'BOXEE'
        }
        web_url = (
            'http://mlb.mlb.com/media/player/entry.jsp?calendar_event_id=%s&source=boxeeRef'
            % item.GetProperty('event-id'))
        media_request = underscore((mr_url % urllib.urlencode(params)))
        if simulate_blackout:
            playlist_url = -1
        elif simulate_not_authorized:
            playlist_url = -2
        else:
            media_data = queryMediaService(media_request)
            playlist_url = media_data['playlist_url']
            update_media_state = media_data['media_state']
            if (bool(update_media_state)
                    and (str(update_media_state).lower() !=
                         item.GetProperty('media-state').lower())):
                info(
                    'playitem',
                    ('updating media_state (%s)' % update_media_state.lower()))
                item.SetProperty('media-state', update_media_state.lower())
        if (playlist_url == -3000):
            check_auth = authenticate()
            if (check_auth == status_valid):
                media_data = queryMediaService(media_request)
                playlist_url = media_data['playlist_url']
                update_media_state = media_data['media_state']
                if (bool(update_media_state)
                        and (str(update_media_state).lower() !=
                             item.GetProperty('media-state').lower())):
                    info('playitem', ('updating media_state (%s)' %
                                      update_media_state.lower()))
                    item.SetProperty('media-state', update_media_state.lower())
            else:
                raiseError(
                    'Unable to validate your account. Please make sure your mlb.tv account is linked with Boxee! See boxee.tv/services.',
                    'playitem', 'lost users login credentials')
                mc.HideDialogWait()
                return False
        if ((playlist_url == -1)
                and ((not item.GetProperty('audio-string')) and
                     (item.GetProperty('media-state') != 'media_on'))):
            return raiseError(
                'No available audio streams found for this game. We apologize for the inconvenience.'
            )
        confirm = mc.ShowDialogConfirm(
            'MLB.TV',
            'Video is not currently available for this game. Would you like to listen to the live audio broadcast?',
            'No', 'Yes')
        if confirm:
            play_audio = parseAudioStreams(item)
            if play_audio:
                return False
            params = {
                'subject': 'LIVE_EVENT_COVERAGE',
                'playbackScenario': audio_request_type,
                'eventId': item.GetProperty('event-id'),
                'contentId': play_audio[1],
                'sessionKey': session_id,
                'fingerprint': cf.GetValue('fprt'),
                'identityPointId': cf.GetValue('ipid'),
                'platform': 'BOXEE'
            }
            del params['platform']
            media_request = underscore((mr_url % urllib.urlencode(params)))
            media_data = queryMediaService(media_request)
            playlist_url = media_data['playlist_url']
            update_media_state = media_data['media_state']
            if (bool(update_media_state)
                    and (str(update_media_state).lower() !=
                         item.GetProperty('media-state').lower())):
                info(
                    'playitem',
                    ('updating media_state (%s)' % update_media_state.lower()))
                item.SetProperty('media-state', update_media_state.lower())
        else:
            mc.HideDialogWait()
            return False
    if ((playlist_url == -2) and mc.GetActiveWindow().ClearStateStack()):
        return raiseError(
            'You must own MLB.TV to watch live baseball. Please go to mlb.com/boxee to sign up.'
        )
    if play_audio:
        content_type = 'audio/mpeg'
        stream_type = mc.ListItem.MEDIA_AUDIO_OTHER
        playlist_url = playlist_url.replace('http://', 'shout://')
    else:
        live = 0
        playlist_url = (playlist_url + ('&quality=%s' % promptQuality()))
        if (item.GetProperty('media-state') == 'media_on'):
            confirm = mc.ShowDialogConfirm(
                'MLB.TV',
                'Would you like to watch this game from the start or jump into the live broadcast?',
                'Start', 'Live')
            live = int(confirm)
        playlist_url = ((playlist_url + '&live=') + str(live))
        content_type = 'application/vnd.apple.mpegurl'
        stream_type = mc.ListItem.MEDIA_VIDEO_OTHER
    alt_label = item.GetProperty('alt-label')
    title = alt_label.replace('#', '').replace('@mlbtv', '')
    title = (title.replace(' v ', ' @ ') + ' on MLB.TV')
    playlist_url = ((playlist_url + '&bx-ourl=') + urllib.quote_plus(web_url))
    ext = mc.ListItem(stream_type)
    ext.SetTitle(alt_label)
    ext.SetLabel(title)
    ext.SetDescription(item.GetDescription(), False)
    ext.SetContentType(content_type)
    ext.SetThumbnail(item.GetThumbnail())
    ext.SetProviderSource('MLB.TV')
    params = {
        'title': title,
        'alt-label': alt_label,
        'event-id': item.GetProperty('event-id'),
        'content-id': item.GetProperty('content-id'),
        'description': item.GetDescription(),
        'bx-ourl': web_url,
        'thumbnail': item.GetThumbnail(),
        'audio-stream': play_audio,
        'media-state': item.GetProperty('media-state')
    }
    if play_audio:
        params['audio-string'] = item.GetProperty('audio-string')
        rand_number = str(random.randint(10000, 100000000))
        tracking_url = (((
            ((('http://mlbglobal08.112.2o7.net/b/ss/mlbglobal08/1/G.5--NS/' +
               rand_number) + '?ch=Media&pageName=BOXEE%20Media%20Return&c25=')
             + str(play_audio[2])) + '%7C') + underscore(audio_request_type)) +
                        '&c27=Media%20Player&c43=BOXEE')
        notify = mc.Http().Get(tracking_url)
        del notify
    ext.SetPath(('app://mlb/launch?%s' % urllib.urlencode(params)))
    new_item = mc.ListItem(stream_type)
    new_item.SetLabel(title)
    new_item.SetTitle(alt_label)
    new_item.SetDescription(item.GetDescription(), False)
    new_item.SetPath(playlist_url)
    new_item.SetProviderSource('MLB.TV')
    new_item.SetContentType(content_type)
    new_item.SetThumbnail(item.GetThumbnail())
    if (play_audio and new_item.SetAddToHistory(False)):
        new_item.SetReportToServer(False)
    new_item.SetExternalItem(ext)
    mc.GetActiveWindow().ClearStateStack()
    try:
        track_label = generateTrackerGameString(item)
        if (track_label
                and myTracker.trackEvent('Video', 'Play', track_label)):
            pass
    except:
        myTracker.trackEvent('Video', 'Play', title)
    mc.HideDialogWait()
    mc.GetPlayer().Play(new_item)
示例#12
0
def checkPlayback(playlist):
    player = mc.GetPlayer()
    if playlist.Size() > 0 and not player.IsPlayingAudio(
    ) and not player.IsPaused():
        player.PlaySelected(0)
示例#13
0
def playVideo():
    mc.ActivateWindow(14001)
    item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP)
    item.SetPath('/media/unnamed/1.mp4')
    item.SetContentType('video/mp4')
    mc.GetPlayer().PlayInBackground(item)
示例#14
0
def doAction(action, label, title = "", subtitle = ""):
	# show loading dialog
	mc.ShowDialogWait()
	# get cookies and set them
	action = action.split("/")
	print action
	# push state for back button but not when on the index
	if action[2] != "index":
		mc.GetWindow(14000).PushState()

	if action[2] == "zoek":
		# get search query
		query = mc.ShowDialogKeyboard("Zoekterm:", "", False)
		subtitle = query
		# make url for search
		url = ZOEK_URI +query.replace(" ","%20")
		data = uzgf.GetCached(url).decode('latin-1')
		data = data.replace("<span class=\"highlight\">", "").replace("</span>", "")
		# create and fill the list with items from Shows
		list        = mc.GetWindow(14000).GetList(51)
		list_items  = mc.ListItems() 
		result = re.compile(REGEX_PAGE_PAGES, re.DOTALL + re.IGNORECASE).findall(data)
		# more pages?
		if len(result) > 0:
			for e in result:
				url2 = url + '&pgNum=' + str(e[0])
				list_items = Shows(list_items, uzgf.GetCached(url2).decode('latin-1'), REGEX_SEARCH_ITEM, "Zoeken", subtitle)
		else:
			list_items = Shows(list_items, data, REGEX_SEARCH_ITEM, "Zoeken", subtitle)
		try:
			list.SetItems(list_items)
		except:
			# no results?
			list_items  = mc.ListItems() 
			list_item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP)
			# set everything in the list item
			list_item.SetLabel("Geen resultaten")
			list_item.SetDescription("Probeer een andere (langere) zoekterm")
			# set the path for doAction
			list_item.SetPath("feed://zoek/")
			list_item.SetThumbnail("")
			# add the item to the list items container
			list_item.SetProperty("title", "Zoeken")
			list_item.SetProperty("subtitle", subtitle)
			list_items.append(list_item)
			list.SetItems(list_items)
 
			
	if action[2] == "dag":
		# create url for day
		url = DAY_URI +action[3]
		data = uzgf.GetCached(url, 600).decode('latin-1')
		data = data.replace("<span class=\"highlight\">", "").replace("</span>", "")
		# create and fill the list with items from Shows
		list        = mc.GetWindow(14000).GetList(51)
		list_items  = mc.ListItems() 
		result = re.compile(REGEX_PAGE_PAGES, re.DOTALL + re.IGNORECASE).findall(data)
		# more pages?
		if len(result) > 0:
			for e in result:
				url2 = url + '&pgNum=' + str(e[0])
				list_items = Shows(list_items, uzgf.GetCached(url2, 600).decode('latin-1'), REGEX_PAGE_ITEM, label, "")
		else:
				list_items = Shows(list_items, data, REGEX_PAGE_ITEM, label, "")
		list.SetItems(list_items)

	if action[2] == "zender":
		# create url for zender
		url = ZENDER_URI +action[3]
		data = uzgf.GetCached(url, 3600).decode('latin-1')
		data = data.replace("<span class=\"highlight\">", "").replace("</span>", "")
		# create and fill the list with items from Shows
		list        = mc.GetWindow(14000).GetList(51)
		list_items  = mc.ListItems() 
		result = re.compile(REGEX_PAGE_PAGES, re.DOTALL + re.IGNORECASE).findall(data)
		# more pages?
		if len(result) > 0:
			for e in result:
				url2 = url + '&pgNum=' + str(e[0])
				list_items = Shows(list_items, uzgf.GetCached(url2, 3600).decode('latin-1'), REGEX_PAGE_ITEM, title, label)
		else:
				list_items = Shows(list_items, data, REGEX_PAGE_ITEM, title, subtitle)
		list.SetItems(list_items)

	if action[2] == "shows":
		# create url for show
		url = ROOT_URI + "index.php/serie" + base64.b64decode(action[3])
		data = uzgf.GetCached(url, 600).decode('latin-1')
		print data.encode('utf-8')
		results = re.compile(REGEX_PAGE_ITEM2, re.DOTALL + re.IGNORECASE + re.M).findall(data)
		if len(results) < 1:
			data = uzgf.GetCached(ROOT_URI, 1)
			time.sleep(2)
			data = uzgf.GetCached(url, 1).decode('latin-1')
		# create and fill the list with items from ShowItems
		list        = mc.GetWindow(14000).GetList(51)
		list_items  = mc.ListItems()
		list_items = ShowItems(list_items, data, REGEX_PAGE_ITEM2, subtitle, label)
		list.SetItems(list_items)

	if action[2] == "play":
		# we don't want to render the index again when we get back from playing the video
		config.SetValue("wantindex", "no")
		# we got an item to play. lets call getStreamUrl to get the url and send it to the player
		url = getStreamUrl(action[3])	
		player		= mc.GetPlayer()
		# make a list item for the player
		list_item 	= mc.ListItem(mc.ListItem.MEDIA_VIDEO_EPISODE)
		# set url
		list_item.SetPath(str(url))
		# report to server
		list_item.SetReportToServer(True)
		# set label
		list_item.SetLabel(str(label))
		# we want to add it to our history
		list_item.SetAddToHistory(True)
		# set title from label_2
		list_item.SetTVShowTitle(str(config.GetValue("label_2")))
		# set description from xml feed
		list_item.SetDescription("Video from Uitzending Gemist (dutch)")
		# and play it
		player.Play(list_item)
		
	if action[2] == "zenders":
		# we should set some labels
		config.SetValue("label_1", "Kies een zender")
		config.SetValue("label_2", "")
		list        = mc.GetWindow(14000).GetList(51)
		list_items  = mc.ListItems()
		list_item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP)
		# set everything in the list item
		list_item.SetLabel("Nederland 1")
		list_item.SetDescription("Bekijk programma's van Nederland 1")
		# set the path for doAction
		list_item.SetPath("feed://zender/1")
		list_item.SetThumbnail("http://www.bartsidee.nl/boxee/apps/uzg/thumbs/ned1.png")
		list_item.SetProperty("title", "Zenders")
		list_item.SetProperty("subtitle", "Kies een zender")
		# add the item to the list items container
		list_items.append(list_item)

		list_item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP)
		# set everything in the list item
		list_item.SetLabel("Nederland 2")
		list_item.SetDescription("Bekijk programma's van Nederland 2")
		# set the path for doAction
		list_item.SetPath("feed://zender/2")
		list_item.SetThumbnail("http://www.bartsidee.nl/boxee/apps/uzg/thumbs/ned2.png")
		list_item.SetProperty("title", "Zenders")
		list_item.SetProperty("subtitle", "Kies een zender")
		# add the item to the list items container
		list_items.append(list_item)


		list_item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP)
		# set everything in the list item
		list_item.SetLabel("Nederland 3")
		list_item.SetDescription("Bekijk programma's van Nederland 3")
		# set the path for doAction
		list_item.SetPath("feed://zender/3")
		list_item.SetThumbnail("http://www.bartsidee.nl/boxee/apps/uzg/thumbs/ned3.png")
		list_item.SetProperty("title", "Zenders")
		list_item.SetProperty("subtitle", "Kies een zender")
		# add the item to the list items container
		list_items.append(list_item)


		# add all the items to the list control
		list.SetItems(list_items)

	if action[2] == "index":
		list        = mc.GetWindow(14000).GetList(51)
		list_items  = mc.ListItems()
		list_item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP)
		# set everything in the list item
		list_item.SetLabel("Zenders")
		list_item.SetDescription("Bekijk per zender")
		# set the path for doAction
		list_item.SetPath("feed://zenders/")
		list_item.SetProperty("title", "Uitzending Gemist")
		list_item.SetProperty("subtitle", "Maak je keuze")
		list_item.SetThumbnail("ned1.png")
		# add the item to the list items container
		list_items.append(list_item)
		list_item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP)
		# set everything in the list item
		list_item.SetLabel("Vandaag")
		list_item.SetDescription("Bekijk programma's van vandaag")
		# set the path for doAction
		list_item.SetPath("feed://dag/vandaag")
		list_item.SetThumbnail("")
		# add the item to the list items container
		list_item.SetProperty("title", "Uitzending Gemist")
		list_item.SetProperty("subtitle", "Maak je keuze")
		list_items.append(list_item)
		list_item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP)
		# set everything in the list item
		list_item.SetLabel("Gisteren")
		list_item.SetDescription("Bekijk programma's van gisteren")
		# set the path for doAction
		list_item.SetPath("feed://dag/gisteren")
		list_item.SetThumbnail("")
		# add the item to the list items container
		list_item.SetProperty("title", "Uitzending Gemist")
		list_item.SetProperty("subtitle", "Maak je keuze")

		list_items.append(list_item)
		list_item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP)
		# set everything in the list item
		list_item.SetLabel("Zoeken")
		list_item.SetDescription("Zoek naar programma's")
		# set the path for doAction
		list_item.SetPath("feed://zoek/")
		list_item.SetThumbnail("")
		# add the item to the list items container
		list_item.SetProperty("title", "Uitzending Gemist")
		list_item.SetProperty("subtitle", "Maak je keuze")

		list_items.append(list_item)

		list.SetItems(list_items)

	# we should be done! hide the wait dialog
	mc.HideDialogWait()
示例#15
0
def doAction(action, label, episode="", season="", desc="", thumb=""):
        action = action.split("/", 4)
	mc.ShowDialogWait()
        if action[2] == "play":
                config.SetValue("wantindex", "no")
                player = mc.GetPlayer()
                url = TMF_BASE_URL + '/video/' + action[3] + '/'
                params = urllib.urlencode({'src':  url})
                list_item       = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP)
                path = 'flash://%s/src=%s&bx-jsactions=%s' % ("tmf.nl", quote(url), quote('http://boxee.bartsidee.nl/apps/js/tmf.js'))
                list_item.SetPath(path)
                list_item.SetReportToServer(True)
                list_item.SetAddToHistory(True)
                list_item.SetLabel(str(desc))
                player.Play(list_item)
		
	if action[2] == "artist":
		list_items 	= mc.ListItems()
		data = tmf_f.getFeed(TMF_ARTIST_VIDEOS % action[3])
		try: 
			items = data.getElementsByTagName("content")[0].getElementsByTagName("image")
			for item in items:
				titel = tmf_f.unescape(item.getElementsByTagName("description")[0].firstChild.wholeText).encode('utf-8')
				videoid = tmf_f.unescape(item.getElementsByTagName("data")[0].firstChild.wholeText).encode('utf-8')
				thumb = tmf_f.unescape(item.getElementsByTagName("path")[0].firstChild.wholeText).encode('utf-8').split("proxy.php?src=", 1)[1]
				videoid = re.search(r'Video\((.+)\);', videoid).group(1)
				if titel.find(" - ") != -1:
					titel = titel.split(" - ", 1)[1]
				list_item 	= mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP)
				list_item.SetLabel(str(titel))
				list_item.SetThumbnail(str(thumb))
				list_item.SetPath("feed://play/"+videoid)
				list_item.SetDescription(label + " - " + titel)
				list_item.SetProperty("isvideoclip", "jep")
				list_item.SetProperty("titel", label)
				list_items.append(list_item)
			app = mc.GetApp()
			params = mc.Parameters()
			params[""] = ""
			app.ActivateWindow(14002, params)
                        list            = mc.GetWindow(14002).GetList(53)
			list.SetItems(list_items)
		except:
			print "no data?"		

	if action[2] == "index":
		list        	= mc.GetWindow(14000).GetList(53)
		list_items 	= mc.ListItems()
		list_item 	= mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP)
		list_item.SetLabel("0-9")
		list_item.SetPath("feed://letter/0-9")
		list_items.append(list_item)
		for char in string.ascii_uppercase:
				list_item 	= mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP)
				list_item.SetLabel(str(char))
				list_item.SetPath("feed://letter/" + str(char))
				list_items.append(list_item)

		list.SetItems(list_items)

	if action[2] == "letter":
		list_items 	= mc.ListItems()
		letter = action[3]
		query = base64.b64encode(TMF_ARTISTS_QUERY % (letter.lower(), 1))
		data = tmf_f.Get(TMF_CONTENT % query)
		numPages = 0
		try: 
			result = re.compile('<div class="cb">(.*?)</div>', re.DOTALL + re.IGNORECASE).search(data).group(1)
			pages = re.compile('<a href(.*?)</a>', re.DOTALL + re.IGNORECASE).findall(result)
		except:
			numPages = 1
		if numPages != 1:
			numPages= len(pages)-1
		
		for i in range(1, numPages+1):
			query = base64.b64encode(TMF_ARTISTS_QUERY % (letter.lower(), i))
			data = tmf_f.Get(TMF_CONTENT % query).decode('latin-1')
			result = re.compile('<div class="cb item"(.*?)\/.item', re.DOTALL + re.IGNORECASE).findall(data)
			for item in result:
				artist = re.compile('<div class="title">.*?<a href=".*?">(.*?)</a>', re.DOTALL + re.IGNORECASE).search(item).group(1).strip()
				desc = re.compile('<div class="text">(.*?)</div>', re.DOTALL + re.IGNORECASE).search(item).group(1).strip()
				link = re.compile('<a href="/artiesten/(.*?)">', re.DOTALL + re.IGNORECASE).search(item).group(1)
				thumb = re.compile('<img src="(.*?)"', re.DOTALL + re.IGNORECASE).search(item).group(1)
				list_item 	= mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP)
				list_item.SetLabel(str(tmf_f.unescape(artist).encode('utf-8')))
				list_item.SetDescription(str(tmf_f.unescape(desc).encode('utf-8')))
				list_item.SetPath("feed://artist/"+str(link))
				list_item.SetThumbnail(str(thumb))
				list_items.append(list_item)
		app = mc.GetApp()
		params = mc.Parameters()
		params[""] = ""
		app.ActivateWindow(14001, params)
		list            = mc.GetWindow(14001).GetList(53)
		list.SetItems(list_items)

	mc.HideDialogWait()