Logo Search packages:      
Sourcecode: hellanzb version File versions  Download package

def Hellanzb::NZBLeecher::NZBModel::NZBFile::needsDownload (   self,
  workingDirListing,
  workingDirDupeMap 
)

Whether or not this NZBFile needs to be downloaded (isn't on the file system). You may
specify the optional workingDirListing so this function does not need to prune
this directory listing every time it is called (i.e. prune directory
names). workingDirListing should be a list of only filenames (basename, not
including dirname) of files lying in Hellanzb.WORKING_DIR 

Definition at line 476 of file NZBModel.py.

00476                                                                  :
        """ Whether or not this NZBFile needs to be downloaded (isn't on the file system). You may
        specify the optional workingDirListing so this function does not need to prune
        this directory listing every time it is called (i.e. prune directory
        names). workingDirListing should be a list of only filenames (basename, not
        including dirname) of files lying in Hellanzb.WORKING_DIR """
        if os.path.isfile(self.getDestination()):
            # This block only handles matching temporary file names
            self.nzb.firstSegmentsDownloaded += 1
            return False

        elif self.filename is None:
            # First, check if this is one of the dupe files on disk
            isDupe, dupeNeedsDl = handleDupeNZBFileNeedsDownload(self, workingDirDupeMap)
            if isDupe:
                # NOTE: We should know this is a par, but probably don't care if it is.
                # If there is a par file fully assembled on disk, we don't care about
                # skipping it
                if self.filename is not None:
                    identifyPar(self)
                if not dupeNeedsDl:
                    self.nzb.firstSegmentsDownloaded += 1
                return dupeNeedsDl

            # We only know about the temp filename. In that case, fall back to matching
            # filenames in our subject line
            for file in workingDirListing:
                # Whole file match
                if self.subject.find(file) > -1:
                    # No need for setRealFileName(self, file)'s extra work here
                    self.filename = file
                    
                    # Prevent matching of this file multiple times
                    workingDirListing.remove(file)

                    if Hellanzb.SMART_PAR:
                        identifyPar(self)
                        if self.isPar:
                            debug('needsDownload: Found par on disk: %s isExtraPar: %s' % \
                                  (file, str(self.isExtraPar)))
                        
                    self.nzb.firstSegmentsDownloaded += 1
                    return False
    
        return True

    def getTempFileName(self):


Generated by  Doxygen 1.6.0   Back to index