@mgpai: Here is my first try, more the idea, not a working script. Can you help me, to make it work?
Code:
// Write a .txt-file with Download-Link, fileName and the Video-Description.
// Trigger: "A Download Started"
if (link.isStarted () && link.isVideo ()) {
var fileName = link.getName ()
var fileFolder = link.package.getDownloadFolder () + "/" ?
var fileFolderName = fileFolder + fileName + "\.txt"
var downloadLinkAsString = link.name
var text = downloadLinkAsString + "\n"
text = text + fileName + "\n\n"
text = text + link.getComment ()
if (getPath (fileFolderName).exists ())
getPath (fileFolderName).rename (fileFolderName + ".bak")
writeFile (fileFolderName, text, true)
}
Edit 2021-09-30, the Answers from mgpai:
1. Contains link.package.getDownloadFolder () a "/" at the end? --> Answer: No
2. Is link.getComment () the Description on the HTML-Page of the Video?
--> Answer: Returns the contents of the 'comment' field of link property, which is either set automatically by the plugin, or manually by the user.
3. Is "if (link.isStarted ()" sufficient to enable the triger "a download is started for each link that is downloaded"?
--> Answer: Better to use 'stopped' trigger and run script only after link is 'finished'.
4. How can i strip of the ending (e.g. .mp4) of fileName or can we get a function getNameWithoutEnding ()?
--> Answer: Check example in my script.
5. Has the Event-Scripter the functions: isVideo (), isAudio (), isPicture () and isBook () or can we get it for using in Event-Scripter?
--> Answer: Can use 'myDownloadLink.getLinkInfo()' method.