コード例 #1
0
    def downloads(self):
        movie_downloads = control.setting('movie.download.path')
        tv_downloads = control.setting('tv.download.path')

        if len(control.listDir(movie_downloads)[0]) > 0:
            self.addDirectoryItem(32001, movie_downloads, 'movies.png', 'DefaultMovies.png', isAction=False)
        if len(control.listDir(tv_downloads)[0]) > 0:
            self.addDirectoryItem(32002, tv_downloads, 'tvshows.png', 'DefaultTVShows.png', isAction=False)

        self.endDirectory()
コード例 #2
0
ファイル: navigator.py プロジェクト: CYBERxNUKE/xbmc-addon
    def root(self):
        self.addDirectoryItem('Created by JP Hightek', 'ShowChangelog', 'icon.png', 'DefaultFolder.png')
        self.addDirectoryItem('Genesis Reborn Custom Viewtype', 'viewsNavigator', 'icon.png', 'DefaultAddonProgram.png')
        self.addDirectoryItem('Genesis Reborn Movies', 'movieNavigator', 'movies.png', 'DefaultMovies.png')
        self.addDirectoryItem('Genesis Reborn TV Shows', 'tvNavigator', 'channels.png', 'DefaultTVShows.png')
        self.addDirectoryItem('My Genesis Reborn Library', 'libraryNavigator', 'tools.png', 'DefaultAddonProgram.png')

        if not control.setting('lists.widget') == '0':
            self.addDirectoryItem('My Genesis Reborn Movies (Trakt/Imdb)', 'mymovieNavigator', 'mymovies.png', 'DefaultVideoPlaylists.png')
            self.addDirectoryItem('My Genesis Reborn TV Shows (Trakt/Imdb)', 'mytvNavigator', 'mymovies.png', 'DefaultVideoPlaylists.png')

        if not control.setting('movie.widget') == '0':
            self.addDirectoryItem('Genesis Reborn New Movies', 'movieWidget', 'latest-movies.png', 'DefaultRecentlyAddedMovies.png')

        if (traktIndicators == True and not control.setting('tv.widget.alt') == '0') or (traktIndicators == False and not control.setting('tv.widget') == '0'):
            self.addDirectoryItem('Genesis Reborn New TV Shows', 'tvshows&url=premiere', 'years.png', 'DefaultRecentlyAddedEpisodes.png')

        self.addDirectoryItem('Genesis Reborn Channels', 'channels', 'channels.png', 'DefaultMovies.png')

        self.addDirectoryItem('Genesis Reborn Tools', 'toolNavigator', 'tools.png', 'DefaultAddonProgram.png')

        downloads = True if control.setting('downloads') == 'true' and (len(control.listDir(control.setting('movie.download.path'))[0]) > 0 or len(control.listDir(control.setting('tv.download.path'))[0]) > 0) else False
        if downloads == True:
            self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png', 'DefaultFolder.png')

        self.addDirectoryItem('Genesis Reborn Search Menu', 'searchNavigator', 'search.png', 'DefaultFolder.png')
        
        self.addDirectoryItem('Join The Private Facebook Group Called - Jesus Box Media Support & Addons', 'ShowChangelog', 'icon.png', 'DefaultFolder.png')

        self.endDirectory()
コード例 #3
0
ファイル: LwSLive.py プロジェクト: azumimuo/family-xbmc-addon
def getCategory():
    getDirectory('0', phLink, '0', '0', '0', '0', close=False)
    addCategoryItem(control.lang(30701).encode('utf-8'), 'openSettings', 'settings.png')

    if phTest in control.listDir(control.dataPath)[1]: addCategoryItem('Testings', 'localDirectory', 'home.png')

    endCategory()
コード例 #4
0
ファイル: navigator.py プロジェクト: shannah/exodus
    def root(self):
        self.addDirectoryItem(30001, 'movieNavigator', 'movies.png', 'DefaultMovies.png')
        self.addDirectoryItem(30002, 'tvNavigator', 'tvshows.png', 'DefaultTVShows.png')
        self.addDirectoryItem(30003, 'channels', 'channels.png', 'DefaultMovies.png')

        if not control.setting('lists.widget') == '0':
            self.addDirectoryItem(30004, 'myNavigator', 'userlists.png', 'DefaultVideoPlaylists.png')

        if not control.setting('movie.widget') == '0':
            self.addDirectoryItem(30005, 'movieWidget', 'latest-movies.png', 'DefaultRecentlyAddedMovies.png', queue=True)

        if (traktIndicators == True and not control.setting('tv.widget.alt') == '0') or (traktIndicators == False and not control.setting('tv.widget') == '0'):
            self.addDirectoryItem(30006, 'tvWidget', 'latest-episodes.png', 'DefaultRecentlyAddedEpisodes.png', queue=True)

        if not control.setting('calendar.widget') == '0':
            self.addDirectoryItem(30007, 'calendars', 'calendar.png', 'DefaultRecentlyAddedEpisodes.png')

        self.addDirectoryItem(30008, 'toolNavigator', 'tools.png', 'DefaultAddonProgram.png')

        downloads = True if control.setting('downloads') == 'true' and (len(control.listDir(control.setting('movie.download.path'))[0]) > 0 or len(control.listDir(control.setting('tv.download.path'))[0]) > 0) else False
        if downloads == True:
            self.addDirectoryItem(30010, 'downloadNavigator', 'downloads.png', 'DefaultFolder.png')

        self.addDirectoryItem(30009, 'searchNavigator', 'search.png', 'DefaultFolder.png')

        self.endDirectory()

        from resources.lib.modules import cache
        from resources.lib.modules import changelog
        cache.get(changelog.get, 600000000, control.addonInfo('version'), table='changelog')
コード例 #5
0
    def root(self):
        self.addDirectoryItem(32001, 'movieNavigator', 'movies.png', 'DefaultMovies.png')
        self.addDirectoryItem(32002, 'tvNavigator', 'tvshows.png', 'DefaultTVShows.png')

        if not control.setting('lists.widget') == '0':
            self.addDirectoryItem(32003, 'mymovieNavigator', 'mymovies.png', 'DefaultVideoPlaylists.png')
            self.addDirectoryItem(32004, 'mytvNavigator', 'mytvshows.png', 'DefaultVideoPlaylists.png')

        if not control.setting('movie.widget') == '0':
            self.addDirectoryItem(32005, 'movieWidget', 'latest-movies.png', 'DefaultRecentlyAddedMovies.png')

        if (traktIndicators == True and not control.setting('tv.widget.alt') == '0') or (traktIndicators == False and not control.setting('tv.widget') == '0'):
            self.addDirectoryItem(32006, 'tvWidget', 'latest-episodes.png', 'DefaultRecentlyAddedEpisodes.png')

        self.addDirectoryItem(32007, 'channels', 'channels.png', 'DefaultMovies.png')

        self.addDirectoryItem(32008, 'toolNavigator', 'tools.png', 'DefaultAddonProgram.png')

        downloads = True if control.setting('downloads') == 'true' and (len(control.listDir(control.setting('movie.download.path'))[0]) > 0 or len(control.listDir(control.setting('tv.download.path'))[0]) > 0) else False
        if downloads == True:
            self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png', 'DefaultFolder.png')

        self.addDirectoryItem(32010, 'searchNavigator', 'search.png', 'DefaultFolder.png')

        self.endDirectory()
コード例 #6
0
    def root(self):
        self.addDirectoryItem(32001, 'movieNavigator', 'movies.png', 'DefaultMovies.png')
        self.addDirectoryItem(32002, 'tvNavigator', 'tvshows.png', 'DefaultTVShows.png')


        self.addDirectoryItem(32008, 'toolNavigator', 'tools.png', 'DefaultAddonProgram.png')

        downloads = True if control.setting('downloads') == 'true' and (len(control.listDir(control.setting('movie.download.path'))[0]) > 0 or len(control.listDir(control.setting('tv.download.path'))[0]) > 0) else False
        if downloads == True:
            self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png', 'DefaultFolder.png')


        self.endDirectory()
コード例 #7
0
ファイル: phstreams.py プロジェクト: c0ns0le/YCBuilds
def getCategory():
    getDirectory('0', phLink, '0', '0', '0', '0', close=False)
    addCategoryItem('Radio Crazy', 'radioDirectory', 'http://mecca.watchkodi.com/images/radios.png')
    addCategoryItem('Cartoon Crazy','CartoonDirectory','http://mecca.watchkodi.com/images/cartoon.png')
    addCategoryItem('NHL', 'nhlDirectory', 'http://mecca.watchkodi.com/images/hockey.jpg')
    addCategoryItem('News Updates', 'dmode&url=%s' % phNews, artPath + 'blazetameravAni.gif')
    addCategoryItem(control.lang(30701).encode('utf-8'), 'openSettings', artPath + 'settings.png')
    addCategoryItem(control.lang(30721).encode('utf-8'), 'downloader', artPath + 'downloader.png')
    addCategoryItem(control.lang(30702).encode('utf-8'), 'search', artPath + 'search.png')

    if phTest in control.listDir(control.dataPath)[1]:
        addCategoryItem('Testings', 'localDirectory', artPath + 'home.png')

    endCategory()
コード例 #8
0
def downloads_root():
    movie_downloads = control.setting('movie.download.path')
    tv_downloads = control.setting('tv.download.path')
    cm = [(control.lang(32007).encode('utf-8'),
           'RunPlugin(plugin://plugin.video.cartoonsgr/?mode=17)'),
          (control.lang(32008).encode('utf-8'),
           'RunPlugin(plugin://plugin.video.cartoonsgr/?mode=9)')]
    if len(control.listDir(movie_downloads)[0]) > 0:
        item = control.item(label='Movies')
        item.addContextMenuItems(cm)
        item.setArt({'icon': ART + 'movies.jpg', 'fanart': FANART})
        xbmcplugin.addDirectoryItem(int(sys.argv[1]), movie_downloads, item,
                                    True)

    if len(control.listDir(tv_downloads)[0]) > 0:
        item = control.item(label='Tv Shows')
        item.addContextMenuItems(cm)
        item.setArt({'icon': ART + 'tvshows.jpg', 'fanart': FANART})
        xbmcplugin.addDirectoryItem(int(sys.argv[1]), tv_downloads, item, True)

    control.content(int(sys.argv[1]), 'videos')
    control.directory(int(sys.argv[1]))
    views.selectView('movies', 'movie-view')
コード例 #9
0
ファイル: navigator.py プロジェクト: aenemapy/aenemapyrepo
 def download_manager(self):
     self.addDirectoryItem('Downloading', 'download_manager_list',
                           'cloud.png', 'DefaultFolder.png')
     downloads = True if control.setting('downloads') == 'true' else False
     if downloads == True:
         download_path = control.setting('download.path')
         dest = control.transPath(download_path)
         if len(control.listDir(dest)[0]) > 0:
             self.addDirectoryItem(32009,
                                   dest,
                                   'cloud.png',
                                   'DefaultFolder.png',
                                   isAction=False)
     self.endDirectory()
コード例 #10
0
ファイル: navigator.py プロジェクト: N2Roar/roar-repository
	def root(self):
		self.addDirectoryItem(32001, 'movieNavigator', 'movies.png', 'DefaultMovies.png')
		self.addDirectoryItem(32002, 'tvNavigator', 'tvshows.png', 'DefaultTVShows.png')
		if control.getMenuEnabled('navi.anime'):
			self.addDirectoryItem('Anime', 'anime_Navigator', 'boxsets.png', 'DefaultFolder.png')
		if control.getMenuEnabled('mylists.widget'):
			self.addDirectoryItem(32003, 'mymovieNavigator', 'mymovies.png','DefaultVideoPlaylists.png')
			self.addDirectoryItem(32004, 'mytvNavigator', 'mytvshows.png', 'DefaultVideoPlaylists.png')

		if control.setting('newmovies.widget') != '0':
			indexer = 32478
			indexer_icon = 'imdb.png'
			setting = control.setting('newmovies.widget')
			if setting == '2':
				indexer = 32479
				indexer_icon = 'trakt.png'
			self.addDirectoryItem(indexer if indexLabels else 32477, 'newMovies', indexer_icon if iconLogos else 'latest-movies.png', 'DefaultRecentlyAddedMovies.png')

		if (traktCredentials and control.setting('tv.widget.alt') != '0') or (not traktCredentials and control.setting('tv.widget') != '0'):
			indexer = 32481
			indexer_icon = 'tvmaze.png'
			setting = control.setting('tv.widget.alt')
			if setting == '2' or setting == '3':
				indexer = 32482
				indexer_icon = 'trakt.png'
			self.addDirectoryItem(indexer if indexLabels else 32480, 'tvWidget', indexer_icon if iconLogos else 'latest-episodes.png', 'DefaultRecentlyAddedEpisodes.png')
			self.addDirectoryItem(32484 if indexLabels else 32483, 'calendar&url=added', 'tvmaze.png' if iconLogos else 'latest-episodes.png', 'DefaultTVShows.png', queue=True)

		if control.setting('furk.api') != '':
			self.addDirectoryItem('Furk.net', 'furkNavigator', 'movies.png',  'DefaultMovies.png')

		if control.getMenuEnabled('navi.youtube'):
			self.addDirectoryItem('You Tube Videos', 'youtube', 'youtube.png', 'youtube.png')

		self.addDirectoryItem(32010, 'searchNavigator', 'search.png', 'DefaultAddonsSearch.png')
		self.addDirectoryItem(32008, 'toolNavigator', 'tools.png', 'DefaultAddonService.png')

		downloads = True if control.setting('downloads') == 'true' and (len(control.listDir(control.setting('movie.download.path'))[0]) > 0 or len(control.listDir(control.setting('tv.download.path'))[0]) > 0) else False
		if downloads:
			self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png', 'DefaultFolder.png')

		if control.getMenuEnabled('navi.prem.services'):
			self.addDirectoryItem('Premium Services', 'premiumNavigator', 'premium.png', 'DefaultFolder.png')

		if control.getMenuEnabled('navi.news'):
			self.addDirectoryItem(32013, 'ShowNews', 'icon.png', 'DefaultAddonHelper.png', isFolder=False)
		if control.getMenuEnabled('navi.changelog'):
			self.addDirectoryItem(32014, 'ShowChangelog', 'icon.png', 'DefaultAddonsUpdates.png', isFolder=False)
		self.endDirectory()
コード例 #11
0
def Main_addDir():
    addDir('[B][COLOR yellow]' + Lang(32022).encode('utf-8') + '[/COLOR][/B]',
           Baseurl + 'genre/christmas/', 34, ART + 'mas.jpg', FANART, '')
    addDir(
        '[B][COLOR yellow]Gamato ' + Lang(32000).encode('utf-8') +
        '[/COLOR][/B]', '', 20, ART + 'dub.jpg', FANART, '')
    # addDir('[B][COLOR yellow]' + Lang(32005).encode('utf-8') + '[/COLOR][/B]', BASEURL, 8, ART + 'random.jpg', FANART, '')
    # addDir('[B][COLOR yellow]' + Lang(32008).encode('utf-8') + '[/COLOR][/B]', BASEURL, 5, ART + 'latest.jpg', FANART, '')
    # addDir('[B][COLOR yellow]' + Lang(32004).encode('utf-8') + '[/COLOR][/B]', BASEURL + 'quality/metaglotismeno/',
    #        5, ART + 'dub.jpg', FANART, '')
    # addDir('[B][COLOR yellow]' + Lang(32003).encode('utf-8') + '[/COLOR][/B]', BASEURL+'quality/ellinikoi-ypotitloi/',
    #        5, ART + 'sub.jpg', FANART, '')

    addDir('[B][COLOR yellow]Tenies-Online[/COLOR][/B]', '', 30,
           ART + 'dub.jpg', FANART, '')
    # addDir('[B][COLOR yellow]' + Lang(32000).encode('utf-8') + '[/COLOR][/B]', '', 13, ART + 'movies.jpg', FANART, '')
    # addDir('[B][COLOR yellow]' + Lang(32001).encode('utf-8') + '[/COLOR][/B]', '', 14, ART + 'tvshows.jpg', FANART, '')
    downloads = True if control.setting('downloads') == 'true' and (
        len(control.listDir(control.setting('movie.download.path'))[0]) > 0
        or len(control.listDir(control.setting('tv.download.path'))[0]) > 0
    ) else False
    if downloads:
        addDir('[B][COLOR yellow]Downloads[/COLOR][/B]', '', 40, ICON, FANART,
               '')

    addDir('[B][COLOR gold]' + Lang(32002).encode('utf-8') + '[/COLOR][/B]',
           '', 6, ICON, FANART, '')
    addDir('[B][COLOR gold]' + Lang(32020).encode('utf-8') + '[/COLOR][/B]',
           '', 17, ART + 'set.jpg', FANART, '')
    addDir('[B][COLOR gold]' + Lang(32021).encode('utf-8') + '[/COLOR][/B]',
           '', 9, ART + 'set.jpg', FANART, '')
    addDir(
        '[B][COLOR gold]' + Lang(32019).encode('utf-8') +
        ': [COLOR lime]%s[/COLOR][/B]' % vers, '', 'bug', ART + 'ver.jpg',
        FANART, '')
    views.selectView('menu', 'menu-view')
コード例 #12
0
ファイル: navigator.py プロジェクト: JACKEVOLVE/Kodi_Repo
    def root(self):
        self.addDirectoryItem(32001, 'movieNavigator', 'movies.jpg',
                              'DefaultMovies.jpg')
        self.addDirectoryItem(32002, 'tvNavigator', 'tvshows.jpg',
                              'DefaultTVShows.jpg')
        self.addDirectoryItem('Top Movies', 'playlistNavigator', 'top.jpg',
                              'DefaultMovies.jpg')
        self.addDirectoryItem('Playlists', 'customNavigator', 'playlist.jpg',
                              'DefaultMovies.jpg')
        self.addDirectoryItem('IMDB User Lists', 'imdbLists', 'imdb.jpg',
                              'DefaultMovies.jpg')
        self.addDirectoryItem('Critters Corner', 'critterLists', 'critter.jpg',
                              'DefaultMovies.jpg')
        self.addDirectoryItem('What The Fork?', 'wtfNavigator', 'wtf.jpg',
                              'DefaultMovies.jpg')
        if not control.setting('lists.widget') == '0':
            self.addDirectoryItem(32003, 'mymovieNavigator', 'mymovies.jpg',
                                  'DefaultVideoPlaylists.jpg')
            self.addDirectoryItem(32004, 'mytvNavigator', 'mytvshows.jpg',
                                  'DefaultVideoPlaylists.jpg')

        self.addDirectoryItem(32008, 'toolNavigator', 'tools.jpg',
                              'DefaultAddonProgram.jpg')

        downloads = True if control.setting('downloads') == 'true' and (
            len(control.listDir(control.setting('movie.download.path'))[0]) > 0
            or len(control.listDir(control.setting('tv.download.path'))[0]) > 0
        ) else False
        if downloads == True:
            self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.jpg',
                                  'DefaultFolder.jpg')

        self.addDirectoryItem(32010, 'searchNavigator', 'search.jpg',
                              'DefaultFolder.jpg')

        self.endDirectory()
コード例 #13
0
	def root(self):
		self.addDirectoryItem(33046, 'movieNavigator', 'movies.png', 'DefaultMovies.png')
		self.addDirectoryItem(33047, 'tvNavigator', 'tvshows.png', 'DefaultTVShows.png')
		if getMenuEnabled('navi.anime'): self.addDirectoryItem('Anime', 'anime_Navigator', 'boxsets.png', 'DefaultFolder.png')
		if getMenuEnabled('mylists.widget'):
			self.addDirectoryItem(32003, 'mymovieNavigator', 'mymovies.png', 'DefaultVideoPlaylists.png')
			self.addDirectoryItem(32004, 'mytvNavigator', 'mytvshows.png', 'DefaultVideoPlaylists.png')
		if getMenuEnabled('navi.youtube'): self.addDirectoryItem('You Tube Videos', 'youtube', 'youtube.png', 'youtube.png')
		self.addDirectoryItem(32010, 'tools_searchNavigator', 'search.png', 'DefaultAddonsSearch.png')
		self.addDirectoryItem(32008, 'tools_toolNavigator', 'tools.png', 'tools.png')
		downloads = True if getSetting('downloads') == 'true' and (len(control.listDir(getSetting('movie.download.path'))[0]) > 0 or len(control.listDir(getSetting('tv.download.path'))[0]) > 0) else False
		if downloads: self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png', 'DefaultFolder.png')
		if getMenuEnabled('navi.prem.services'): self.addDirectoryItem('Premium Services', 'premiumNavigator', 'premium.png', 'DefaultFolder.png')
		if getMenuEnabled('navi.news'): self.addDirectoryItem(32013, 'tools_ShowNews', 'icon.png', 'DefaultAddonHelper.png', isFolder=False)
		if getMenuEnabled('navi.changelog'): self.addDirectoryItem(32014, 'tools_ShowChangelog&name=Venom', 'icon.png', 'DefaultAddonHelper.png', isFolder=False)
		self.endDirectory()
コード例 #14
0
def getCategory():
    getDirectory('0', phLink, '0', '0', '0', '0', close=False)
    addCategoryItem('VinMan FM', 'radioDirectory', 'radios.png')
    addCategoryItem('Cartoon Crazy', 'CartoonDirectory', 'cartoon.png')
    addCategoryItem('NHL', 'nhlDirectory', 'hockey.jpg')
    addCategoryItem('News Updates', 'dmode&url=%s' % phNews, 'news.gif')
    addCategoryItem(
        control.lang(30701).encode('utf-8'), 'openSettings', 'settings.png')
    addCategoryItem(
        control.lang(30721).encode('utf-8'), 'downloader', 'downloader.png')
    addCategoryItem(
        control.lang(30702).encode('utf-8'), 'search', 'search.png')

    if phTest in control.listDir(control.dataPath)[1]:
        addCategoryItem('Testings', 'localDirectory', 'home.png')

    endCategory()
コード例 #15
0
    def root(self):
        self.addDirectoryItem(32001, 'movieNavigator', 'movies.png', 'DefaultMovies.png')
        self.addDirectoryItem(32002, 'tvNavigator', 'channels.png', 'DefaultTVShows.png')
        if not control.setting('movie.widget') == '0': self.addDirectoryItem('Spotlight', 'movieWidget', 'latest-movies.png', 'DefaultRecentlyAddedMovies.png')
        self.addDirectoryItem('Movies Watchlist', 'movieFavourites', 'mymovies.png', 'DefaultMovies.png')
        self.addDirectoryItem('TV Shows Watchlist', 'tvFavourites', 'mymovies.png', 'DefaultMovies.png')
        self.addDirectoryItem('New Movies', 'movies&url=premiere', 'trending.png', 'DefaultRecentlyAddedMovies.png')
        self.addDirectoryItem(32026, 'tvshows&url=premiere', 'years.png', 'DefaultTVShows.png')
        self.addDirectoryItem('My Lists', 'lists_navigator', 'trending.png', 'DefaultRecentlyAddedMovies.png')

        self.addDirectoryItem(32007, 'channels', 'channels.png', 'DefaultMovies.png')
        self.addDirectoryItem(32008, 'toolNavigator', 'tools.png', 'DefaultAddonProgram.png')
        downloads = True if control.setting('downloads') == 'true' and (len(control.listDir(control.setting('movie.download.path'))[0]) > 0) else False
        if downloads == True: self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png', 'DefaultFolder.png')

        self.addDirectoryItem(32010, 'searchNavigator', 'search.png', 'DefaultFolder.png')
        self.addDirectoryItem('Changelog', 'ShowChangelog', 'icon.png', 'DefaultFolder.png')
        self.endDirectory()
コード例 #16
0
    def root(self):
        # self.addDirectoryItem('Merry Christmas!', 'movies&url=tmdbxmas', 'xmas.png', 'DefaultMovies.png')

        self.addDirectoryItem(32001, 'movieNavigator', 'movies.png', 'DefaultMovies.png')
        self.addDirectoryItem(32002, 'tvNavigator', 'channels.png', 'DefaultTVShows.png')
        if not control.setting('movie.widget') == '0': self.addDirectoryItem('Spotlight', 'movieWidget', 'latest-movies.png', 'DefaultRecentlyAddedMovies.png')
        self.addDirectoryItem('New Movies', 'movies&url=premiere', 'trending.png', 'DefaultRecentlyAddedMovies.png')
        self.addDirectoryItem(32026, 'tvshows&url=premiere', 'years.png', 'DefaultTVShows.png')
        self.addDirectoryItem('My Elysium', 'lists_navigator', 'mymovies.png', 'DefaultRecentlyAddedMovies.png')
        self.addDirectoryItem(32027, 'calendars', 'networks.png', 'DefaultRecentlyAddedEpisodes.png')
        self.addDirectoryItem(32007, 'channels', 'channels.png', 'DefaultMovies.png')
        self.addDirectoryItem(32008, 'toolNavigator', 'tools.png', 'DefaultAddonProgram.png')
        downloads = True if control.setting('downloads') == 'true' and (len(control.listDir(control.setting('movie.download.path'))[0]) > 0) else False
        if downloads == True: self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png', 'DefaultFolder.png')

        self.addDirectoryItem(32010, 'searchNavigator', 'search.png', 'DefaultFolder.png')
        self.addDirectoryItem('Changelog', 'ShowChangelog', 'icon.png', 'DefaultFolder.png')
        self.endDirectory()
コード例 #17
0
    def root(self):
        # self.addDirectoryItem('Merry Christmas!', 'movies&url=tmdbxmas', 'xmas.png', 'DefaultMovies.png')

        self.addDirectoryItem('Genesis Reborn Movies', 'movieNavigator',
                              'movies.png', 'DefaultMovies.png')
        self.addDirectoryItem('Genesis Reborn TV Shows', 'tvNavigator',
                              'channels.png', 'DefaultTVShows.png')
        if not control.setting('movie.widget') == '0':
            self.addDirectoryItem('Genesis Reborn Top Movies', 'movieWidget',
                                  'latest-movies.png',
                                  'DefaultRecentlyAddedMovies.png')
        self.addDirectoryItem('My Genesis Reborn Movie List',
                              'movieFavourites', 'mymovies.png',
                              'DefaultMovies.png')
        self.addDirectoryItem('My Genesis Reborn TV Show List', 'tvFavourites',
                              'mymovies.png', 'DefaultMovies.png')
        self.addDirectoryItem('Genesis Reborn New Movies',
                              'movies&url=premiere', 'trending.png',
                              'DefaultRecentlyAddedMovies.png')
        self.addDirectoryItem('Genesis Reborn New TV Shows',
                              'tvshows&url=premiere', 'years.png',
                              'DefaultTVShows.png')
        self.addDirectoryItem('My Genesis Reborn Account', 'lists_navigator',
                              'mymovies.png', 'DefaultRecentlyAddedMovies.png')
        self.addDirectoryItem('Genesis Reborn On TV', 'calendars',
                              'networks.png',
                              'DefaultRecentlyAddedEpisodes.png')
        self.addDirectoryItem('Genesis Reborn Channels', 'channels',
                              'channels.png', 'DefaultMovies.png')
        self.addDirectoryItem('Genesis Reborn Tools', 'toolNavigator',
                              'tools.png', 'DefaultAddonProgram.png')
        downloads = True if control.setting('downloads') == 'true' and (
            len(control.listDir(
                control.setting('movie.download.path'))[0]) > 0) else False
        if downloads == True:
            self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png',
                                  'DefaultFolder.png')

        self.addDirectoryItem('Genesis Reborn Search Menu', 'searchNavigator',
                              'search.png', 'DefaultFolder.png')
        self.addDirectoryItem('Genesis Reborn Changelog', 'ShowChangelog',
                              'icon.png', 'DefaultFolder.png')
        self.endDirectory()
コード例 #18
0
    def root(self):
        # self.addDirectoryItem('Merry Christmas!', 'movies&url=tmdbxmas', 'xmas.png', 'DefaultMovies.png')

        self.addDirectoryItem('Genesis Reborn Movies', 'movieNavigator', 'movies.png', 'DefaultMovies.png')
        self.addDirectoryItem('Genesis Reborn TV Shows', 'tvNavigator', 'channels.png', 'DefaultTVShows.png')
        if not control.setting('movie.widget') == '0': self.addDirectoryItem('Genesis Reborn Top Movies', 'movieWidget', 'latest-movies.png', 'DefaultRecentlyAddedMovies.png')
        self.addDirectoryItem('My Genesis Reborn Movie List', 'movieFavourites', 'mymovies.png', 'DefaultMovies.png')
        self.addDirectoryItem('My Genesis Reborn TV Show List', 'tvFavourites', 'mymovies.png', 'DefaultMovies.png')
        self.addDirectoryItem('Genesis Reborn New Movies', 'movies&url=premiere', 'trending.png', 'DefaultRecentlyAddedMovies.png')
        self.addDirectoryItem('Genesis Reborn New TV Shows', 'tvshows&url=premiere', 'years.png', 'DefaultTVShows.png')
        self.addDirectoryItem('My Genesis Reborn Account', 'lists_navigator', 'mymovies.png', 'DefaultRecentlyAddedMovies.png')
        self.addDirectoryItem('Genesis Reborn On TV', 'calendars', 'networks.png', 'DefaultRecentlyAddedEpisodes.png')
        self.addDirectoryItem('Genesis Reborn Channels', 'channels', 'channels.png', 'DefaultMovies.png')
        self.addDirectoryItem('Genesis Reborn Tools', 'toolNavigator', 'tools.png', 'DefaultAddonProgram.png')
        downloads = True if control.setting('downloads') == 'true' and (len(control.listDir(control.setting('movie.download.path'))[0]) > 0) else False
        if downloads == True: self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png', 'DefaultFolder.png')

        self.addDirectoryItem('Genesis Reborn Search Menu', 'searchNavigator', 'search.png', 'DefaultFolder.png')
        self.addDirectoryItem('Genesis Reborn Changelog', 'ShowChangelog', 'icon.png', 'DefaultFolder.png')
        self.endDirectory()
コード例 #19
0
    def root(self):
        self.addDirectoryItem('[B][COLOR cyan]Noticias e Atualizacoes[/COLOR][/B]', 'newsNavigator', 'tools.png', 'DefaultAddonProgram.png')
        self.addDirectoryItem(32001, 'movieNavigator', 'movies.png', 'DefaultMovies.png')
        self.addDirectoryItem(32002, 'tvNavigator', 'tvshows.png', 'DefaultTVShows.png')

        if not control.setting('lists.widget') == '0':
            self.addDirectoryItem(32003, 'mymovieNavigator', 'mymovies.png', 'DefaultVideoPlaylists.png')
            self.addDirectoryItem(32004, 'mytvNavigator', 'mytvshows.png', 'DefaultVideoPlaylists.png')

        if not control.setting('movie.widget') == '0':
            self.addDirectoryItem(32005, 'movieWidget', 'latest-movies.png', 'DefaultRecentlyAddedMovies.png')

        if (traktIndicators == True and not control.setting('tv.widget.alt') == '0') or (traktIndicators == False and not control.setting('tv.widget') == '0'):
            self.addDirectoryItem(32006, 'tvWidget', 'latest-episodes.png', 'DefaultRecentlyAddedEpisodes.png')

        if self.getMenuEnabled('navi.docu') == True:
            self.addDirectoryItem(32631, 'docuHeaven', 'movies.png', 'DefaultMovies.png')
        if self.getMenuEnabled('navi.kidscorner') == True:
            self.addDirectoryItem(32610, 'kidscorner', 'kidscorner.png', 'DefaultMovies.png')
        if self.getMenuEnabled('navi.fitness') == True:
            self.addDirectoryItem(32611, 'fitness', 'fitness.png', 'DefaultMovies.png')
        if self.getMenuEnabled('navi.legends') == True:
            self.addDirectoryItem(32612, 'legends', 'legends.png', 'DefaultMovies.png')

        if self.getMenuEnabled('navi.podcasts') == True:
            self.addDirectoryItem(32620, 'podcastNavigator', 'podcast.png', 'DefaultVideoPlaylists.png')

        if self.getMenuEnabled('navi.channels') == True:
            self.addDirectoryItem(32007, 'channels', 'channels.png', 'DefaultMovies.png')

        self.addDirectoryItem(32008, 'toolNavigator', 'tools.png', 'DefaultAddonProgram.png')

        downloads = True if control.setting('downloads') == 'true' and (len(control.listDir(control.setting('movie.download.path'))[0]) > 0 or len(control.listDir(control.setting('tv.download.path'))[0]) > 0) else False
        if downloads == True:
            self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png', 'DefaultFolder.png')

        self.addDirectoryItem(32010, 'searchNavigator', 'search.png', 'DefaultFolder.png')
        #self.addDirectoryItem('[COLOR=cyan]like on Facebook: www.facebook.com/TVsupertuga.PT/[/COLOR]', 'sectionItem', 'icon.png', 'DefaultAddonProgram.png')
        #self.addDirectoryItem('[COLOR=cyan]YouTube:  http://youtube.[/COLOR]', 'sectionItem', 'icon.png', 'DefaultAddonProgram.png')

        self.endDirectory()
コード例 #20
0
ファイル: navigator.py プロジェクト: CYBERxNUKE/xbmc-addon
	def root(self):
		self.addDirectoryItem(32001, 'movieNavigator', 'movies.jpg', 'DefaultMovies.jpg')
		self.addDirectoryItem(32002, 'tvNavigator', 'tvshows.jpg', 'DefaultTVShows.jpg')
		self.addDirectoryItem('Top Movies', 'playlistNavigator', 'top.jpg', 'DefaultMovies.jpg')
		self.addDirectoryItem('Playlists', 'customNavigator', 'playlist.jpg', 'DefaultMovies.jpg')
		self.addDirectoryItem('IMDB User Lists', 'imdbLists', 'imdb.jpg', 'DefaultMovies.jpg')
		self.addDirectoryItem('Critters Corner', 'critterLists', 'critter.jpg', 'DefaultMovies.jpg')
		self.addDirectoryItem('What The Fork?', 'wtfNavigator', 'wtf.jpg', 'DefaultMovies.jpg')
		if not control.setting('lists.widget') == '0':
			self.addDirectoryItem(32003, 'mymovieNavigator', 'mymovies.jpg', 'DefaultVideoPlaylists.jpg')
			self.addDirectoryItem(32004, 'mytvNavigator', 'mytvshows.jpg', 'DefaultVideoPlaylists.jpg')

		self.addDirectoryItem(32008, 'toolNavigator', 'tools.jpg', 'DefaultAddonProgram.jpg')

		downloads = True if control.setting('downloads') == 'true' and (len(control.listDir(control.setting('movie.download.path'))[0]) > 0 or len(control.listDir(control.setting('tv.download.path'))[0]) > 0) else False
		if downloads == True:
			self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.jpg', 'DefaultFolder.jpg')

		self.addDirectoryItem(32010, 'searchNavigator', 'search.jpg', 'DefaultFolder.jpg')

		self.endDirectory()
コード例 #21
0
 def root(self):
     self.addDirectoryItem('Merry Christmas', 'movies&url=tmdbxmas',
                           'holidaycollections.png', 'DefaultMovies.png')
     self.addDirectoryItem(32001, 'movieNavigator', 'movies.png',
                           'DefaultMovies.png')
     self.addDirectoryItem(32002, 'tvNavigator', 'tvshows.png',
                           'DefaultTVShows.png')
     if not control.setting('movie.widget') == '0':
         self.addDirectoryItem('Spotlight', 'movieWidget',
                               'latest-movies.png',
                               'DefaultRecentlyAddedMovies.png')
     self.addDirectoryItem('TV Collections', 'tvCollections',
                           'collection.png', 'DefaultMovies.png')
     self.addDirectoryItem('Movie Collections', 'collectionsMovies',
                           'collection.png', 'DefaultMovies.png')
     self.addDirectoryItem(32026, 'tvshows&url=premiere', 'years.png',
                           'DefaultTVShows.png')
     self.addDirectoryItem('My Uranus', 'lists_navigator', 'mymovies.png',
                           'DefaultRecentlyAddedMovies.png')
     self.addDirectoryItem(32027, 'calendars', 'networks.png',
                           'DefaultRecentlyAddedEpisodes.png')
     # self.addDirectoryItem(32007,              'channels',             'sly.png',      'DefaultMovies.png')
     self.addDirectoryItem(32008, 'toolNavigator', 'tools.png',
                           'DefaultAddonProgram.png')
     downloads = True if control.setting('downloads') == 'true' and (
         len(control.listDir(
             control.setting('movie.download.path'))[0]) > 0) else False
     if downloads == True:
         self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png',
                               'DefaultFolder.png')
     if not control.setting('lists.widget') == '0':
         self.addDirectoryItem('Trakt Movies', 'soullessNavigator',
                               'trakt.png', 'DefaultVideoPlaylists.png')
         self.addDirectoryItem('Trakt TV', 'tvshowstNavigator', 'trakt.png',
                               'DefaultVideoPlaylists.png')
     self.addDirectoryItem(32010, 'searchNavigator', 'search.png',
                           'DefaultFolder.png')
     self.addDirectoryItem('Changelog', 'ShowChangelog', 'icon.png',
                           'DefaultFolder.png')
     self.endDirectory()
コード例 #22
0
    def root(self):
        self.addDirectoryItem('[COLOR=orange]News and Updates[/COLOR]', 'newsNavigator', 'tools.png', 'DefaultAddonProgram.png')
        self.addDirectoryItem(32001, 'movieNavigator', 'movies.png', 'DefaultMovies.png')
        self.addDirectoryItem(32002, 'tvNavigator', 'tvshows.png', 'DefaultTVShows.png')

        if not control.setting('lists.widget') == '0':
            self.addDirectoryItem(32003, 'mymovieNavigator', 'mymovies.png', 'DefaultVideoPlaylists.png')
            self.addDirectoryItem(32004, 'mytvNavigator', 'mytvshows.png', 'DefaultVideoPlaylists.png')

        if not control.setting('movie.widget') == '0':
            self.addDirectoryItem(32005, 'movieWidget', 'latest-movies.png', 'DefaultRecentlyAddedMovies.png')

        if (traktIndicators == True and not control.setting('tv.widget.alt') == '0') or (traktIndicators == False and not control.setting('tv.widget') == '0'):
            self.addDirectoryItem(32006, 'tvWidget', 'latest-episodes.png', 'DefaultRecentlyAddedEpisodes.png')

        if self.getMenuEnabled('navi.docu') == True:
            self.addDirectoryItem(32631, 'docuHeaven', 'movies.png', 'DefaultMovies.png')
        if self.getMenuEnabled('navi.kidscorner') == True:
            self.addDirectoryItem(32610, 'kidscorner', 'kidscorner.png', 'DefaultMovies.png')
        if self.getMenuEnabled('navi.fitness') == True:
            self.addDirectoryItem(32611, 'fitness', 'fitness.png', 'DefaultMovies.png')
        if self.getMenuEnabled('navi.legends') == True:
            self.addDirectoryItem(32612, 'legends', 'legends.png', 'DefaultMovies.png')

        if self.getMenuEnabled('navi.podcasts') == True:
            self.addDirectoryItem(32620, 'podcastNavigator', 'podcast.png', 'DefaultVideoPlaylists.png')

        self.addDirectoryItem(32008, 'toolNavigator', 'tools.png', 'DefaultAddonProgram.png')

        downloads = True if control.setting('downloads') == 'true' and (len(control.listDir(control.setting('movie.download.path'))[0]) > 0 or len(control.listDir(control.setting('tv.download.path'))[0]) > 0) else False
        if downloads == True:
            self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png', 'DefaultFolder.png')

        self.addDirectoryItem(32010, 'searchNavigator', 'search.png', 'DefaultFolder.png')
        self.addDirectoryItem('[COLOR=orange]Follow on Twitter: @Daddy_Blamo[/COLOR]', 'sectionItem', 'icon.png', 'DefaultAddonProgram.png')
        self.addDirectoryItem('[COLOR=orange]Can find on YouTube at http://youtube.tantrumtv.com[/COLOR]', 'sectionItem', 'icon.png', 'DefaultAddonProgram.png')

        self.endDirectory()
コード例 #23
0
 def root(self):
     self.addDirectoryItem(32001, 'movieNavigator', 'movies.png', 'DefaultMovies.png')
     self.addDirectoryItem(32002, 'tvNavigator', 'tvshows.png', 'DefaultTVShows.png')
     if self.getMenuEnabled('navi.channels') == True:
         self.addDirectoryItem(32007, 'channels', 'channels.png', 'DefaultMovies.png')
     if not control.setting('lists.widget') == '0':
         self.addDirectoryItem(32003, 'mymovieNavigator', 'mymovies.png', 'DefaultVideoPlaylists.png')
         self.addDirectoryItem(32004, 'mytvNavigator', 'mytvshows.png', 'DefaultVideoPlaylists.png')
     if not control.setting('movie.widget') == '0':
         self.addDirectoryItem(32005, 'movieWidget', 'latest-movies.png', 'DefaultRecentlyAddedMovies.png')
     if (traktIndicators == True and not control.setting('tv.widget.alt') == '0') or (traktIndicators == False and not control.setting('tv.widget') == '0'):
         self.addDirectoryItem(32006, 'tvWidget', 'latest-episodes.png', 'DefaultRecentlyAddedEpisodes.png')
     if not control.setting('furk.api') == '':
         self.addDirectoryItem('Furk.net', 'furkNavigator', 'movies.png', 'movies.png')
     if self.getMenuEnabled('navi.docu') == True:
         self.addDirectoryItem(32631, 'docuHeaven', 'movies.png', 'DefaultMovies.png')
     self.addDirectoryItem(32010, 'searchNavigator', 'search.png', 'DefaultAddonProgram.png')
     self.addDirectoryItem(32008, 'toolNavigator', 'tools.png', 'DefaultAddonProgram.png')
     self.addDirectoryItem('Scraper Settings', 'exoscrapersSettings&query=0.0', 'tools.png', 'DefaultAddonProgram.png')
     downloads = True if control.setting('downloads') == 'true' and (len(control.listDir(control.setting('movie.download.path'))[0]) > 0 or len(control.listDir(control.setting('tv.download.path'))[0]) > 0) else False
     if downloads == True:
         self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png', 'DefaultAddonProgram.png')
     self.addDirectoryItem('Info!!', 'newsNavigator', 'tools.png', 'DefaultAddonProgram.png')
     self.endDirectory()
コード例 #24
0
    def addDirectory(self, items, queue=False):
        if items == None or len(items) == 0: return

        sysaddon = sys.argv[0]
        addonPoster = addonBanner = control.addonInfo('icon')
        addonFanart = control.addonInfo('fanart')

        playlist = control.playlist
        if not queue == False: playlist.clear()

        try:
            devmode = True if 'testings.xml' in control.listDir(
                control.dataPath)[1] else False
        except:
            devmode = False

        mode = [i['content'] for i in items if 'content' in i]
        if 'movies' in mode: mode = 'movies'
        elif 'tvshows' in mode: mode = 'tvshows'
        elif 'seasons' in mode: mode = 'seasons'
        elif 'episodes' in mode: mode = 'episodes'
        elif 'videos' in mode: mode = 'videos'
        else: mode = 'addons'

        for i in items:
            try:
                try:
                    name = control.lang(int(i['name'])).encode('utf-8')
                except:
                    name = i['name']

                url = '%s?action=%s' % (sysaddon, i['action'])
                try:
                    url += '&url=%s' % urllib.quote_plus(i['url'])
                except:
                    pass
                try:
                    url += '&content=%s' % urllib.quote_plus(i['content'])
                except:
                    pass

                if i['action'] == 'plugin' and 'url' in i: url = i['url']

                try:
                    devurl = dict(
                        urlparse.parse_qsl(
                            urlparse.urlparse(url).query))['action']
                except:
                    devurl = None
                if devurl == 'developer' and not devmode == True:
                    raise Exception()

                poster = i['poster'] if 'poster' in i else '0'
                banner = i['banner'] if 'banner' in i else '0'
                fanart = i['fanart'] if 'fanart' in i else '0'
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster

                content = i['content'] if 'content' in i else '0'

                folder = i['folder'] if 'folder' in i else True

                meta = dict((k, v) for k, v in i.iteritems() if not v == '0')

                cm = []

                if content in ['movies', 'tvshows']:
                    meta.update({
                        'trailer':
                        '%s?action=trailer&name=%s' %
                        (sysaddon, urllib.quote_plus(name))
                    })
                    cm.append((control.lang(30707).encode('utf-8'),
                               'RunPlugin(%s?action=trailer&name=%s)' %
                               (sysaddon, urllib.quote_plus(name))))

                if content in ['movies', 'tvshows', 'seasons', 'episodes']:
                    cm.append((control.lang(30708).encode('utf-8'),
                               'XBMC.Action(Info)'))

                if (folder == False and not '|regex=' in str(i.get('url'))
                    ) or (folder == True
                          and content in ['tvshows', 'seasons']):
                    cm.append((control.lang(30723).encode('utf-8'),
                               'RunPlugin(%s?action=queueItem)' % sysaddon))

                if content == 'movies':
                    try:
                        dfile = '%s (%s)' % (i['title'], i['year'])
                    except:
                        dfile = name
                    try:
                        cm.append((control.lang(30722).encode(
                            'utf-8'
                        ), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)'
                                   % (sysaddon, urllib.quote_plus(dfile),
                                      urllib.quote_plus(i['url']),
                                      urllib.quote_plus(poster))))
                    except:
                        pass
                elif content == 'episodes':
                    try:
                        dfile = '%s S%02dE%02d' % (i['tvshowtitle'],
                                                   int(i['season']),
                                                   int(i['episode']))
                    except:
                        dfile = name
                    try:
                        cm.append((control.lang(30722).encode(
                            'utf-8'
                        ), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)'
                                   % (sysaddon, urllib.quote_plus(dfile),
                                      urllib.quote_plus(i['url']),
                                      urllib.quote_plus(poster))))
                    except:
                        pass
                elif content == 'songs':
                    try:
                        cm.append((control.lang(30722).encode(
                            'utf-8'
                        ), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)'
                                   % (sysaddon, urllib.quote_plus(name),
                                      urllib.quote_plus(i['url']),
                                      urllib.quote_plus(poster))))
                    except:
                        pass

                if mode == 'movies':
                    cm.append((control.lang(30711).encode('utf-8'),
                               'RunPlugin(%s?action=addView&content=movies)' %
                               sysaddon))
                elif mode == 'tvshows':
                    cm.append((control.lang(30712).encode('utf-8'),
                               'RunPlugin(%s?action=addView&content=tvshows)' %
                               sysaddon))
                elif mode == 'seasons':
                    cm.append((control.lang(30713).encode('utf-8'),
                               'RunPlugin(%s?action=addView&content=seasons)' %
                               sysaddon))
                elif mode == 'episodes':
                    cm.append(
                        (control.lang(30714).encode('utf-8'),
                         'RunPlugin(%s?action=addView&content=episodes)' %
                         sysaddon))

                if devmode == True:
                    try:
                        cm.append(('Open in browser',
                                   'RunPlugin(%s?action=browser&url=%s)' %
                                   (sysaddon, urllib.quote_plus(i['url']))))
                    except:
                        pass

                item = control.item(label=name,
                                    iconImage=poster,
                                    thumbnailImage=poster)

                try:
                    item.setArt({
                        'poster': poster,
                        'tvshow.poster': poster,
                        'season.poster': poster,
                        'banner': banner,
                        'tvshow.banner': banner,
                        'season.banner': banner
                    })
                except:
                    pass

                if not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                if queue == False:
                    item.setInfo(type='Video', infoLabels=meta)
                    item.addContextMenuItems(cm)
                    control.addItem(handle=int(sys.argv[1]),
                                    url=url,
                                    listitem=item,
                                    isFolder=folder)
                else:
                    item.setInfo(type='Video', infoLabels=meta)
                    playlist.add(url=url, listitem=item)
            except:
                pass

        if not queue == False:
            return control.player.play(playlist)

        try:
            i = items[0]
            if i['next'] == '': raise Exception()
            url = '%s?action=%s&url=%s' % (sysaddon, i['nextaction'],
                                           urllib.quote_plus(i['next']))
            item = control.item(label=control.lang(30500).encode('utf-8'))
            item.setArt({
                'addonPoster': addonPoster,
                'thumb': addonPoster,
                'poster': addonPoster,
                'tvshow.poster': addonPoster,
                'season.poster': addonPoster,
                'banner': addonPoster,
                'tvshow.banner': addonPoster,
                'season.banner': addonPoster
            })
            item.setProperty('addonFanart_Image', addonFanart)
            control.addItem(handle=int(sys.argv[1]),
                            url=url,
                            listitem=item,
                            isFolder=True)
        except:
            pass

        if not mode == None: control.content(int(sys.argv[1]), mode)
        control.directory(int(sys.argv[1]), cacheToDisc=True)
        if mode in ['movies', 'tvshows', 'seasons', 'episodes']:
            views.setView(mode, {'skin.estuary': 55})
コード例 #25
0
    def update(self, query=None, info="true"):
        if not query == None:
            control.idle()

        try:

            items = []
            season, episode = [], []
            show = [os.path.join(self.library_folder, i) for i in control.listDir(self.library_folder)[0]]
            for s in show:
                try:
                    season += [os.path.join(s, i) for i in control.listDir(s)[0]]
                except:
                    pass
            for s in season:
                try:
                    episode.append([os.path.join(s, i) for i in control.listDir(s)[1] if i.endswith(".strm")][-1])
                except:
                    pass

            for file in episode:
                try:
                    file = control.openFile(file)
                    read = file.read()
                    read = read.encode("utf-8")
                    file.close()

                    if not read.startswith(sys.argv[0]):
                        raise Exception()

                    params = dict(urlparse.parse_qsl(read.replace("?", "")))

                    try:
                        tvshowtitle = params["tvshowtitle"]
                    except:
                        tvshowtitle = None
                    try:
                        tvshowtitle = params["show"]
                    except:
                        pass
                    if tvshowtitle == None or tvshowtitle == "":
                        raise Exception()

                    year, imdb, tvdb = params["year"], params["imdb"], params["tvdb"]

                    imdb = "tt" + re.sub("[^0-9]", "", str(imdb))

                    try:
                        tmdb = params["tmdb"]
                    except:
                        tmdb = "0"

                    try:
                        tvrage = params["tvrage"]
                    except:
                        tvrage = "0"

                    items.append(
                        {
                            "tvshowtitle": tvshowtitle,
                            "year": year,
                            "imdb": imdb,
                            "tmdb": tmdb,
                            "tvdb": tvdb,
                            "tvrage": tvrage,
                        }
                    )
                except:
                    pass

            items = [i for x, i in enumerate(items) if i not in items[x + 1 :]]
            if len(items) == 0:
                raise Exception()
        except:
            return

        try:
            lib = control.jsonrpc(
                '{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"properties" : ["imdbnumber", "title", "year"]}, "id": 1}'
            )
            lib = unicode(lib, "utf-8", errors="ignore")
            lib = json.loads(lib)["result"]["tvshows"]
        except:
            return

        if (
            info == "true"
            and not control.condVisibility("Window.IsVisible(infodialog)")
            and not control.condVisibility("Player.HasVideo")
        ):
            control.infoDialog(control.lang(30422).encode("utf-8"), time=10000000)
            self.infoDialog = True

        try:
            control.makeFile(control.dataPath)
            dbcon = database.connect(control.libcacheFile)
            dbcur = dbcon.cursor()
            dbcur.execute("CREATE TABLE IF NOT EXISTS tvshows (" "id TEXT, " "items TEXT, " "UNIQUE(id)" ");")
        except:
            return
        try:
            from resources.lib.indexers import episodes
        except:
            return

        for item in items:
            it = None

            if xbmc.abortRequested == True:
                return sys.exit()

            try:
                dbcur.execute("SELECT * FROM tvshows WHERE id = '%s'" % item["tvdb"])
                fetch = dbcur.fetchone()
                it = eval(fetch[1].encode("utf-8"))
            except:
                pass

            try:
                if not it == None:
                    raise Exception()

                it = episodes.episodes().get(
                    item["tvshowtitle"],
                    item["year"],
                    item["imdb"],
                    item["tmdb"],
                    item["tvdb"],
                    item["tvrage"],
                    idx=False,
                )

                status = it[0]["status"].lower()

                it = [
                    {
                        "name": i["name"],
                        "title": i["title"],
                        "year": i["year"],
                        "imdb": i["imdb"],
                        "tmdb": i["tmdb"],
                        "tvdb": i["tvdb"],
                        "tvrage": i["tvrage"],
                        "season": i["season"],
                        "episode": i["episode"],
                        "tvshowtitle": i["tvshowtitle"],
                        "alter": i["alter"],
                        "date": i["premiered"],
                    }
                    for i in it
                ]

                if status == "continuing":
                    raise Exception()
                dbcur.execute("INSERT INTO tvshows Values (?, ?)", (item["tvdb"], repr(it)))
                dbcon.commit()
            except:
                pass

            try:
                id = [item["imdb"], item["tvdb"]]
                if not item["tmdb"] == "0":
                    id += [item["tmdb"]]

                ep = [
                    x["title"].encode("utf-8")
                    for x in lib
                    if str(x["imdbnumber"]) in id
                    or (x["title"].encode("utf-8") == item["tvshowtitle"] and str(x["year"]) == item["year"])
                ][0]
                ep = control.jsonrpc(
                    '{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"filter":{"and": [{"field": "tvshow", "operator": "is", "value": "%s"}]}, "properties": ["season", "episode"]}, "id": 1}'
                    % ep
                )
                ep = unicode(ep, "utf-8", errors="ignore")
                ep = json.loads(ep)["result"]["episodes"][-1]

                num = [
                    x
                    for x, y in enumerate(it)
                    if str(y["season"]) == str(ep["season"]) and str(y["episode"]) == str(ep["episode"])
                ][-1]
                it = [y for x, y in enumerate(it) if x > num]
                if len(it) == 0:
                    continue
            except:
                continue

            for i in it:
                try:
                    if xbmc.abortRequested == True:
                        return sys.exit()

                    if int(self.date) <= int(re.sub("[^0-9]", "", str(i["date"]))):
                        from resources.lib.sources import sources

                        src = sources().checkSources(
                            i["name"],
                            i["title"],
                            i["year"],
                            i["imdb"],
                            i["tmdb"],
                            i["tvdb"],
                            i["tvrage"],
                            i["season"],
                            i["episode"],
                            i["tvshowtitle"],
                            i["alter"],
                            i["date"],
                        )
                        control.log("### SOURCES SRC 10 %s | %s" % (src, i["name"]))
                        if src == False:
                            raise Exception()

                    libtvshows().strmFile(i)
                except:
                    pass

        if self.infoDialog == True:
            control.infoDialog(control.lang(30423).encode("utf-8"), time=1)

        if self.library_setting == "true" and not control.condVisibility("Library.IsScanningVideo"):
            control.execute("UpdateLibrary(video)")
コード例 #26
0
	def addDirectory(self, items, queue=False):
		if items is None or len(items) == 0: return
		sysaddon = argv[0]
		addonPoster = addonBanner = control.addonInfo('icon')
		addonFanart = control.addonInfo('fanart')

		playlist = control.playlist
		if not queue is False: playlist.clear()

		try: devmode = True if 'testings.xml' in control.listDir(control.dataPath)[1] else False
		except: devmode = False

		mode = [i['content'] for i in items if 'content' in i]
		if 'movies' in mode: mode = 'movies'
		elif 'tvshows' in mode: mode = 'tvshows'
		elif 'seasons' in mode: mode = 'seasons'
		elif 'episodes' in mode: mode = 'episodes'
		elif 'videos' in mode: mode = 'videos'
		else: mode = 'addons'
		for i in items:
			try: 
				try: name = control.lang(int(i['name']))
				except: name = i['name']
				if name == '': name = i['name']
				url = '%s?action=%s' % (sysaddon, i['action'])
				try: url += '&url=%s' % quote_plus(i['url'])
				except: pass
				try: url += '&content=%s' % quote_plus(i['content'])
				except: pass

				if i['action'] == 'plugin' and 'url' in i: url = i['url']

				try: devurl = dict(parse_qsl(urlparse(url).query))['action']
				except: devurl = None
				if devurl == 'developer' and not devmode is True: raise Exception()

				poster = i['poster'] if 'poster' in i else ''
				banner = i['banner'] if 'banner' in i else ''
				fanart = i['fanart'] if 'fanart' in i else ''
				if not poster: poster = addonPoster
				if not banner and not poster: banner = addonBanner
				elif banner == '': banner = poster

				content = i['content'] if 'content' in i else ''
				folder = i['folder'] if 'folder' in i else True

				meta = dict((k, v) for k, v in control.iteritems(i) if v is not None and v != '')
				cm = []

				if content in ['movies', 'tvshows']:
					meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, quote_plus(name))})
					cm.append((control.lang(30707), 'RunPlugin(%s?action=trailer&name=%s)' % (sysaddon, quote_plus(name))))

				if content in ['movies', 'tvshows', 'seasons', 'episodes']:
					cm.append((control.lang(30708), 'XBMC.Action(Info)'))

				if (folder is False and not '|regex=' in str(i.get('url'))) or (folder is True and content in ['tvshows', 'seasons']):
					cm.append((control.lang(30723), 'RunPlugin(%s?action=playlist_QueueItem)' % sysaddon))

				if content == 'movies':
					try: dfile = '%s (%s)' % (i['title'], i['year'])
					except: dfile = name
					try: cm.append((control.lang(30722), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, quote_plus(dfile), quote_plus(i['url']), quote_plus(poster))))
					except: pass
				elif content == 'episodes':
					try: dfile = '%s S%02dE%02d' % (i['tvshowtitle'], int(i['season']), int(i['episode']))
					except: dfile = name
					try: cm.append((control.lang(30722), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, quote_plus(dfile), quote_plus(i['url']), quote_plus(poster))))
					except: pass
				elif content == 'songs':
					try: cm.append((control.lang(30722), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, quote_plus(name), quote_plus(i['url']), quote_plus(poster))))
					except: pass

				if mode == 'movies':
					cm.append((control.lang(30711), 'RunPlugin(%s?action=tools_addView&content=movies)' % sysaddon))
				elif mode == 'tvshows':
					cm.append((control.lang(30712), 'RunPlugin(%s?action=tools_addView&content=tvshows)' % sysaddon))
				elif mode == 'seasons':
					cm.append((control.lang(30713), 'RunPlugin(%s?action=tools_addView&content=seasons)' % sysaddon))
				elif mode == 'episodes':
					cm.append((control.lang(30714), 'RunPlugin(%s?action=tools_addView&content=episodes)' % sysaddon))

				if devmode is True:
					try: cm.append(('Open in browser', 'RunPlugin(%s?action=browser&url=%s)' % (sysaddon, quote_plus(i['url']))))
					except: pass

				try: item = control.item(label=name, offscreen=True)
				except: item = control.item(label=name)
				if fanart == '0': fanart = addonFanart
				try: item.setArt({'poster': poster, 'fanart': fanart, 'tvshow.poster': poster, 'season.poster': poster, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner})
				except: pass
				if queue is False:
					item.setInfo(type='Video', infoLabels = meta)
					item.addContextMenuItems(cm)
					control.addItem(handle=int(argv[1]), url=url, listitem=item, isFolder=folder)
				else:
					item.setInfo(type='Video', infoLabels = meta)
					playlist.add(url=url, listitem=item)
			except:
				log_utils.error()

		if not queue is False:
			return control.player.play(playlist)

		try:
			i = items[0]
			if i['next'] == '': raise Exception()

			# nextMenu = control.lang(32053)
			# page = '  [I](%s)[/I]' % str(url.split('&page=', 1)[1])
			# nextMenu = '[COLOR skyblue]' + nextMenu + page + '[/COLOR]'

			url = '%s?action=%s&url=%s' % (sysaddon, i['nextaction'], quote_plus(i['next']))
			try: item = control.item(label=control.lang(30500), offscreen=True)
			except: item = control.item(label=control.lang(30500))
			item.setArt({'addonPoster': addonPoster, 'thumb': addonPoster, 'poster': addonPoster, 'fanart': addonFanart, 'tvshow.poster': addonPoster, 'season.poster': addonPoster, 'banner': addonPoster, 'tvshow.banner': addonPoster, 'season.banner': addonPoster})
			control.addItem(handle=int(argv[1]), url=url, listitem=item, isFolder=True)
		except:
			log_utils.error()

		if not mode is None: control.content(int(argv[1]), mode)
		control.directory(int(argv[1]), cacheToDisc=True)
		if mode in ['movies', 'tvshows', 'seasons', 'episodes']:
			views.setView(mode, {'skin.estuary': 55})
コード例 #27
0
    def root(self):
        self.addDirectoryItem('[COLOR=orange]News and Updates[/COLOR]',
                              'newsNavigator', 'tools.png',
                              'DefaultAddonProgram.png')
        self.addDirectoryItem(32001, 'movieNavigator', 'movies.png',
                              'DefaultMovies.png')
        self.addDirectoryItem(32002, 'tvNavigator', 'tvshows.png',
                              'DefaultTVShows.png')

        if not control.setting('lists.widget') == '0':
            self.addDirectoryItem(32003, 'mymovieNavigator', 'mymovies.png',
                                  'DefaultVideoPlaylists.png')
            self.addDirectoryItem(32004, 'mytvNavigator', 'mytvshows.png',
                                  'DefaultVideoPlaylists.png')

        if not control.setting('movie.widget') == '0':
            self.addDirectoryItem(32005, 'movieWidget', 'latest-movies.png',
                                  'DefaultRecentlyAddedMovies.png')

        if (traktIndicators == True and not control.setting('tv.widget.alt')
                == '0') or (traktIndicators == False
                            and not control.setting('tv.widget') == '0'):
            self.addDirectoryItem(32006, 'tvWidget', 'latest-episodes.png',
                                  'DefaultRecentlyAddedEpisodes.png')

        if self.getMenuEnabled('navi.docu') == True:
            self.addDirectoryItem(32631, 'docuHeaven', 'movies.png',
                                  'DefaultMovies.png')
        if self.getMenuEnabled('navi.kidscorner') == True:
            self.addDirectoryItem(32610, 'kidscorner', 'kidscorner.png',
                                  'DefaultMovies.png')
        if self.getMenuEnabled('navi.fitness') == True:
            self.addDirectoryItem(32611, 'fitness', 'fitness.png',
                                  'DefaultMovies.png')
        if self.getMenuEnabled('navi.legends') == True:
            self.addDirectoryItem(32612, 'legends', 'legends.png',
                                  'DefaultMovies.png')

        if self.getMenuEnabled('navi.podcasts') == True:
            self.addDirectoryItem(32620, 'podcastNavigator', 'podcast.png',
                                  'DefaultVideoPlaylists.png')

        self.addDirectoryItem(32008, 'toolNavigator', 'tools.png',
                              'DefaultAddonProgram.png')

        downloads = True if control.setting('downloads') == 'true' and (
            len(control.listDir(control.setting('movie.download.path'))[0]) > 0
            or len(control.listDir(control.setting('tv.download.path'))[0]) > 0
        ) else False
        if downloads == True:
            self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png',
                                  'DefaultFolder.png')

        self.addDirectoryItem(32010, 'searchNavigator', 'search.png',
                              'DefaultFolder.png')
        self.addDirectoryItem(
            '[COLOR=orange]Follow on Twitter: @Daddy_Blamo[/COLOR]',
            'sectionItem', 'icon.png', 'DefaultAddonProgram.png')
        self.addDirectoryItem(
            '[COLOR=orange]Can find on YouTube at http://youtube.tantrumtv.com[/COLOR]',
            'sectionItem', 'icon.png', 'DefaultAddonProgram.png')

        self.endDirectory()
コード例 #28
0
ファイル: streamhub.py プロジェクト: vphuc81/MyRepository
    def addDirectory(self, items, queue=False):
        if items == None or len(items) == 0: return

        sysaddon = sys.argv[0]
        addonPoster = addonBanner = control.addonInfo('icon')
        addonFanart = control.addonInfo('fanart')

        playlist = control.playlist
        if not queue == False: playlist.clear()

        try: devmode = True if 'testings.xml' in control.listDir(control.dataPath)[1] else False
        except: devmode = False

        mode = [i['content'] for i in items if 'content' in i]
        if 'movies' in mode: mode = 'movies'
        elif 'tvshows' in mode: mode = 'tvshows'
        elif 'seasons' in mode: mode = 'seasons'
        elif 'episodes' in mode: mode = 'episodes'
        elif 'addons' in mode: mode = 'addons'
        else: mode = 'videos'

        for i in items:
            try:
                try: name = control.lang(int(i['name'])).encode('utf-8')
                except: name = i['name']

                url = '%s?action=%s' % (sysaddon, i['action'])
                try: url += '&url=%s' % urllib.quote_plus(i['url'])
                except: pass
                try: url += '&content=%s' % urllib.quote_plus(i['content'])
                except: pass

                if i['action'] == 'plugin' and 'url' in i: url = i['url']

                try: devurl = dict(urlparse.parse_qsl(urlparse.urlparse(url).query))['action']
                except: devurl = None
                if devurl == 'developer' and not devmode == True: raise Exception()

                poster = i['poster'] if 'poster' in i else '0'
                banner = i['banner'] if 'banner' in i else '0'
                fanart = i['fanart'] if 'fanart' in i else '0'
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster

                content = i['content'] if 'content' in i else '0'

                folder = i['folder'] if 'folder' in i else True

                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')

                cm = []

                if content in ['movies', 'tvshows']:
                    meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, urllib.quote_plus(name))})
                    cm.append((control.lang(30707).encode('utf-8'), 'RunPlugin(%s?action=trailer&name=%s)' % (sysaddon, urllib.quote_plus(name))))

                if content in ['movies', 'tvshows', 'seasons', 'episodes']:
                    cm.append((control.lang(30708).encode('utf-8'), 'XBMC.Action(Info)'))

                if (folder == False and not '|regex=' in str(i.get('url'))) or (folder == True and content in ['tvshows', 'seasons']):
                    cm.append((control.lang(30723).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon))

                if content == 'movies':
                    try: dfile = '%s (%s)' % (i['title'], i['year'])
                    except: dfile = name
                    try: cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(dfile), urllib.quote_plus(i['url']), urllib.quote_plus(poster))))
                    except: pass
                elif content == 'episodes':
                    try: dfile = '%s S%02dE%02d' % (i['tvshowtitle'], int(i['season']), int(i['episode']))
                    except: dfile = name
                    try: cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(dfile), urllib.quote_plus(i['url']), urllib.quote_plus(poster))))
                    except: pass
                elif content == 'songs':
                    try: cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(name), urllib.quote_plus(i['url']), urllib.quote_plus(poster))))
                    except: pass

                if mode == 'movies':
                    cm.append((control.lang(30711).encode('utf-8'), 'RunPlugin(%s?action=addView&content=movies)' % sysaddon))
                elif mode == 'tvshows':
                    cm.append((control.lang(30712).encode('utf-8'), 'RunPlugin(%s?action=addView&content=tvshows)' % sysaddon))
                elif mode == 'seasons':
                    cm.append((control.lang(30713).encode('utf-8'), 'RunPlugin(%s?action=addView&content=seasons)' % sysaddon))
                elif mode == 'episodes':
                    cm.append((control.lang(30714).encode('utf-8'), 'RunPlugin(%s?action=addView&content=episodes)' % sysaddon))

                if devmode == True:
                    try: cm.append(('Open in browser', 'RunPlugin(%s?action=browser&url=%s)' % (sysaddon, urllib.quote_plus(i['url']))))
                    except: pass


                item = control.item(label=name, iconImage=poster, thumbnailImage=poster)

                try: item.setArt({'poster': poster, 'tvshow.poster': poster, 'season.poster': poster, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner})
                except: pass

                if not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                if queue == False:
                    item.setInfo(type='Video', infoLabels = meta)
                    item.addContextMenuItems(cm)
                    control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=folder)
                else:
                    item.setInfo(type='Video', infoLabels = meta)
                    playlist.add(url=url, listitem=item)
            except:
                pass

        if not queue == False:
            return control.player.play(playlist)

        try:
            i = items[0]
            if i['next'] == '': raise Exception()
            url = '%s?action=%s&url=%s' % (sysaddon, i['nextaction'], urllib.quote_plus(i['next']))
            item = control.item(label=control.lang(30500).encode('utf-8'))
            item.setArt({'addonPoster': addonPoster, 'thumb': addonPoster, 'poster': addonPoster, 'tvshow.poster': addonPoster, 'season.poster': addonPoster, 'banner': addonPoster, 'tvshow.banner': addonPoster, 'season.banner': addonPoster})
            item.setProperty('addonFanart_Image', addonFanart)
            control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
        except:
            pass

        if not mode == None: control.content(int(sys.argv[1]), mode)
        control.directory(int(sys.argv[1]), cacheToDisc=True)
        if mode in ['movies', 'tvshows', 'seasons', 'episodes']:
            views.setView(mode, {'skin.estuary': 55})
コード例 #29
0
    def root(self):
        self.addDirectoryItem('[COLOR red]Search[/COLOR]', 'searchNavigator',
                              'search.png', 'DefaultFolder.png')
        if traktCredentials == True:
            self.addDirectoryItem(
                '[COLOR yellow]Trakt[/COLOR] TV Series',
                'tvshows&url=http://api.trakt.tv/users/k1m05/lists/series/items',
                'trakt.png', 'DefaultTVShows.png')
            self.addDirectoryItem(
                '[COLOR yellow]Trakt[/COLOR] Texas Chainsaw Massacre',
                'movies&url=http://api.trakt.tv/users/k1m05/lists/texas-chainsaw-massacre/items',
                'trakt.png', 'DefaultTVShows.png')
            self.addDirectoryItem(
                '[COLOR yellow]Trakt[/COLOR] Saw',
                'movies&url=http://api.trakt.tv/users/k1m05/lists/saw/items',
                'trakt.png', 'DefaultTVShows.png')
            self.addDirectoryItem(
                '[COLOR yellow]Trakt[/COLOR] Movies',
                'movies&url=http://api.trakt.tv/users/k1m05/lists/movies/items',
                'trakt.png', 'DefaultTVShows.png')
            self.addDirectoryItem(
                '[COLOR yellow]Trakt[/COLOR] Rob Zombie',
                'movies&url=http://api.trakt.tv/users/k1m05/lists/rob-zombie/items',
                'trakt.png', 'DefaultTVShows.png')
            self.addDirectoryItem(
                '[COLOR yellow]Trakt[/COLOR] Chucky',
                'movies&url=http://api.trakt.tv/users/k1m05/lists/chucky/items',
                'trakt.png', 'DefaultTVShows.png')
            self.addDirectoryItem(
                '[COLOR yellow]Trakt[/COLOR] RarBG ScnRls',
                'movies&url=http://api.trakt.tv/users/giladg/lists/latest-releases/items',
                'trakt.png', 'DefaultTVShows.png')
            self.addDirectoryItem(
                '[COLOR yellow]Trakt[/COLOR] Horror Movie Franchises',
                'movies&url=http://api.trakt.tv/users/srcapncdlvl99/lists/horror-movie-franchises/items',
                'trakt.png', 'DefaultTVShows.png')
            #self.addDirectoryItem('[COLOR yellow]Trakt[/COLOR] ', 'tvshows&url=', 'trakt.png', 'DefaultTVShows.png')
            #self.addDirectoryItem('[COLOR yellow]Trakt[/COLOR] ', 'tvshows&url=', 'trakt.png', 'DefaultTVShows.png')
        self.addDirectoryItem('Movies', 'movieNavigator', 'movies.png',
                              'DefaultMovies.png')
        self.addDirectoryItem('TV Shows', 'tvNavigator', 'channels.png',
                              'DefaultTVShows.png')

        if not control.setting('lists.widget') == '0':
            self.addDirectoryItem('Movies (Trakt/Imdb)', 'mymovieNavigator',
                                  'mymovies.png', 'DefaultVideoPlaylists.png')
            self.addDirectoryItem('TV Shows (Trakt/Imdb)', 'mytvNavigator',
                                  'mymovies.png', 'DefaultVideoPlaylists.png')

        if not control.setting('movie.widget') == '0':
            self.addDirectoryItem('New Movies', 'movieWidget',
                                  'latest-movies.png',
                                  'DefaultRecentlyAddedMovies.png')

        if (traktIndicators == True and not control.setting('tv.widget.alt')
                == '0') or (traktIndicators == False
                            and not control.setting('tv.widget') == '0'):
            self.addDirectoryItem('New TV Shows', 'tvshows&url=premiere',
                                  'years.png',
                                  'DefaultRecentlyAddedEpisodes.png')

        self.addDirectoryItem('Tools', 'toolNavigator', 'tools.png',
                              'DefaultAddonProgram.png')

        downloads = True if control.setting('downloads') == 'true' and (
            len(control.listDir(control.setting('movie.download.path'))[0]) > 0
            or len(control.listDir(control.setting('tv.download.path'))[0]) > 0
        ) else False
        if downloads == True:
            self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png',
                                  'DefaultFolder.png')

        self.endDirectory()
コード例 #30
0
ファイル: phstreams.py プロジェクト: kevintone/tdbaddon
    def addDirectory(self, items, mode=True):
        if items == None or len(items) == 0: return

        sysaddon = sys.argv[0]
        addonPoster = addonBanner = control.addonInfo('icon')
        addonFanart = control.addonInfo('fanart')

        try: devmode = True if 'testings.xml' in control.listDir(control.dataPath)[1] else False
        except: devmode = False

        if mode == True: mode = [i['content'] for i in items if 'content' in i]
        else: mode = []
        if 'movies' in mode: mode = 'movies'
        elif 'tvshows' in mode: mode = 'tvshows'
        elif 'seasons' in mode: mode = 'seasons'
        elif 'episodes' in mode: mode = 'episodes'
        else: mode = None

        for i in items:
            try:
                try: name = control.lang(int(i['name'])).encode('utf-8')
                except: name = i['name']

                url = '%s?action=%s' % (sysaddon, i['action'])
                try: url += '&url=%s' % urllib.quote_plus(i['url'])
                except: pass

                if i['action'] == 'plugin' and 'url' in i: url = i['url']
                if i['action'] == 'developer' and not devmode == True: raise Exception()

                poster = i['poster'] if 'poster' in i else '0'
                banner = i['banner'] if 'banner' in i else '0'
                fanart = i['fanart'] if 'fanart' in i else '0'
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster

                content = i['content'] if 'content' in i else '0'
                replaceItems = False if content == '0' else True

                folder = i['folder'] if 'folder' in i else True

                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                try: meta.update({'duration': str(int(meta['duration']) * 60)})
                except: pass

                cm = []

                if content in ['movies', 'tvshows']:
                    meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, urllib.quote_plus(name))})
                    cm.append((control.lang(30707).encode('utf-8'), 'RunPlugin(%s?action=trailer&name=%s)' % (sysaddon, urllib.quote_plus(name))))

                if content == 'movies':
                    cm.append((control.lang(30708).encode('utf-8'), 'XBMC.Action(Info)'))
                elif content in ['tvshows', 'seasons']:
                    cm.append((control.lang(30709).encode('utf-8'), 'XBMC.Action(Info)'))
                elif content == 'episodes':
                    cm.append((control.lang(30710).encode('utf-8'), 'XBMC.Action(Info)'))

                if content == 'movies':
                    try: dfile = '%s (%s)' % (data['title'], data['year'])
                    except: dfile = name
                    try: cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(dfile), urllib.quote_plus(i['url']), urllib.quote_plus(poster))))
                    except: pass
                elif content == 'episodes':
                    try: dfile = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode']))
                    except: dfile = name
                    try: cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(dfile), urllib.quote_plus(i['url']), urllib.quote_plus(poster))))
                    except: pass

                if mode == 'movies':
                    cm.append((control.lang(30711).encode('utf-8'), 'RunPlugin(%s?action=addView&content=movies)' % sysaddon))
                elif mode == 'tvshows':
                    cm.append((control.lang(30712).encode('utf-8'), 'RunPlugin(%s?action=addView&content=tvshows)' % sysaddon))
                elif mode == 'seasons':
                    cm.append((control.lang(30713).encode('utf-8'), 'RunPlugin(%s?action=addView&content=seasons)' % sysaddon))
                elif mode == 'episodes':
                    cm.append((control.lang(30714).encode('utf-8'), 'RunPlugin(%s?action=addView&content=episodes)' % sysaddon))

                if devmode == True:
                    try: cm.append(('Open in browser', 'RunPlugin(%s?action=browser&url=%s)' % (sysaddon, urllib.quote_plus(i['url']))))
                    except: pass

                if replaceItems == True:
                    cm.append((control.lang(30725).encode('utf-8'), 'RunPlugin(%s?action=openSettings)' % sysaddon))


                item = control.item(label=name, iconImage=poster, thumbnailImage=poster)

                try: item.setArt({'poster': poster, 'tvshow.poster': poster, 'season.poster': poster, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner})
                except: pass

                if not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setInfo(type='Video', infoLabels = meta)
                item.addContextMenuItems(cm, replaceItems=replaceItems)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=folder)
            except:
                pass

        if not mode == None: control.content(int(sys.argv[1]), mode)
        #control.do_block_check(False)
        control.directory(int(sys.argv[1]), cacheToDisc=True)
        if not mode == None: views.setView(mode)
コード例 #31
0
	def downloads(self):
		movie_downloads = getSetting('movie.download.path')
		tv_downloads = getSetting('tv.download.path')
		if len(control.listDir(movie_downloads)[0]) > 0: self.addDirectoryItem(32001, movie_downloads, 'movies.png', 'DefaultMovies.png', isAction=False)
		if len(control.listDir(tv_downloads)[0]) > 0: self.addDirectoryItem(32002, tv_downloads, 'tvshows.png', 'DefaultTVShows.png', isAction=False)
		self.endDirectory()
コード例 #32
0
	def update(self):
		if control.setting('library.service.update') == 'false': control.notification(message=32106)
		contains = lib_tools().ckKodiSources()
		if not contains:
			control.notification(message=32107)
			return

		try:
			items, season, episode = [], [], []
			show = [control.joinPath(self.library_folder, i) for i in control.listDir(self.library_folder)[0]]
			if show == []:
				control.notification(message=32108)
				return
			for s in show:
				try: season += [control.joinPath(s, i) for i in control.listDir(s)[0]]
				except: pass
			for s in season:
				try: episode.append([control.joinPath(s, i) for i in control.listDir(s)[1] if i.endswith('.strm')][-1])
				except: pass
			for file in episode:
				try:
					file = control.openFile(file)
					read = file.read()
					read = read.encode('utf-8')
					file.close()
					if not read.startswith(sys.argv[0]): continue

					params = dict(parse_qsl(read.replace('?','')))
					try: tvshowtitle = params['tvshowtitle']
					except: tvshowtitle = None

					try: tvshowtitle = params['show']
					except: pass

					if tvshowtitle is None or tvshowtitle == '': continue

					year, imdb, tvdb = params['year'], params['imdb'], params['tvdb']
					imdb = 'tt' + re.sub(r'[^0-9]', '', str(imdb))
					tmdb = params.get('tmdb', '0')

					items.append({'tvshowtitle': tvshowtitle, 'year': year, 'imdb': imdb, 'tmdb': tmdb, 'tvdb': tvdb})
				except: pass

			items = [i for x, i in enumerate(items) if i not in items[x + 1:]]

			if len(items) == 0: return
		except:
			log_utils.error()
			return

		try:
			lib = control.jsonrpc('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"properties": ["imdbnumber", "title", "year"]}, "id": 1 }')
			# lib = control.jsonrpc('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"filter":{"or": [{"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}]}, "properties": ["imdbnumber", "title", "year"]}, "id": 1}' % (year, str(int(year)+1), str(int(year)-1)))
			lib = unicode(lib, 'utf-8', errors='ignore')
			lib = loads(lib)['result']['tvshows']
		except:
			log_utils.error()
			return

		if service_notification and not control.condVisibility('Window.IsVisible(infodialog)') and not control.condVisibility('Player.HasVideo'):
			control.notification(message=32553)

		try:
			control.makeFile(control.dataPath)
			dbcon = database.connect(control.libcacheFile)
			dbcur = dbcon.cursor()
			dbcur.execute('''CREATE TABLE IF NOT EXISTS tvshows (id TEXT, items TEXT, UNIQUE(id));''')
			dbcur.connection.commit()
			# from resources.lib.menus import episodes
			from resources.lib.menus import seasons
		except:
			log_utils.error()
			try: dbcur.close() ; dbcon.close()
			except: pass
			return

		files_added = 0
		# __init__ doesn't get called from services so self.date never gets updated and new episodes are not added to the library
		# self.date_time = (datetime.utcnow() - timedelta(hours=5))
		self.date_time = datetime.utcnow()
		if control.setting('library.importdelay') != 'true': self.date = self.date_time.strftime('%Y%m%d')
		else: self.date = (self.date_time - timedelta(hours=24)).strftime('%Y%m%d')

		for item in items:
			it = None
			if control.monitor.abortRequested():
				try: dbcur.close() ; dbcon.close()
				except: pass
				return sys.exit()

			try:
				fetch = dbcur.execute("SELECT * FROM tvshows WHERE id = '%s'" % item['tvdb']).fetchone()
				if fetch: it = eval(fetch[1].encode('utf-8'))
			except:
				log_utils.error()

			try:
				if it: raise Exception()
				# it = episodes.Episodes().get(item['tvshowtitle'], item['year'], item['imdb'], item['tmdb'], item['tvdb'], idx=False)
				it = seasons.Seasons().tvdb_list(item['tvshowtitle'], item['year'], item['imdb'], item['tmdb'], item['tvdb'], control.apiLanguage()['tvdb'], '-1') # fetch fresh meta (uncached)
				if not it: continue
				status = it[0]['status'].lower()
				it = [{'title': i['title'], 'year': i['year'], 'imdb': i['imdb'], 'tmdb': i['tmdb'], 'tvdb': i['tvdb'], 'season': i['season'], 'episode': i['episode'], 'tvshowtitle': i['tvshowtitle'], 'premiered': i['premiered']} for i in it]
				if status == 'continuing': raise Exception()
				dbcur.execute("INSERT INTO tvshows Values (?, ?)", (item['tvdb'], repr(it)))
				dbcur.connection.commit()
			except:
				log_utils.error()

			try:
				id = [item['imdb'], item['tvdb']]
				if item['tmdb'] != '0':
					id += [item['tmdb']]
				ep = [x['title'].encode('utf-8') for x in lib if str(x['imdbnumber']) in id or (x['title'].encode('utf-8') == item['tvshowtitle'] and str(x['year']) == item['year'])][0]
				ep = control.jsonrpc('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"filter":{"and": [{"field": "tvshow", "operator": "is", "value": "%s"}]}, "properties": ["season", "episode"]}, "id": 1}' % ep)
				ep = unicode(ep, 'utf-8', errors = 'ignore')
				ep = loads(ep).get('result', {}).get('episodes', {})
				ep = [{'season': int(i['season']), 'episode': int(i['episode'])} for i in ep]
				ep = sorted(ep, key = lambda x: (x['season'], x['episode']))[-1]
				num = [x for x,y in enumerate(it) if str(y['season']) == str(ep['season']) and str(y['episode']) == str(ep['episode'])][-1]
				it = [y for x,y in enumerate(it) if x > num]
				if len(it) == 0: continue
			except:
				# log_utils.error()
				continue

			for i in it:
				if control.monitor.abortRequested(): return sys.exit()
				try:
					# Show Season Special(Season0).
					if str(i.get('season')) == '0' and control.setting('tv.specials') == 'false': continue
					# Show Unaired items.
					premiered = i.get('premiered', '0')
					if premiered == '0' and self.include_unknown == 'false': continue
					elif int(re.sub(r'[^0-9]', '', str(premiered))) > int(re.sub(r'[^0-9]', '', str(self.date))):
						if self.showunaired != 'true': continue
					libtvshows().strmFile(i)
					files_added += 1
					if service_notification :
						control.notification(title=item['tvshowtitle'], message=32678)
				except:
					log_utils.error()

		try: dbcur.close() ; dbcon.close()
		except: pass

		if files_added == 0 and service_notification :
			control.notification(message=32109)

		if self.library_update == 'true' and not control.condVisibility('Library.IsScanningVideo') and files_added > 0:
			if contains:
				if service_notification:
					control.notification(message=32554)
				control.sleep(10000)
				control.execute('UpdateLibrary(video)')
			elif service_notification:
				control.notification(message=32103)
コード例 #33
0
ファイル: navigator.py プロジェクト: southpaw99/houseatreides
    def root(self):
        rootMenu = jsonmenu.jsonMenu()
        rootMenu.load('main')

        for item in rootMenu.menu['main_menu']:
            try:
                '''
                First things first, let's see if this is an entry with on/off settings and if we should display it.
                '''
                try:
                    toggle = item.get('toggle', None)
                    if toggle is not None:
                        if self.getMenuEnabled(toggle) is False:
                            continue
                except Exception:
                    pass
                '''
                Language file support can be done this way
                '''
                title = item.get('title', 'No Title Given')
                tcheck = title
                try:
                    title = control.lang(int(title)).encode('utf-8')
                except Exception:
                    pass
                '''
                Check to see if is a My Lists entry and skip if not enabled
                '''
                try:
                    if tcheck == '32003' or tcheck == '32004':
                        if control.setting('lists.widget') == '0':
                            continue
                except Exception:
                    pass
                '''
                Check to see if is New Movies and skip if not enabled
                '''
                try:
                    if tcheck == '32005':
                        theSetting = control.setting('movie.widget')
                        if theSetting == '0':
                            continue
                        if theSetting == '1':
                            title = title + " (" + control.lang(32321).encode(
                                'utf-8') + ")"
                        elif theSetting == '2':
                            title = title + " (" + control.lang(32322).encode(
                                'utf-8') + ")"
                        elif theSetting == '3':
                            title = title + " (" + control.lang(32323).encode(
                                'utf-8') + ")"
                        elif theSetting == '4':
                            title = title + " (" + control.lang(32324).encode(
                                'utf-8') + ")"
                        elif theSetting == '5':
                            title = title + " (" + control.lang(32580).encode(
                                'utf-8') + ")"
                except Exception:
                    pass
                '''
                Check to see if is New Episodes entry and skip if not enabled
                '''
                try:
                    if tcheck == '32006':
                        if (traktIndicators is True
                                and control.setting('tv.widget.alt') == '0'
                            ) or (traktIndicators is False
                                  and control.setting('tv.widget') == '0'):
                            continue
                except Exception:
                    pass
                '''
                Check to see if is Downloads entry and skip if not enabled
                '''
                try:
                    if tcheck == '32009':
                        downloads = True if control.setting(
                            'downloads') == 'true' and (len(
                                control.listDir(
                                    control.setting('movie.download.path'))[0]
                            ) > 0 or len(
                                control.listDir(
                                    control.setting('tv.download.path'))[0]) >
                                                        0) else False
                        if downloads is False:
                            continue
                except Exception:
                    pass

                icon = item['thumbnail']
                link = item.get('action', None)

                try:
                    menu_file = item.get('menu_file', None)
                    menu_section = item.get('menu_section', None)
                    link = '%s&menu_file=%s&menu_section=%s' % (
                        link, menu_file,
                        menu_section) if menu_file is not None else link
                except Exception:
                    pass

                try:
                    link = '%s&menu_title=%s' % (link, title)
                except Exception:
                    pass

                try:
                    menu_sort = item.get('menu_sort', None)
                    link = '%s&menu_sort=%s' % (
                        link, menu_sort) if menu_sort is not None else link
                except Exception:
                    pass

                self.addDirectoryItem(title, link, icon, icon)
            except Exception:
                pass

        self.endDirectory()

        newsUpdate = control.setting('NewsUpdate')
        if newsUpdate == '':
            newsUpdate = 1
        else:
            newsUpdate = int(float(newsUpdate))
        if time.time() < newsUpdate:
            return
        newsUpdate = time.time() + (60 * 60 * 24 * 7)
        control.setSetting('NewsUpdate', str(newsUpdate))

        from resources.lib.dialogs import news
        news.load()
コード例 #34
0
ファイル: streams.py プロジェクト: bitsbb01/coldkeys-addons
    def addDirectory(self, items, mode=True):
        if items == None or len(items) == 0: return

        sysaddon = sys.argv[0]
        addonPoster = addonBanner = control.addonInfo('icon')
        addonFanart = control.addonInfo('fanart')

        try:
            devmode = True if 'testings.xml' in control.listDir(
                control.dataPath)[1] else False
        except:
            devmode = False

        if mode == True: mode = [i['content'] for i in items if 'content' in i]
        else: mode = []
        if 'movies' in mode: mode = 'movies'
        elif 'tvshows' in mode: mode = 'tvshows'
        elif 'seasons' in mode: mode = 'seasons'
        elif 'episodes' in mode: mode = 'episodes'
        else: mode = None

        for i in items:
            try:
                try:
                    name = control.lang(int(i['name'])).encode('utf-8')
                except:
                    name = i['name']

                url = '%s?action=%s' % (sysaddon, i['action'])
                try:
                    url += '&url=%s' % urllib.quote_plus(i['url'])
                except:
                    pass

                if i['action'] == 'plugin' and 'url' in i: url = i['url']
                if i['action'] == 'developer' and not devmode == True:
                    raise Exception()

                poster = i['poster'] if 'poster' in i else '0'
                banner = i['banner'] if 'banner' in i else '0'
                fanart = i['fanart'] if 'fanart' in i else '0'
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster

                content = i['content'] if 'content' in i else '0'
                replaceItems = False if content == '0' else True

                folder = i['folder'] if 'folder' in i else True

                meta = dict((k, v) for k, v in i.iteritems() if not v == '0')
                try:
                    meta.update({'duration': str(int(meta['duration']) * 60)})
                except:
                    pass

                cm = []

                if content in ['movies', 'tvshows']:
                    meta.update({
                        'trailer':
                        '%s?action=trailer&name=%s' %
                        (sysaddon, urllib.quote_plus(name))
                    })
                    cm.append((control.lang(30707).encode('utf-8'),
                               'RunPlugin(%s?action=trailer&name=%s)' %
                               (sysaddon, urllib.quote_plus(name))))

                if content == 'movies':
                    cm.append((control.lang(30708).encode('utf-8'),
                               'XBMC.Action(Info)'))
                elif content in ['tvshows', 'seasons']:
                    cm.append((control.lang(30709).encode('utf-8'),
                               'XBMC.Action(Info)'))
                elif content == 'episodes':
                    cm.append((control.lang(30710).encode('utf-8'),
                               'XBMC.Action(Info)'))

                if content == 'movies':
                    try:
                        dfile = '%s (%s)' % (data['title'], data['year'])
                    except:
                        dfile = name
                    try:
                        cm.append((control.lang(30722).encode(
                            'utf-8'
                        ), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)'
                                   % (sysaddon, urllib.quote_plus(dfile),
                                      urllib.quote_plus(i['url']),
                                      urllib.quote_plus(poster))))
                    except:
                        pass
                elif content == 'episodes':
                    try:
                        dfile = '%s S%02dE%02d' % (data['tvshowtitle'],
                                                   int(data['season']),
                                                   int(data['episode']))
                    except:
                        dfile = name
                    try:
                        cm.append((control.lang(30722).encode(
                            'utf-8'
                        ), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)'
                                   % (sysaddon, urllib.quote_plus(dfile),
                                      urllib.quote_plus(i['url']),
                                      urllib.quote_plus(poster))))
                    except:
                        pass

                if mode == 'movies':
                    cm.append((control.lang(30711).encode('utf-8'),
                               'RunPlugin(%s?action=addView&content=movies)' %
                               sysaddon))
                elif mode == 'tvshows':
                    cm.append((control.lang(30712).encode('utf-8'),
                               'RunPlugin(%s?action=addView&content=tvshows)' %
                               sysaddon))
                elif mode == 'seasons':
                    cm.append((control.lang(30713).encode('utf-8'),
                               'RunPlugin(%s?action=addView&content=seasons)' %
                               sysaddon))
                elif mode == 'episodes':
                    cm.append(
                        (control.lang(30714).encode('utf-8'),
                         'RunPlugin(%s?action=addView&content=episodes)' %
                         sysaddon))

                if devmode == True:
                    try:
                        cm.append(('Open in browser',
                                   'RunPlugin(%s?action=browser&url=%s)' %
                                   (sysaddon, urllib.quote_plus(i['url']))))
                    except:
                        pass

                if replaceItems == True:
                    cm.append((control.lang(30725).encode('utf-8'),
                               'RunPlugin(%s?action=openSettings)' % sysaddon))

                item = control.item(label=name,
                                    iconImage=poster,
                                    thumbnailImage=poster)

                try:
                    item.setArt({
                        'poster': poster,
                        'tvshow.poster': poster,
                        'season.poster': poster,
                        'banner': banner,
                        'tvshow.banner': banner,
                        'season.banner': banner
                    })
                except:
                    pass

                if not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                item.setInfo(type='Video', infoLabels=meta)
                item.addContextMenuItems(cm, replaceItems=replaceItems)
                control.addItem(handle=int(sys.argv[1]),
                                url=url,
                                listitem=item,
                                isFolder=folder)
            except:
                pass

        if not mode == None: control.content(int(sys.argv[1]), mode)
        control.directory(int(sys.argv[1]), cacheToDisc=True)
        if not mode == None: views.setView(mode)
コード例 #35
0
    def root(self):
        self.addDirectoryItem(32001, 'movieNavigator', 'movies.png',
                              'DefaultMovies.png')
        self.addDirectoryItem('Family Movies', 'movies&url=fammov', 'fam.png',
                              'DefaultMovies.png')
        self.addDirectoryItem(32002, 'tvNavigator', 'tvshows.png',
                              'DefaultTVShows.png')
        self.addDirectoryItem('Family TV Shows', 'tvshows&url=famtv',
                              'famt.png', 'DefaultTVShows.png')

        if self.getMenuEnabled('mylists.widget') is True:
            self.addDirectoryItem(32003, 'mymovieNavigator', 'mymovies.png',
                                  'DefaultVideoPlaylists.png')
            self.addDirectoryItem(32004, 'mytvNavigator', 'mytvshows.png',
                                  'DefaultVideoPlaylists.png')

        if not control.setting('newmovies.widget') == '0':
            indexer = 32478
            indexer_icon = 'imdb.png'
            setting = control.setting('newmovies.widget')
            if setting == '2':
                indexer = 32479
                indexer_icon = 'trakt.png'
            self.addDirectoryItem(
                32477 if control.setting('index.labels') == 'false' else
                indexer, 'newMovies',
                'latest-movies.png' if control.setting('icon.logos')
                == 'Traditional' else indexer_icon,
                'DefaultRecentlyAddedMovies.png')

        if (traktIndicators is True and not control.setting('tv.widget.alt')
                == '0') or (traktIndicators is False
                            and not control.setting('tv.widget') == '0'):
            indexer = 32481
            indexer_icon = 'tvmaze.png'
            setting = control.setting('tv.widget.alt')
            if setting == '2' or setting == '3':
                indexer = 32482
                indexer_icon = 'trakt.png'
            self.addDirectoryItem(
                32480 if control.setting('index.labels') == 'false' else
                indexer, 'tvWidget',
                'latest-episodes.png' if control.setting('icon.logos')
                == 'Traditional' else indexer_icon,
                'DefaultRecentlyAddedEpisodes.png')
            self.addDirectoryItem(
                32483 if control.setting('index.labels') == 'false' else 32484,
                'calendar&url=added',
                'latest-episodes.png' if control.setting('icon.logos')
                == 'Traditional' else 'tvmaze.png',
                'DefaultTVShows.png',
                queue=True)

        if not control.setting('furk.api') == '' or None:
            self.addDirectoryItem('Furk.net', 'furkNavigator', 'movies.png',
                                  'DefaultMovies.png')

        self.addDirectoryItem(32010, 'searchNavigator', 'search.png',
                              'DefaultAddonsSearch.png')
        self.addDirectoryItem(32008, 'toolNavigator', 'tools.png',
                              'DefaultAddonService.png')

        downloads = True if control.setting('downloads') == 'true' and (
            len(control.listDir(control.setting('movie.download.path'))[0]) > 0
            or len(control.listDir(control.setting('tv.download.path'))[0]) > 0
        ) else False
        if downloads is True:
            self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png',
                                  'DefaultFolder.png')

        self.endDirectory()
コード例 #36
0
    def root(self):
        self.addDirectoryItem(32001, 'movieNavigator', 'movies.png',
                              'DefaultMovies.png')
        self.addDirectoryItem(32002, 'tvNavigator', 'tvshows.png',
                              'DefaultTVShows.png')

        if not control.setting('lists.widget') == '0':
            self.addDirectoryItem(32003, 'mymovieNavigator', 'mymovies.png',
                                  'DefaultVideoPlaylists.png')
            self.addDirectoryItem(32004, 'mytvNavigator', 'mytvshows.png',
                                  'DefaultVideoPlaylists.png')

        if not control.setting('movie.widget') == '0':
            self.addDirectoryItem(32005, 'movieWidget', 'latest-movies.png',
                                  'DefaultRecentlyAddedMovies.png')

        #if (traktIndicators == True and not control.setting('tv.widget.alt') == '0') or (traktIndicators == False and not control.setting('tv.widget') == '0'):
        #	self.addDirectoryItem(32006, 'tvWidget', 'latest-episodes.png', 'DefaultRecentlyAddedEpisodes.png')

        self.addDirectoryItem(32007, 'channels', 'channels.png',
                              'DefaultMovies.png')
        self.addDirectoryItem("TV Guide", 'apollotvguide', 'channels.png',
                              'DefaultMovies.png')
        if control.addon().getSetting(
                'apollo.adult') == "true" and control.addon().getSetting(
                    'apollo.adultshow') == "true":
            self.addDirectoryItem("Adults", 'xxxNavigator', 'movies.png',
                                  'DefaultMovies.png')

        self.addDirectoryItem(32008, 'openSettings&query=0.0', 'tools.png',
                              'DefaultAddonProgram.png')

        downloads = True if control.setting('downloads') == 'true' and (
            len(control.listDir(control.setting('movie.download.path'))[0]) > 0
            or len(control.listDir(control.setting('tv.download.path'))[0]) > 0
        ) else False
        if downloads == True:
            self.addDirectoryItem(32009, 'downloadNavigator', 'downloads.png',
                                  'DefaultFolder.png')

        self.addDirectoryItem(32010, 'searchNavigator', 'search.png',
                              'DefaultFolder.png')
        if control.addon().getSetting(
                'apollo.paid') == "false" and control.addon().getAddonInfo(
                    'id') == "program.apollo":
            item = control.item(
                label=
                "[COLOR red]Visit us for more info and Support at our Facebook @ApolloGroupTV.[/COLOR]"
            )
            thumb = os.path.join(artPath, "highly-rated.png")
            item.setArt({'icon': thumb, 'thumb': thumb})
            control.addItem(handle=syshandle,
                            url='',
                            listitem=item,
                            isFolder=False)
            item = control.item(
                label=
                "[COLOR red]Free slots are full? Follow the announcement on our Facebook page.[/COLOR]"
            )
            thumb = os.path.join(artPath, "highly-rated.png")
            item.setArt({'icon': thumb, 'thumb': thumb})
            control.addItem(handle=syshandle,
                            url='',
                            listitem=item,
                            isFolder=False)

        self.endDirectory()
コード例 #37
0
    def update(self, query=None, info='true'):
        if not query == None: control.idle()

        try:

            items = []
            season, episode = [], []
            show = [
                os.path.join(self.library_folder, i)
                for i in control.listDir(self.library_folder)[0]
            ]
            for s in show:
                try:
                    season += [
                        os.path.join(s, i) for i in control.listDir(s)[0]
                    ]
                except:
                    pass
            for s in season:
                try:
                    episode.append([
                        os.path.join(s, i) for i in control.listDir(s)[1]
                        if i.endswith('.strm')
                    ][-1])
                except:
                    pass

            for file in episode:
                try:
                    file = control.openFile(file)
                    read = file.read()
                    read = read.encode('utf-8')
                    file.close()

                    if not read.startswith(sys.argv[0]): raise Exception()

                    params = dict(urlparse.parse_qsl(read.replace('?', '')))

                    try:
                        tvshowtitle = params['tvshowtitle']
                    except:
                        tvshowtitle = None
                    try:
                        tvshowtitle = params['show']
                    except:
                        pass
                    if tvshowtitle == None or tvshowtitle == '':
                        raise Exception()

                    year, imdb, tvdb = params['year'], params['imdb'], params[
                        'tvdb']

                    imdb = 'tt' + re.sub('[^0-9]', '', str(imdb))

                    try:
                        tmdb = params['tmdb']
                    except:
                        tmdb = '0'

                    items.append({
                        'tvshowtitle': tvshowtitle,
                        'year': year,
                        'imdb': imdb,
                        'tmdb': tmdb,
                        'tvdb': tvdb
                    })
                except:
                    pass

            items = [i for x, i in enumerate(items) if i not in items[x + 1:]]
            if len(items) == 0: raise Exception()
        except:
            return

        try:
            lib = control.jsonrpc(
                '{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"properties" : ["imdbnumber", "title", "year"]}, "id": 1}'
            )
            lib = unicode(lib, 'utf-8', errors='ignore')
            lib = json.loads(lib)['result']['tvshows']
        except:
            return

        if info == 'true' and not control.condVisibility(
                'Window.IsVisible(infodialog)') and not control.condVisibility(
                    'Player.HasVideo'):
            control.infoDialog(control.lang(32553).encode('utf-8'),
                               time=10000000)
            self.infoDialog = True

        try:
            control.makeFile(control.dataPath)
            dbcon = database.connect(control.libcacheFile)
            dbcur = dbcon.cursor()
            dbcur.execute("CREATE TABLE IF NOT EXISTS tvshows ("
                          "id TEXT, "
                          "items TEXT, "
                          "UNIQUE(id)"
                          ");")
        except:
            return

        try:
            from resources.lib.indexers import episodes
        except:
            return

        files_added = 0

        # __init__ doesn't get called from services so self.date never gets updated and new episodes are not added to the library
        self.datetime = (datetime.datetime.utcnow() -
                         datetime.timedelta(hours=5))
        self.date = (self.datetime -
                     datetime.timedelta(hours=24)).strftime('%Y%m%d')

        for item in items:
            it = None

            if xbmc.abortRequested == True: return sys.exit()

            try:
                dbcur.execute("SELECT * FROM tvshows WHERE id = '%s'" %
                              item['tvdb'])
                fetch = dbcur.fetchone()
                it = eval(fetch[1].encode('utf-8'))
            except:
                pass

            try:
                if not it == None: raise Exception()

                it = episodes.episodes().get(item['tvshowtitle'],
                                             item['year'],
                                             item['imdb'],
                                             item['tvdb'],
                                             idx=False)

                status = it[0]['status'].lower()

                it = [{
                    'title': i['title'],
                    'year': i['year'],
                    'imdb': i['imdb'],
                    'tvdb': i['tvdb'],
                    'season': i['season'],
                    'episode': i['episode'],
                    'tvshowtitle': i['tvshowtitle'],
                    'premiered': i['premiered']
                } for i in it]

                if status == 'continuing': raise Exception()
                dbcur.execute("INSERT INTO tvshows Values (?, ?)",
                              (item['tvdb'], repr(it)))
                dbcon.commit()
            except:
                pass

            try:
                id = [item['imdb'], item['tvdb']]
                if not item['tmdb'] == '0': id += [item['tmdb']]

                ep = [
                    x['title'].encode('utf-8') for x in lib
                    if str(x['imdbnumber']) in id or (
                        x['title'].encode('utf-8') == item['tvshowtitle']
                        and str(x['year']) == item['year'])
                ][0]
                ep = control.jsonrpc(
                    '{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"filter":{"and": [{"field": "tvshow", "operator": "is", "value": "%s"}]}, "properties": ["season", "episode"]}, "id": 1}'
                    % ep)
                ep = unicode(ep, 'utf-8', errors='ignore')
                ep = json.loads(ep).get('result', {}).get('episodes', {})
                ep = [{
                    'season': int(i['season']),
                    'episode': int(i['episode'])
                } for i in ep]
                ep = sorted(ep, key=lambda x: (x['season'], x['episode']))[-1]

                num = [
                    x for x, y in enumerate(it)
                    if str(y['season']) == str(ep['season'])
                    and str(y['episode']) == str(ep['episode'])
                ][-1]
                it = [y for x, y in enumerate(it) if x > num]
                if len(it) == 0: continue
            except:
                continue

            for i in it:
                try:
                    if xbmc.abortRequested == True: return sys.exit()

                    premiered = i.get('premiered', '0')
                    if (premiered != '0'
                            and int(re.sub('[^0-9]', '', str(premiered))) >
                            int(self.date)) or (premiered == '0'
                                                and not self.include_unknown):
                        continue

                    libtvshows().strmFile(i)
                    files_added += 1
                except:
                    pass

        if self.infoDialog == True:
            control.infoDialog(control.lang(32554).encode('utf-8'), time=1)

        if self.library_setting == 'true' and not control.condVisibility(
                'Library.IsScanningVideo') and files_added > 0:
            control.execute('UpdateLibrary(video)')
コード例 #38
0
    def update(self, query=None, info='true'):
        if not query == None: control.idle()

        try:

            items = []
            season, episode = [], []
            show = [os.path.join(self.library_folder, i) for i in control.listDir(self.library_folder)[0]]
            for s in show:
                try: season += [os.path.join(s, i) for i in control.listDir(s)[0]]
                except: pass
            for s in season:
                try: episode.append([os.path.join(s, i) for i in control.listDir(s)[1] if i.endswith('.strm')][-1])
                except: pass

            for file in episode:
                try:
                    file = control.openFile(file)
                    read = file.read()
                    read = read.encode('utf-8')
                    file.close()

                    if not read.startswith(sys.argv[0]): raise Exception()

                    params = dict(urlparse.parse_qsl(read.replace('?','')))

                    try: tvshowtitle = params['tvshowtitle']
                    except: tvshowtitle = None
                    try: tvshowtitle = params['show']
                    except: pass
                    if tvshowtitle == None or tvshowtitle == '': raise Exception()

                    year, imdb, tvdb = params['year'], params['imdb'], params['tvdb']

                    imdb = 'tt' + re.sub('[^0-9]', '', str(imdb))

                    try: tmdb = params['tmdb']
                    except: tmdb = '0'

                    items.append({'tvshowtitle': tvshowtitle, 'year': year, 'imdb': imdb, 'tmdb': tmdb, 'tvdb': tvdb})
                except:
                    pass

            items = [i for x, i in enumerate(items) if i not in items[x + 1:]]
            if len(items) == 0: raise Exception()
        except:
            return

        try:
            lib = control.jsonrpc('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"properties" : ["imdbnumber", "title", "year"]}, "id": 1}')
            lib = unicode(lib, 'utf-8', errors='ignore')
            lib = json.loads(lib)['result']['tvshows']
        except:
            return

        if info == 'true' and not control.condVisibility('Window.IsVisible(infodialog)') and not control.condVisibility('Player.HasVideo'):
            control.infoDialog(control.lang(32553).encode('utf-8'), time=10000000)
            self.infoDialog = True

        try:
            control.makeFile(control.dataPath)
            dbcon = database.connect(control.libcacheFile)
            dbcur = dbcon.cursor()
            dbcur.execute("CREATE TABLE IF NOT EXISTS tvshows (""id TEXT, ""items TEXT, ""UNIQUE(id)"");")
        except:
            return

        try:
            from resources.lib.indexers import episodes
        except:
            return

        files_added = 0

        # __init__ doesn't get called from services so self.date never gets updated and new episodes are not added to the library
        self.datetime = (datetime.datetime.utcnow() - datetime.timedelta(hours = 5))
        self.date = (self.datetime - datetime.timedelta(hours = 24)).strftime('%Y%m%d')
        
        for item in items:
            it = None

            if xbmc.abortRequested == True: return sys.exit()

            try:
                dbcur.execute("SELECT * FROM tvshows WHERE id = '%s'" % item['tvdb'])
                fetch = dbcur.fetchone()
                it = eval(fetch[1].encode('utf-8'))
            except:
                pass

            try:
                if not it == None: raise Exception()

                it = episodes.episodes().get(item['tvshowtitle'], item['year'], item['imdb'], item['tvdb'], idx=False)

                status = it[0]['status'].lower()

                it = [{'title': i['title'], 'year': i['year'], 'imdb': i['imdb'], 'tvdb': i['tvdb'], 'season': i['season'], 'episode': i['episode'], 'tvshowtitle': i['tvshowtitle'], 'premiered': i['premiered']} for i in it]

                if status == 'continuing': raise Exception()
                dbcur.execute("INSERT INTO tvshows Values (?, ?)", (item['tvdb'], repr(it)))
                dbcon.commit()
            except:
                pass

            try:
                id = [item['imdb'], item['tvdb']]
                if not item['tmdb'] == '0': id += [item['tmdb']]

                ep = [x['title'].encode('utf-8') for x in lib if str(x['imdbnumber']) in id or (x['title'].encode('utf-8') == item['tvshowtitle'] and str(x['year']) == item['year'])][0]
                ep = control.jsonrpc('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"filter":{"and": [{"field": "tvshow", "operator": "is", "value": "%s"}]}, "properties": ["season", "episode"]}, "id": 1}' % ep)
                ep = unicode(ep, 'utf-8', errors='ignore')
                ep = json.loads(ep).get('result', {}).get('episodes', {})
                ep = [{'season': int(i['season']), 'episode': int(i['episode'])} for i in ep]
                ep = sorted(ep, key=lambda x: (x['season'], x['episode']))[-1]

                num = [x for x,y in enumerate(it) if str(y['season']) == str(ep['season']) and str(y['episode']) == str(ep['episode'])][-1]
                it = [y for x,y in enumerate(it) if x > num]
                if len(it) == 0: continue
            except:
                continue

            for i in it:
                try:
                    if xbmc.abortRequested == True: return sys.exit()

                    premiered = i.get('premiered', '0')
                    if (premiered != '0' and int(re.sub('[^0-9]', '', str(premiered))) > int(self.date)) or (premiered == '0' and not self.include_unknown):
                        continue

                    libtvshows().strmFile(i)
                    files_added += 1
                except:
                    pass

        if self.infoDialog == True:
            control.infoDialog(control.lang(32554).encode('utf-8'), time=1)

        if self.library_setting == 'true' and not control.condVisibility('Library.IsScanningVideo') and files_added > 0:
            control.execute('UpdateLibrary(video)')