Ticket #6474: imdbpy_plot_2.patch

File imdbpy_plot_2.patch, 1.1 KB (added by r.d.vaughan@…, 15 years ago)

Added standarization of error message to stderr instead of stdout

  • mythplugins/mythvideo/mythvideo/scripts/imdbpy.py

     
    1919try:
    2020        import imdb
    2121except ImportError:
    22         print "You need to install the IMDbPy library "\
    23                 "from (http://imdbpy.sourceforge.net/?page=download)"
     22        sys.stderr.write("You need to install the IMDbPy library "\
     23                "from (http://imdbpy.sourceforge.net/?page=download)\n")
    2424        sys.exit(1)
    2525
    2626try:
     
    328328                #print "%d plots found" % len(plots)
    329329                for plot in plots:
    330330                        text = plot.split("::")[1]
    331                         if shortest_found == None or len(text) < len(shortest_found):
    332                                 shortest_found = text
     331                        if text.find('@') != -1 or len(text.split(' ')) < 10: # Skip plots of less than 5 words
     332                                continue
     333                        # Use word count as the method to identify the smallest plot
     334                        if shortest_found == None or len(text.split(' ')) < len(shortest_found.split(' ')):
     335                                        shortest_found = text
    333336                metadata.plot = shortest_found
    334337
    335338        cast = movie.get('cast')