Ticket #6219: imdb_script.patch

File imdb_script.patch, 1.3 KB (added by jyavenard@…, 12 years ago)
  • imdbpy.py

     
    327327                shortest_found = None
    328328                #print "%d plots found" % len(plots)
    329329                for plot in plots:
    330                         text = plot.split("::")[1]
     330                        #IMDbPY 3.9 doesn't order the content of plot like earlier version of IMDbPY.
     331                        # IMDB 3.6 is : plot_content::author
     332                        # IMDB 3.9 is : author::plot_content
     333                        #So we assume that should one side longer than the other, it's actually where the description is
     334                        splitvalue = plot.split("::")
     335                        if len(splitvalue[0]) > len(splitvalue[1]):
     336                                text = splitvalue[0]
     337                        else:
     338                                text = splitvalue[1]
    331339                        if shortest_found == None or len(text) < len(shortest_found):
    332340                                shortest_found = text
    333341                metadata.plot = shortest_found
  • find_meta.py

     
    153153                        lowest_cutpoint = pos
    154154
    155155        title = title[0:lowest_cutpoint]
     156        # Remove trailing year in the form of "name [year]" or "name (year)"if any
     157        m = re.compile(r"(.*)([\(\[]([0-9]+)[\]\)])$")
     158        found = m.match(title.strip())
     159        if found:
     160                title = found.group(1)
    156161        return title.strip()
    157162
    158163def parse_meta(variable, oldvalue, emptyvalue="", meta=""):