示例#1
0
文件: views.py 项目: tyage/arupaka
def index(request):
    movies = cache.get("movies")
    if movies is None:
        movies = Movies()
        cache.set("movies", movies, UPDATE_TIME)
    if request.method == "GET":
        dirs = movies.get_filenames()
        extra_context = {"dirs":dirs, "ip":ip, "dirnames":MOVIE_DIRS}
        extra_context.update(get_vlc_status())
        return render(request, "index.html", extra_context)
    elif request.method == "POST":
        keyword = request.POST["keyword"].encode("utf-8")
        dirs = movies.search(keyword)
        return render(request, "search.html", {"dirs":dirs, "dirnames":MOVIE_DIRS})
示例#2
0
文件: views.py 项目: tyage/arupaka
def get_status(request):
    res = json.dumps(get_vlc_status())
    return HttpResponse(res)