mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-06 03:39:51 +01:00
Transmission pp folder name
Get folder name from hash
This commit is contained in:
@@ -53,12 +53,14 @@ def checkFolder():
|
||||
else:
|
||||
download_dir = headphones.CONFIG.DOWNLOAD_TORRENT_DIR
|
||||
|
||||
# Qbittorrent - get folder from torrent hash
|
||||
if album['TorrentHash']:
|
||||
if headphones.CONFIG.TORRENT_DOWNLOADER == 4:
|
||||
# Get folder from torrent hash
|
||||
if album['TorrentHash'] and headphones.CONFIG.TORRENT_DOWNLOADER:
|
||||
if headphones.CONFIG.TORRENT_DOWNLOADER == 1:
|
||||
torrent_folder_name, single = transmission.getFolder(album['TorrentHash'])
|
||||
elif headphones.CONFIG.TORRENT_DOWNLOADER == 4:
|
||||
torrent_folder_name, single = qbittorrent.getFolder(album['TorrentHash'])
|
||||
if torrent_folder_name:
|
||||
folder_name = torrent_folder_name
|
||||
if torrent_folder_name:
|
||||
folder_name = torrent_folder_name
|
||||
|
||||
if folder_name:
|
||||
album_path = os.path.join(download_dir, folder_name).encode(
|
||||
|
||||
@@ -928,11 +928,11 @@ def send_to_downloader(data, bestqual, album):
|
||||
logger.error("Error sending torrent to Transmission. Are you sure it's running?")
|
||||
return
|
||||
|
||||
folder_name = transmission.getTorrentFolder(torrentid)
|
||||
folder_name = transmission.getName(torrentid)
|
||||
if folder_name:
|
||||
logger.info('Torrent folder name: %s' % folder_name)
|
||||
logger.info('Torrent name: %s' % folder_name)
|
||||
else:
|
||||
logger.error('Torrent folder name could not be determined')
|
||||
logger.error('Torrent name could not be determined')
|
||||
return
|
||||
|
||||
# Set Seed Ratio
|
||||
|
||||
@@ -17,6 +17,7 @@ import time
|
||||
import json
|
||||
import base64
|
||||
import urlparse
|
||||
import os
|
||||
|
||||
from headphones import logger, request
|
||||
import headphones
|
||||
@@ -64,7 +65,31 @@ def addTorrent(link, data=None):
|
||||
return False
|
||||
|
||||
|
||||
def getTorrentFolder(torrentid):
|
||||
def getFolder(torrentid):
|
||||
torrent_folder = None
|
||||
single_file = False
|
||||
method = 'torrent-get'
|
||||
arguments = {'ids': torrentid, 'fields': ['files']}
|
||||
|
||||
response = torrentAction(method, arguments)
|
||||
|
||||
try:
|
||||
torrent_files = response['arguments']['torrents'][0]['files']
|
||||
if torrent_files:
|
||||
if len(torrent_files) == 1:
|
||||
torrent_folder = torrent_files[0]['name']
|
||||
single_file = True
|
||||
else:
|
||||
torrent_folder = os.path.split(torrent_files[0]['name'])[0]
|
||||
single_file = False
|
||||
except:
|
||||
torrent_folder = None
|
||||
single_file = False
|
||||
|
||||
return torrent_folder, single_file
|
||||
|
||||
|
||||
def getName(torrentid):
|
||||
method = 'torrent-get'
|
||||
arguments = {'ids': torrentid, 'fields': ['name', 'percentDone']}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user