- The script will write the tag to a new file with the same name, which will be created in 'jd\tmp' folder.
- If the tag is added successfully, the orignal file will be deleted and replaced with the temp file.
- 'youtube.com' is excluded, since JD adds the metadata to that host by default.
- Currently the script only processes 'mp4' files. Other filetypes which support the 'comment' tag can be whitelisted in the script.
- Periodically, check the 'jd\tmp' folder for any temp files which may have not be copied/deleted by the script and left behind.
- Please use the comment section below for feedback/queries.
-
-
Save mgpai/333320d234485272ce9a28780c08081a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
add metadata to media files | |
trigger : a download finished | |
*/ | |
var hosts = ["youtubee.com"]; //exclude hosts | |
var exts = ["mp4"]; //include filetypes | |
var ext = link.name.split(".").reverse()[0]; | |
if ( | |
link.finished && | |
hosts.indexOf(hosts) == -1 && | |
exts.indexOf(ext) > -1 | |
) { | |
var url = link.contentURL; | |
var input = getPath(link.downloadPath); | |
var output = getPath(JD_HOME + "/tmp/" + link.name); | |
var ffmpeg = callAPI("config", "get", "org.jdownloader.controlling.ffmpeg.FFmpegSetup", null, "BinaryPath"); | |
callAsync(function(n) { | |
if (n === 0) { | |
input.delete(); | |
output.moveTo(link.package.downloadFolder); | |
} else { | |
output.delete(); | |
} | |
}, ffmpeg, "-i", input, "-metadata", "comment=" + url, "-codec", "copy", output); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment