예제 #1
0
def MainMenu():
    """
    Setup Main menu
    Free Cams', Free Cams by Age', Free Cams by Region, Free Cams by Status
    """

    oc = ObjectContainer(title2=TITLE, art=R(ART), no_cache=True)

    Updater(PREFIX + '/updater', oc)

    for t in CAT_LIST:
        oc.add(DirectoryObject(key=Callback(SubList, title=t), title=t))

    if Client.Product in DumbKeyboard.clients:
        DumbKeyboard(PREFIX, oc, Search, dktitle='Search', dkthumb=R('icon-search.png'))
        DumbKeyboard(PREFIX, oc, Hashtag, dktitle='#Hashtag', dkthumb=R('icon-search.png'))
    else:
        oc.add(InputDirectoryObject(
            key=Callback(Search), title='Search', summary='Search Chaturbate',
            prompt='Search for...', thumb=R('icon-search.png')
            ))
        oc.add(InputDirectoryObject(
            key=Callback(Hashtag), title='#Hashtag', summary='Hashtag Chaturbate',
            prompt='Search hashtag...', thumb=R('icon-search.png')
            ))

    return oc
예제 #2
0
def MainMenu():
    """Setup Main Menu, Includes Updater"""

    oc = ObjectContainer(title2=TITLE, no_cache=True)
    mhref = '/movie'

    Updater(PREFIX + '/updater', oc)

    oc.add(
        DirectoryObject(key=Callback(DirectoryList,
                                     title='Most Recent',
                                     href='%s?sort=published' % mhref,
                                     page=1),
                        title='Most Recent',
                        thumb=R(ICON_RECENT)))
    oc.add(
        DirectoryObject(key=Callback(SortList, title='Most Viewed',
                                     href=mhref),
                        title='Most Viewed',
                        thumb=R(ICON_VIEWS)))
    oc.add(
        DirectoryObject(key=Callback(SortList, title='Top Rated', href=mhref),
                        title='Top Rated',
                        thumb=R(ICON_LIKE)))
    oc.add(
        DirectoryObject(key=Callback(CategoryList),
                        title='Categories',
                        thumb=R(ICON_CAT)))
    oc.add(
        DirectoryObject(key=Callback(SortListC,
                                     title='Pornstars',
                                     href='/pornstar'),
                        title='Pornstars',
                        thumb=R(ICON_STAR)))

    oc.add(
        DirectoryObject(key=Callback(MyBookmarks),
                        title='My Bookmarks',
                        thumb=R(ICON_BM)))

    if Client.Product in DumbPrefs.clients:
        DumbPrefs(PREFIX, oc, title='Preferences', thumb=R('icon-prefs.png'))
    else:
        oc.add(PrefsObject(title='Preferences', thumb=R('icon-prefs.png')))

    if Client.Product in DumbKeyboard.clients:
        DumbKeyboard(PREFIX,
                     oc,
                     Search,
                     dktitle='Search',
                     dkthumb=R('icon-search.png'))
    else:
        oc.add(
            InputDirectoryObject(key=Callback(Search),
                                 title='Search',
                                 summary='Search JavHiHi',
                                 prompt='Search for...',
                                 thumb=R('icon-search.png')))

    return oc
예제 #3
0
def series():
    try:
        response = get('/series')
        oc = ObjectContainer(title2=L('series'))
        if Client.Product in DumbKeyboard.clients:
            DumbKeyboard(PREFIX,
                         oc,
                         series_lookup,
                         dktitle=L('add'),
                         dkthumb=R('search.png'))
        else:
            oc.add(
                InputDirectoryObject(key=Callback(series_lookup),
                                     title=L('add'),
                                     thumb=R('search.png'),
                                     prompt=L('search')))
        for curr_series in sorted(response, key=lambda x: x['sortTitle']):
            title = curr_series['title']
            series_id = curr_series['id']
            summary = '{0}: {1}'.format(getdefault(curr_series, 'network'),
                                        curr_series['status'])
            do = DirectoryObject(key=Callback(seriesid,
                                              series_id=series_id,
                                              title2=title),
                                 title=title,
                                 summary=summary)
            cover_type(curr_series, do)
            oc.add(do)
        return oc
    except Exception as e:
        return error_message(e)
예제 #4
0
def SearchMenu(**kwargs):
    """Returns a list of the different search methods"""
    search_routes = {
        'streams': SearchStreams,
        'channels': SearchChannels,
        'games': SearchGames
    }
    oc = ObjectContainer(title2=L('search'))

    Log.Debug('search: Client Product is {}'.format(Client.Product))

    for search_type, route in search_routes.iteritems():
        title = '{} {}'.format(L('search'), L(search_type))
        prompt = '{} {}'.format(L('search_prompt'), L(search_type))
        if Client.Product in DumbKeyboard.clients:
            DumbKeyboard(PREFIX,
                         oc,
                         route,
                         dktitle=unicode(title),
                         dkthumb=ICONS['search'])
        else:
            oc.add(
                InputDirectoryObject(key=Callback(route),
                                     title=unicode(title),
                                     thumb=ICONS['search'],
                                     prompt=unicode(prompt)))
    return oc
예제 #5
0
def MainMenu():

    oc = ObjectContainer()

    oc.add(
        DirectoryObject(key=Callback(Section, title='Movies', type='movies'),
                        title='Movies',
                        thumb=R(MOVIE_ICON)))
    oc.add(
        DirectoryObject(key=Callback(Section, title='TV Shows', type='tv'),
                        title='TV Shows',
                        thumb=R(TV_ICON)))
    oc.add(
        DirectoryObject(key=Callback(BookmarksMain),
                        title='My Bookmarks',
                        thumb=R('icon-bookmarks.png')))
    if Client.Product in DumbPrefs.clients:
        DumbPrefs(PREFIX, oc, title='Preferences', thumb=R('icon-prefs.png'))
    else:
        oc.add(PrefsObject(title='Preferences'))
    if Client.Product in DumbKeyboard.clients:
        DumbKeyboard(PREFIX,
                     oc,
                     Search,
                     dktitle='Search',
                     dkthumb=R('icon-search.png'))
    else:
        oc.add(
            InputDirectoryObject(key=Callback(Search),
                                 title='Search',
                                 prompt='Search',
                                 thumb=R('icon-search.png')))

    return oc
예제 #6
0
def SearchFolder(query=None, genre=[], country=[]):
    oc = ObjectContainer(title2=L('MAIN_SEARCH'))
    genres_title = 'GENRE'  # TODO: localize
    countries_title = 'COUNTRY'  # TODO: localize
    if Client.Product in DumbKeyboard.clients:
        genres_title = genres_title + ': %s' % ''.join('[%s]' % i
                                                       for i in genre)
        countries_title = countries_title + ': %s' % ''.join('[%s]' % i
                                                             for i in country)
        DumbKeyboard(PREFIX + '/search',
                     oc,
                     GetSearchResultFolder,
                     genre=genre,
                     country=country,
                     dktitle=L('SEARCH_INPUT'))
    else:
        oc.add(
            InputDirectoryObject(key=Callback(GetSearchResultFolder,
                                              genre=genre,
                                              country=country),
                                 title=L('SEARCH_INPUT')))
    if Prefs['api_key']:
        oc.add(
            DirectoryObject(key=Callback(GetSearchGenreFolder,
                                         query=query,
                                         genre=genre,
                                         country=country),
                            title=L('SEARCH_PICK_GENRE')))  # TODO: localize
        oc.add(
            DirectoryObject(key=Callback(GetSearchCountryFolder,
                                         query=query,
                                         genre=genre,
                                         country=country),
                            title=L('SEARCH_PICK_COUNTRY')))  # TODO: localize
    return oc
예제 #7
0
def menu():
    object_container = ObjectContainer(title2='TV Shows')
    object_container.add(DirectoryObject(key=Callback(shows_menu, title='Recent', page='/shows', sort='updated', page_index=1), title='Recent', summary='Browse recently updated TV shows.'))
    object_container.add(DirectoryObject(key=Callback(shows_menu, title='Trending', page='/shows', sort='trending', page_index=1), title='Trending', summary='Browse trending TV shows.'))
    object_container.add(DirectoryObject(key=Callback(shows_menu, title='Popular', page='/shows', sort='', page_index=1), title='Popular', summary='Browse popular TV shows.'))
    object_container.add(DirectoryObject(key=Callback(favorites_menu, title='Favorites'), title='Favorites', summary='Browse your favorite TV shows', thumb=R('favorites.png')))

    if Client.Product in DumbKeyboard.clients:
        DumbKeyboard(SharedCodeService.common.PREFIX + '/' + SUBPREFIX, object_container, search_menu, dktitle='Search', dkthumb=R('search.png'), title='Search')
    else:
        object_container.add(InputDirectoryObject(key=Callback(search_menu, title='Search'), title='Search', summary='Search TV shows', thumb=R('search.png'), prompt='Search for TV shows'))
    return object_container
예제 #8
0
def MainMenu(**kwargs):

    if Prefs['search'] or Prefs['m3u_manual_reload'] or Prefs['xmltv_manual_reload'] or Prefs['preferences']:
        oc = ObjectContainer()
        oc.add(
            DirectoryObject(
                key = Callback(ListGroups),
                title = unicode(L('View playlist')),
                thumb = R('icon-list.png')
            )
        )
        if Prefs['search']:
            if Client.Product in DumbKeyboard.clients:
                DumbKeyboard(PREFIX, oc, ListItems,
                    dktitle = unicode(L('Search')),
                    dkthumb = R('icon-search.png')
                )
            else:
                oc.add(
                    InputDirectoryObject(
                        key = Callback(ListItems),
                        title = unicode(L('Search')), 
                        #prompt = unicode(L('Search')),
                        thumb = R('icon-search.png')
                    )
                )
        if Prefs['m3u_manual_reload']:
            oc.add(
                DirectoryObject(
                    key = Callback(ReloadPlaylist),
                    title = unicode(L('Reload playlist')),
                    thumb = R('icon-reload.png')
                )
            )
        if Prefs['xmltv'] and Prefs['xmltv_manual_reload']:
            oc.add(
                DirectoryObject(
                    key = Callback(ReloadGuide),
                    title = unicode(L('Reload program guide')),
                    thumb = R('icon-reload.png')
                )
            )
        if Prefs['preferences']:
            oc.add(
                PrefsObject(
                    title = unicode(L('Preferences')),
                    thumb = R('icon-prefs.png')
                )
            )
        return oc
    else:
        return ListGroups()
def ViewRequestsPassword(locked='locked'):
    oc = ObjectContainer(header=TITLE,
                         message="Please enter the password in the searchbox")
    if Client.Product in DUMB_KEYBOARD_CLIENTS:
        DumbKeyboard(prefix=PREFIX,
                     oc=oc,
                     callback=ViewRequests,
                     dktitle="Enter password:"******"Enter password:"******"Please enter the password:"))
    return oc
예제 #10
0
def menu():
    object_container = ObjectContainer(title2='Movies')
    object_container.add(
        DirectoryObject(key=Callback(movies_menu,
                                     title='Recent',
                                     page='/movies',
                                     sort='last%20added',
                                     page_index=1),
                        title='Recent',
                        summary='Browse recent movies.'))
    object_container.add(
        DirectoryObject(key=Callback(movies_menu,
                                     title='Trending',
                                     page='/movies',
                                     sort='trending',
                                     page_index=1),
                        title='Trending',
                        summary='Browse trending movies.'))
    object_container.add(
        DirectoryObject(key=Callback(movies_menu,
                                     title='Popular',
                                     page='/movies',
                                     sort='',
                                     page_index=1),
                        title='Popular',
                        summary='Browse popular movies.'))
    object_container.add(
        DirectoryObject(key=Callback(watchlist_menu, title='Watchlist'),
                        title='Watchlist',
                        summary='Browse your watchlist',
                        thumb=R('favorites.png')))

    if Client.Product in DumbKeyboard.clients:
        DumbKeyboard(SharedCodeService.common.PREFIX + '/' + SUBPREFIX,
                     object_container,
                     search_menu,
                     dktitle='Search',
                     dkthumb=R('search.png'),
                     title='Search')
    else:
        object_container.add(
            InputDirectoryObject(key=Callback(search_menu, title='Search'),
                                 title='Search',
                                 summary='Search movies',
                                 thumb=R('search.png'),
                                 prompt='Search for movies'))
    return object_container
예제 #11
0
def MainMenu():

    Log.Debug('*' * 80)
    Log.Debug(u'* Client.Product         = {}'.format(Client.Product))
    Log.Debug(u'* Client.Platform        = {}'.format(Client.Platform))
    Log.Debug(u'* Client.Version         = {}'.format(Client.Version))

    admin = CheckAdmin()
    oc = ObjectContainer(title2=TITLE, no_cache=Client.Product in ['Plex Web'])

    if admin:
        lvc = list()
        if Prefs['update_channel'] == 'Stable':
            # Setup Updater to track latest release
            Updater.gui_update(PREFIX + '/updater', oc, GIT_REPO, tag='latest', list_view_clients=lvc)
        else:
            # Setup Updater to track branch commits
            Updater.gui_update(PREFIX + '/updater', oc, GIT_REPO, branch='dev', list_view_clients=lvc)

    oc.add(DirectoryObject(
        key=Callback(Section, title='Movies', type='movies'), title='Movies', thumb=R(MOVIE_ICON)
        ))
    oc.add(DirectoryObject(
        key=Callback(Section, title='TV Shows', type='tv'), title='TV Shows', thumb=R(TV_ICON)
        ))

    if not Prefs['no_bm']:
        oc.add(DirectoryObject(
            key=Callback(BookmarksMain), title='My Bookmarks', thumb=R('icon-bookmarks.png')
            ))

    if Client.Product in DumbPrefs.clients:
        DumbPrefs(PREFIX, oc, title='Preferences', thumb=R('icon-prefs.png'))
    elif admin:
        oc.add(PrefsObject(title='Preferences'))

    if Client.Product in DumbKeyboard.clients:
        DumbKeyboard(PREFIX, oc, Search, dktitle='Search', dkthumb=R('icon-search.png'))
    else:
        oc.add(InputDirectoryObject(
            key=Callback(Search), title='Search', prompt='Search', thumb=R('icon-search.png')
            ))

    return oc
예제 #12
0
def MainMenu(header=NAME, message=""):
    oc = ObjectContainer(no_cache=True, no_history=True, replace_parent=True)

    if message is not "":
        oc.message = message
        oc.header = header

    if Client.Product in DUMB_KEYBOARD_CLIENTS or Client.Platform in DUMB_KEYBOARD_CLIENTS:
        Log.Debug("Client does not support Input. Using DumbKeyboard")
        DumbKeyboard(PREFIX, oc, CreateRoom, dktitle="Create a Room")
    else:
        oc.add(
            InputDirectoryObject(key=Callback(CreateRoom),
                                 title='Create a Room',
                                 prompt='Please enter a room name'))

    if Client.Product == 'Plex Web' and not ROOM_HANDLER.rooms:
        oc.add(
            DirectoryObject(
                key=Callback(MainMenu),
                title=
                'You\'re using Plex Web. Please type a room name into the search field and hit enter to add your first room.'
            ))

    for room_uuid, room in ROOM_HANDLER.rooms.iteritems():
        oc.add(
            DirectoryObject(key=Callback(EditRoom, room_uuid=room_uuid),
                            title=room['name']))

    # This function is specific to Hue
    if is_hue_enabled():
        if not automation_services[hue.name].has_username():
            oc.add(
                DirectoryObject(
                    key=Callback(ConnectHueBridge),
                    title="Press button on Hue hub and then click here"))

    for name, service in automation_services.iteritems():
        if not service.is_authenticated():
            oc.add(
                DirectoryObject(key=Callback(MainMenu),
                                title="Error connecting to " + service.name))
    return oc
예제 #13
0
def AddNewMovie(title, locked='unlocked'):
    oc = ObjectContainer(
        header=TITLE,
        message="Please enter the movie name in the searchbox and press enter."
    )
    if Client.Product in DUMB_KEYBOARD_CLIENTS:
        DumbKeyboard(prefix=PREFIX,
                     oc=oc,
                     callback=SearchMovie,
                     dktitle=title,
                     dkthumb=R('search.png'),
                     locked=locked)
    else:
        oc.add(
            InputDirectoryObject(key=Callback(SearchMovie, locked=locked),
                                 title=title,
                                 prompt="Enter the name of the movie:",
                                 thumb=R('search.png')))
    return oc
예제 #14
0
def MainMenu():

    Log.Debug('*' * 80)
    Log.Debug('* Client.Product         = {0}'.format(Client.Product))
    Log.Debug('* Client.Platform        = {0}'.format(Client.Platform))
    Log.Debug('* Client.Version         = {0}'.format(Client.Version))

    oc = ObjectContainer(view_group='List',
                         no_cache=Client.Product in ['Plex Web'])

    # setup updater
    Updater.gui_update(PREFIX + '/updater', oc, GIT_REPO, tag='latest')

    oc.add(
        DirectoryObject(key=Callback(AlphabetList),
                        title='Alphabets',
                        thumb=R(ABC_ICON)))
    oc.add(
        DirectoryObject(key=Callback(GenreList),
                        title='Genres',
                        thumb=R(GENRES_ICON)))

    # setup prefs object
    if Client.Product in DumbPrefs.clients:
        DumbPrefs(PREFIX, oc, title='Preferences', thumb=R(PREFS_ICON))
    else:
        oc.add(PrefsObject(title='Preferences', thumb=R(PREFS_ICON)))

    # setup search object
    if Client.Product in DumbKeyboard.clients:
        DumbKeyboard(PREFIX,
                     oc,
                     Search,
                     dktitle='Search',
                     dkthumb=R(SEARCH_ICON))
    else:
        oc.add(
            InputDirectoryObject(key=Callback(Search),
                                 title='Search Manga',
                                 prompt='Search Manga',
                                 thumb=R(SEARCH_ICON)))

    return oc
예제 #15
0
def MainMenu():
    '''Populate main menu options'''
    oc = ObjectContainer(view_group="InfoList", no_cache=True)
    
    if CP_API_KEY() != 'notfound':
        oc.add(DirectoryObject(key=Callback(MoviesMenu), title="Manage your movies list",
            summary="View and edit your CouchPotato wanted movies list",thumb=R(ICON)))
        oc.add(DirectoryObject(key=Callback(ComingSoonMenu), title="Coming Soon",
            summary="Browse upcoming movies and add them to your wanted list", thumb=R("RT-icon.png")))
        if Client.Product in DumbKeyboard.clients:
            DumbKeyboard(PREFIX, oc, Search, dktitle="Search for Movies", dkthumb=R(SEARCH_ICON))
        else:
            oc.add(InputDirectoryObject(key=Callback(Search), title="Search for Movies",
                                        summary="Find movies to add to your wanted list", prompt="Search for",
                                        thumb=R(SEARCH_ICON), ))
        oc.add(DirectoryObject(key=Callback(Suggestions), title="Suggestions",
            summary="Movies suggested by CouchPotato", thumb=R(ICON)))
    
    oc.add(PrefsObject(title="Preferences", summary="Set prefs to allow plugin to connect to CouchPotato app",thumb=R(PREFS_ICON)))
    
    return oc
예제 #16
0
def MainMenu():
    oc = ObjectContainer(title2=TITLE, no_cache=True)

    Updater(PREFIX + '/updater', oc)
    oc.add(
        DirectoryObject(key=Callback(DirectoryList, page=1),
                        title='All',
                        thumb=R(ALL_ICON)))
    oc.add(
        DirectoryObject(key=Callback(CountryList),
                        title='Countries',
                        thumb=R(COUNTRY_ICON)))
    oc.add(
        DirectoryObject(key=Callback(GenreList),
                        title='Genres',
                        thumb=R(GENRE_ICON)))
    oc.add(
        DirectoryObject(key=Callback(BookmarksMain),
                        title='My Bookmarks',
                        thumb=R(BOOKMARK_ICON)))
    if Client.Product in DumbPrefs.clients:
        DumbPrefs(PREFIX, oc, title='Preferences', thumb=R(PREFS_ICON))
    else:
        oc.add(PrefsObject(title='Preferences', thumb=R(PREFS_ICON)))
    if Client.Product in DumbKeyboard.clients:
        DumbKeyboard(PREFIX,
                     oc,
                     Search,
                     dktitle='Search',
                     dkthumb=R(SEARCH_ICON))
    else:
        oc.add(
            InputDirectoryObject(key=Callback(Search),
                                 title='Search',
                                 summary='Search LihatTV',
                                 prompt='Search for...',
                                 thumb=R(SEARCH_ICON)))

    return oc
예제 #17
0
def MainMenu():

    Log.Debug('*' * 80)
    Log.Debug('* Client.Product         = %s' %Client.Product)
    Log.Debug('* Client.Platform        = %s' %Client.Platform)
    Log.Debug('* Client.Version         = %s' %Client.Version)

    admin = CheckAdmin()

    oc = ObjectContainer(no_cache=admin)

    if admin:
        Updater(PREFIX + '/updater', oc)

    oc.add(DirectoryObject(
        key=Callback(Section, title='Movies', type='movies'), title='Movies', thumb=R(MOVIE_ICON)
        ))
    oc.add(DirectoryObject(
        key=Callback(Section, title='TV Shows', type='tv'), title='TV Shows', thumb=R(TV_ICON)
        ))
    if not Prefs['no_bm']:
        oc.add(DirectoryObject(
            key=Callback(BookmarksMain), title='My Bookmarks', thumb=R('icon-bookmarks.png')
            ))

    if Client.Product in DumbPrefs.clients:
        DumbPrefs(PREFIX, oc, title='Preferences', thumb=R('icon-prefs.png'))
    elif admin:
        oc.add(PrefsObject(title='Preferences'))

    if Client.Product in DumbKeyboard.clients:
        DumbKeyboard(PREFIX, oc, Search, dktitle='Search', dkthumb=R('icon-search.png'))
    else:
        oc.add(InputDirectoryObject(
            key=Callback(Search), title='Search', prompt='Search', thumb=R('icon-search.png')
            ))

    return oc
예제 #18
0
def UpdatesFolder():
    oc = ObjectContainer(title2=L('MAIN_LATEST_UPDATES'))
    oc.add(
        DirectoryObject(key=Callback(GetUpdatesFolder, query=1),
                        title=L('LATEST_UPDATES_1D')))
    oc.add(
        DirectoryObject(key=Callback(GetUpdatesFolder, query=3),
                        title=L('LATEST_UPDATES_3D')))
    oc.add(
        DirectoryObject(key=Callback(GetUpdatesFolder, query=7),
                        title=L('LATEST_UPDATES_1W')))
    if Client.Product in DumbKeyboard.clients:
        # NB: For clients, that cannot display InputDirectoryObject
        DumbKeyboard(PREFIX + '/updates',
                     oc,
                     GetUpdatesFolder,
                     dktitle=L('LATEST_UPDATES_INPUT_PROMPT'),
                     dknumbersonly=True)
    else:
        oc.add(
            InputDirectoryObject(key=Callback(GetUpdatesFolder),
                                 title=L('LATEST_UPDATES_INPUT'),
                                 prompt=L('LATEST_UPDATES_INPUT_PROMPT')))
    return oc
예제 #19
0
def DevToolsC(title=None, header=None, message=None, session=None, **kwargs):
    """Tools to Remove all Covers/URLs cached files"""

    if not common.interface.isInitialized():
        return MC.message_container(
            "Please wait..",
            "Please wait a few seconds for the Interface to Load & Initialize plugins"
        )

    if AuthTools.CheckAdmin() == False:
        return MC.message_container(
            'Admin Access Only', 'Only the Admin can perform this action !')

    oc = ObjectContainer(title2='Tools', header=header, message=message)

    if title:
        if title == 'plex_cache':
            count = ClearCache(caches_path, Datetime.Delta())
            message = 'Cleaned {} Cached files'.format(count)
            Log(u'\n----------Removed {} Cached files from {}----------'.
                format(count, caches_path))
        elif title == 'save_bm':
            count = SaveBookmarks()
            message = 'Saved {} Bookmarks'.format(count)
            Log(u'\n----------Saved {} Bookmarks to {}----------'.format(
                count, resources_path))
        elif title == 'load_bm':
            count = LoadBookmarks()
            if count == -1:
                message = 'Bookmarks file (bookmarks.json) does not exist in Resource folder !'
            else:
                message = 'Loaded {} Bookmarks'.format(count)
            Log(u'\n----------Loaded {} Bookmarks from {}----------'.format(
                count, resources_path))
        elif title == 'save_config':
            bool = SaveConfig()
            if bool == True:
                message = 'Saved Config file'
                Log(u'\n----------Saved Config to {}----------'.format(
                    resources_path))
            else:
                message = 'Error: Could not Save Config file (config.json)'
        elif title == 'load_config':
            bool = LoadConfig()
            if bool == True:
                message = 'Loaded Config file'
                Log(u'\n----------Loaded Config from {}----------'.format(
                    resources_path))
            else:
                message = 'Error: Could not Load Config file (config.json)'
        elif title == 'check_externals':
            if len(externals.BUSY_BOOL) > 0:
                message = 'Checking externals. Please wait and try again.'
            else:
                Thread.Create(externals.checkRoutine)
                time.sleep(7)
                if len(externals.BUSY_BOOL) > 0:
                    message = 'Checking externals. Please wait and try again.'
                else:
                    if len(externals.CHECK_ROUTINE_LOG) > 0:
                        for item in externals.CHECK_ROUTINE_LOG:
                            oc.add(
                                DirectoryObject(title=item,
                                                key=Callback(
                                                    MyMessage, 'Info', item)))
                        return oc
                    else:
                        message = 'Could not retrieve output from externals.'
        elif title == 'set_base_url':
            oc = ObjectContainer(title2='Set Base URL')
            base_url_match = False
            for u in common.BASE_URLS:
                if u == fmovies.BASE_URL:
                    base_url_match = True
                ch = common.GetEmoji(
                    type=True) if u == fmovies.BASE_URL else common.GetEmoji(
                        type=False)
                oc.add(
                    DirectoryObject(title='%s | Base URL : %s' % (ch, u),
                                    key=Callback(SetBaseUrl, url=u)))
            if base_url_match == False:
                u = fmovies.BASE_URL
                ch = common.GetEmoji(
                    type=True) if u == fmovies.BASE_URL else common.GetEmoji(
                        type=False)
                oc.add(
                    DirectoryObject(
                        title='%s | Base URL : %s (set by redirection detector)'
                        % (ch, u),
                        key=Callback(SetBaseUrl, url=u)))

            return oc
        elif title == 'openload_input_id':
            oc = ObjectContainer(title2='OpenLoad Video ID')
            if common.UsingOption(key=common.DEVICE_OPTIONS[0],
                                  session=session):
                DumbKeyboard(PREFIX,
                             oc,
                             openloadID,
                             dktitle='OpenLoad Video ID')
            else:
                oc.add(
                    InputDirectoryObject(key=Callback(openloadID,
                                                      session=session),
                                         title='OpenLoad Video ID',
                                         summary='OpenLoad Video ID',
                                         prompt='OpenLoad Video ID...'))
            return oc
        elif title == 'imdb_input_id':
            oc = ObjectContainer(title2='Input IMDb ID')
            if common.UsingOption(key=common.DEVICE_OPTIONS[0],
                                  session=session):
                DumbKeyboard(PREFIX, oc, imdbID, dktitle='Input IMDb ID')
            else:
                oc.add(
                    InputDirectoryObject(key=Callback(imdbID, session=session),
                                         title='Input IMDb ID',
                                         summary='Input IMDb ID',
                                         prompt='Input IMDb ID...'))
            return oc

        return MC.message_container('Info', message)

    # oc.add(DirectoryObject(key=Callback(DevToolsC, title='plex_cache'),
    # title=u'Reset {} Cache'.format(PLEX_CACHE_DIR),
    # thumb = R(ICON_TOOLS),
    # summary=u'Remove cached files from {} directory.'.format(caches_path)))
    oc.add(
        DirectoryObject(
            key=Callback(DevToolsC, title='save_bm'),
            title=u'Save Bookmarks',
            thumb=R(ICON_TOOLS),
            summary=
            u'Save Bookmarks to the Resource dir. (file: bookmarks.json)'))
    oc.add(
        DirectoryObject(
            key=Callback(DevToolsC, title='load_bm'),
            title=u'Load Bookmarks',
            thumb=R(ICON_TOOLS),
            summary=
            u'Load Bookmarks from the Resource dir. (file: bookmarks.json)'))
    oc.add(
        DirectoryObject(
            key=Callback(DevToolsC, title='save_config'),
            title=u'Save Config',
            thumb=R(ICON_TOOLS),
            summary=
            u'Save Config to the Resource dir. (file: config.json). Device Options (all clients), Bookmarks, Recent WatchList, SearchQue, Downloads and Interface Options can be saved and restored using Config file.'
        ))
    oc.add(
        DirectoryObject(
            key=Callback(DevToolsC, title='load_config'),
            title=u'Load Config',
            thumb=R(ICON_TOOLS),
            summary=
            u'Load Config from the Resource dir. (file: config.json). Device Options (all clients), Bookmarks, Recent WatchList, SearchQue, Downloads and Interface Options can be saved and restored using Config file.'
        ))
    oc.add(
        DirectoryObject(
            key=Callback(DevToolsC, title='check_externals'),
            title=u'Check Externals',
            thumb=R(ICON_TOOLS),
            summary=
            u'Check externals like PhantomJS and Cryptodome have been installed or not'
        ))
    oc.add(
        DirectoryObject(key=Callback(DevToolsC, title='set_base_url'),
                        title=u'Set Base URL',
                        thumb=R(ICON_TOOLS),
                        summary=u'Set the Base URL to be used by the Channel'))
    oc.add(
        DirectoryObject(key=Callback(DevToolsC,
                                     title='openload_input_id',
                                     session=session),
                        title=u'OpenLoad Video ID',
                        thumb=R(ICON_TOOLS),
                        summary=u'OpenLoad Video ID'))
    oc.add(
        DirectoryObject(
            key=Callback(DevToolsC, title='imdb_input_id', session=session),
            title=u'IMDB Video Search (requires VideoSpider API Key)',
            thumb=R(ICON_TOOLS),
            summary=u'IMDB Video Search (requires VideoSpider API Key in Prefs)'
        ))

    return oc
예제 #20
0
def MainMenu():
    """Create the Main Menu"""

    Log.Debug('*' * 80)
    Log.Debug('* Client.Product         = {}'.format(Client.Product))
    Log.Debug('* Client.Platform        = {}'.format(Client.Platform))
    Log.Debug('* Client.Version         = {}'.format(Client.Version))

    oc = ObjectContainer(title2=TITLE, no_cache=Client.Product in ['Plex Web'])

    cp_match = Client.Platform in Common.LIST_VIEW_CLIENTS

    # set thumbs based on client
    if cp_match:
        bookmark_thumb = None
        prefs_thumb = None
        search_thumb = None
    else:
        bookmark_thumb = R(BOOKMARK_ICON)
        prefs_thumb = R(PREFS_ICON)
        search_thumb = R(SEARCH_ICON)

    if Prefs['update_channel'] == 'Stable':
        #Setup Updater to track latest release
        Updater.gui_update(
            PREFIX + '/updater', oc, GIT_REPO,
            tag='latest', list_view_clients=Common.LIST_VIEW_CLIENTS
            )
    else:
        # Setup Updater to track branch commits
        Updater.gui_update(
            PREFIX + '/updater', oc, GIT_REPO,
            branch='dev', list_view_clients=Common.LIST_VIEW_CLIENTS
            )

    if Prefs['login']:
        values = {
            'username': Prefs['username'],
            'password': Prefs['password'],
            'remember': '1'
            }
        ul_url = Prefs['domain'] + '/user/login'
        Network.unCache(ul_url)
        cookies = Network.cookies_from_res(Network.Request(ul_url, values=values))

        oc.add(DirectoryObject(
            key=Callback(OnDeck, title='On Deck', cookies=cookies), title='On Deck'
            ))

        oc.add(DirectoryObject(
            key=Callback(Watchlist, title='Watchlist', cookies=cookies), title='Watchlist'
            ))

    # setup basic main menus
    for (t, h) in MAIN_MENUS.items():
        oc.add(DirectoryObject(
            key=Callback(SubMenu, title=t, href=h), title=t,
            ))

    # setup prefs button
    if Client.Product in DumbPrefs.clients:
        DumbPrefs(PREFIX, oc, title='Preferences', thumb=prefs_thumb)
    else:
        oc.add(PrefsObject(title='Preferences', thumb=prefs_thumb))

    # setup search function
    if Client.Product in DumbKeyboard.clients:
        DumbKeyboard(PREFIX, oc, Search, dktitle='Search', dkthumb=R(SEARCH_ICON))
    else:
        oc.add(InputDirectoryObject(
            key=Callback(Search), title='Search', prompt='Search for...', thumb=search_thumb
            ))

    return oc
예제 #21
0
def MainMenu():
    """Create the Main Menu"""

    oc = ObjectContainer(title2=TITLE, no_cache=True)

    Updater(PREFIX + '/updater', oc)

    oc.add(
        DirectoryObject(key=Callback(ABCList,
                                     page=0,
                                     sort_by='name.raw',
                                     title='Alphabetical'),
                        title='Alphabetical'))

    oc.add(
        DirectoryObject(key=Callback(BrandList, title='Brands'),
                        title='Brands'))

    oc.add(
        DirectoryObject(key=Callback(DirectoryList,
                                     page=0,
                                     sort_by='views',
                                     title='Views'),
                        title='Views'))

    oc.add(
        DirectoryObject(key=Callback(DirectoryList,
                                     page=0,
                                     sort_by='favorites_count',
                                     title='Favorites'),
                        title='Favorites'))

    oc.add(
        DirectoryObject(key=Callback(DirectoryList,
                                     page=0,
                                     sort_by='created_at',
                                     title='Upload Date'),
                        title='Upload Date'))

    oc.add(
        DirectoryObject(key=Callback(DirectoryList,
                                     page=0,
                                     sort_by='released_at',
                                     title='Release Date'),
                        title='Release Date'))

    if Client.Product in DumbPrefs.clients:
        DumbPrefs(PREFIX, oc, title='Preferences', thumb=R('icon-prefs.png'))
    else:
        oc.add(PrefsObject(title='Preferences', thumb=R('icon-prefs.png')))

    if Client.Product in DumbKeyboard.clients:
        DumbKeyboard(PREFIX,
                     oc,
                     Search,
                     dktitle='Search',
                     dkthumb=R('icon-search.png'))
    else:
        oc.add(
            InputDirectoryObject(key=Callback(Search),
                                 title='Search',
                                 summary='Search Hanime.tv',
                                 prompt='Search for...'))

    return oc
예제 #22
0
def DevToolsC(title=None, header=None, message=None, session=None, **kwargs):
	"""Tools to Remove all Covers/URLs cached files"""

	if not common.interface.isInitialized():
		return MC.message_container(common.MSG0, '%s. Progress %s%s (%s)' % (common.MSG1, common.interface.getProvidersInitStatus(), '%', common.interface.getCurrentProviderInProcess()))
		
	if AuthTools.CheckAdmin() == False:
		return MC.message_container('Admin Access Only', 'Only the Admin can perform this action !')

	oc = ObjectContainer(title2='Tools', header=header, message=message)

	if title:
		if title == 'plex_cache':
			count = ClearCache(caches_path, Datetime.Delta())
			message = 'Cleaned {} Cached files'.format(count)
			Log(u'\n----------Removed {} Cached files from {}----------'.format(count, caches_path))
		elif title == 'save_bm':
			count = SaveBookmarks()
			message = 'Saved {} Bookmarks'.format(count)
			Log(u'\n----------Saved {} Bookmarks to {}----------'.format(count, resources_path))
		elif title == 'load_bm':
			count = LoadBookmarks()
			if count == -1:
				message='Bookmarks file (bookmarks.json) does not exist in Resource folder !'
			else:
				message = 'Loaded {} Bookmarks'.format(count)
			Log(u'\n----------Loaded {} Bookmarks from {}----------'.format(count, resources_path))
		elif title == 'save_config':
			bool = SaveConfig()
			if bool == True:
				message = 'Saved Config file'
				Log(u'\n----------Saved Config to {}----------'.format(resources_path))
			else:
				message = 'Error: Could not Save Config file (config.json)'
		elif title == 'load_config':
			bool = LoadConfig()
			if bool == True:
				message = 'Loaded Config file'
				Log(u'\n----------Loaded Config from {}----------'.format(resources_path))
			else:
				message='Error: Could not Load Config file (config.json)'
		elif title == 'check_externals':
			if len(externals.BUSY_BOOL) > 0:
				message = 'Checking externals. Please wait and try again.'
			else:
				Thread.Create(externals.checkRoutine, {}, session)
				time.sleep(7)
				if len(externals.BUSY_BOOL) > 0:
					message = 'Checking externals. Please wait and try again.'
				else:
					if len(externals.CHECK_ROUTINE_LOG) > 0:
						for item in externals.CHECK_ROUTINE_LOG:
							if 'VerifiedForDownload' in item:
								comps = item.split('|')
								oc.add(DirectoryObject(title = '%s Download/Install %s %s' % (common.EMOJI_DOWNARROW3x, comps[1], common.EMOJI_DOWNARROW3x), thumb = R(common.ICON_OTHERSOURCESDOWNLOAD), key=Callback(SaveUrlToDest, filedata=E(JSON.StringFromObject(comps[2:])))))
							else:
								oc.add(DirectoryObject(title=item,key=Callback(MyMessage, 'Info', item)))
						return oc
					else:
						message = 'Could not retrieve output from externals.'
		elif title == 'set_base_url':
			oc = ObjectContainer(title2='Set Base URL')
			base_url_match = False
			for u in common.BASE_URLS:
				if u == fmovies.BASE_URL:
					base_url_match = True
				ch = common.GetEmoji(type=True) if u == fmovies.BASE_URL else common.GetEmoji(type=False)
				oc.add(DirectoryObject(title='%s | Base URL : %s' % (ch, u),key=Callback(SetBaseUrl, url=u)))
			if base_url_match == False:
				u = fmovies.BASE_URL
				ch = common.GetEmoji(type=True) if u == fmovies.BASE_URL else common.GetEmoji(type=False)
				oc.add(DirectoryObject(title='%s | Base URL : %s (set by redirection detector)' % (ch, u),key=Callback(SetBaseUrl, url=u)))
				
			return oc
		elif title == 'set_9base_url':
			oc = ObjectContainer(title2='Set 9Anime Base URL')
			base9_url_match = False
			for d in common.ANIME_DOMS:
				u = 'https://%s.%s' % (common.ANIME_KEY, d)
				if u == common.ANIME_URL:
					base9_url_match = True
				ch = common.GetEmoji(type=True) if u == common.ANIME_URL else common.GetEmoji(type=False)
				oc.add(DirectoryObject(title='%s | 9Anime Base URL : %s' % (ch, u),key=Callback(Set9BaseUrl, url=u)))
			if base9_url_match == False:
				u = common.ANIME_URL
				ch = common.GetEmoji(type=True) if u == common.ANIME_URL else common.GetEmoji(type=False)
				oc.add(DirectoryObject(title='%s | 9Anime Base URL : %s (set by redirection detector)' % (ch, u),key=Callback(Set9BaseUrl, url=u)))
				
			return oc
		elif title == 'set_ext_list_url':
			oc = ObjectContainer(title2='Set External Listing URL')
			ext_list_url_match = False
			for u in common.EXT_LIST_URLS:
				if u == common.ES_API_URL:
					ext_list_url_match = True
				ch = common.GetEmoji(type=True) if u == common.ES_API_URL else common.GetEmoji(type=False)
				oc.add(DirectoryObject(title='%s | External Listing URL : %s' % (ch, u),key=Callback(SetExtListUrl, url=u)))
			if ext_list_url_match == False:
				u = common.ES_API_URL
				ch = common.GetEmoji(type=True) if u == common.ES_API_URL else common.GetEmoji(type=False)
				oc.add(DirectoryObject(title='%s | External Listing URL : %s (set by redirection detector)' % (ch, u),key=Callback(SetExtListUrl, url=u)))
				
			return oc
		elif title == 'openload_input_id':
			oc = ObjectContainer(title2='OpenLoad Video ID')
			if common.UsingOption(key=common.DEVICE_OPTIONS[0], session=session):
				DumbKeyboard(PREFIX, oc, openloadID,
						dktitle = 'OpenLoad Video ID'
				)
			else:
				oc.add(InputDirectoryObject(key = Callback(openloadID, session = session), title='OpenLoad Video ID', summary='OpenLoad Video ID', prompt='OpenLoad Video ID...'))
				for q in RECENT_IMDB_SEARCHES.keys():
					q_msg = '%s (%s) | %s | %s | %s' % (RECENT_IMDB_SEARCHES[q]['title'], RECENT_IMDB_SEARCHES[q]['year'], RECENT_IMDB_SEARCHES[q]['file_size'], RECENT_IMDB_SEARCHES[q]['quality'], RECENT_IMDB_SEARCHES[q]['rip'])
					q_sum = q_msg if RECENT_IMDB_SEARCHES[q]['summary'] == None else RECENT_IMDB_SEARCHES[q]['summary']
					data = RECENT_IMDB_SEARCHES[q]['data']
					oc.add(DirectoryObject(title=q_msg, summary=q_sum, thumb=RECENT_IMDB_SEARCHES[q]['thumb'],key=Callback(openloadID, query=q, dataIMDb=data, direct=True, session=session)))
				if len(RECENT_IMDB_SEARCHES.keys()) > 0:
					oc.add(DirectoryObject(title='Clear Recent Items',key=Callback(clearRecentOpenLoadID), thumb=R(common.ICON_CLEAR)))
			return oc
		elif title == 'imdb_input_id':
			oc = ObjectContainer(title2='Input IMDb ID')
			if common.UsingOption(key=common.DEVICE_OPTIONS[0], session=session):
				DumbKeyboard(PREFIX, oc, imdbID,
						dktitle = 'Input IMDb ID'
				)
			else:
				oc.add(InputDirectoryObject(key = Callback(imdbID, session = session), title='Input IMDb ID', summary='Input IMDb ID', prompt='Input IMDb ID...'))
				
			for q in RECENT_IMDB_SEARCHES.keys():
				q_msg = '%s (%s) | %s | %s | %s' % (RECENT_IMDB_SEARCHES[q]['title'], RECENT_IMDB_SEARCHES[q]['year'], RECENT_IMDB_SEARCHES[q]['file_size'], RECENT_IMDB_SEARCHES[q]['quality'], RECENT_IMDB_SEARCHES[q]['rip'])
				q_sum = q_msg if RECENT_IMDB_SEARCHES[q]['summary'] == None else RECENT_IMDB_SEARCHES[q]['summary']
				data = RECENT_IMDB_SEARCHES[q]['data']
				oc.add(DirectoryObject(title=q_msg, summary=q_sum, thumb=RECENT_IMDB_SEARCHES[q]['thumb'],key=Callback(openloadID, query=q, dataIMDb=data, direct=True, session=session)))
			if len(RECENT_IMDB_SEARCHES.keys()) > 0:
				oc.add(DirectoryObject(title='Clear Recent Items',key=Callback(clearRecentOpenLoadID), thumb=R(common.ICON_CLEAR)))
				
			return oc

		return MC.message_container('Info', message)

	# oc.add(DirectoryObject(key=Callback(DevToolsC, title='plex_cache', session=session),
		# title=u'Reset {} Cache'.format(PLEX_CACHE_DIR),
		# thumb = R(common.ICON_TOOLS),
		# summary=u'Remove cached files from {} directory.'.format(caches_path)))
	oc.add(DirectoryObject(key=Callback(DevToolsC, title='save_bm', session=session),
		title=u'Save Bookmarks',
		thumb = R(common.ICON_FL_SAVE),
		summary=u'Save Bookmarks to the Resource dir. (file: bookmarks.json)'))
	oc.add(DirectoryObject(key=Callback(DevToolsC, title='load_bm', session=session),
		title=u'Load Bookmarks',
		thumb = R(common.ICON_FL_LOAD),
		summary=u'Load Bookmarks from the Resource dir. (file: bookmarks.json)'))
	oc.add(DirectoryObject(key=Callback(DevToolsC, title='save_config', session=session),
		title=u'Save Config',
		thumb = R(common.ICON_FL_SAVE),
		summary=u'Save Config to the Resource dir. (file: config.json). Device Options (all clients), Bookmarks, Recent WatchList, SearchQue, Downloads and Interface Options can be saved and restored using Config file.'))
	oc.add(DirectoryObject(key=Callback(DevToolsC, title='load_config', session=session),
		title=u'Load Config',
		thumb = R(common.ICON_FL_LOAD),
		summary=u'Load Config from the Resource dir. (file: config.json). Device Options (all clients), Bookmarks, Recent WatchList, SearchQue, Downloads and Interface Options can be saved and restored using Config file.'))
	oc.add(DirectoryObject(key=Callback(DevToolsC, title='check_externals', session=session),
		title=u'Check Externals',
		thumb = R(common.ICON_TOOLS),
		summary=u'Check externals like PhantomJS and Cryptodome have been installed or not'))
	oc.add(DirectoryObject(key=Callback(DevToolsC, title='set_base_url', session=session),
		title=u'Set Base URL',
		thumb = R(common.ICON_TOOLS),
		summary=u'Set the Base URL to be used by the Channel'))
	oc.add(DirectoryObject(key=Callback(DevToolsC, title='set_9base_url', session=session),
		title=u'Set 9Anime Base URL',
		thumb = R(common.ICON_TOOLS),
		summary=u'Set the 9Anime Base URL to be used by the Channel'))
	oc.add(DirectoryObject(key=Callback(DevToolsC, title='set_ext_list_url', session=session),
		title=u'Set External Listing URL',
		thumb = R(common.ICON_TOOLS),
		summary=u'Set the External Listing URL to be used by the Channel'))
	oc.add(DirectoryObject(key=Callback(DevToolsC, title='openload_input_id', session=session),
		title=u'OpenLoad Video ID',
		thumb = Resource.ContentsOfURLWithFallback(url = common.ICON_OPENLOAD, fallback=common.ICON_TOOLS),
		summary=u'OpenLoad Video ID'))
		
	cc = Dict['VSPAPI']['count']
	if common.control.get_setting('control_videospider_api_key') == None and cc >= common.control.setting('vspapicount'):
		videospider_msg = u'IMDb Video Search (requires VideoSpider API Key in Prefs)'
	else:
		if common.control.get_setting('control_videospider_api_key') != None:
			videospider_msg = u'IMDb Video Search (via VideoSpider) | User API Key'
		else:
			videospider_msg = u'IMDb Video Search (via VideoSpider) | %s Free Trials left' % (common.control.setting('vspapicount')-cc)
		
	oc.add(DirectoryObject(key=Callback(DevToolsC, title='imdb_input_id', session=session),
		title=videospider_msg,
		thumb = Resource.ContentsOfURLWithFallback(url = common.ICON_IMDB, fallback=common.ICON_TOOLS),
		summary=videospider_msg))

	oc.add(DirectoryObject(key = Callback(main.MainMenu), title = '<< Main Menu', thumb = R(common.ICON)))
	return oc
예제 #23
0
def SearchTV(query, locked='unlocked'):
    oc = ObjectContainer(title1="Search Results",
                         content=ContainerContent.Shows,
                         view_group="Details")
    query = String.Quote(query, usePlus=True)
    xml = XML.ElementFromURL(TVDB_API_URL + "GetSeries.php?seriesname=" +
                             query)
    series = xml.xpath("//Series")
    if len(series) == 0:
        oc = ObjectContainer(header=TITLE,
                             message="Sorry there were no results found.")
        if Client.Product in DUMB_KEYBOARD_CLIENTS:
            DumbKeyboard(prefix=PREFIX,
                         oc=oc,
                         callback=SearchTV,
                         dktitle="Search Again",
                         dkthumb=R('search.png'),
                         locked=locked)
        else:
            oc.add(
                InputDirectoryObject(key=Callback(SearchTV, locked=locked),
                                     title="Search Again",
                                     prompt="Enter the name of the TV Show:",
                                     thumb=R('search.png')))
        oc.add(
            DirectoryObject(key=Callback(MainMenu, locked=locked),
                            title="Return to Main Menu",
                            thumb=R('return.png')))
        return oc
    count = 0
    for serie in series:
        id = ""
        title = ""
        year = ""
        poster = ""
        summary = ""
        for child in serie.getchildren():
            if child.tag.lower() == "seriesid" and child.text:
                id = child.text
            elif child.tag.lower() == "seriesname" and child.text:
                title = child.text
            elif child.tag.lower() == "banner" and child.text and not poster:
                poster = TVDB_BANNER_URL + child.text
            elif child.tag.lower() == "overview" and child.text:
                summary = child.text
            elif child.tag.lower() == "firstaired" and child.text:
                release_date = child.text
                year = release_date[0:4]
            elif child.tag.lower() == "poster" and child.text:
                poster = TVDB_BANNER_URL + child.text
        if count < 11:  # Let's look for the actual poster for only the first 10 tv shows to reduce api hits
            try:
                serie_page = XML.ElementFromURL(TVDB_API_URL + TVDB_API_KEY +
                                                "/series/" + id)
                poster_text = serie_page.xpath("//Series/poster/text()")
                if poster_text:
                    poster = TVDB_BANNER_URL + poster_text[0]
            except Exception as e:
                Log.Debug(e)
            count += 1
        if id == "":
            Log.Debug("No id found!")
        if year:
            title_year = title + " (" + year + ")"
        else:
            title_year = title
        if poster:
            thumb = poster
        else:
            thumb = R('no-poster.jpg')
        oc.add(
            TVShowObject(key=Callback(ConfirmTVRequest,
                                      id=id,
                                      source='tvdb',
                                      title=title,
                                      year=year,
                                      poster=poster,
                                      summary=summary,
                                      locked=locked),
                         rating_key=id,
                         title=title_year,
                         summary=summary,
                         thumb=thumb))
    if Client.Product in DUMB_KEYBOARD_CLIENTS:
        DumbKeyboard(prefix=PREFIX,
                     oc=oc,
                     callback=SearchTV,
                     dktitle="Search Again",
                     dkthumb=R('search.png'),
                     locked=locked)
    else:
        oc.add(
            InputDirectoryObject(key=Callback(SearchTV, locked=locked),
                                 title="Search Again",
                                 prompt="Enter the name of the TV Show:",
                                 thumb=R('search.png')))
    oc.add(
        DirectoryObject(key=Callback(MainMenu, locked=locked),
                        title="Return to Main Menu",
                        thumb=R('return.png')))
    return oc
예제 #24
0
def canal(channel_name="",
          action="",
          caller_item_serialized=None,
          itemlist=""):
    oc = ObjectContainer(view_group="List")

    try:
        if caller_item_serialized is None:
            Log.Info("caller_item_serialized=None")
            caller_item = Item()
        else:
            Log.Info("caller_item_serialized=" + caller_item_serialized)
            caller_item = Item()
            caller_item.fromurl(caller_item_serialized)
        Log.Info("caller_item=" + str(caller_item))

        Log.Info("Importando...")
        channelmodule = servertools.get_channel_module(channel_name)
        Log.Info("Importado")

        Log.Info("Antes de hasattr")
        if hasattr(channelmodule, action):
            Log.Info("El módulo " + caller_item.channel +
                     " tiene una funcion " + action)

            itemlist = getattr(channelmodule, action)(caller_item)

            if action == "play" and len(itemlist) > 0 and isinstance(
                    itemlist[0], Item):
                itemlist = play_video(itemlist[0])
            if action == "play" and len(itemlist) > 0 and isinstance(
                    itemlist[0], list):
                item.video_urls = itemlist
                itemlist = play_video(item)

        else:
            Log.Info("El módulo " + caller_item.channel +
                     " *NO* tiene una funcion " + action)

            if action == "findvideos":
                Log.Info("Llamando a la funcion findvideos comun")
                itemlist = findvideos(caller_item)
            elif action == "play":
                itemlist = play_video(caller_item)
            elif action == "menu_principal":
                return mainlist()

        Log.Info("Tengo un itemlist con %d elementos" % len(itemlist))

        for item in itemlist:
            if item.action == "search" and item.thumbnail == "":
                item.thumbnail = "http://media.tvalacarta.info/pelisalacarta/squares/thumb_buscar.png"

            try:
                Log.Info("item=" +
                         unicode(item.tostring(), "utf-8", errors="replace"))
            except:
                pass

            if action != "play":
                #if "type" in item and item.type == "input":
                if item.action == "control_text_click" or item.action == "search":
                    Log.Info("Canal: item tipo input")
                    if 'value' in item:
                        value = item.value
                    else:
                        value = ""

                    if Client.Product in DumbKeyboard.clients:
                        DumbKeyboard("/video/pelisalacarta",
                                     oc,
                                     get_input,
                                     dktitle=unicode(item.title,
                                                     "utf-8",
                                                     errors="replace"),
                                     dkitem=item,
                                     dkplaceholder=value,
                                     dkthumb=item.thumbnail)
                    else:
                        dkitem = item.tourl()
                        oc.add(
                            InputDirectoryObject(key=Callback(get_input,
                                                              dkitem=dkitem),
                                                 title=unicode(
                                                     item.title,
                                                     "utf-8",
                                                     errors="replace"),
                                                 prompt=value,
                                                 thumb=item.thumbnail))
                else:
                    oc.add(
                        DirectoryObject(key=Callback(
                            canal,
                            channel_name=item.channel,
                            action=item.action,
                            caller_item_serialized=item.tourl()),
                                        title=unicode(item.title,
                                                      "utf-8",
                                                      errors="replace"),
                                        thumb=item.thumbnail))
            else:
                Log.Info("Llamando a la funcion play comun")
                videoClipObject = VideoClipObject(
                    title=unicode(item.title, "utf-8", errors="replace"),
                    thumb=item.thumbnail,
                    url="pelisalacarta://" + item.url)
                oc.add(videoClipObject)

    except:
        Log.Info("Excepcion al ejecutar " + channel_name + "." + action)
        import traceback
        Log.Info("Detalles: " + traceback.format_exc())

    return oc
예제 #25
0
def MainMenu():
    """Setup Main Menu, Includes Updater"""

    oc = ObjectContainer(title2=TITLE, no_cache=True)

    Updater(PREFIX + '/updater', oc)

    oc.add(
        DirectoryObject(key=Callback(CategoryList, title='Categories'),
                        title='Categories',
                        thumb=R(ICON_CAT)))
    oc.add(
        DirectoryObject(key=Callback(DirectoryList,
                                     title='Trending',
                                     href='/trending_videos/',
                                     page=1),
                        title='Trending',
                        thumb=R(ICON_TREND)))
    oc.add(
        DirectoryObject(key=Callback(DirectoryList,
                                     title='New',
                                     href='/new_videos/',
                                     page=1),
                        title='New',
                        thumb=R(ICON_NEW)))
    oc.add(
        DirectoryObject(key=Callback(PeriodList,
                                     title='Popular',
                                     href='/most_popular/?'),
                        title='Popular',
                        thumb=R(ICON_POP)))
    oc.add(
        DirectoryObject(key=Callback(PeriodList,
                                     title='Most Liked',
                                     href='/top_rated/?'),
                        title='Most Liked',
                        thumb=R(ICON_LIKED)))
    oc.add(
        DirectoryObject(key=Callback(PeriodList,
                                     title='Longest',
                                     href='/longest_videos/?'),
                        title='Longest',
                        thumb=R(ICON_TIME)))
    oc.add(
        DirectoryObject(key=Callback(PornstarsList, href='/pornstars', page=1),
                        title='Pornstars',
                        thumb=R(ICON_STAR)))

    oc.add(
        DirectoryObject(key=Callback(MyBookmarks),
                        title='My Bookmarks',
                        thumb=R(ICON_BM)))

    if Client.Product in DumbKeyboard.clients:
        DumbKeyboard(PREFIX,
                     oc,
                     Search,
                     dktitle='Search',
                     dkthumb=R(ICON_SEARCH))
    else:
        oc.add(
            InputDirectoryObject(key=Callback(Search),
                                 title='Search',
                                 summary='Search SpankBang',
                                 prompt='Search for...',
                                 thumb=R(ICON_SEARCH)))

    return oc
예제 #26
0
def SearchMovie(title="Search Results", query="", locked='unlocked'):
    oc = ObjectContainer(title1=title,
                         content=ContainerContent.Movies,
                         view_group="Details")
    query = String.Quote(query, usePlus=True)
    if Prefs['movie_db'] == "TheMovieDatabase":
        headers = {'Accept': 'application/json'}
        request = JSON.ObjectFromURL(url=TMDB_API_URL +
                                     "search/movie?api_key=" + TMDB_API_KEY +
                                     "&query=" + query,
                                     headers=headers)
        if 'results' in request:
            results = request['results']
            for key in results:
                if not key['title']:
                    continue
                if key['release_date']:
                    year = key['release_date'][0:4]
                else:
                    year = ""
                if key['poster_path']:
                    thumb = TMDB_IMAGE_BASE_URL + POSTER_SIZE + key[
                        'poster_path']
                else:
                    thumb = None
                if key['backdrop_path']:
                    art = TMDB_IMAGE_BASE_URL + BACKDROP_SIZE + key[
                        'backdrop_path']
                else:
                    art = None
                title_year = key['title'] + " (" + year + ")"
                oc.add(
                    DirectoryObject(key=Callback(ConfirmMovieRequest,
                                                 id=key['id'],
                                                 source='tmdb',
                                                 title=key['title'],
                                                 year=year,
                                                 poster=thumb,
                                                 backdrop=art,
                                                 summary=key['overview'],
                                                 locked=locked),
                                    title=title_year,
                                    thumb=thumb,
                                    summary=key['overview'],
                                    art=art))
        else:
            Log.Debug("No Results Found")
            if Client.Product in DUMB_KEYBOARD_CLIENTS:
                DumbKeyboard(prefix=PREFIX,
                             oc=oc,
                             callback=SearchMovie,
                             dktitle="Search Again",
                             dkthumb=R('search.png'),
                             locked=locked)
            else:
                oc.add(
                    InputDirectoryObject(
                        key=Callback(SearchMovie, locked=locked),
                        title="Search Again",
                        prompt="Enter the name of the movie:"))
            oc = ObjectContainer(
                header=TITLE,
                message="Sorry there were no results found for your search.")
            oc.add(
                DirectoryObject(key=Callback(MainMenu, locked=locked),
                                title="Back to Main Menu",
                                thumb=R('return.png')))
            return oc
    else:  # Use OMDB By Default
        request = JSON.ObjectFromURL(url=OMDB_API_URL + "?s=" + query +
                                     "&r=json")
        if 'Search' in request:
            results = request['Search']
            for key in results:
                if not key['Title']:
                    continue
                if 'type' in key and not (
                        key['type'] == "movie"):  # only show movie results
                    continue
                title_year = key['Title'] + " (" + key['Year'] + ")"
                if key['Poster']:
                    thumb = key['Poster']
                else:
                    thumb = R('no-poster.jpg')
                oc.add(
                    TVShowObject(key=Callback(ConfirmMovieRequest,
                                              id=key['imdbID'],
                                              source='imdb',
                                              title=key['Title'],
                                              year=key['Year'],
                                              poster=key['Poster'],
                                              locked=locked),
                                 rating_key=key['imdbID'],
                                 title=title_year,
                                 thumb=thumb))
        else:
            Log.Debug("No Results Found")
            oc = ObjectContainer(
                header=TITLE,
                message="Sorry there were no results found for your search.")
            if Client.Product in DUMB_KEYBOARD_CLIENTS:
                DumbKeyboard(prefix=PREFIX,
                             oc=oc,
                             callback=SearchMovie,
                             dktitle="Search Again",
                             dkthumb=R('search.png'),
                             locked=locked)
            else:
                oc.add(
                    InputDirectoryObject(
                        key=Callback(SearchMovie, locked=locked),
                        title="Search Again",
                        prompt="Enter the name of the movie:"))
            oc.add(
                DirectoryObject(key=Callback(MainMenu, locked=locked),
                                title="Back to Main Menu",
                                thumb=R('return.png')))
            return oc
    if Client.Product in DUMB_KEYBOARD_CLIENTS:
        DumbKeyboard(prefix=PREFIX,
                     oc=oc,
                     callback=SearchMovie,
                     dktitle="Search Again",
                     dkthumb=R('search.png'),
                     locked=locked)
    else:
        oc.add(
            InputDirectoryObject(key=Callback(SearchMovie, locked=locked),
                                 title="Search Again",
                                 prompt="Enter the name of the movie:",
                                 thumb=R('search.png')))
    oc.add(
        DirectoryObject(key=Callback(MainMenu, locked=locked),
                        title="Return to Main Menu",
                        thumb=R('return.png')))
    return oc