def filesrch(): """""" global currloc global lastloc lastloc = currloc currloc = filesrch index = 1 searchagain = False dispdat.osclear() dispdat.title("Search Cache") dispdat.numlist(SRCHOPT) print HR cmd = getdat.getinput() if cmd == "1": searchagain = srchdat.fortitle() elif cmd == "2": searchagain = srchdat.forid() if searchagain: return True elif not searchagain: return False
def loadformat(): """""" global currloc global lastloc global loaded loaded = None lastloc = currloc currloc = loadformat format = None dispdat.osclear() dispdat.title("Format Selection") dispdat.numlist(FORMATS, True) print HR cmd = getdat.getinput() if cmd == "1": format = FORMATS[0] elif cmd == "2": format = FORMATS[1] dispdat.osclear() filelist = getdat.localfiles(format) dispdat.title("Local Files") dispdat.numlist(filelist) loaded = getdat.fromfile(filelist, True) return True
def main (): """""" global currloc global lastloc lastloc = currloc currloc = main index = 1 killscript = False dispdat.osclear() dispdat.title("Main Menu") dispdat.numlist(MAINOPT) if loaded is not None: print "{0} {1}{2}".format("File:", loaded, NL) print HR cmd = getdat.getinput() if cmd == "1": killscript = loadformat() elif cmd == "2": killscript = filesrch() elif cmd == "3": killscript = omdbsrch() elif cmd == "4": killscript = False if killscript: return True elif not killscript: return False
def fortitle (omdb=False): """""" def titlesearch (): """""" for mov in getdat.cache: movtitle = mov[MKEY[3]].lower() movtitlespl = mov[MKEY[3]].lower().split() if search == movtitle or search == movtitle[4:]: if year == "": dispdat.movdata(mov) return True else: if year == mov[MKEY[4]]: dispdat.movdata(mov) return True # elif any(word in searchspl for word in movtitlespl): # for word in search.split(): # if word in movtitlespl: # matches.append("{0} ({1})").format(mov[MKEY[3]], # mov[MKEY[4]]) else: return False # matches = [] dispdat.osclear() dispdat.title("Search by Title") title = getdat.getinput("Title: ") year = getdat.getinput("Year (optional): ") search = title.lower() searchspl = search.split() searchl = len(searchspl) found = titlesearch() if not found and omdb: getdat.withtitle(search, year) # elif searchl == 2: # getdat.withtitle(searchpl[0], searchpl[1]) found = titlesearch() # if len(matches) > 0 < 10: # index = 1 # print("Which one?" + NL) # for title in matches: # print("[{0}] {1}").format(str(index), title) # index += 1 # print # newchoice = raw_input("Enter 1 - " + str(len(matches)) + ": ") if not found: print print LOADERR[0] + NL getdat.getinput() return True else: cmd = getdat.getinput(UIQUERY[1]) if cmd in ["y", "Y"]: return True elif cmd in ["n", "N"]: return False