Skip to content

Instantly share code, notes, and snippets.

@HanSooloo
Last active June 26, 2018 09:32
Show Gist options
  • Save HanSooloo/b47be6cd6e4384d0a8ccc592ef421d73 to your computer and use it in GitHub Desktop.
Save HanSooloo/b47be6cd6e4384d0a8ccc592ef421d73 to your computer and use it in GitHub Desktop.
var script = JD_HOME + '/jdownloader-postprocess.sh'
var path = package.getDownloadFolder()
var name = package.getName()
var first_file = package.getDownloadLinks() ? package.getDownloadLinks()[0].getArchive() : "N/A"
var links = package.getDownloadLinks() ? package.getDownloadLinks() : []
var FilePath = getPath(path)
function isReallyFinished() {
for (var i = 0; i < links.length; i++) {
if (links[i].getArchive() != null && links[i].getExtractionStatus() != "SUCCESSFUL" || !package.isFinished()) {
return false
}
}
return true
}
if (isReallyFinished()) {
var command = [script, path, name, first_file, 'PACKAGE_FINISHED']
log(command)
log(callSync(command))
log(package.getDownloadFolder())
log(FilePath)
// log(FilePath.delete())
// log(package.remove())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment