Example script to add album art to mp3 files from soundcloud.com
Code:
// Add album art (if available) to mp3 audiofiles from soundcloud.com
// Trigger : "Package Finished"
// Uses "original thumbnail" from soundcloud for album art
// Software required: metamp3.exe (**External links are only visible to Support Staff**
// Can also be used to add title, url and other metadata to the audio file
var links = package.getDownloadLinks();
for (i = 0; i < links.length; i++) {
var link = links[i];
var host = link.getHost();
var fileType = getPath(link.getDownloadPath()).getExtension();
if (host == "soundcloud.com" && fileType == "mp3") {
var downloadFolder = link.getPackage().getDownloadFolder();
var plainFileName = link.getProperty("plainfilename");
var linkID = link.getProperty("linkid");
var channel = link.getProperty("channel");
var coverFileName = plainFileName + "_original_" + linkID + " - " + channel + ".jpg";
var coverFile = getPath(downloadFolder + "/" + coverFileName);
if (coverFile.exists()) {
var tagger = "c:/portableapps/metamp3.exe"; // Full path to metamp3.exe
var audioFile = link.getDownloadPath();
callSync(tagger, "--pict", "{3}" + coverFile, audioFile);
//coverFile.delete(); // Delete cover file
}
}
}