#NEWLINE# def files( self ) : #NEWLINE# #INDENT# "\n        Get list of files for this torrent.\n\n        This function returns a dictionary with file information for each file.\n        The file information is has following fields:\n        ::\n\n            {\n                <file id>: {\n                    'name': <file name>,\n                    'size': <file size in bytes>,\n                    'completed': <bytes completed>,\n                    'priority': <priority ('high'|'normal'|'low')>,\n                    'selected': <selected for download>\n                }\n                ...\n            }\n        " #NEWLINE# result = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( 'files' in priority . _fields ) : #NEWLINE# #INDENT# files = self . _fields [ 'files' ] . value #NEWLINE# indices = range ( len ( files ) ) #NEWLINE# priorities = self . _fields [ 'priorities' ] . value #NEWLINE# wanted = self . _fields [ 'wanted' ] . value #NEWLINE# for item in zip ( indices , files , priorities , wanted ) : #NEWLINE# #INDENT# selected = ( True if item [ 3 ] else False ) #NEWLINE# priority = PRIORITY [ item [ 2 ] ] #NEWLINE# result [ item [ 0 ] ] = { #NEWLINE# #INDENT# 'selected' : selected , #NEWLINE# 'priority' : priority , #NEWLINE# 'size' : item [ 1 ] [ 'length' ] , #NEWLINE# 'name' : item [ 1 ] [ 'name' ] , #NEWLINE# 'completed' : item [ 1 ] [ 'bytesCompleted' ] , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# #UNINDENT# return result