@@ -162,8 +162,9 @@ def addVideo(name,asin,poster=False,fanart=False,infoLabels=False,totalItems=0,c
162162 cm = []
163163 if int (addon .getSetting ("playmethod" )) == 0 :
164164 liz .setProperty ('IsPlayable' , 'true' )
165- cm .insert (0 , (getString (30109 ), 'XBMC.RunPlugin(%s&trailer=<0>&selbitrate=<1>)' % u ) )
166- cm .insert (1 , (getString (30113 ), 'XBMC.RunPlugin(%s&trailer=<0>&selbitrate=<org>)' % u ) )
165+ cm .insert (0 , (getString (30109 ), 'RunPlugin(%s&trailer=<0>&selbitrate=<1>)' % u ) )
166+ cm .insert (1 , (getString (30113 ), 'RunPlugin(%s&trailer=<0>&selbitrate=<org>)' % u ) )
167+ cm .insert (0 , (getString (30101 ), 'Action(ToggleWatched)' ) )
167168 if isHD :
168169 liz .addStreamInfo ('video' , { 'width' :1280 ,'height' : 720 })
169170 else :
@@ -370,16 +371,30 @@ def checkCase(title):
370371 title = title .title ().replace ('[Ov]' , '[OV]' ).replace ('Bc' , 'BC' )
371372 return title
372373
373- def getNewest ():
374+ def getCategories ():
374375 import urlparse
375376 response = getURL (ATV_URL + '/cdp/catalog/GetCategoryList?firmware=fmw:15-app:1.1.23&deviceTypeID=A1MPSLFC7L5AFK&deviceID=%s&format=json&OfferGroups=B0043YVHMY&IncludeAll=T&version=2' % addon .getSetting ("GenDeviceID" ))
376377 data = demjson .decode (response )
377378 asins = {}
378- for type in data ['message' ]['body' ]['categories' ][0 ]['categories' ][0 ]['categories' ]:
379- subPageType = None
380- if type .has_key ('subPageType' ): subPageType = type ['subPageType' ]
381- if subPageType == 'PrimeMovieRecentlyAdded' or subPageType == 'PrimeTVRecentlyAdded' :
382- asins .update ({subPageType : urlparse .parse_qs (type ['query' ])['ASINList' ][0 ].split (',' )})
379+ for maincat in data ['message' ]['body' ]['categories' ]:
380+ mainCatId = maincat .get ('id' )
381+ if mainCatId == 'movies' or mainCatId == 'tv_shows' :
382+ asins .update ({mainCatId : {}})
383+ for type in maincat ['categories' ][0 ]['categories' ]:
384+ subPageType = type .get ('subPageType' )
385+ subCatId = type .get ('id' )
386+ if subPageType == 'PrimeMovieRecentlyAdded' or subPageType == 'PrimeTVRecentlyAdded' :
387+ asins [mainCatId ].update ({subPageType : urlparse .parse_qs (type ['query' ])['ASINList' ][0 ].split (',' )})
388+ elif 'prime_editors_picks' in subCatId :
389+ for picks in type ['categories' ]:
390+ query = picks .get ('query' ).upper ()
391+ title = picks .get ('title' )
392+ if title and ('ASINLIST' in query ):
393+ querylist = urlparse .parse_qs (query )
394+ alkey = None
395+ for key in querylist .keys ():
396+ if 'ASINLIST' in key : alkey = key
397+ asins [mainCatId ].update ({title : urlparse .parse_qs (query )[alkey ][0 ]})
383398 return asins
384399
385400def SetView (content , view = False , updateListing = False ):
@@ -491,7 +506,13 @@ def copyDB(ask=False):
491506 cur_fileacc = int (os .path .getmtime (tvDBfile ) + os .path .getmtime (MovieDBfile ))
492507 if org_fileacc > cur_fileacc :
493508 copyDB (True )
494-
509+ if 1 == 0 :
510+ import movies
511+ import tv
512+ NewAsins = getCategories ()
513+ movies .setNewest (NewAsins )
514+ tv .setNewest (NewAsins )
515+ #tv.cleanDB()
495516urlargs = urllib .unquote_plus (sys .argv [2 ][1 :].replace ('&' , ', ' )).replace ('<' ,'"' ).replace ('>' ,'"' )
496517Log ('Args: %s' % urlargs )
497518exec "args = _Info(%s)" % urlargs
0 commit comments