def checkTorrentFinished():
    """
    Remove Torrent + data if Post Processed and finished Seeding
    """

    logger.info("Checking if any torrents have finished seeding and can be removed")

    with postprocessor_lock:
        myDB = db.DBConnection()
        results = myDB.select('SELECT * from snatched WHERE Status="Seed_Processed"')

        for album in results:
            hash = album['FolderName']
            albumid = album['AlbumID']
            torrent_removed = False
            if headphones.CONFIG.TORRENT_DOWNLOADER == 1:
                torrent_removed = transmission.removeTorrent(hash, True)
            else:
                torrent_removed = utorrent.removeTorrent(hash, True)

            if torrent_removed:
                myDB.action('DELETE from snatched WHERE status = "Seed_Processed" and AlbumID=?',
                            [albumid])

    logger.info("Checking finished torrents completed")
示例#2
0
def checkTorrentFinished():

    with postprocessor_lock:

        myDB = db.DBConnection()
        results = myDB.select('SELECT * from snatched WHERE Status="Seed_Processed"')

        for album in results:
            hash = album['FolderName']
            albumid = album['AlbumID']
            torrent_removed = False
            if headphones.TORRENT_DOWNLOADER == 1:
                torrent_removed = transmission.removeTorrent(hash, True)
            else:
                torrent_removed = utorrent.removeTorrent(hash, True)

            if torrent_removed:
                myDB.action('DELETE from snatched WHERE status = "Seed_Processed" and AlbumID=?', [albumid])