예제 #1
0
def view_top():
    addDirectoryItem(plugin.handle, plugin.url_for("/live"), ListItem("Direkte"), True)
    addDirectoryItem(plugin.handle, plugin.url_for("/recommended"), ListItem("Aktuelt"), True)
    addDirectoryItem(plugin.handle, plugin.url_for("/mostrecent"), ListItem("Siste"), True)
    addDirectoryItem(plugin.handle, plugin.url_for("/categories"), ListItem("Kategorier"), True)
    addDirectoryItem(plugin.handle, plugin.url_for("/letters"), ListItem("A-Å"), True)
    endOfDirectory(plugin.handle)
예제 #2
0
 def update_folder(self, details, folder):
     """
     :type details: Details
     :type folder: Folder
     """
     media_path = self.get_media_path(details.section, details.title)
     if not direxists(media_path):
         self.log.info("Creating library folder: %s", media_path)
         xbmcvfs.mkdir(media_path)
     else:
         self.log.info("Updating library folder: %s", media_path)
     self.storage[folder.id] = (details.media_id, media_path, details.section)
     files = folder.files
     """ :type : list of File """
     for f in files:
         file_path = os.path.join(media_path, self.get_file_name(folder.id, f.title))
         if not xbmcvfs.exists(file_path):
             self.log.info("Adding file: %s", file_path)
             fp = xbmcvfs.File(file_path, 'w')
             can_mark_watched = len(files) == 1 and not details.section.is_series()
             url = plugin.url_for('play_file', section=details.section.filter_val,
                                  media_id=details.media_id, url=f.link,
                                  title=f.title, can_mark_watched=int(can_mark_watched))
             fp.write(ensure_str(url))
             fp.close()
     return media_path
예제 #3
0
def addPager(title, url, thumb, total):
	li = xbmcgui.ListItem(title, thumbnailImage=thumb)
	playable = plugin.route_for(url) == play
	li.setProperty('isplayable', str(playable))
	if playable:
		li.setInfo('video', {'plot':descr})
	xbmcplugin.addDirectoryItem(plugin.handle, plugin.url_for(url), li, not playable, total)
예제 #4
0
def view(elements, next_url=None):
	if not elements:
		error_title = __translation(30002)
		error_message1 = __translation(30003)
		error_message2 = __translation(30004)
		dialog = xbmcgui.Dialog()
		dialog.ok(error_title, error_message1, error_message2)
		return

	total = len(elements)
	for title, url, descr, thumb in elements:
		descr = descr() if callable(descr) else descr
		thumb = thumb() if callable(thumb) else thumb

		li = xbmcgui.ListItem(title, thumbnailImage=thumb)
		playable = plugin.route_for(url) == play
		li.setProperty('isplayable', str(playable))
		if playable:
			li.setInfo('video', {'plot':descr})
		xbmcplugin.addDirectoryItem(plugin.handle, plugin.url_for(url), li, not playable, total)

	if next_url:
		text_next_page = __translation(30001)
		addPager(text_next_page, next_url, '', total)
	xbmcplugin.endOfDirectory(plugin.handle)
예제 #5
0
def seasons(arg):
    import data

    titles, urls, thumbs, bgs = data.parse_seasons(arg)
    if len(titles) == 1:
        plugin.redirect(plugin.url_for(urls[0]))
        return
    view(titles, urls, thumbs=thumbs, bgs=bgs)
예제 #6
0
def view(titles, urls, thumbs=repeat(""), bgs=repeat(""), descr=repeat("")):
    total = len(titles)
    for title, url, descr, thumb, bg in zip(titles, urls, descr, thumbs, bgs):
        descr = descr() if callable(descr) else descr
        thumb = thumb() if callable(thumb) else thumb
        bg = bg() if callable(bg) else bg
        li = ListItem(title, thumbnailImage=thumb)
        playable = plugin.route_for(url) == play
        li.setProperty("isplayable", str(playable))
        li.setProperty("fanart_image", bg)
        if playable:
            li.setInfo("video", {"plot": descr})
        addDirectoryItem(plugin.handle, plugin.url_for(url), li, not playable, total)
    endOfDirectory(plugin.handle)
예제 #7
0
def view_top():
	text_categories = __translation(30010)
	text_years = __translation(30011)
	text_provinces = __translation(30012)
	text_cities = __translation(30013)
	text_themes = __translation(30020)
	text_popular = __translation(30021)
	text_latest = __translation(30022)
	text_search = __translation(30023)

	xbmcplugin.addDirectoryItem(plugin.handle, plugin.url_for("/categories/categories"), xbmcgui.ListItem(text_categories), True)
	xbmcplugin.addDirectoryItem(plugin.handle, plugin.url_for("/categories/years"), xbmcgui.ListItem(text_years), True)
	xbmcplugin.addDirectoryItem(plugin.handle, plugin.url_for("/categories/provinces"), xbmcgui.ListItem(text_provinces), True)
	xbmcplugin.addDirectoryItem(plugin.handle, plugin.url_for("/categories/cities"), xbmcgui.ListItem(text_cities), True)
	xbmcplugin.addDirectoryItem(plugin.handle, plugin.url_for("/themes"), xbmcgui.ListItem(text_themes), True)
	xbmcplugin.addDirectoryItem(plugin.handle, plugin.url_for("/popular"), xbmcgui.ListItem(text_popular), True)
	xbmcplugin.addDirectoryItem(plugin.handle, plugin.url_for("/recent"), xbmcgui.ListItem(text_latest), True)
	xbmcplugin.addDirectoryItem(plugin.handle, plugin.url_for("/search"), xbmcgui.ListItem(text_search), True)
	xbmcplugin.endOfDirectory(plugin.handle)
예제 #8
0
def seasons(arg):
  titles, urls = data.parse_seasons(arg)
  if len(titles) == 1:
    plugin.redirect(plugin.url_for(urls[0]))
    return
  view(titles, urls)