Ejemplo n.º 1
0
 def process_locations(self):
     """for all locations defined, find all
     items within said locations and process
     each item"""
     dirs = {}
     for l in self.locations:
         dirs[l] = os.listdir(l)
     it = iter(dirs.items())
     for d in it:
         base = d[0]
         contents_of_base = d[1]
         #for item in progress.bar( contents_of_base ):
         count = 1
         for item in contents_of_base:
             if self.prompt:
                 #This needs to be moved so that already seen items arent asked to be processed
                 if confirm(
                         colored.red("%d/%d process %s" % (
                             count,
                             len(contents_of_base),
                             item,
                         )), True):
                     self.process_item(item, base)
                 else:
                     if self.debug:
                         print colored.yellow(
                             "Not processing 'cuz ya said No")
                     #Not setting this so we can manually iterate as long as we want
                     #self.ignore_count += 1
                 count += 1
             else:
                 self.process_item(item, base)
Ejemplo n.º 2
0
 def process_locations( self ): 
     """for all locations defined, find all
     items within said locations and process
     each item"""
     dirs = {}
     for l in self.locations:
         dirs[l] = os.listdir( l )
     it = iter( dirs.items() )
     for d in it:
         base = d[0]
         contents_of_base = d[1] 
         #for item in progress.bar( contents_of_base ):
         count = 1 
         for item in contents_of_base:
             if self.prompt:
                 #This needs to be moved so that already seen items arent asked to be processed
                 if confirm(colored.red("%d/%d process %s" % (count, len(contents_of_base), item,)),  True): 
                     self.process_item( item, base ) 
                 else:
                     if self.debug:
                         print colored.yellow("Not processing 'cuz ya said No")
                     #Not setting this so we can manually iterate as long as we want
                     #self.ignore_count += 1
                 count += 1 
             else:
                 self.process_item( item, base )
Ejemplo n.º 3
0
 def confirm_locations( self ):
     '''confirms with user the locations to process by
     iterating over them if user choses to do so'''
     print "confirming locations",  self.locations
     new_locations = [] 
     if self.prompt:
         question = colored.yellow("Do you want to process the following %d locations: %s" % (len(self.locations), self.locations, ))
         if not confirm(question, True): 
             sys.exit("User aborted, no locations to process. Exiting.")
Ejemplo n.º 4
0
 def confirm_locations(self):
     '''confirms with user the locations to process by
     iterating over them if user choses to do so'''
     print "confirming locations", self.locations
     new_locations = []
     if self.prompt:
         question = colored.yellow(
             "Do you want to process the following %d locations: %s" % (
                 len(self.locations),
                 self.locations,
             ))
         if not confirm(question, True):
             sys.exit("User aborted, no locations to process. Exiting.")