Beispiel #1
0
def get_view_days(path):
    fs = FolderSorter(path)
    days = fs.get_sorted_list()
    view_days = []
    total = 0
    total_ready = 0
    for day in days:
        view_day = {'total':0}
        view_day['total_ready'] = 0
        view_day['boards'] = []
        for board in day:
            bh = BoardHandler(path + os.sep + board)
            b = {}
            b['image'] = bh.get_preview()
            b['path'] = path + os.sep + board
            view_day['boards'].append(b)
            dur =  bh.get_duration()
            view_day['total'] += dur
            total += dur
            if bh.is_ready(): 
                view_day['total_ready'] += dur
                total_ready += dur
        view_days.append(view_day)

    return view_days, total, total_ready
Beispiel #2
0
def set_status(request):
    if request.POST:
        path = get_ncfolder_path(request.POST['shop'],request.POST['folder'])
        path += os.sep + request.POST['NCName']
        bh = BoardHandler(path)
        if request.POST['NCStatus'] == 'ready':
            bh.set_ready()
        else:
            bh.get_preview(force=True)

    return HttpResponse(json.dumps([]), mimetype='application/json')