示例#1
0
def check_args_with_db(self):
    if len(sys.argv) > 1:
        try:
            opts, args = getopt.getopt(sys.argv[1:], options[0], options[1])
        except getopt.GetoptError:
            # print help information and exit:
            con_usage()
            sys.exit(3)

        sort = None
        shell = False
        where = {}
        for o, a in opts:
            if o in ('-C', '--clean'):
                gutils.clean_posters_dir(self)
                sys.exit()
            elif o in ('-D', '--debug'):
                self.debug_mode = True
            elif o in ('-s', '--sort'):
                sort = a
            elif o in ('-o', '--original_title'):
                where['o_title'] = a
            elif o in ('-t', '--title'):
                where['title'] = a
            elif o in ('-d', '--director'):
                where['director'] = a
            elif o in ('-c', '--cast'):
                where['cast'] = a
            elif o in ('-y', '--year'):
                where['year'] = str(int(a))
            elif o == '--seen':
                where['seen'] = a
            elif o == '--loaned':
                where['loaned'] = a
            elif o == '--number':
                where['number'] = a
            elif o == '--runtime':
                where['runtime'] = a
            elif o == '--rating':
                where['rating'] = a
            elif o == '--shell':
                shell = True
        if where:
            con_search_movie(self, where, sort)
        if shell:
            run_shell(self)
示例#2
0
def check_args_with_db(self):
    if len(sys.argv) > 1:
        try:
            opts, args = getopt.getopt(sys.argv[1:], options[0], options[1])
        except getopt.GetoptError:
            # print help information and exit:
            con_usage()
            sys.exit(3)

        sort = None
        shell = False
        where = {}
        for o, a in opts:
            if o in ('-C', '--clean'):
                gutils.clean_posters_dir(self)
                sys.exit()
            elif o in ('-D', '--debug'):
                self.debug_mode = True
            elif o in ('-s', '--sort'):
                sort = a
            elif o in ('-o', '--original_title'):
                where['o_title'] = a
            elif o in ('-t', '--title'):
                where['title'] = a
            elif o in ('-d', '--director'):
                where['director'] = a
            elif o in ('-c', '--cast'):
                where['cast'] = a
            elif o in ('-y', '--year'):
                where['year'] = str(int(a))
            elif o == '--seen':
                where['seen'] = a
            elif o == '--loaned':
                where['loaned'] = a
            elif o == '--number':
                where['number'] = a
            elif o == '--runtime':
                where['runtime'] = a
            elif o == '--rating':
                where['rating'] = a
            elif o == '--shell':
                shell = True
        if where:
            con_search_movie(self, where, sort)
        if shell:
            run_shell(self)
示例#3
0
def check_args_with_db(self):
    if len(sys.argv) > 1:
        try:
            opts, args = getopt.getopt(sys.argv[1:], options[0], options[1])
        except getopt.GetoptError:
            # print help information and exit:
            con_usage()
            sys.exit(3)

        sort = None
        shell = False
        where = {}
        for o, a in opts:
            if o in ("-C", "--clean"):
                gutils.clean_posters_dir(self)
                sys.exit()
            elif o in ("-D", "--debug"):
                self.debug_mode = True
            elif o in ("-s", "--sort"):
                sort = a
            elif o in ("-o", "--original_title"):
                where["o_title"] = a
            elif o in ("-t", "--title"):
                where["title"] = a
            elif o in ("-d", "--director"):
                where["director"] = a
            elif o in ("-c", "--cast"):
                where["cast"] = a
            elif o in ("-y", "--year"):
                where["year"] = str(int(a))
            elif o == "--seen":
                where["seen"] = a
            elif o == "--loaned":
                where["loaned"] = a
            elif o == "--number":
                where["number"] = a
            elif o == "--runtime":
                where["runtime"] = a
            elif o == "--rating":
                where["rating"] = a
            elif o == "--shell":
                shell = True
        if where:
            con_search_movie(self, where, sort)
        if shell:
            run_shell(self)
示例#4
0
def check_args_with_db(self):
	if len(sys.argv)>1:
		try:
			opts, args = getopt.getopt(sys.argv[1:], 'hDCo:t:d:c:y:s:',
				('help', 'debug', 'sqlecho', 'clean', 'check-dep', 'show-dep',
				'original_title=', 'title=', 'director=', 'cast=', 'year=',
				'sort=', 'seen=', 'loaned=', 'number=', 'runtime=',
				'rating=', 'home='))
		except getopt.GetoptError:
			# print help information and exit:
			con_usage()
			sys.exit(3)

		sort = None
		where = {}
		for o, a in opts:
			if o in ('-C', '--clean'):
				gutils.clean_posters_dir(self)
				sys.exit()
			elif o == '--sqlecho':
				self.db.metadata.engine.echo = True
			elif o in ('-s', '--sort'):
				sort = a
			elif o in ('-o', '--original_title'):
				where['o_title'] = a
			elif o in ('-t', '--title'):
				where['title'] = a
			elif o in ('-d', '--director'):
				where['director'] = a
			elif o in ('-c', '--cast'):
				where['cast'] = a
			elif o in ('-y', '--year'):
				where['year'] = str(int(a))
			elif o == '--seen':
				where['seen'] = a
			elif o == '--loaned':
				where['loaned'] = a
			elif o == '--number':
				where['number'] = a
			elif o == '--runtime':
				where['runtime'] = a
			elif o == '--rating':
				where['rating'] = a
		if where:
			con_search_movie(self, where, sort)