Пример #1
0
 def fillUpdateDB( self ) :
     """
     Copies the Shows from the database to a temporary database, for determining what shows to update.
     
     :rtype: None
     """
     self.updateDB = copy.deepcopy( self.currentDB )
     
     
     backends = dict()
     
     ## Group every Show into the backend used.
     for Show in self.updateDB.database :
         Show.clearEpisodes()
         if backends.has_key( Show.backend ) == False :
             backends[ Show.backend ] = [ copy.deepcopy(Show) ]
         else :
             backends[ Show.backend ].append( copy.deepcopy(Show) )
     
     
     for backend, Shows in backends.iteritems() :
         exec( 'backend = ' + backend + '()' )
         
         ## Download every Show in one backend before moving on to another backend.
         dictionary = backend.downloadShowList( Shows )
         DB = backend.getShowDetails( dictionary )
         
         ## Populate the updateDB
         for Show in DB.database :
             show = self.updateDB.getShow( Show )
             for Season in Show.seasons :
                 show.addSeason( Season )
     
     
     return self.incrementalUpdate()