Quote:
Originally Posted by epikk
... how can an mp3 be saved along with its picture (cover picture) from Soundcloud?
|
Code:
/*
Add cover art
Trigger : Package finished
*/
var links = package.downloadLinks.filter(function(link) {
return link.host == "soundcloud.com" && getPath(link.downloadPath).extension == "mp3";
})
if (links.length) {
var ffmpeg = callAPI("config", "get", "org.jdownloader.controlling.ffmpeg.FFmpegSetup", null, "binarypath");
links.forEach(function(link) {
var cover = getPath(link.downloadPath.replace(/_\d{9}/, "_original_").replace(/mp3$/, "jpg"));
if (cover.exists()) {
var input = link.downloadPath;
var output = input + ".mp3";
callAsync(function(exitCode) {
if (exitCode == 0) {
getPath(input).delete();
getPath(output).renameTo(input);
}
}, ffmpeg, "-hide_banner", "-i", input, "-i", cover, "-map", "0:0", "-map", "1:0", "-c", "copy", output);
}
})
}