mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 18:47:09 -07:00
add option move-sym to create symlink to renamed files. Fixes #894
This commit is contained in:
parent
a121cb6baf
commit
316cc64075
3 changed files with 24 additions and 4 deletions
|
@ -232,10 +232,13 @@ def copy_link(src, targetLink, useLink):
|
|||
return True
|
||||
elif useLink == "sym":
|
||||
logger.info("Sym linking SOURCE MEDIAFILE -> TARGET FOLDER", 'COPYLINK')
|
||||
#shutil.move(src, targetLink)
|
||||
#linktastic.symlink(targetLink, src)
|
||||
linktastic.symlink(src, targetLink)
|
||||
return True
|
||||
elif useLink == "move-sym":
|
||||
logger.info("Sym linking SOURCE MEDIAFILE -> TARGET FOLDER", 'COPYLINK')
|
||||
shutil.move(src, targetLink)
|
||||
linktastic.symlink(targetLink, src)
|
||||
return True
|
||||
elif useLink == "move":
|
||||
logger.info("Moving SOURCE MEDIAFILE -> TARGET FOLDER", 'COPYLINK')
|
||||
shutil.move(src, targetLink)
|
||||
|
@ -248,6 +251,19 @@ def copy_link(src, targetLink, useLink):
|
|||
|
||||
return True
|
||||
|
||||
def replace_links(link):
|
||||
if not os.path.islink(link):
|
||||
return
|
||||
target = link
|
||||
n = 0
|
||||
while os.path.islink(target):
|
||||
target = os.readlink(target)
|
||||
n = n + 1
|
||||
if n > 1:
|
||||
logger.info("Changing sym-link: %s to point directly to file: %s" % (link, target), 'COPYLINK')
|
||||
os.unlink(link)
|
||||
linktastic.symlink(target, link)
|
||||
|
||||
def flatten(outputDestination):
|
||||
logger.info("FLATTEN: Flattening directory: %s" % (outputDestination))
|
||||
for outputFile in listMediaFiles(outputDestination):
|
||||
|
@ -782,7 +798,7 @@ def remove_torrent(clientAgent, inputHash, inputID, inputName):
|
|||
time.sleep(5)
|
||||
except:
|
||||
logger.warning("Failed to delete torrent %s in %s" % (inputName, clientAgent))
|
||||
else:
|
||||
else:
|
||||
resume_torrent(clientAgent, inputHash, inputID, inputName)
|
||||
|
||||
def find_download(clientAgent, download_id):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue