Exemple #1
0
def PlayVideo(sender, url):
    # PlayVideo is called each time a video is played or fast forwarded.  We only care about new plays and this messes up tracking.
    # Keep track of the latest play url and only track if it doesn't match
    if 'last_video_url' in Dict:
        if Dict['last_video_url'] != url:
            fetcher = veedios.Fetcher()
            fetcher.track(url)
    else:
        fetcher = veedios.Fetcher()
        fetcher.track(url)

    # Keep track of the last url played for comparison
    Dict['last_video_url'] = url
    Dict.Save()

    return Redirect(url)
Exemple #2
0
def CategoryList(sender):
    fetcher = veedios.Fetcher()
    categories = fetcher.fetch_categories()

    dir = MediaContainer(title2=L('CategoryListTitle2'))
    for cat in categories['categories']:
        dir.Append(
            Function(DirectoryItem(SubcategoryList,
                                   title=str(cat).upper(),
                                   thumb=R(BROWSE_ICON)),
                     selectedCategory=str(cat)))

    return dir
Exemple #3
0
def VideoMainMenu():
    # Reset to clear tracking url
    Dict.Reset()
    Dict['last_video_url'] = ''

    dir = MediaContainer(viewGroup="InfoList")

    # Test Categories to determine if this is a single or multi-level template
    fetcher = veedios.Fetcher()
    catCount = fetcher.get_category_count()

    if catCount == 1:
        #Single level template.  Jump straight to the videos.
        dir.Append(
            Function(
                DirectoryItem(VideoList,
                              L('VideoListTitle2'),
                              subtitle=appconfig.app_subtitle,
                              summary=appconfig.app_summary,
                              thumb=R(ICON),
                              art=R(ART))))
    else:
        #Multi level template.  Start at the category list.
        dir.Append(
            Function(
                DirectoryItem(CategoryList,
                              L('CategoryListTitle'),
                              subtitle=appconfig.app_subtitle,
                              summary=appconfig.app_summary,
                              thumb=R(ICON),
                              art=R(ART))))

    dir.Append(
        Function(
            DirectoryItem(TagList,
                          L('TagListTitle'),
                          subtitle=L('TagListSubtitle'),
                          summary='',
                          thumb=R(BROWSE_ICON),
                          art=R(ART))))

    dir.Append(
        Function(
            InputDirectoryItem(SearchResults,
                               L('SearchTitle'),
                               L('SearchInputMessage'),
                               L('SearchSummary'),
                               thumb=R(SEARCH_ICON),
                               art=R(ART))))

    return dir
Exemple #4
0
def TagList(sender, selectedTag=None, start=0, pageSize=10):
    fetcher = veedios.Fetcher()
    tags = fetcher.fetch_tags()

    dir = MediaContainer(title2=L('TagListTitle2'))
    for tag in tags:
        dir.Append(
            Function(DirectoryItem(SearchResults,
                                   title=str(tag['tag']).upper(),
                                   thumb=R(BROWSE_ICON)),
                     query=tag['tag'],
                     start=0,
                     pageSize=10))

    return dir
Exemple #5
0
def SubcategoryList(sender, selectedCategory):
    fetcher = veedios.Fetcher()
    category_feeds = fetcher.get_feeds_for_category(selectedCategory)

    dir = MediaContainer(title2=L('CategoryListTitle3'))
    for feed in category_feeds['feeds']:
        feedKey = category_feeds['feeds'][feed]["key"]
        dir.Append(
            Function(DirectoryItem(VideoList,
                                   title=str(feed).upper(),
                                   thumb=R(BROWSE_ICON)),
                     feedKey=feedKey,
                     start=0,
                     pageSize=10))

    return dir
Exemple #6
0
def VideoList(sender, feedKey=None, start=0, pageSize=10):
    fetcher = veedios.Fetcher()
    feedDetails = fetcher.fetch_feeditems(feedKey, start, pageSize)
    dir = FeedEntriesToListitems(L('VideoListTitle2'), feedDetails["entries"],
                                 False)

    if feedDetails['pagination'] and feedDetails['pagination'][
            'hasmore'] == True:
        dir.Append(
            Function(DirectoryItem(VideoList,
                                   title=L('NextPage'),
                                   thumb=R(NEXT_ICON)),
                     feedKey=None,
                     start=feedDetails['pagination']['nextstart'],
                     pageSize=10))

    return dir
Exemple #7
0
def SearchResults(sender, query=None, start=0, pageSize=10):
    fetcher = veedios.Fetcher()
    feedDetails = fetcher.fetch_search_results(query, start, pageSize)

    if len(feedDetails['results']['feedentryresults']) > 0:
        dir = FeedEntriesToListitems(
            "Search Results", feedDetails['results']['feedentryresults'], True)

        pagination = feedDetails['results']['feedentryresultspagination']
        if pagination and pagination['hasmore'] == True:
            dir.Append(
                Function(DirectoryItem(SearchResults,
                                       title=L('NextPage'),
                                       thumb=R(NEXT_ICON)),
                         query=query,
                         start=pagination['nextstart'],
                         pageSize=10))

        return dir
    else:
        return MessageContainer(L('SearchErrorTitle'),
                                "\n" + L('SearchErrorMessage') + ' ' + query)