Example #1
0
def sabnzbd_history_item(id):
    global sabnzbd_history_slots
    if sabnzbd_history_slots:
        for item in sabnzbd_history_slots['slots']:
            if item['nzo_id'] == id:
                return render_template(
                    'mobile/sabnzbd/history_item.html',
                    item=item,
                )

        return sabnzbd_history()
    else:
        try:
            sabnzbd = sabnzbd_api(method='history', params='&limit=50')
            sabnzbd = sabnzbd_history_slots = sabnzbd['history']

            for item in sabnzbd_history_slots['slots']:
                if item['nzo_id'] == id:
                    return render_template(
                        'mobile/sabnzbd/history_item.html',
                        item=item,
                    )
        except Exception as e:
            logger.log(
                'Mobile :: SabNZBd+ :: Could not retrieve SabNZBd - %s]' % (e),
                'WARNING')
            sabnzbd = None

        return render_template(
            'mobile/sabnzbd/history.html',
            history=sabnzbd,
        )
Example #2
0
def sabnzbd_history_item(id):
    global sabnzbd_history_slots
    if sabnzbd_history_slots:
        for item in sabnzbd_history_slots['slots']:
            if item['nzo_id'] == id:
                return render_template('mobile/sabnzbd/history_item.html',
                    item=item,
                )

        return sabnzbd_history()
    else:
        try:
            sabnzbd = sabnzbd_api(method='history', params='&limit=50')
            sabnzbd = sabnzbd_history_slots = sabnzbd['history']

            for item in sabnzbd_history_slots['slots']:
                if item['nzo_id'] == id:
                    return render_template('mobile/sabnzbd/history_item.html',
                        item=item,
                    )
        except Exception as e:
            logger.log('Mobile :: SabNZBd+ :: Could not retrieve SabNZBd - %s]' % (e), 'WARNING')
            sabnzbd = None

        return render_template('mobile/sabnzbd/history.html',
            history=sabnzbd,
        )
Example #3
0
def sabnzbd_history():
    global sabnzbd_history_slots
    try:
        sabnzbd = sabnzbd_api(method='history', params='&limit=50')
        sabnzbd = sabnzbd_history_slots = sabnzbd['history']

    except Exception as e:
        logger.log('Mobile :: SabNZBd+ :: Could not retrieve SabNZBd - %s]' % (e), 'WARNING')
        sabnzbd = None

    return render_template('mobile/sabnzbd/history.html',
        history=sabnzbd,
    )
Example #4
0
def sabnzbd_history():
    global sabnzbd_history_slots
    try:
        sabnzbd = sabnzbd_api(method='history', params='&limit=50')
        sabnzbd = sabnzbd_history_slots = sabnzbd['history']

    except Exception as e:
        logger.log('Mobile :: SabNZBd+ :: Could not retrieve SabNZBd - %s]' % (e), 'WARNING')
        sabnzbd = None

    return render_template('mobile/sabnzbd/history.html',
        history=sabnzbd,
    )
Example #5
0
def sabnzbd_queue_item(id):
    try:
        sab = sabnzbd_api(method='queue')
        sab = sab['queue']

        for item in sab['slots']:
            if item['nzo_id'] == id:
                return render_template('mobile/sabnzbd/queue_item.html',
                    item=item,
                )
    except Exception as e:
        logger.log('Mobile :: SabNZBd+ :: Could not retrieve SabNZBd - %s]' % (e), 'WARNING')

    return sabnzbd()
Example #6
0
def sabnzbd_queue_item(id):
    try:
        sab = sabnzbd_api(method='queue')
        sab = sab['queue']

        for item in sab['slots']:
            if item['nzo_id'] == id:
                return render_template('mobile/sabnzbd/queue_item.html',
                    item=item,
                )
    except Exception as e:
        logger.log('Mobile :: SabNZBd+ :: Could not retrieve SabNZBd - %s]' % (e), 'WARNING')

    return sabnzbd()
Example #7
0
def sabnzbd():
    try:
        sabnzbd = sabnzbd_api(method='queue')
        sabnzbd = sabnzbd['queue']
        download_speed = format_number(int((sabnzbd['kbpersec'])[:-3]) * 1024) + '/s'
        if sabnzbd['speedlimit']:
            sabnzbd['speedlimit'] = format_number(int((sabnzbd['speedlimit'])) * 1024) + '/s'

    except Exception as e:
        logger.log('Mobile :: SabNZBd+ :: Could not retrieve SabNZBd - %s]' % (e), 'WARNING')
        sabnzbd = None

    return render_template('mobile/sabnzbd/sabnzbd.html',
        queue=sabnzbd,
        download_speed=download_speed,
    )
Example #8
0
def sabnzbd():
    try:
        sabnzbd = sabnzbd_api(method='queue')
        sabnzbd = sabnzbd['queue']
        download_speed = format_number(int((sabnzbd['kbpersec'])[:-3]) * 1024) + '/s'
        if sabnzbd['speedlimit']:
            sabnzbd['speedlimit'] = format_number(int((sabnzbd['speedlimit'])) * 1024) + '/s'

    except Exception as e:
        logger.log('Mobile :: SabNZBd+ :: Could not retrieve SabNZBd - %s]' % (e), 'WARNING')
        sabnzbd = None

    return render_template('mobile/sabnzbd/sabnzbd.html',
        queue=sabnzbd,
        download_speed=download_speed,
    )