Esempio n. 1
0
def serialize_queue(queue):
    timeToStart = 0
    items = []
    current = queue[0]
    for q in queue:
        item = {
            "id": q.id,
            "url": q.what.url,
            "username": q.who,
            "index": q.index,
            "timeToStart": timeToStart
        }
        if q.what.got_metadata and timeToStart != None:
            timeToStart += q.what.trackLength
            if q == current and player.elapsed():
                timeToStart -= player.elapsed()
        else:
            timeToStart = None
        items.append(item)
    return items
Esempio n. 2
0
def serialize_queue(queue):
    timeToStart = 0
    items = []
    current = queue[0]
    for q in queue:
        item = {
            "id": q.id,
            "url": q.what.url,
            "username": q.who,
            "index": q.index,
            "timeToStart": timeToStart
        }
        if q.what.got_metadata and timeToStart != None:
            timeToStart += q.what.trackLength
            if q == current and player.elapsed():
                timeToStart -= player.elapsed()
        else:
            timeToStart = None
        items.append(item)
    return items
Esempio n. 3
0
def status_info(request):
    items, itemsMeta = get_items()
    first = (items[0], itemsMeta[0])
    return {
        "status": get_state(),
        "entry":first[0],
        "info": first[1],
        "queue": items[1:],
        "queueInfo": itemsMeta[1:],
        "paused": player.status != Status.playing,
        "elapsedTime": player.elapsed(),
        "downloads": [x.url for x in downloader.downloads()]
    }
Esempio n. 4
0
def status_info(request):
    items, itemsMeta = get_items()
    first = (items[0], itemsMeta[0])
    return {
        "status": get_state(),
        "entry": first[0],
        "info": first[1],
        "queue": items[1:],
        "queueInfo": itemsMeta[1:],
        "paused": player.status != Status.playing,
        "elapsedTime": player.elapsed(),
        "downloads": [x.url for x in downloader.downloads()]
    }