예제 #1
0
def PlayVideo(type, url, id, indirect=None):
    oc = ObjectContainer()

    movie_id = re.match('http://www.netflix.com/Movie/.+/(?P<id>[0-9]+)',
                        url).groupdict()['id']
    player_url = 'http://www.netflix.com/WiPlayer?movieid=%s' % movie_id
    user_url = "http://api-public.netflix.com/users/%s" % US_Account.GetUserId(
    )

    params = {'movieid': movie_id, 'user': user_url}
    video_url = US_Account.GetAPIURL(player_url, params=params)

    # If the &resume=true parameter was specified, ensure that it's copied to the final webkit URL
    if url.endswith('&resume=true'):
        video_url = video_url + '&resume=true'
    Log("Final WebKit URL: " + video_url)

    oc.add(
        VideoClipObject(key=Callback(Lookup, type=type, id=id),
                        rating_key=id,
                        items=[
                            MediaObject(
                                parts=[PartObject(key=WebVideoURL(video_url))],
                                protocol='webkit')
                        ]))

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

    # Attempt to log in
    logged_in = US_Account.LoggedIn()
    if not logged_in:
        logged_in = US_Account.TryLogIn()

    oc = ObjectContainer(no_cache=True)

    if logged_in:

        oc.add(DirectoryObject(key=Callback(UserList), title='TV & Movies'))
        oc.add(
            DirectoryObject(key=Callback(
                MenuItem,
                url='http://api-public.netflix.com/users/%s/queues/instant' %
                US_Account.GetUserId(),
                title='Instant Queue',
                is_queue=True),
                            title='Instant Queue'))
        oc.add(
            InputDirectoryObject(key=Callback(Search),
                                 title='Search',
                                 prompt='Search for a Movie or TV Show...'))

    oc.add(PrefsObject(title='Preferences'))

    return oc
예제 #3
0
def UserList():

    oc = ObjectContainer()

    user_id = US_Account.GetUserId()
    user_list_url = US_Account.GetAPIURL(
        'http://api-public.netflix.com/users/%s/lists' % user_id,
        params={
            'v': '2',
            'client': 'plex'
        })
    user_list = XML.ElementFromURL(user_list_url)

    # Add the found items
    for item in user_list.xpath('//lists/list/link'):
        url = item.get('href')
        title = item.get('title')
        oc.add(
            DirectoryObject(key=Callback(MenuItem, url=url, title=title),
                            title=title))

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

    # Attempt to log in
    logged_in = US_Account.LoggedIn()
    if not logged_in:
        logged_in = US_Account.TryLogIn()

    oc = ObjectContainer(no_cache=True)

    if logged_in:

        oc.add(DirectoryObject(key=Callback(UserList), title='TV & Movies'))
        oc.add(
            DirectoryObject(key=Callback(
                MenuItem,
                url='http://api-public.netflix.com/users/%s/queues/instant' %
                US_Account.GetUserId(),
                title='Instant Queue',
                is_queue=True),
                            title='Instant Queue'))
        oc.add(
            InputDirectoryObject(key=Callback(Search),
                                 title='Search',
                                 prompt='Search for a Movie or TV Show...'))

    else:

        # The user has not yet provided valid credentials. Therefore, we should allow them to be redirected
        # to sign up for a free trial.
        if Client.Platform in ('MacOSX', 'Windows'):
            oc.add(
                DirectoryObject(key=Callback(FreeTrial),
                                title='Sign up for free trial'))

    oc.add(PrefsObject(title='Preferences'))

    return oc