JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #221  
Old 19.10.2017, 00:07
fred_gaou's Avatar
fred_gaou fred_gaou is offline
DSL User
 
Join Date: Mar 2016
Location: France
Posts: 39
Default

Quote:
Originally Posted by Jiaz View Post
I'm sorry but I don't understand. I've just checked 'Package Finished','Packagizer Hook' and methods of package/link are listed above. See FilePackage and PackagizerLink Section
Don't worry, my script is ready with interval trigger and the algorithm you pointed. Just waiting next core update to deeply test it with getFinishedDate().
Reply With Quote
  #222  
Old 19.10.2017, 09:34
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,232
Default

Update got released yesterday
__________________
JD-Dev & Server-Admin
Reply With Quote
  #223  
Old 19.10.2017, 20:04
fred_gaou's Avatar
fred_gaou fred_gaou is offline
DSL User
 
Join Date: Mar 2016
Location: France
Posts: 39
Default

Quote:
Originally Posted by Jiaz View Post
isFinished is no bug. Disabled Links are not counted! Links must be enabled and in finished state.
Well package.isFinished() returns true even if there are disable links whereas link.isFinished() returns false for disable links. There is some inconsistency for me. package.isFinished() should return false if it contains unfinished links, disabled or not. This is how the isFinished term is intuitively understood by the script programmer.
Reply With Quote
  #224  
Old 19.10.2017, 20:12
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,232
Default

For links the internal state is checked. But for packages only enabled links are checked. For example via packagizer/manual disabled mirror links in case they are needed later. In that case package would never finish.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #225  
Old 22.10.2017, 22:09
fred_gaou's Avatar
fred_gaou fred_gaou is offline
DSL User
 
Join Date: Mar 2016
Location: France
Posts: 39
Lightbulb Scripts list

Hey,

What about creating a introducing post in this thread that would only contains:
  • links to posts or threads that offer scripts
  • their short description


This thread growing up, it contains now more help, requests and support, etc. than actually scripts. I supposed this thread must be currently overwhelming for new comers that want list of available scripts.
Reply With Quote
  #226  
Old 23.10.2017, 09:38
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,232
Default

Good idea But I don't have time to do this, so anyone is welcome to create such a post and keep it updated. I will make it sticky then.
@mgpai
@fred_gaou
Help is welcome
__________________
JD-Dev & Server-Admin
Reply With Quote
  #227  
Old 24.10.2017, 19:00
fred_gaou's Avatar
fred_gaou fred_gaou is offline
DSL User
 
Join Date: Mar 2016
Location: France
Posts: 39
Question ES6 support

Could we hope to have ES6 features in our JS script?

Controlling variable scope is so much easier and cleaner with it as just an example.
Reply With Quote
  #228  
Old 24.10.2017, 19:28
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,232
Default

@fred_gaou: I don't think so. The used javascript interpreter does only support very limited subset of features.
mozilla.github.io/rhino/compat/engines.html
If you need such advanced features, I think it would be simplier to use Eventscripter to call an external javascript interpreter that supports more javascript features.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #229  
Old 30.10.2017, 23:32
fred_gaou's Avatar
fred_gaou fred_gaou is offline
DSL User
 
Join Date: Mar 2016
Location: France
Posts: 39
Default

How about adding a button|link in JD settings/scripts toward this thread for user to see all available scripts?
Reply With Quote
  #230  
Old 31.10.2017, 01:27
fred_gaou's Avatar
fred_gaou fred_gaou is offline
DSL User
 
Join Date: Mar 2016
Location: France
Posts: 39
Lightbulb Clean up and log finished packages: script link

Hi,

I released my script you can find at some post before this one in this thread.

Here is the direct link:
Code:
board.jdownloader.org/showpost.php?p=410187&postcount=210
Later this week, I will create a welcome post for this thread that will content all the links to each script published here with a description. But I will need to have the right to post link or that an admin point me the right way to do it. I could write a draft and send it to an admin so he'll just have to post it, right?
Reply With Quote
  #231  
Old 02.11.2017, 10:51
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,232
Default

@fred_gaou: You can post links that link to our board. Those are whitelisted.
Thanks for your contribution. Once such a *index* post exists, we can easily link it in eventscripter, great idea!
__________________
JD-Dev & Server-Admin
Reply With Quote
  #232  
Old 06.11.2017, 13:42
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,528
Default Save Link URLs

Code:
// Save Link URLs
// Files will be created in default (Global) download folder
// Trigger Required: A Download Stopped

if (link.isFinished()) {
    var data = "<details><summary>" + link.getName() + "</summary><table>";

    var urls = {
        "Content": link.getContentURL(),
        "Container": link.getContainerURL(),
        "Origin": link.getOriginURL(),
        "Referrer": link.getReferrerURL()
    };

    for (x in urls) {
        if (urls[x]) data += "<tr><td>" + x + "</td><td> : <a href=\"" + urls[x] + "\">" + urls[x] + "</a></td></tr>";
    }

    data += "</table></details>";

    var folder = callAPI("config", "get", "org.jdownloader.settings.GeneralSettings", null, "DefaultDownloadFolder");
    var date = new Date().toDateString().substr(4);
    var file = folder + "/" + date + ".htm";

    writeFile(file, data, true);
}
Reply With Quote
  #233  
Old 10.11.2017, 15:52
animus animus is offline
Ultra Loader
 
Join Date: Jan 2010
Posts: 48
Default

hi @mgpai
i am trying to find away to rename video files to the name of the archives name
example
mgpai.the.movie.rar contains fghjk.mp4 --rename--> mgpai.the.movie.mp4
edit
but of course not limited to mp4.mkv/mp4/avi/wmv/flv etc.

thanks

Last edited by animus; 10.11.2017 at 15:56.
Reply With Quote
  #234  
Old 12.11.2017, 13:16
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,528
Default

Quote:
Originally Posted by animus View Post
... i am trying to find away to rename video files to the name of the archives name ...
Packagizer has an option to rename files after extraction.
Reply With Quote
  #235  
Old 17.11.2017, 10:52
torrero007
Guest
 
Posts: n/a
Default Script for sending email after package finished

I came up with a way to send myself an email after a package is finished in JD. The trigger for the Event Scripter is "package finished". Here is the script:

Code:
//Add your script here. Feel free to use the available api properties and methods
callAsync(function(exitCode, stdOut, errOut) {}, "C:\\sendEmail.exe", "-o", "tls=yes", "-t", "someone@gmail.com", "-u", "Download Completed:", package.getName(), "-m", "Download completed:", package.getName(), "-f", "youremail@gmail.com", "-s", "smtp.gmail.com:587", "-xu", "yourusername", "-xp", "yourpassword");

Info
"C:\\sendEmail.exe" : the path were the sendEmail is in your PC
"-t", "someone@gmail.com" : the address which will notified
"-f", "youremail@gmail.com" : the address which will send the notification
"-xu", "yourusername" : your username on the "-f" account
"-xp", "yourpassword" : your password on the "-f" account

You will need a very simple program called "Sendemail". Download the version with TLS support.

You will also need to enable POP and IMAP in the Gmail account you will use to send the notification from (the "f" attribute email address). In addition you need to turn on the "Access for less secure apps" on this account or else the Gmail with block the access to the acount.

I would like to thank Jiaz for helping me start and finish it.

Hope it helps

Last edited by torrero007; 17.11.2017 at 14:32. Reason: corrections
Reply With Quote
  #236  
Old 25.11.2017, 15:19
ottoS ottoS is offline
Vacuum Cleaner
 
Join Date: May 2013
Posts: 17
Default How to build an interactive script?

Hi,

with the new trigger-functionality now we can start a script on button-press.
Very, very nice.
With this scenario I want to build an interactive script with an datetime-picker at script start.
For instance:
1. button pressed in JD-menu launches the script.
2. the script should launch a dialog box with a datetime-picker (at best there would be a cancel-button).
3. after input the script then processes the value ... (or abortes on cancel-button).

Now my question:
How to render the picker, because we have no html-canvas onto we can render the UI-elements (form, etc)?
(The only GUI-canvas I see is the alert-popup, but can it blown up to a multifunctional UI-element?)


Thx for reading this.
A lot more thanks for a reply.
__________________
Sys-Info: Win10Home32bit | NTFS | OracleJRE1.8 | JD2 with GUI

Last edited by ottoS; 25.11.2017 at 19:16.
Reply With Quote
  #237  
Old 27.11.2017, 12:19
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,232
Default

@ottoS: what for do you need the date picker exactly for? You could just let user enter input like hours:minutes:day...
__________________
JD-Dev & Server-Admin
Reply With Quote
  #238  
Old 29.11.2017, 14:50
MaybeGrimm MaybeGrimm is offline
Ultra Loader
 
Join Date: Nov 2017
Posts: 45
Default

Quote:
Originally Posted by mgpai View Post
Code:
// Add metadata to image file, using external program
// Trigger: "A Download Stopped"
// External program required: ExifTool by Phil Harvey (**External links are only visible to Support Staff**
// IMPORTANT: Remove any command line parameters included in the executable. For e.g. in Windows OS, rename 'exiftool(-k).exe' to 'exiftool.exe'

if (link.isFinished()) {
    var filePath = link.getDownloadPath();
    var ext = getPath(filePath).getExtension();
    var supported = ["jpg", "tiff"]; // <- Specify supported file types.

    if (supported.indexOf(ext) > -1) {
        var comment = link.getComment();

        if (comment) {
            var exiftool = "c:/portable/exiftool/exiftool.exe"; // <- Set full path to "exiftool.exe"
            var tagName = "comment"; // <- For the comment to be visible in the OS file properties viewer, use OS compatible tag name.
            comment = comment.replace(/"/g, "'");
            callAsync(function() {}, exiftool, "-overwrite_original", "-" + tagName + "=" + comment, filePath);
        }
    }
}
I've tried, but seems it doesn't work for me. It simply doesn't save the comments. I've already changed the tag name in "system.comment" and "Comentarios" (my OS is in spanish) and still not working.
What I'm doing wrong?
Sorry for the questions.
Reply With Quote
Old 29.11.2017, 15:07
MaybeGrimm
Message deleted by Jiaz.
  #239  
Old 30.11.2017, 15:53
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,528
Default

@MaybeGrimm: The script which you have quoted, is used to embed comments to image file. In your other thread you mentioned you need a script which can create 'Single Info-file'. Can you please clarify as to which kind of script you are looking for?
Reply With Quote
  #240  
Old 30.11.2017, 23:11
MaybeGrimm MaybeGrimm is offline
Ultra Loader
 
Join Date: Nov 2017
Posts: 45
Default

Quote:
Originally Posted by mgpai View Post
@MaybeGrimm: The script which you have quoted, is used to embed comments to image file. In your other thread you mentioned you need a script which can create 'Single Info-file'. Can you please clarify as to which kind of script you are looking for?
The single info file was a second option, but what I wanted was that the comments appear in the file metadata. Just that I didn't tought that was possible, but it's what I prefer (and what this script does, if I don't misunderstand).
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 07:19.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.