def fuzzygen(): popen('cd "{0}";find . -name "*.mp3" > {1}'.format( Tool.get('music_folder'), Tool.get('music_database'), ))
# coding: utf-8 from flask import Flask, render_template, send_from_directory from os.path import isdir, isfile from os import listdir from tools import Tool from fuzzywuzzy import process app = Flask(__name__) tool = Tool() # Initilize search engine fuzzy_choices = [] fuzzy_choices_lower = [] ko = 0 match_search = tool.get('use_match') music_db = tool.get('music_database') if isfile(music_db): with open(tool.get('music_database')) as f: for line in f: try: entry = line.strip().decode('utf-8') fuzzy_choices.append(entry) # put computed lower string in cache if match_search: fuzzy_choices_lower.append(entry.lower()) except Exception as decodeError: ko += 0 if ko: tool.debug(ko, 'files could not be add to the seach engine') search_limit = tool.get('search_limit')