示例#1
0
 def _weakMatch(self, title1, title2):
     """ Return TRUE if the two titles match after some string manipulation. """
     # Manipulate Title 1
     title1 = title1.lower()
     title1 = util.replaceChars(title1, REPLACE_CHARS)
     title1 = util.removePrefixWords(title1, STOP_WORDS)
     if (title1.endswith('the')): title1 = title1[0:-3]
     title1 = title1.strip()
     # Manipulate Title 2
     title2 = title2.lower()
     title2 = util.replaceChars(title2, REPLACE_CHARS)
     title2 = util.removePrefixWords(title2, STOP_WORDS)
     if (title2.endswith('the')): title2 = title2[0:-3]
     title2 = title2.strip()
     # Return the Comparison
     #log.info("Checking match '%s' and '%s'" % (title1, title2))
     return title1 == title2
示例#2
0
 def updateNewDirName(self, aka=None):
     """ Update the new DirName to place video files.
         Format: http://forum.boxee.tv/showthread.php?t=5214
         @param aka: Optional alternative title (useful for foreign videos)
     """
     year = self.year or self.curYear
     self.newDirName = aka or self.title or self.curTitle
     self.newDirName = util.replaceChars(self.newDirName, REPLACE_CHARS)
     self.newDirName = util.removeChars(self.newDirName, INVALID_CHARS)
     self.newDirName = util.removePrefixWords(self.newDirName, STOP_WORDS)
     self.newDirName = util.removeExtraChars(self.newDirName, '.')
     if (aka) and (year): self.newDirName = "%s (%s-%s)" % (self.newDirName, self.country, year)
     elif (aka): self.newDirName = "%s (%s)" % (self.newDirName, self.country)
     elif (year): self.newDirName = "%s (%s)" % (self.newDirName, year)