def getMainMenu(): if os.path.exists(uncut): li_daily = xbmcgui.ListItem('[COLOR green]RECENTLY ADDED[/COLOR]') url = get_url.fetch(mode='dailyupdate', action=main_url) li_daily.setIsFolder(True) xbmcplugin.addDirectoryItem(addon_handle, url, li_daily, True) li_1xbet = xbmcgui.ListItem('[COLOR white]NEW & POPULAR[/COLOR]') url = get_url.fetch(mode='xbet') li_1xbet.setArt({'poster': '{}/New.png'.format(imgPath)}) li_1xbet.setIsFolder(True) xbmcplugin.addDirectoryItem(addon_handle, url, li_1xbet, True) li_download = xbmcgui.ListItem('[COLOR green]DOWNLOADS[/COLOR]') url = get_url.fetch(mode='check download') li_download.setArt({'poster': '{}/Download.png'.format(imgPath)}) li_download.setIsFolder(True) xbmcplugin.addDirectoryItem(addon_handle, url, li_download, True) menu = mainListing() for cat in menu: li = xbmcgui.ListItem(label="[COLOR yellow]%s[/COLOR]" % cat) url = get_url.fetch(mode='main', category=cat) li.setArt({'poster': '{}/{}.png'.format(imgPath, cat)}) li.setIsFolder(True) xbmcplugin.addDirectoryItem(addon_handle, url, li, True) xbmcplugin.endOfDirectory(addon_handle)
def menu(): """ Creating a listing for Current Downloads. """ listing = dbHelper.show() for item in listing: download = extractMY.extract(item[0]) movie = download['name'] year = download['year'] link = item[1] videoPath = os.path.join(download_path, item[0]) li = xbmcgui.ListItem('[COLOR green]%s[/COLOR]' % (movie)) li.setInfo('video', {'title': movie, 'mediatype': 'movies'}) li.addContextMenuItems([ ('Resume Download', 'xbmc.RunPlugin(%s?mode=download&filename=%s&action=%s)' % (base_url, item[0], item[1])), ('STOP', 'xbmc.RunPlugin(%s?mode=stop)' % (base_url)), ('Remove', 'xbmc.RunPlugin(%s?mode=remove&filename=%s)' % (base_url, item[0])) ]) url = get_url.fetch(mode='video', action=videoPath) #li.setIsFolder(False) li.setProperty('IsPlayable', 'true') xbmcplugin.addDirectoryItem(addon_handle, url, li, False) xbmcplugin.endOfDirectory(addon_handle)
def getSubMenu(cat): items = subListing(cat) if type(items) == str: URLS = category.parse_level(items) first_level.addDir(URLS) else: for item in items: li = xbmcgui.ListItem(label="[COLOR yellow]%s[/COLOR]" % item['name']) url = get_url.fetch(mode='first_level', action=item['link']) li.setIsFolder(True) xbmcplugin.addDirectoryItem(addon_handle, url, li, True) xbmcplugin.endOfDirectory(addon_handle)
def menu(links): params = dict(parse_qsl(sys.argv[2][1:])) fname = params['filename'] if os.path.exists(os.path.join(download_path, fname)): dl_context = 'Resume' else: dl_context = 'Download' for link in links: li = xbmcgui.ListItem(label="[COLOR yellow]Stream Now[/COLOR]") url = get_url.fetch(mode='video', filename=fname, action=main_url + link) myMovie = extractMY.extract(fname) movie = myMovie['name'] year = myMovie['year'] tmdb = dbHelper.getInfo(movie, year)[0] if tmdb[1] == '': li.setArt({ 'icon': 'DefaultVideo.png', 'poster': 'DefaultVideo.png' }) else: li.setArt({ 'icon': '{}{}'.format(icon, tmdb[1]), 'poster': '{}{}'.format(icon, tmdb[1]) }) if tmdb[2] == '': li.setArt({'fanart': bgFile}) else: li.setArt({'fanart': '{}{}'.format(full, tmdb[2])}) if tmdb[5] == '': li.setInfo('video', {'cast': []}) else: act = """{}""".format(tmdb[5]) crew = list(json.loads(act)) li.setCast(crew) tmp_genre = """{}""".format(tmdb[7]) genre = list(json.loads(tmp_genre)) tmp_director = """{}""".format(tmdb[8]) director = list(json.loads(tmp_director)) tmp_writer = """{}""".format(tmdb[9]) writer = list(json.loads(tmp_writer)) li.setInfo( 'video', { 'title': movie, 'mediatype': 'movie', 'plot': tmdb[3], 'trailer': 'plugin://plugin.video.youtube/?action=play_video&videoid=%s' % tmdb[4], 'tagline': tmdb[6], 'genre': genre, 'director': director, 'writer': writer, 'aired': tmdb[10], 'mpaa': tmdb[11], 'rating': tmdb[12], 'duration': int(tmdb[13]) }) li.addContextMenuItems([ (dl_context, 'xbmc.RunPlugin(%s?mode=download&filename=%s&action=%s)' % (base_url, fname, main_url + link)) ]) li.setProperty('IsPlayable', 'true') #li.setIsFolder(False) xbmcplugin.addDirectoryItem(addon_handle, url, li, False) xbmcplugin.endOfDirectory(addon_handle)
def addPrimary(url): global n URLS = getPrimaryLinks(url) movies = movieList(URLS) infoList(movies) listing = [] #xbmc.log('total number of pages %s'%(str(len(movies))),xbmc.LOGNOTICE) for movie in movies: tmdb = dbHelper.getInfo(movie['name'], movie['year'])[0] filename = '{} ({}).mkv'.format(movie['name'], movie['year']) url = get_url.fetch(mode='xbetAgain', link=movie['path']) li = xbmcgui.ListItem(label='[COLOR golden]%s[/COLOR]' % movie['name']) if tmdb[1] == '': li.setArt({ 'icon': 'DefaultVideo.png', 'poster': 'DefaultVideo.png' }) else: li.setArt({ 'icon': '{}{}'.format(icon, tmdb[1]), 'poster': '{}{}'.format(icon, tmdb[1]) }) if tmdb[2] == '': li.setArt({'fanart': bgFile}) else: li.setArt({'fanart': '{}{}'.format(full, tmdb[2])}) if tmdb[5] == '': li.setInfo('video', {'cast': []}) else: act = """{}""".format(tmdb[5]) crew = list(json.loads(act)) li.setCast(crew) tmp_genre = """{}""".format(tmdb[7]) genre = list(json.loads(tmp_genre)) tmp_director = """{}""".format(tmdb[8]) director = list(json.loads(tmp_director)) tmp_writer = """{}""".format(tmdb[9]) writer = list(json.loads(tmp_writer)) li.setInfo( 'video', { 'title': movie['name'], 'mediatype': 'movie', 'plot': tmdb[3], 'trailer': 'plugin://plugin.video.youtube/?action=play_video&videoid=%s' % tmdb[4], 'tagline': tmdb[6], 'genre': genre, 'director': director, 'writer': writer, 'aired': tmdb[10], 'mpaa': tmdb[11], 'rating': tmdb[12], 'duration': int(tmdb[13]) }) #li.setIsFolder(True) isFolder = True listing.append((url, li, isFolder)) xbmcplugin.addDirectoryItems(addon_handle, listing, len(listing)) n += 1 nextUrl = '{}/page/{}'.format(xbetmovies, n) if (requests.get(nextUrl)).status_code == 200: nextPage = xbmcgui.ListItem('[COLOR blue]Next Page[/COLOR]', iconImage='DefaultFolder.png') url = get_url.fetch(mode='xbetpage', link=nextUrl) #nextPage.setIsFolder(True) xbmcplugin.addDirectoryItem(addon_handle, url, nextPage, True) xbmcplugin.endOfDirectory(addon_handle)
def addPages(): links = pagination(linksForPages(), items_per_page) URLS = [] for link in links: URLS.append(link) params = dict(parse_qsl(sys.argv[2][1:])) if params.has_key('page'): page = int(params['page']) else: page = 1 movies = movieList(URLS[page - 1]) infoList(movies) offset = 1 listing = [] #xbmc.log('total number of pages %s'%(str(len(movies))),xbmc.LOGNOTICE) for movie in movies: offset += 1 if re.search('orgmovies', movie['path']): continue if re.search('linkstock', movie['path']): linkstock.menu(movie['path']) elif re.search('keeplinks', movie['path']): keeplinks.menu(movie['path']) else: tmdb = dbHelper.getInfo(movie['name'], movie['year'])[0] filename = '{} ({}).mkv'.format(movie['name'], movie['year']) url = get_url.fetch(mode='second_level', action='{}{}'.format(main_url, movie['path']), filename=filename) li = xbmcgui.ListItem(label='[COLOR golden]%s[/COLOR]' % movie['name']) if tmdb[1] == '': li.setArt({ 'icon': 'DefaultVideo.png', 'poster': 'DefaultVideo.png' }) else: li.setArt({ 'icon': '{}{}'.format(icon, tmdb[1]), 'poster': '{}{}'.format(icon, tmdb[1]) }) if tmdb[2] == '': li.setArt({'fanart': bgFile}) else: li.setArt({'fanart': '{}{}'.format(full, tmdb[2])}) if tmdb[5] == '': li.setInfo('video', {'cast': []}) else: act = """{}""".format(tmdb[5]) crew = list(json.loads(act)) li.setCast(crew) tmp_genre = """{}""".format(tmdb[7]) genre = list(json.loads(tmp_genre)) tmp_director = """{}""".format(tmdb[8]) director = list(json.loads(tmp_director)) tmp_writer = """{}""".format(tmdb[9]) writer = list(json.loads(tmp_writer)) li.setInfo( 'video', { 'title': movie['name'], 'mediatype': 'movie', 'plot': tmdb[3], 'trailer': 'plugin://plugin.video.youtube/?action=play_video&videoid=%s' % tmdb[4], 'tagline': tmdb[6], 'genre': genre, 'director': director, 'writer': writer, 'aired': tmdb[10], 'mpaa': tmdb[11], 'rating': tmdb[12], 'duration': int(tmdb[13]) }) #li.setIsFolder(True) isFolder = True listing.append((url, li, isFolder)) xbmcplugin.addDirectoryItems(addon_handle, listing, len(listing)) if offset > items_per_page: nextPage = xbmcgui.ListItem('[COLOR blue]Next Page[/COLOR]', iconImage='DefaultFolder.png') url = get_url.fetch(mode='page', page=page + 1) #nextPage.setIsFolder(True) xbmcplugin.addDirectoryItem(addon_handle, url, nextPage, True) xbmcplugin.endOfDirectory(addon_handle)
def addDir(URLS): movies = movieList(URLS) infoList(movies) listing = [] #xbmc.log('total number of pages %s'%(str(len(movies))),xbmc.LOGNOTICE) for movie in movies: if re.search('linkstock', movie['path']): linkstock.menu(movie['path']) elif re.search('keeplinks', movie['path']): keeplinks.menu(movie['path']) else: tmdb = dbHelper.getInfo(movie['name'], movie['year'])[0] filename = '{} ({}).mkv'.format(movie['name'],movie['year']) url = get_url.fetch(mode = 'third_level' , action = '{}{}'.format(main_url,movie['path']), filename = filename) li = xbmcgui.ListItem(label='[COLOR golden]%s[/COLOR]'%movie['name']) if tmdb[1] == '': li.setArt({'icon': 'DefaultVideo.png', 'poster': 'DefaultVideo.png'}) else: li.setArt({'icon': '{}{}'.format(icon,tmdb[1]), 'poster': '{}{}'.format(icon,tmdb[1])}) if tmdb[2] == '': li.setArt({'fanart': bgFile}) else: li.setArt({'fanart': '{}{}'.format(full,tmdb[2])}) if tmdb[5] == '': li.setInfo('video',{'cast': []}) else: act = """{}""".format(tmdb[5]) crew = list(json.loads(act)) li.setCast(crew) tmp_genre = """{}""".format(tmdb[7]) genre = list(json.loads(tmp_genre)) tmp_director = """{}""".format(tmdb[8]) director = list(json.loads(tmp_director)) tmp_writer = """{}""".format(tmdb[9]) writer = list(json.loads(tmp_writer)) li.setInfo('video', {'title': movie['name'], 'mediatype': 'movie', 'plot': tmdb[3], 'trailer': 'plugin://plugin.video.youtube/?action=play_video&videoid=%s'%tmdb[4], 'tagline': tmdb[6], 'genre': genre, 'director': director, 'writer': writer, 'aired': tmdb[10], 'mpaa': tmdb[11], 'rating': tmdb[12], 'duration': int(tmdb[13])}) #li.setIsFolder(True) isFolder = True listing.append((url, li, isFolder)) xbmcplugin.addDirectoryItems(addon_handle, listing, len(listing)) xbmcplugin.endOfDirectory(addon_handle)