示例#1
0
    def imdb_search(self, arg=None, menuw=None):
        """
        search imdb for this item
        """
        fxd = FxdImdb()

        box = PopupBox(text=_('searching IMDB...'))
        box.show()

        items = []

        try:
            duplicates = []
            if self.disc_set:
                self.searchstring = self.item.media.label
            else:
                self.searchstring = self.item.name

            for id, name, year, type in fxd.guessImdb(self.searchstring,
                                                      self.disc_set):
                try:
                    for i in self.item.parent.play_items:
                        if i.name == name:
                            if not i in duplicates:
                                duplicates.append(i)
                except:
                    pass
                try:
                    items.append(
                        menu.MenuItem(
                            '%s (%s, %s)' % (htmlenties2txt(name), year, type),
                            self.imdb_create_fxd, (id, year)))
                except UnicodeError, e:
                    print e
        except Exception, e:
            print 'imdb_search:', e
            box.destroy()
            box = PopupBox(text=_('Unknown error while connecting to IMDB'))
            box.show()
            time.sleep(2)
            box.destroy()
            return
示例#2
0
    def imdb_search(self, arg=None, menuw=None):
        """
        search imdb for this item
        """
        fxd = FxdImdb()

        box = PopupBox(text=_('searching IMDB...'))
        box.show()

        items = []

        try:
            duplicates = []
            if self.disc_set:
                self.searchstring = self.item.media.label
            else:
                self.searchstring = self.item.name

            for id, name, year, type in fxd.guessImdb(self.searchstring,
                                                      self.disc_set):
                try:
                    for i in self.item.parent.play_items:
                        if i.name == name:
                            if not i in duplicates:
                                duplicates.append(i)
                except:
                    pass
                try:
                    #items.append(menu.MenuItem('%s (%s, %s)' % (htmlenties2txt(name), year, type),
                    items.append(
                        menu.MenuItem('%s (%s, %s)' % (name, year, type),
                                      self.imdb_create_fxd, (id, year)))
                except UnicodeError, e:
                    print e
            # if filename had a season/episode lets´ grab it
            self.season = fxd.season
            self.episode = fxd.episode
示例#3
0
        if len(args) != 0:
            usage()

        filename = search_arg
        print "searching " + filename
        for result in fxd.searchImdb(filename):
            if result[3]:
                print '%s   %s (%s, %s)' % result
            else:
                print '%s   %s (%s)' % (result[0], result[1], result[2])
        sys.exit(0)

    if task == 'guess':
        filename = search_arg
        print "searching " + filename
        for result in fxd.guessImdb(filename):
            if result[3]:
                print '%s   %s (%s, %s)' % result
            else:
                print '%s   %s (%s)' % (result[0], result[1], result[2])
        sys.exit(0)

    # normal usage
    if len(args) < 2:
        usage()

    imdb_number = args[0]
    filename = args[1]

    files, cdid = parse_file_args(args[2:])
示例#4
0
        print "Searching IMDB for '%s'..." % filename
        results = fxd.searchImdb(filename)
        _debug_('%r' % results)
        if len(results) == 0:
            print 'No results'
        for result in results:
            if result[3]:
                print '%s   %s (%s) %s' % result
            else:
                print '%s   %s (%s)' % (result[0], result[1], result[2])
        sys.exit(0)

    if task == 'guess':
        filename = search_arg
        print "Searching IMDB for '%s'..." % filename
        results = fxd.guessImdb(filename)
        if len(results) == 0:
            print 'No results'
        _debug_('%r' % results)
        for result in results:
            if result[3]:
                print '%s   %s (%s) %s' % result
            else:
                print '%s   %s (%s)' % (result[0], result[1], result[2])
        sys.exit(0)

    # normal usage
    if len(args) < 2:
        usage()

    imdb_number = args[0]
示例#5
0
        # Print the results.
        print '%s result%s for "%s":' % (len(results), ('', 's')[len(results) != 1], title.encode(opts.encoding, 'replace'))
        print 'movieID\t: imdbID : title'

        # Print the long imdb title for every movie.
        for movie in results:
            outp = u'%s\t: %s : %s' % (movie.movieID, fxd.imdb.get_imdbID(movie),
                                    movie['long imdb title'])
            print outp.encode(opts.encoding, 'replace')            
        sys.exit(0)

    if opts.guess:
        filename = ' '.join(args)
        print "Searching IMDB for '%s'..." % filename
        results = fxd.guessImdb(filename)
        if not results:
            print 'No results'

        # Print the results.
        print '    %s result%s for "%s":' % (len(results),
                                            ('', 's')[len(results) != 1],
                                            title.encode(opts.encoding, 'replace'))
        print 'movieID\t: imdbID : title'

        # Print the long imdb title for every movie.
        for movie in results:
            outp = u'%s\t: %s : %s' % (movie.movieID, fxd.imdb.get_imdbID(movie),
                                    movie['long imdb title'])
            print outp.encode(opts.encoding, 'replace')            
            print '%s' % title.encode(opts.encoding)