mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-20 16:03:59 +01: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>
|
<label>Cache Directory</label>
|
||||||
<input type="text" name="cache_dir" value="${config['cache_dir']}" size="50">
|
<input type="text" name="cache_dir" value="${config['cache_dir']}" size="50">
|
||||||
</div>
|
</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>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
|||||||
+30
-13
@@ -213,16 +213,27 @@ def verify(albumid, albumpath, Kind=None, forced=False, keep_original_folder=Fal
|
|||||||
# Split cue before metadata check
|
# Split cue before metadata check
|
||||||
if headphones.CONFIG.CUE_SPLIT and downloaded_cuecount and downloaded_cuecount >= len(
|
if headphones.CONFIG.CUE_SPLIT and downloaded_cuecount and downloaded_cuecount >= len(
|
||||||
downloaded_track_list):
|
downloaded_track_list):
|
||||||
|
new_folder = None
|
||||||
|
new_albumpath = albumpath
|
||||||
if keep_original_folder:
|
if keep_original_folder:
|
||||||
keep_original_folder = False
|
temp_path = helpers.preserve_torrent_directory(new_albumpath)
|
||||||
albumpath = helpers.preserve_torrent_directory(albumpath)
|
if not temp_path:
|
||||||
if not albumpath:
|
markAsUnprocessed(albumid, new_albumpath, keep_original_folder)
|
||||||
return
|
return
|
||||||
Kind = "cue_split"
|
else:
|
||||||
albumpath = helpers.cue_split(albumpath)
|
new_albumpath = temp_path
|
||||||
if not albumpath:
|
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
|
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
|
# test #1: metadata - usually works
|
||||||
logger.debug('Verifying metadata...')
|
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.',
|
logger.warn(u'Could not identify album: %s. It may not be the intended album.',
|
||||||
albumpath.decode(headphones.SYS_ENCODING, 'replace'))
|
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(
|
myDB.action(
|
||||||
'UPDATE snatched SET status = "Unprocessed" WHERE status NOT LIKE "Seed%" and AlbumID=?',
|
'UPDATE snatched SET status = "Unprocessed" WHERE status NOT LIKE "Seed%" and AlbumID=?', [albumid])
|
||||||
[albumid])
|
|
||||||
processed = re.search(r' \(Unprocessed\)(?:\[\d+\])?', albumpath)
|
processed = re.search(r' \(Unprocessed\)(?:\[\d+\])?', albumpath)
|
||||||
if not processed:
|
if not processed:
|
||||||
if headphones.CONFIG.RENAME_UNPROCESSED:
|
if headphones.CONFIG.RENAME_UNPROCESSED and not keep_original_folder:
|
||||||
renameUnprocessedFolder(albumpath, tag="Unprocessed")
|
renameUnprocessedFolder(albumpath, tag="Unprocessed")
|
||||||
else:
|
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'))
|
albumpath.decode(headphones.SYS_ENCODING, 'replace'))
|
||||||
|
|
||||||
|
|
||||||
@@ -328,10 +343,12 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list,
|
|||||||
|
|
||||||
# Preserve the torrent dir
|
# Preserve the torrent dir
|
||||||
if keep_original_folder:
|
if keep_original_folder:
|
||||||
albumpath = helpers.preserve_torrent_directory(albumpath)
|
temp_path = helpers.preserve_torrent_directory(albumpath)
|
||||||
if not albumpath:
|
if not temp_path:
|
||||||
|
markAsUnprocessed(albumid, albumpath, keep_original_folder)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
albumpath = temp_path
|
||||||
new_folder = os.path.split(albumpath)[0]
|
new_folder = os.path.split(albumpath)[0]
|
||||||
elif Kind == "cue_split":
|
elif Kind == "cue_split":
|
||||||
new_folder = os.path.split(albumpath)[0]
|
new_folder = os.path.split(albumpath)[0]
|
||||||
|
|||||||
@@ -1293,6 +1293,7 @@ class WebInterface(object):
|
|||||||
"magnet_links_3": radio(headphones.CONFIG.MAGNET_LINKS, 3),
|
"magnet_links_3": radio(headphones.CONFIG.MAGNET_LINKS, 3),
|
||||||
"log_dir": headphones.CONFIG.LOG_DIR,
|
"log_dir": headphones.CONFIG.LOG_DIR,
|
||||||
"cache_dir": headphones.CONFIG.CACHE_DIR,
|
"cache_dir": headphones.CONFIG.CACHE_DIR,
|
||||||
|
"keep_torrent_files_dir": headphones.CONFIG.KEEP_TORRENT_FILES_DIR,
|
||||||
"interface_list": interface_list,
|
"interface_list": interface_list,
|
||||||
"music_encoder": checked(headphones.CONFIG.MUSIC_ENCODER),
|
"music_encoder": checked(headphones.CONFIG.MUSIC_ENCODER),
|
||||||
"encoder": headphones.CONFIG.ENCODER,
|
"encoder": headphones.CONFIG.ENCODER,
|
||||||
|
|||||||
Reference in New Issue
Block a user