@mod.route('/subtitles')
def find_subtitles():
    rel_path = request.args.get('src')[len(current_app.config["MOVIES_URL"])+1:]
    json = cache.get(rel_path)
    if json == None:
        path = os.path.join(
                current_app.config['MOVIES_DIR'],
                urllib.unquote(rel_path).decode('utf8')
            )

        subtitles = []
        results = os_search(path)
        try:
            for sub in results:
                if sub['SubFormat'] == 'srt':
                    subtitles.append({
                        'url': sub['SubDownloadLink'],
                        'language': sub['LanguageName'],
                        'name': sub['MovieName']
                    })
        except __HOLE__:
            pass
        json = jsonify(
            subtitles=subtitles
        )
        cache.set(rel_path, json, timeout=7 * 24 * 60 * 60)
    return json
dataset/ETHPy150Open rangermeier/flaskberry/flaskberry/views/movies/routes.py/find_subtitles