add option move-sym to create symlink to renamed files. Fixes #894

This commit is contained in:
clinton-hall 2015-12-15 22:52:01 +10:30
commit 316cc64075
3 changed files with 24 additions and 4 deletions

View file

@ -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):