mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-21 12:19:27 +00:00
Keep original folder
- Added config option for directory to use when keeping folder for seeding - cue processing fixup
This commit is contained in:
@@ -1655,6 +1655,10 @@
|
||||
<label>Cache Directory</label>
|
||||
<input type="text" name="cache_dir" value="${config['cache_dir']}" size="50">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Keep Files For Seeding Directory</label>
|
||||
<input type="text" name="keep_torrent_files_dir" value="${config['keep_torrent_files_dir']}" size="50" title="Enter the directory to preserve files for seeding, default is system temp directory">
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
|
||||
@@ -213,16 +213,27 @@ def verify(albumid, albumpath, Kind=None, forced=False, keep_original_folder=Fal
|
||||
# Split cue before metadata check
|
||||
if headphones.CONFIG.CUE_SPLIT and downloaded_cuecount and downloaded_cuecount >= len(
|
||||
downloaded_track_list):
|
||||
new_folder = None
|
||||
new_albumpath = albumpath
|
||||
if keep_original_folder:
|
||||
keep_original_folder = False
|
||||
albumpath = helpers.preserve_torrent_directory(albumpath)
|
||||
if not albumpath:
|
||||
temp_path = helpers.preserve_torrent_directory(new_albumpath)
|
||||
if not temp_path:
|
||||
markAsUnprocessed(albumid, new_albumpath, keep_original_folder)
|
||||
return
|
||||
Kind = "cue_split"
|
||||
albumpath = helpers.cue_split(albumpath)
|
||||
if not albumpath:
|
||||
else:
|
||||
new_albumpath = temp_path
|
||||
new_folder = os.path.split(new_albumpath)[0]
|
||||
Kind = "cue_split"
|
||||
cuepath = helpers.cue_split(new_albumpath)
|
||||
if not cuepath:
|
||||
if new_folder:
|
||||
shutil.rmtree(new_folder)
|
||||
markAsUnprocessed(albumid, albumpath, keep_original_folder)
|
||||
return
|
||||
downloaded_track_list = helpers.get_downloaded_track_list(albumpath)
|
||||
else:
|
||||
albumpath = cuepath
|
||||
downloaded_track_list = helpers.get_downloaded_track_list(albumpath)
|
||||
keep_original_folder = False
|
||||
|
||||
# test #1: metadata - usually works
|
||||
logger.debug('Verifying metadata...')
|
||||
@@ -309,15 +320,19 @@ def verify(albumid, albumpath, Kind=None, forced=False, keep_original_folder=Fal
|
||||
|
||||
logger.warn(u'Could not identify album: %s. It may not be the intended album.',
|
||||
albumpath.decode(headphones.SYS_ENCODING, 'replace'))
|
||||
markAsUnprocessed(albumid, albumpath, keep_original_folder)
|
||||
|
||||
|
||||
def markAsUnprocessed(albumid, albumpath, keep_original_folder=False):
|
||||
myDB = db.DBConnection()
|
||||
myDB.action(
|
||||
'UPDATE snatched SET status = "Unprocessed" WHERE status NOT LIKE "Seed%" and AlbumID=?',
|
||||
[albumid])
|
||||
'UPDATE snatched SET status = "Unprocessed" WHERE status NOT LIKE "Seed%" and AlbumID=?', [albumid])
|
||||
processed = re.search(r' \(Unprocessed\)(?:\[\d+\])?', albumpath)
|
||||
if not processed:
|
||||
if headphones.CONFIG.RENAME_UNPROCESSED:
|
||||
if headphones.CONFIG.RENAME_UNPROCESSED and not keep_original_folder:
|
||||
renameUnprocessedFolder(albumpath, tag="Unprocessed")
|
||||
else:
|
||||
logger.warn(u"Won't rename %s to mark as 'Unprocessed', because it is disabled.",
|
||||
logger.warn(u"Won't rename %s to mark as 'Unprocessed', because it is disabled or folder is being kept.",
|
||||
albumpath.decode(headphones.SYS_ENCODING, 'replace'))
|
||||
|
||||
|
||||
@@ -328,10 +343,12 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list,
|
||||
|
||||
# Preserve the torrent dir
|
||||
if keep_original_folder:
|
||||
albumpath = helpers.preserve_torrent_directory(albumpath)
|
||||
if not albumpath:
|
||||
temp_path = helpers.preserve_torrent_directory(albumpath)
|
||||
if not temp_path:
|
||||
markAsUnprocessed(albumid, albumpath, keep_original_folder)
|
||||
return
|
||||
else:
|
||||
albumpath = temp_path
|
||||
new_folder = os.path.split(albumpath)[0]
|
||||
elif Kind == "cue_split":
|
||||
new_folder = os.path.split(albumpath)[0]
|
||||
|
||||
@@ -1293,6 +1293,7 @@ class WebInterface(object):
|
||||
"magnet_links_3": radio(headphones.CONFIG.MAGNET_LINKS, 3),
|
||||
"log_dir": headphones.CONFIG.LOG_DIR,
|
||||
"cache_dir": headphones.CONFIG.CACHE_DIR,
|
||||
"keep_torrent_files_dir": headphones.CONFIG.KEEP_TORRENT_FILES_DIR,
|
||||
"interface_list": interface_list,
|
||||
"music_encoder": checked(headphones.CONFIG.MUSIC_ENCODER),
|
||||
"encoder": headphones.CONFIG.ENCODER,
|
||||
|
||||
Reference in New Issue
Block a user