diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index 9413d587..0d78a53b 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -507,6 +507,11 @@ +
+ + + Set this to where your download client puts its completed downloads in +
diff --git a/headphones/__init__.py b/headphones/__init__.py index 94eeb545..fcd7af90 100644 --- a/headphones/__init__.py +++ b/headphones/__init__.py @@ -92,6 +92,7 @@ CHECK_GITHUB = False CHECK_GITHUB_ON_STARTUP = False CHECK_GITHUB_INTERVAL = None +POST_PROCESSING_DIR = None MUSIC_DIR = None DESTINATION_DIR = None LOSSLESS_DESTINATION_DIR = None @@ -327,7 +328,7 @@ def initialize(): NZBGET_USERNAME, NZBGET_PASSWORD, NZBGET_CATEGORY, NZBGET_HOST, HEADPHONES_INDEXER, NZBMATRIX, TRANSMISSION_HOST, TRANSMISSION_USERNAME, TRANSMISSION_PASSWORD, \ UTORRENT_HOST, UTORRENT_USERNAME, UTORRENT_PASSWORD, NEWZNAB, NEWZNAB_HOST, NEWZNAB_APIKEY, NEWZNAB_ENABLED, EXTRA_NEWZNABS, \ NZBSORG, NZBSORG_UID, NZBSORG_HASH, NZBSRUS, NZBSRUS_UID, NZBSRUS_APIKEY, OMGWTFNZBS, OMGWTFNZBS_UID, OMGWTFNZBS_APIKEY, \ - NZB_DOWNLOADER, TORRENT_DOWNLOADER, PREFERRED_WORDS, REQUIRED_WORDS, IGNORED_WORDS, LASTFM_USERNAME, \ + NZB_DOWNLOADER, TORRENT_DOWNLOADER, PREFERRED_WORDS, REQUIRED_WORDS, IGNORED_WORDS, LASTFM_USERNAME, \ INTERFACE, FOLDER_PERMISSIONS, FILE_PERMISSIONS, ENCODERFOLDER, ENCODER_PATH, ENCODER, XLDPROFILE, BITRATE, SAMPLINGFREQUENCY, \ MUSIC_ENCODER, ADVANCEDENCODER, ENCODEROUTPUTFORMAT, ENCODERQUALITY, ENCODERVBRCBR, ENCODERLOSSLESS, DELETE_LOSSLESS_FILES, \ PROWL_ENABLED, PROWL_PRIORITY, PROWL_KEYS, PROWL_ONSNATCH, PUSHOVER_ENABLED, PUSHOVER_PRIORITY, PUSHOVER_KEYS, PUSHOVER_ONSNATCH, MIRRORLIST, \ @@ -335,11 +336,9 @@ def initialize(): MIRROR, CUSTOMHOST, CUSTOMPORT, CUSTOMSLEEP, HPUSER, HPPASS, XBMC_ENABLED, XBMC_HOST, XBMC_USERNAME, XBMC_PASSWORD, XBMC_UPDATE, \ XBMC_NOTIFY, NMA_ENABLED, NMA_APIKEY, NMA_PRIORITY, NMA_ONSNATCH, SYNOINDEX_ENABLED, ALBUM_COMPLETION_PCT, PREFERRED_BITRATE_HIGH_BUFFER, \ PREFERRED_BITRATE_LOW_BUFFER, PREFERRED_BITRATE_ALLOW_LOSSLESS, CACHE_SIZEMB, JOURNAL_MODE, UMASK, ENABLE_HTTPS, HTTPS_CERT, HTTPS_KEY, \ -<<<<<<< HEAD - PLEX_ENABLED, PLEX_SERVER_HOST, PLEX_CLIENT_HOST, PLEX_USERNAME, PLEX_PASSWORD, PLEX_UPDATE, PLEX_NOTIFY -======= - PUSHALOT_ENABLED, PUSHALOT_APIKEY, PUSHALOT_ONSNATCH ->>>>>>> echel0n/pushalot + PLEX_ENABLED, PLEX_SERVER_HOST, PLEX_CLIENT_HOST, PLEX_USERNAME, PLEX_PASSWORD, PLEX_UPDATE, PLEX_NOTIFY, PUSHALOT_ENABLED, PUSHALOT_APIKEY, PUSHALOT_ONSNATCH, \ + POST_PROCESSING_DIR + if __INITIALIZED__: return False @@ -400,6 +399,7 @@ def initialize(): CHECK_GITHUB_ON_STARTUP = bool(check_setting_int(CFG, 'General', 'check_github_on_startup', 1)) CHECK_GITHUB_INTERVAL = check_setting_int(CFG, 'General', 'check_github_interval', 360) + POST_PROCESSING_DIR = check_setting_str(CFG, 'General', 'post_processing_dir', '') MUSIC_DIR = check_setting_str(CFG, 'General', 'music_dir', '') DESTINATION_DIR = check_setting_str(CFG, 'General', 'destination_dir', '') LOSSLESS_DESTINATION_DIR = check_setting_str(CFG, 'General', 'lossless_destination_dir', '') @@ -539,13 +539,13 @@ def initialize(): XBMC_UPDATE = bool(check_setting_int(CFG, 'XBMC', 'xbmc_update', 0)) XBMC_NOTIFY = bool(check_setting_int(CFG, 'XBMC', 'xbmc_notify', 0)) - PLEX_ENABLED = bool(check_setting_int(CFG, 'Plex', 'plex_enabled', 0)) - PLEX_SERVER_HOST = check_setting_str(CFG, 'Plex', 'plex_server_host', '') - PLEX_CLIENT_HOST = check_setting_str(CFG, 'Plex', 'plex_client_host', '') + PLEX_ENABLED = bool(check_setting_int(CFG, 'Plex', 'plex_enabled', 0)) + PLEX_SERVER_HOST = check_setting_str(CFG, 'Plex', 'plex_server_host', '') + PLEX_CLIENT_HOST = check_setting_str(CFG, 'Plex', 'plex_client_host', '') PLEX_USERNAME = check_setting_str(CFG, 'Plex', 'plex_username', '') PLEX_PASSWORD = check_setting_str(CFG, 'Plex', 'plex_password', '') - PLEX_UPDATE = bool(check_setting_int(CFG, 'Plex', 'plex_update', 0)) - PLEX_NOTIFY = bool(check_setting_int(CFG, 'Plex', 'plex_notify', 0)) + PLEX_UPDATE = bool(check_setting_int(CFG, 'Plex', 'plex_update', 0)) + PLEX_NOTIFY = bool(check_setting_int(CFG, 'Plex', 'plex_notify', 0)) NMA_ENABLED = bool(check_setting_int(CFG, 'NMA', 'nma_enabled', 0)) NMA_APIKEY = check_setting_str(CFG, 'NMA', 'nma_apikey', '') @@ -788,6 +788,7 @@ def config_write(): new_config['General']['check_github_on_startup'] = int(CHECK_GITHUB_ON_STARTUP) new_config['General']['check_github_interval'] = CHECK_GITHUB_INTERVAL + new_config['General']['post_processing_dir'] = POST_PROCESSING_DIR new_config['General']['music_dir'] = MUSIC_DIR new_config['General']['destination_dir'] = DESTINATION_DIR new_config['General']['lossless_destination_dir'] = LOSSLESS_DESTINATION_DIR diff --git a/headphones/postprocessor.py b/headphones/postprocessor.py index d9ada20e..6261b0db 100644 --- a/headphones/postprocessor.py +++ b/headphones/postprocessor.py @@ -55,7 +55,7 @@ def checkFolder(): for nzb_folder_name in nzb_album_possibilities: - nzb_album_path = os.path.join(headphones.DOWNLOAD_DIR, nzb_folder_name).encode(headphones.SYS_ENCODING, 'replace') + nzb_album_path = os.path.join(headphones.POST_PROCESSING_DIR, nzb_folder_name).encode(headphones.SYS_ENCODING, 'replace') if os.path.exists(nzb_album_path): logger.debug('Found %s in NZB download folder. Verifying....' % album['FolderName']) @@ -63,7 +63,7 @@ def checkFolder(): if album['Kind'] == 'torrent': - torrent_album_path = os.path.join(headphones.DOWNLOAD_TORRENT_DIR, album['FolderName']).encode(headphones.SYS_ENCODING,'replace') + torrent_album_path = os.path.join(headphones.POST_PROCESSING_DIR, album['FolderName']).encode(headphones.SYS_ENCODING,'replace') if os.path.exists(torrent_album_path): logger.debug('Found %s in torrent download folder. Verifying....' % album['FolderName']) @@ -915,15 +915,10 @@ def renameUnprocessedFolder(albumpath): def forcePostProcess(): download_dirs = [] - if headphones.DOWNLOAD_DIR: - download_dirs.append(headphones.DOWNLOAD_DIR.encode(headphones.SYS_ENCODING, 'replace')) - if headphones.DOWNLOAD_TORRENT_DIR: - download_dirs.append(headphones.DOWNLOAD_TORRENT_DIR.encode(headphones.SYS_ENCODING, 'replace')) + if headphones.POST_PROCESSING_DIR: + download_dirs.append(headphones.POST_PROCESSING_DIR.encode(headphones.SYS_ENCODING, 'replace')) - # If DOWNLOAD_DIR and DOWNLOAD_TORRENT_DIR are the same, remove the duplicate to prevent us from trying to process the same folder twice. - download_dirs = list(set(download_dirs)) - - logger.info('Checking to see if there are any folders to process in download_dir(s): %s' % str(download_dirs).decode(headphones.SYS_ENCODING, 'replace')) + logger.info('Checking to see if there are any folders to process in: %s' % str(download_dirs).decode(headphones.SYS_ENCODING, 'replace')) # Get a list of folders in the download_dir folders = [] for download_dir in download_dirs: diff --git a/headphones/webserve.py b/headphones/webserve.py index 7d5277e4..6c5161da 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -963,7 +963,8 @@ class WebInterface(object): "hppass": headphones.HPPASS, "cache_sizemb": headphones.CACHE_SIZEMB, "file_permissions": headphones.FILE_PERMISSIONS, - "folder_permissions": headphones.FOLDER_PERMISSIONS + "folder_permissions": headphones.FOLDER_PERMISSIONS, + "post_processing_dir" : headphones.POST_PROCESSING_DIR } # Need to convert EXTRAS to a dictionary we can pass to the config: it'll come in as a string like 2,5,6,8 @@ -999,7 +1000,7 @@ class WebInterface(object): pushover_enabled=0, pushover_onsnatch=0, pushover_keys=None, pushover_priority=0, twitter_enabled=0, twitter_onsnatch=0, mirror=None, customhost=None, customport=None, customsleep=None, hpuser=None, hppass=None, preferred_bitrate_high_buffer=None, preferred_bitrate_low_buffer=None, preferred_bitrate_allow_lossless=0, cache_sizemb=None, enable_https=0, https_cert=None, https_key=None, file_permissions=None, folder_permissions=None, plex_enabled=0, plex_server_host=None, plex_client_host=None, plex_username=None, - plex_password=None, plex_update=0, plex_notify=0, **kwargs): + plex_password=None, plex_update=0, plex_notify=0, post_processing_dir=None, **kwargs): headphones.HTTP_HOST = http_host headphones.HTTP_PORT = http_port @@ -1148,6 +1149,7 @@ class WebInterface(object): headphones.CACHE_SIZEMB = int(cache_sizemb) headphones.FILE_PERMISSIONS = file_permissions headphones.FOLDER_PERMISSIONS = folder_permissions + headphones.POST_PROCESSING_DIR = post_processing_dir # Handle the variable config options. Note - keys with False values aren't getting passed