Example #1
0
def nzb_su(item, cat=None):
    API = get_setting_value('nzb_su_API')

    if not API:
        logger.log('SEARCH :: NZB.su API missing', 'DEBUG')
        return jsonify({'error': "Missing NZB.su API"})

    nzb = nzbsu(apiKey=API)

    if item is not '':
        if cat:
            logger.log('SEARCH :: NZB.su :: Searching for "%s" in category: %s' % (item, cat), 'INFO')
            result = nzb.Search(query=item, catId=cat)
        else:
            logger.log('SEARCH :: NZB.su :: Searching for "%s" in all categories' % (item), 'INFO')
            result = nzb.Search(item)

        for x in result['channel']['item']:
            x['link'] = urllib.quote(x['link'])

        logger.log('SEARCH :: NZB.su :: Found %i results for %s' % (len(result['channel']['item']), item), 'INFO')

    else:
        result = ''

    return render_template('search-nzbsu.html',
        site='nzb.su',
        results=result['channel']['item'],
        item=item,
        categories=cat_newznab,
    )
Example #2
0
def nzb_su(item, cat = None):
    API = get_setting_value('nzb_su_API')

    if not API:
        return jsonify ({'error': "Missing NZB.su API"})

    nzb = nzbsu(apiKey=API)

    if item is not '':
        if cat:
            result = nzb.Search(query = item, catId = cat)
        else:
            result = nzb.Search(item)

        for x in result:
            x['link'] = 'nzb.su/api?t=get&id='+x['guid']

    else:
        result = ''

    return render_template('search-nzbsu.html',
        site = 'nzb.su',
        results = result,
        item = item,
        categories = cat_newznab,
    )
Example #3
0
def nzb_su(item, cat=None, mobile=False):
    API = get_setting_value('nzb_su_API')

    if not API:
        logger.log('SEARCH :: NZB.su API missing', 'DEBUG')
        return jsonify({'error': "Missing NZB.su API"})

    nzb = nzbsu(apiKey=API)

    if item is not '':
        if cat:
            logger.log(
                'SEARCH :: NZB.su :: Searching for "%s" in category: %s' %
                (item, cat), 'INFO')
            result = nzb.Search(query=item, catId=cat)
        else:
            logger.log(
                'SEARCH :: NZB.su :: Searching for "%s" in all categories' %
                (item), 'INFO')
            result = nzb.Search(item)

        for x in result['channel']['item']:
            x['link'] = urllib.quote(x['link'])

        logger.log(
            'SEARCH :: NZB.su :: Found %i results for %s' %
            (len(result['channel']['item']), item), 'INFO')

    else:
        result = ''

    if mobile:
        return result

    return render_template(
        'search-nzbsu.html',
        site='nzb.su',
        results=result['channel']['item'],
        item=item,
        categories=cat_newznab,
    )