예제 #1
0
    currentTorrent = None
    #figure out which folder to go into:
    pathString = createMovie_dir(searchAr[0])
    try:
        os.mkdir(pathString)
    except:
        pass
    qb.download_from_link(magnetLinks[0],
                          savepath=pathString,
                          category=catgegory_)
    torrents = qb.torrents()

    for i in torrents:
        if catgegory_ == i['category']:
            qb.resume(i['hash'])
    downloading = True
    while downloading:

        tor = qb.torrents(category=catgegory_)
        wait_time = None

        while wait_time == None:
            try:
                wait_time = int(tor[0]['eta']) / 3
            except:
                pass

        t = time.localtime()
        current_time = time.strftime("%H:%M:%S", t)
        radarr.processMovie(path, settings, pathMapping=path_mapping)
    elif settings.qBittorrent['sr'].startswith(label):
        log.info("Passing %s directory to Sickrage." % path)
        autoProcessTVSR.processEpisode(path,
                                       settings,
                                       pathMapping=path_mapping)
    elif settings.qBittorrent['bypass'].startswith(label):
        log.info("Bypassing any further processing as per category.")

    # Run a qbittorrent action after conversion.
    if settings.qBittorrent['actionafter']:
        # currently only support resuming or deleting torrent
        if settings.qBittorrent['actionafter'] == 'resume':
            log.debug("Sending action %s to qBittorrent" %
                      settings.qBittorrent['actionafter'])
            qb.resume(torrent_hash)
        elif settings.qBittorrent['actionafter'] == 'delete':
            # this will delete the torrent from qBittorrent but it WILL NOT delete the data
            log.debug("Sending action %s to qBittorrent" %
                      settings.qBittorrent['actionafter'])
            qb.delete(torrent_hash)
        elif settings.qBittorrent['actionafter'] == 'deletedata':
            # this will delete the torrent from qBittorrent and delete data
            log.debug("Sending action %s to qBittorrent" %
                      settings.qBittorrent['actionafter'])
            qb.delete_permanently(torrent_hash)

    if delete_dir:
        if os.path.exists(delete_dir):
            try:
                os.rmdir(delete_dir)
예제 #3
0
파일: space.py 프로젝트: bonny1992/qbit-ops
log.info("Free space: %s", free_gb)

qb = Client('http{ssl}://{host}:{port}/'.format(host=QBIT_HOST, port=QBIT_PORT, ssl='s' if QBIT_SSL == 'yes' else ''))

qb.login(QBIT_USER, QBIT_PASS)

if free_gb > MIN_SPACE_GB:
    log.info('Starting paused torrents...')
    torrents = qb.torrents(filter='paused')
    no_of_torrents = len(torrents)
    i = 0
    for torrent in torrents:
        if DO_NOT_RESUME_TAG not in torrent['tags']:
            if DRY_RUN != 'yes':
                qb.resume(torrent['hash'])
            log.debug('Torrent name: %s started%s', torrent['name'], ' [SIMULATED]' if DRY_RUN == 'yes' else '')
            i = i + 1
        else:
            log.debug('Torrent name: %s not resumed as tag %s avoids it%s', torrent['name'], DO_NOT_RESUME_TAG, ' [SIMULATED]' if DRY_RUN == 'yes' else '')
    log.info('Started %d of %d torrents.', i, no_of_torrents)
else:
    log.info('Pausing active torrents...')
    torrents = qb.torrents(filter='downloading')
    no_of_torrents = len(torrents)
    i = 0
    for torrent in torrents:
        if torrent['state'] == 'downloading' or torrent['state'] == 'queuedDL' or torrent['state'] == 'stalledDL':
            if DO_NOT_PAUSE_TAG not in torrent['tags']:
                if DRY_RUN != 'yes':
                    qb.pause(torrent['hash'])