#NEWLINE# def addDirectory( self , items ) : #NEWLINE# #INDENT# if ( ( items == None ) or ( len ( items ) == 0 ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# sysaddon = sys . argv [ 0 ] #NEWLINE# addonFanart = control . addonFanart ( ) #NEWLINE# addonThumb = control . addonThumb ( ) #NEWLINE# artPath = control . artPath ( ) #NEWLINE# for i in items : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# name = control . lang ( i [ 'name' ] ) . encode ( 'utf-8' ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# name = i [ 'name' ] #NEWLINE# #UNINDENT# if i [ 'image' ] . startswith ( 'http://' ) : #NEWLINE# #INDENT# thumb = i [ 'image' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not ( artPath == None ) ) : #NEWLINE# #INDENT# thumb = os . path . join ( artPath , i [ 'image' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# thumb = addonThumb #NEWLINE# #UNINDENT# #UNINDENT# url = ( '%s?action=%s' % ( sysaddon , i [ 'action' ] ) ) #NEWLINE# try : #NEWLINE# #INDENT# url += ( '&url=%s' % urllib . quote_plus ( i [ 'url' ] ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# cm = [ ] #NEWLINE# try : #NEWLINE# #INDENT# cm . append ( ( control . lang ( 30239 ) . encode ( 'utf-8' ) , ( 'RunPlugin(%s?action=tvshowsToLibrary&url=%s)' % ( sysaddon , urllib . quote_plus ( i [ 'context' ] ) ) ) ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# item = control . item ( label = name , iconImage = thumb , thumbnailImage = thumb ) #NEWLINE# item . addContextMenuItems ( cm , replaceItems = False ) #NEWLINE# if ( not ( addonFanart == None ) ) : #NEWLINE# #INDENT# item . setProperty ( 'Fanart_Image' , addonFanart ) #NEWLINE# #UNINDENT# control . addItem ( handle = int ( sys . argv [ 1 ] ) , url = url , listitem = item , isFolder = True ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# control . directory ( int ( sys . argv [ 1 ] ) , cacheToDisc = True )