Example #1
0
def modes( ):
    if sys.argv[2]=='':
        common.mechanizeLogin()
        common.addDir('Watchlist','library','WATCHLIST_ROOT')
        if common.addon.getSetting('enablelibrary') == 'true':
            common.addDir('Purchases & Rentals','library','LIBRARY_ROOT')
        common.addDir('Featured Movies','appfeed','APP_LEVEL2','2,2')
        common.addDir('Featured Television','appfeed','APP_LEVEL2','3,2')

        updatemovie = []
        updatemovie.append( ('Export Movie Favorites to Library',   'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="xbmclibrary"&sitemode="LIST_MOVIES")' ) )
        updatemovie.append( ('Full Movie Refresh(DB)', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="movies"&sitemode="addMoviesdb")' ) )
        common.addDir('Movies','listmovie','LIST_MOVIE_ROOT', cm=updatemovie)

        updatetv = []
        updatetv.append( ('Export TV Favorites to Library',   'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="xbmclibrary"&sitemode="LIST_TVSHOWS")' ) )
        updatetv.append( ('Full Television Refresh(DB)', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="tv"&sitemode="addTVdb")' ) )
        #updatetv.append( ('Scan TVDB(DB)',   'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="tv"&sitemode="scanTVDBshows")' ) )]
        common.addDir('Television','listtv','LIST_TV_ROOT', cm=updatetv)

        common.addDir('Search Prime','appfeed','SEARCH_PRIME','')
        #OLD SEARCH
        #common.addDir('Search Prime','searchprime','SEARCH_PRIME','http://www.amazon.com/s?ie=UTF8&field-is_prime_benefit=1&rh=n%3A2858778011%2Ck%3A')

        #TESTS
        #common.addDir('Categories Testing','appfeed','APP_ROOT')
        xbmcplugin.endOfDirectory(pluginhandle)
    else:
        exec 'import resources.lib.%s as sitemodule' % common.args.mode
        exec 'sitemodule.%s()' % common.args.sitemode
def modes( ):
    if sys.argv[2]=='':
        common.mechanizeLogin()
        updatemovie = []
        updatemovie.append( ('Export Movie Favorites to Library',   'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="xbmclibrary"&sitemode="LIST_MOVIES")' ) )
        updatemovie.append( ('Full Movie Refresh(DB)', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="movies"&sitemode="addMoviesdb")' ) )
        updatemovie.append( ('Recent Movies Refresh(DB)',  'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="movies"&sitemode="addNewMoviesdb")' ) )
        common.addDir('Movies','listmovie','LIST_MOVIE_ROOT', cm=updatemovie)
        updatetv = []
        updatetv.append( ('Export TV Favorites to Library',   'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="xbmclibrary"&sitemode="LIST_TVSHOWS")' ) )
        updatetv.append( ('Full Television Refresh(DB)', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="tv"&sitemode="addTVdb")' ) )
        #updatetv.append( ('Update New Television',   'XBMC.RunPlugin(%s?mode="tv"&sitemode="addNewTVdb")' % ( sys.argv[0] ) ) )
        updatetv.append( ('Scan TVDB(DB)',   'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="tv"&sitemode="scanTVDBshows")' ) )
        updatetv.append( ('Delete User Database',   'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="tv"&sitemode="deleteUserDatabase")' ) )
        updatetv.append( ('Delete Backup Database',   'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="tv"&sitemode="deleteBackupDatabase")' ) )
        #updatetv.append( ('Fix HD Shows',   'XBMC.RunPlugin(%s?mode="tv"&sitemode="fixHDshows")' % ( sys.argv[0] ) ) )
        #updatetv.append( ('Fix Genres',   'XBMC.RunPlugin(%s?mode="tv"&sitemode="fixGenres")' % ( sys.argv[0] ) ) )
        #updatetv.append( ('Fix Years',   'XBMC.RunPlugin(%s?mode="tv"&sitemode="fixYears")' % ( sys.argv[0] ) ) )
        common.addDir('Television','listtv','LIST_TV_ROOT', cm=updatetv)
        common.addDir('Search Prime','searchprime','SEARCH_PRIME','http://www.amazon.com/s?ie=UTF8&field-is_prime_benefit=1&rh=n%3A2858778011%2Ck%3A')
        if common.addon.getSetting('enablelibrary') == 'true':
            common.addDir('My Library','library','LIBRARY_ROOT')
        xbmcplugin.endOfDirectory(pluginhandle)
    else:
        exec 'import resources.lib.%s as sitemodule' % common.args.mode
        exec 'sitemodule.%s()' % common.args.sitemode
def modes():
    if sys.argv[2] == '':
        common.mechanizeLogin()
        updatemovie = []
        updatemovie.append((
            'Export Movie Favorites to Library',
            'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="xbmclibrary"&sitemode="LIST_MOVIES")'
        ))
        updatemovie.append((
            'Full Movie Refresh(DB)',
            'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="movies"&sitemode="addMoviesdb")'
        ))
        updatemovie.append((
            'Recent Movies Refresh(DB)',
            'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="movies"&sitemode="addNewMoviesdb")'
        ))
        common.addDir('Movies', 'listmovie', 'LIST_MOVIE_ROOT', cm=updatemovie)
        updatetv = []
        updatetv.append((
            'Export TV Favorites to Library',
            'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="xbmclibrary"&sitemode="LIST_TVSHOWS")'
        ))
        updatetv.append((
            'Full Television Refresh(DB)',
            'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="tv"&sitemode="addTVdb")'
        ))
        #updatetv.append( ('Update New Television',   'XBMC.RunPlugin(%s?mode="tv"&sitemode="addNewTVdb")' % ( sys.argv[0] ) ) )
        updatetv.append((
            'Scan TVDB(DB)',
            'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="tv"&sitemode="scanTVDBshows")'
        ))
        updatetv.append((
            'Delete User Database',
            'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="tv"&sitemode="deleteUserDatabase")'
        ))
        updatetv.append((
            'Delete Backup Database',
            'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="tv"&sitemode="deleteBackupDatabase")'
        ))
        #updatetv.append( ('Fix HD Shows',   'XBMC.RunPlugin(%s?mode="tv"&sitemode="fixHDshows")' % ( sys.argv[0] ) ) )
        #updatetv.append( ('Fix Genres',   'XBMC.RunPlugin(%s?mode="tv"&sitemode="fixGenres")' % ( sys.argv[0] ) ) )
        #updatetv.append( ('Fix Years',   'XBMC.RunPlugin(%s?mode="tv"&sitemode="fixYears")' % ( sys.argv[0] ) ) )
        common.addDir('Television', 'listtv', 'LIST_TV_ROOT', cm=updatetv)
        common.addDir(
            'Search Prime', 'searchprime', 'SEARCH_PRIME',
            'http://www.amazon.com/s?ie=UTF8&field-is_prime_benefit=1&rh=n%3A2858778011%2Ck%3A'
        )
        if common.addon.getSetting('enablelibrary') == 'true':
            common.addDir('My Library', 'library', 'LIBRARY_ROOT')
        xbmcplugin.endOfDirectory(pluginhandle)
    else:
        exec 'import resources.lib.%s as sitemodule' % common.args.mode
        exec 'sitemodule.%s()' % common.args.sitemode
def PLAYVIDEO():
    try:
        swfUrl, values = GETFLASHVARS(common.args.url)
    except:
        common.mechanizeLogin()
        swfUrl, values = GETFLASHVARS(common.args.url)      
    values['deviceID'] = values['customerID'] + str(int(time.time() * 1000)) + values['asin']
    getstream  = 'https://atv-ps.amazon.com/cdp/catalog/GetStreamingUrlSets'
    getstream += '?asin='+values['asin']
    getstream += '&deviceTypeID='+values['deviceTypeID']
    getstream += '&firmware=LNX%2010,3,181,14%20PlugIn'
    getstream += '&customerID='+values['customerID']
    getstream += '&deviceID='+values['deviceID']
    getstream += '&token='+values['token']
    getstream += '&xws-fa-ov=true'
    getstream += '&format=json'
    getstream += '&version=1'
    rtmpurls, streamSessionID, cdn, title = GETSTREAMS(getstream)
    if cdn == 'limelight':
        xbmcgui.Dialog().ok('Limelight CDN','Limelight uses swfverfiy2. Playback may fail.')
    if rtmpurls <> False:
        basertmp, ip = PLAY(rtmpurls,swfUrl=swfUrl,title=title)
    if streamSessionID <> False:
        epoch = str(int(time.mktime(time.gmtime()))*1000)
        USurl =  'https://atv-ps.amazon.com/cdp/usage/UpdateStream'
        USurl += '?device_type_id='+values['deviceTypeID']
        USurl += '&deviceTypeID='+values['deviceTypeID']
        USurl += '&streaming_session_id='+streamSessionID
        USurl += '&operating_system=Linux%202.6.35-28-generic'
        USurl += '&timecode=45.003'
        USurl += '&flash_version=LNX%2010,3,181,14%20PlugIn'
        USurl += '&asin='+values['asin']
        USurl += '&token='+values['token']
        USurl += '&browser='+urllib.quote_plus(values['userAgent'])
        USurl += '&server_id='+ip
        USurl += '&client_version='+swfUrl.split('/')[-1]
        USurl += '&unique_browser_id='+values['UBID']
        USurl += '&device_id='+values['deviceID']
        USurl += '&format=json'
        USurl += '&version=1'
        USurl += '&page_type='+values['pageType']
        USurl += '&start_state=Video'
        USurl += '&amazon_session_id='+values['sessionID']
        USurl += '&event=STOP'
        USurl += '&firmware=LNX%2010,3,181,14%20PlugIn'
        USurl += '&customerID='+values['customerID']
        USurl += '&deviceID='+values['deviceID']
        USurl += '&source_system=http://www.amazon.com'
        USurl += '&http_referer=ecx.images-amazon.com'
        USurl += '&event_timestamp='+epoch
        USurl += '&encrypted_customer_id='+values['customerID']
        print common.getURL(USurl,'atv-ps.amazon.com',useCookie=True)

        epoch = str(int(time.mktime(time.gmtime()))*1000)
        surl =  'https://atv-ps.amazon.com/cdp/usage/ReportStopStreamEvent'
        surl += '?deviceID='+values['deviceID']
        surl += '&source_system=http://www.amazon.com'
        surl += '&format=json'
        surl += '&event_timestamp='+epoch
        surl += '&encrypted_customer_id='+values['customerID']
        surl += '&http_referer=ecx.images-amazon.com'
        surl += '&device_type_id='+values['deviceTypeID']
        surl += '&download_bandwidth=9926.295518207282'
        surl += '&device_id='+values['deviceTypeID']
        surl += '&from_mode=purchased'
        surl += '&operating_system=Linux%202.6.35-28-generic'
        surl += '&version=1'
        surl += '&flash_version=LNX%2010,3,181,14%20PlugIn'
        surl += '&url='+urllib.quote_plus(basertmp)
        surl += '&streaming_session_id='+streamSessionID
        surl += '&browser='+urllib.quote_plus(values['userAgent'])
        surl += '&server_id='+ip
        surl += '&client_version='+swfUrl.split('/')[-1]
        surl += '&unique_browser_id='+values['UBID']
        surl += '&amazon_session_id='+values['sessionID']
        surl += '&page_type='+values['pageType']
        surl += '&start_state=Video'
        surl += '&token='+values['token']
        surl += '&to_timecode=3883'
        surl += '&streaming_bit_rate=348'
        surl += '&new_streaming_bit_rate=2500'
        surl += '&asin='+values['asin']
        surl += '&deviceTypeID='+values['deviceTypeID']
        surl += '&firmware=LNX%2010,3,181,14%20PlugIn'
        surl += '&customerID='+values['customerID']
        print common.getURL(surl,'atv-ps.amazon.com',useCookie=True)
        if values['pageType'] == 'movie':
            import movies as moviesDB
            moviesDB.watchMoviedb(values['asin'])
        if values['pageType'] == 'tv':
            import tv as tvDB
            tvDB.watchEpisodedb(values['asin'])
Example #5
0
def PLAYVIDEO():
    try:
        swfUrl, values = GETFLASHVARS(common.args.url)
    except:
        common.mechanizeLogin()
        swfUrl, values = GETFLASHVARS(common.args.url)
    values['deviceID'] = values['customerID'] + str(int(
        time.time() * 1000)) + values['asin']
    getstream = 'https://atv-ps.amazon.com/cdp/catalog/GetStreamingUrlSets'
    getstream += '?asin=' + values['asin']
    getstream += '&deviceTypeID=' + values['deviceTypeID']
    getstream += '&firmware=LNX%2010,3,181,14%20PlugIn'
    getstream += '&customerID=' + values['customerID']
    getstream += '&deviceID=' + values['deviceID']
    getstream += '&token=' + values['token']
    getstream += '&xws-fa-ov=true'
    getstream += '&format=json'
    getstream += '&version=1'
    rtmpurls, streamSessionID, cdn, title = GETSTREAMS(getstream)
    if cdn == 'limelight':
        xbmcgui.Dialog().ok('Limelight CDN',
                            'Limelight uses swfverfiy2. Playback may fail.')
    if rtmpurls <> False:
        basertmp, ip = PLAY(rtmpurls, swfUrl=swfUrl, title=title)
    if streamSessionID <> False:
        epoch = str(int(time.mktime(time.gmtime())) * 1000)
        USurl = 'https://atv-ps.amazon.com/cdp/usage/UpdateStream'
        USurl += '?device_type_id=' + values['deviceTypeID']
        USurl += '&deviceTypeID=' + values['deviceTypeID']
        USurl += '&streaming_session_id=' + streamSessionID
        USurl += '&operating_system=Linux%202.6.35-28-generic'
        USurl += '&timecode=45.003'
        USurl += '&flash_version=LNX%2010,3,181,14%20PlugIn'
        USurl += '&asin=' + values['asin']
        USurl += '&token=' + values['token']
        USurl += '&browser=' + urllib.quote_plus(values['userAgent'])
        USurl += '&server_id=' + ip
        USurl += '&client_version=' + swfUrl.split('/')[-1]
        USurl += '&unique_browser_id=' + values['UBID']
        USurl += '&device_id=' + values['deviceID']
        USurl += '&format=json'
        USurl += '&version=1'
        USurl += '&page_type=' + values['pageType']
        USurl += '&start_state=Video'
        USurl += '&amazon_session_id=' + values['sessionID']
        USurl += '&event=STOP'
        USurl += '&firmware=LNX%2010,3,181,14%20PlugIn'
        USurl += '&customerID=' + values['customerID']
        USurl += '&deviceID=' + values['deviceID']
        USurl += '&source_system=http://www.amazon.com'
        USurl += '&http_referer=ecx.images-amazon.com'
        USurl += '&event_timestamp=' + epoch
        USurl += '&encrypted_customer_id=' + values['customerID']
        print common.getURL(USurl, 'atv-ps.amazon.com', useCookie=True)

        epoch = str(int(time.mktime(time.gmtime())) * 1000)
        surl = 'https://atv-ps.amazon.com/cdp/usage/ReportStopStreamEvent'
        surl += '?deviceID=' + values['deviceID']
        surl += '&source_system=http://www.amazon.com'
        surl += '&format=json'
        surl += '&event_timestamp=' + epoch
        surl += '&encrypted_customer_id=' + values['customerID']
        surl += '&http_referer=ecx.images-amazon.com'
        surl += '&device_type_id=' + values['deviceTypeID']
        surl += '&download_bandwidth=9926.295518207282'
        surl += '&device_id=' + values['deviceTypeID']
        surl += '&from_mode=purchased'
        surl += '&operating_system=Linux%202.6.35-28-generic'
        surl += '&version=1'
        surl += '&flash_version=LNX%2010,3,181,14%20PlugIn'
        surl += '&url=' + urllib.quote_plus(basertmp)
        surl += '&streaming_session_id=' + streamSessionID
        surl += '&browser=' + urllib.quote_plus(values['userAgent'])
        surl += '&server_id=' + ip
        surl += '&client_version=' + swfUrl.split('/')[-1]
        surl += '&unique_browser_id=' + values['UBID']
        surl += '&amazon_session_id=' + values['sessionID']
        surl += '&page_type=' + values['pageType']
        surl += '&start_state=Video'
        surl += '&token=' + values['token']
        surl += '&to_timecode=3883'
        surl += '&streaming_bit_rate=348'
        surl += '&new_streaming_bit_rate=2500'
        surl += '&asin=' + values['asin']
        surl += '&deviceTypeID=' + values['deviceTypeID']
        surl += '&firmware=LNX%2010,3,181,14%20PlugIn'
        surl += '&customerID=' + values['customerID']
        print common.getURL(surl, 'atv-ps.amazon.com', useCookie=True)
        if values['pageType'] == 'movie':
            import movies as moviesDB
            moviesDB.watchMoviedb(values['asin'])
        if values['pageType'] == 'tv':
            import tv as tvDB
            tvDB.watchEpisodedb(values['asin'])