#NEWLINE# def channelDirectory( self , items ) : #NEWLINE# #INDENT# if ( ( items == None ) or ( len ( items ) == 0 ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# playbackMenu = ( control . lang ( 30292 ) . encode ( 'utf-8' ) if ( control . setting ( 'autoplay' ) == 'true' ) else control . lang ( 30291 ) . encode ( 'utf-8' ) ) #NEWLINE# ( addonPoster , addonBanner ) = ( control . addonPoster ( ) , control . addonBanner ( ) ) #NEWLINE# addonFanart = control . addonFanart ( ) #NEWLINE# sysaddon = sys . argv [ 0 ] #NEWLINE# for i in items : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# label = ( '[B]%s[/B] : %s' % ( i [ 'channel' ] . upper ( ) , i [ 'name' ] ) ) #NEWLINE# sysname = urllib . quote_plus ( i [ 'name' ] ) #NEWLINE# systitle = urllib . quote_plus ( i [ 'title' ] ) #NEWLINE# ( imdb , tmdb , year ) = ( i [ 'imdb' ] , '0' , i [ 'year' ] ) #NEWLINE# ( poster , banner ) = ( i [ 'poster' ] , i [ 'poster' ] ) #NEWLINE# if ( v == '0' ) : #NEWLINE# #INDENT# poster = addonPoster #NEWLINE# #UNINDENT# if ( ( banner == '0' ) and ( poster == '0' ) ) : #NEWLINE# #INDENT# banner = addonBanner #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( banner == '0' ) : #NEWLINE# #INDENT# banner = poster #NEWLINE# #UNINDENT# #UNINDENT# meta = dict ( ( ( k , v ) for ( k , v ) in i . iteritems ( ) if ( not ( v == '0' ) ) ) ) #NEWLINE# meta . update ( { #NEWLINE# #INDENT# 'trailer' : ( '%s?action=trailer&name=%s' % ( sysaddon , sysname ) ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( i [ 'duration' ] == '0' ) : #NEWLINE# #INDENT# meta . update ( { #NEWLINE# #INDENT# 'duration' : '120' , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# meta . update ( { #NEWLINE# #INDENT# 'duration' : str ( ( int ( meta [ 'duration' ] ) * 60 ) ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# sysmeta = urllib . quote_plus ( json . dumps ( meta ) ) #NEWLINE# url = ( '%s?action=play&name=%s&title=%s&year=%s&imdb=%s&tmdb=%s&meta=%s&t=%s' % ( sysaddon , sysname , systitle , year , imdb , tmdb , sysmeta , self . systime ) ) #NEWLINE# sysurl = urllib . quote_plus ( url ) #NEWLINE# cm = [ ] #NEWLINE# cm . append ( ( playbackMenu , ( 'RunPlugin(%s?action=alterSources&url=%s&meta=%s)' % ( sysaddon , sysurl , sysmeta ) ) ) ) #NEWLINE# cm . append ( ( control . lang ( 30293 ) . encode ( 'utf-8' ) , 'Action(Info)' ) ) #NEWLINE# cm . append ( ( control . lang ( 30294 ) . encode ( 'utf-8' ) , ( 'RunPlugin(%s?action=refresh)' % sysaddon ) ) ) #NEWLINE# cm . append ( ( control . lang ( 30295 ) . encode ( 'utf-8' ) , ( 'RunPlugin(%s?action=openSettings)' % sysaddon ) ) ) #NEWLINE# cm . append ( ( control . lang ( 30296 ) . encode ( 'utf-8' ) , ( 'RunPlugin(%s?action=openPlaylist)' % sysaddon ) ) ) #NEWLINE# item = control . item ( label = label , iconImage = poster , thumbnailImage = poster ) #NEWLINE# try : #NEWLINE# #INDENT# item . setArt ( { #NEWLINE# #INDENT# 'poster' : poster , #NEWLINE# 'banner' : banner , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# if ( not ( addonFanart == None ) ) : #NEWLINE# #INDENT# item . setProperty ( 'Fanart_Image' , addonFanart ) #NEWLINE# #UNINDENT# item . setInfo ( type = 'Video' , infoLabels = meta ) #NEWLINE# item . setProperty ( 'Video' , 'true' ) #NEWLINE# item . addContextMenuItems ( cm , replaceItems = True ) #NEWLINE# control . addItem ( handle = int ( sys . argv [ 1 ] ) , url = url , listitem = item , isFolder = False ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# control . content ( int ( sys . argv [ 1 ] ) , 'movies' ) #NEWLINE# control . directory ( int ( sys . argv [ 1 ] ) , cacheToDisc = True )