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)
Esempio n. 2
0
 def OnSearchInActiveSection(self):
     if self.GetNavSearchContext():
         query = mc.ShowDialogKeyboard(
             mc.GetLocalizedString(137) + " " +
             mc.GetLocalizedString(1405) + " " + self.GetNavSectionName(),
             "", False)
         if 0 != len(query):
             pagesDict = self.model.searchInSectionPagesDict(
                 self.GetNavSearchContext(), query)
             self.UpdatePagesPanelWithSearchResults(query, pagesDict)
     else:
         mc.LogInfo(
             "No search context present - unable to perform search in active section"
         )
Esempio n. 3
0
 def OnSearchEverywhere(self):
     query = mc.ShowDialogKeyboard(
         mc.GetLocalizedString(137) + " EX.UA", "", False)
     if 0 != len(query):
         mc.LogInfo("string to search: %s" % query)
         pagesDict = self.model.searchAllPagesDict(query)
         self.UpdatePagesPanelWithSearchResults(query, pagesDict)
Esempio n. 4
0
 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)
Esempio n. 5
0
 def SaveWindowState(self):
     # save all focused items
     currentFocusControlId = self.PAGES_PANEL_ID
     # find current focused control
     if self.GetControl(self.SEARCH_ALL_ID).HasFocus():
         currentFocusControlId = self.SEARCH_ALL_ID
     elif self.GetControl(self.SEARCH_ID).HasFocus():
         currentFocusControlId = self.SEARCH_ID
     elif self.GetControl(self.PAGES_PANEL_ID).HasFocus():
         currentFocusControlId = self.PAGES_PANEL_ID
     # store current focus info in nav container's focused item
     currentNavItem = self.GetListFocusedItem(self.GetNavigationContainer())
     currentNavItem.SetProperty("focusId", str(currentFocusControlId))
     self.SavePagesFocusedItem()
     self.GetNavAnchorControl().SetFocus()
     mc.GetActiveWindow().PushState()
     self.GetControl(currentFocusControlId).SetFocus()
     # tell user how to go back ;)
     mc.ShowDialogNotification(mc.GetLocalizedString(53112))
	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")