JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1061  
Old 06.02.2020, 17:22
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by leotzian View Post
... I had found the below 2 scripts in post #469 but I don't know how to use them, do I need the sentmail app or else, I you know to help me more, I must use both?
I think you have to configure 'sendmail' in synolgy. I am not sure though.

As far as the scripts are concerned, one will send an email when download is finished and other one when extraction is finished. You can use either or both.

To use the script you need to install/enable eventscripter extension in JD. Install and test the scripts in a JD install with GUI and then copy the contents or the file "org.jdownloader.extensions.eventscripter.EventScripterExtension.scripts.json' to the headless install. The JSON file will be located in the 'cfg' folder.
Reply With Quote
  #1062  
Old 07.02.2020, 08:44
leotzian leotzian is offline
Baby Loader
 
Join Date: Jun 2018
Posts: 6
Default

Hi my friend again I am trying to make this work, first question in the below script

// Send email notification (NAS)
// Trigger Required: A Download Stopped
// Important: Enable "Synchronous execcution" checkbox in top panel

if (link.isFinished()) {
var absender = "nas@domain.de";
var empfaenger = "empfaenger@domain.de";
var inhalt = getPath(JD_HOME + "/link - inhalt.txt");

writeFile(inhalt, "Link Finished: " + link.getName(), true);
callSync("sendmail", "-F", absender, "-t", empfaenger, "<", inhalt);
deleteFile(inhalt, false);
}

I change only the text inside the quotes with my sender email in
var absender = "nas@domain.de";
and the reciever email in
var empfaenger = "empfaenger@domain.de";

nothing else? I managed to install event scripter in JD in my nas and activate it and activate and the script, but it is not working.
I tried to ssh to the nas the sentmail command but I have the response
sentmail: command not found, so I must search the net what else to do in my nas to activate sentmail ..... it seems difficult to me, I don't want to bother you any more...
Thank you very much for the help I don't know if anyone in this forum that had managed to make this work to help a little.

Edit

I had made an improvement I managed to get sentmail command to work, I had to install mailserver package in synology and configuring it.
Now when download is finished I recieve an email in my spam folder without subject and without body
But if I run a script within my synology task manager with the following format email has title body subject and it goes in my inbox perfect, the format is the below

sendmail -F "Synology Station" -f "sender@here.com" -t reciever@herere.com << EOF
Subject: Synology Mail Test
All working fine.
EOF


Is it easy for you to convert the above jdownloader script to this format I had not know how...

Thanks in advance.

Last edited by leotzian; 07.02.2020 at 09:59.
Reply With Quote
  #1063  
Old 07.02.2020, 10:02
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by leotzian View Post
I tried to ssh to the nas the sentmail command but I have the response
sentmail: command not found, so I must search the net what else to do in my nas to activate sentmail ...
Check the synology forum for articles/tutorials on how to configure email server. The script will work only if you are able to send email via CLI. It is very likely other are sending email notifications via eventscripter.
Reply With Quote
  #1064  
Old 07.02.2020, 13:28
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by leotzian View Post
sendmail -F "Synology Station" -f "sender@here.com" -t reciever@herere.com << EOF
Subject: Synology Mail Test
All working fine.
EOF


Is it easy for you to convert the above jdownloader script to this format I had not know how...
I man not familiar with linux commands. Use following method to run terminal commands from script:

Method:
Code:
var myString = callSync(myString[]);/*Call a local Process. Blocks Until the process returns*/
/* Example: */var pingResultString = callSync("ping","jdownloader.org");

I am guessing something like this may work:
Code:
callSync("sendmail", "-F", "\"Synology Station\"", "-f", "\"sender@here.com\"", "-t", "reciever@herere.com", "<<", "EOF", "\r\nSubject: Synology Mail Test\r\nAll working fine.\r\n", "EOF");

Also, I am not sure how linux handles "\r\n".
Reply With Quote
  #1065  
Old 07.02.2020, 14:24
leotzian leotzian is offline
Baby Loader
 
Join Date: Jun 2018
Posts: 6
Default

I CAN sent emails via CLI, but I cannot make the script in Jdownloader to work, email IS sent but goes to spam it has no title, body and subject.
Your suggestion is not working.
I will search synology forums for help, now with your help I know what to search for.
Thanks for your help.
Reply With Quote
  #1066  
Old 07.02.2020, 15:55
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by leotzian View Post
I CAN sent emails via CLI, but I cannot make the script in Jdownloader to work, email IS sent but goes to spam it has no title, body and subject.
I had created those scripts based on the information provide in this link:
Code:
mkleine.de/blog/2016/01/07/synology-sendmail-per-shell-aktivieren/

English version:
Code:
// Send email notification (NAS)
// Trigger Required: A Download Stopped
// Important: Enable "Synchronous execcution" checkbox in top panel

if (link.isFinished()) {
    var sender = "sender@here.com";
    var receiver = "reciever@herere.com";
    var message = getPath(JD_HOME + "/download finished notification.txt");

    writeFile(message, "Link Finished: " + link.getName(), true);
    callSync("sendmail", "-F", sender, "-t", receiver, "<", message);
    deleteFile(message, false);
}

In this case the message body is first written to a temp file and then passed to the call. I guess it might also be possible to include the subject in it.
Reply With Quote
  #1067  
Old 08.02.2020, 10:45
leotzian leotzian is offline
Baby Loader
 
Join Date: Jun 2018
Posts: 6
Default

Quote:
Originally Posted by mgpai View Post
I had created those scripts based on the information provide in this link:
Code:
mkleine.de/blog/2016/01/07/synology-sendmail-per-shell-aktivieren/

English version:
Code:
// Send email notification (NAS)
// Trigger Required: A Download Stopped
// Important: Enable "Synchronous execcution" checkbox in top panel

if (link.isFinished()) {
    var sender = "sender@here.com";
    var receiver = "reciever@herere.com";
    var message = getPath(JD_HOME + "/download finished notification.txt");

    writeFile(message, "Link Finished: " + link.getName(), true);
    callSync("sendmail", "-F", sender, "-t", receiver, "<", message);
    deleteFile(message, false);
}

In this case the message body is first written to a temp file and then passed to the call. I guess it might also be possible to include the subject in it.
Hi my friend thanks for help
I tested your script it is not working, I don't want what is going on, I tried with other email adress
Download is finished at once an email is sent from the sender's email, to the recievers inbox BUT ir had not Title subject or Body only From to .
In my nas had installed from community repo the only version they have look the photo attachment, also If I olen from the nas the file created by the script
org.jdownloader.extensions.eventscripter.EventScripterExtension.scripts.json
usinf text edidor the format is not the same as the original script is this normal?

[ {
"eventTrigger" : "ON_DOWNLOAD_CONTROLLER_STOPPED",
"enabled" : true,
"name" : "Event Script",
"script" : "// Send email notification (NAS)\n// Trigger Required: A Download Stopped\n// Important: Enable "Synchronous execcution" checkbox in top panel\n\nif (link.isFinished()) {\n var sender = "sender@gmail.com";\n var receiver = "reciever@otenet.gr";\n var message = getPath(JD_HOME + "/download finished notification.txt");\n\n writeFile(message, "Link Finished: " + link.getName(), true);\n callSync("sendmail", "-F", sender, "-t", receiver, "<", message);\n deleteFile(message, false);\n}\n",
"eventTriggerSettings" : { },
"id" : 1581153863487
} ]

Perhaps a bug in the NAS version of JDownloader?
Attached Thumbnails
Jdownloader.jpg  
Reply With Quote
  #1068  
Old 08.02.2020, 11:05
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by leotzian View Post
Download is finished at once an email is sent from the sender's email, to the recievers inbox BUT ir had not Title subject or Body only From to
You can try sending static messages for testing. Also, I think the templated which I provided does not include a 'subject'. If you need any help troubleshooting you can contact me in JD Chat. I am currently online there:

Code:
kiwiirc.com/nextclient/irc.freenode.net/#jdownloader
Reply With Quote
  #1069  
Old 10.02.2020, 02:59
ElCho ElCho is offline
Tornado
 
Join Date: May 2014
Posts: 232
Default

Quote:
Originally Posted by mgpai View Post
Only links with errors like 'connection problems' and 'temporarily not available' can be retried with 'stop/start' sequence. Others can be started only when the countdown timer ends, in other words not soon after it has been skipped. All downloads which can be retried with 'stop/restart' action can also be started with 'skip/unskip' action, because 'skipping' a download will essentially 'stop' the download.

'unskip' is only used on partially downloaded files. Links where no data has yet been downloaded will be 'reset'. Unlike 'unskip' it will definitely try to start the download during the next attempt.



How fast the link is skipped will depend on how fast the download has stopped, over which the script has not control. In other words, the download would have stopped even if the script did not skip it. Irrespective of when or how soon it's been skipped, it will only be retried when the next download is finished. And it will keep doing that with all failed downloads till the last successful download has stopped. You can also modify the script to suit your need by using the methods listed in the built-in help.

As mentioned in the chat room, you may not even need to use the script. Just using less than 20 chunks per download might also most likely solve the issue. Jiaz has noted that other users haven't reported similar issue with that host. It is quite likely due to using less chunks.
Hello, I'd been trying the script a little bit more and it has been working fine so far, but I'm wondering about two things:

1- Does it necessarily have to wait for a successfully completed download to trigger the "skip/unskip" sequence? I mean, in the case there aren't no new downloads to start but they all were already put into a "skipped" condition, couldn't it just wait a few seconds, and then retry over those?

2- Something weird happened with the last downloads' batch I left, since despite there was still a pending download, the system was put to sleep:



3- Could the script "skipping" action be triggered not right after after it detects a problem was found with one of the connections, but
just after its third time doing that? So, that way it lets JD2 retry by itself at least three times, thus avoiding skipping right away downloads which
can be resumed correctly after a few attempts. Or maybe, triggering the "skipping" condition only "1" minute after a determined download was put into
a "waiting" or a "stopped" state.

As I told you before in private, I played a little bit with less connections/chunks, but doing it that way would suppose wasting available bandwidth
and, consequently, more time.

Last edited by ElCho; 10.02.2020 at 03:07.
Reply With Quote
  #1070  
Old 10.02.2020, 06:01
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Does it necessarily have to wait for a successfully completed download to trigger the "skip/unskip" sequence? I mean, in the case there aren't no new downloads to start but they all were already put into a "skipped" condition, couldn't it just wait a few seconds, and then retry over those?
As I have alread stated before, some downloads can be started only after the wait time is over. If you want the download to start immediately you have to reset them, instead of resuming them. Simply retrying/resuming them every few seconds will not help in any way.

Quote:
Something weird happened with the last downloads' batch I left, since despite there was still a pending download, the system was put to sleep:
If the download could not be retried/resumed, it will be remain skipped in order to allow the extension to shut down. That is the purpose of this script.

Quote:
Could the script "skipping" action be triggered not right after after it detects a problem was found with one of the connections, but
just after its third time doing that? So, that way it lets JD2 retry by itself at least three times, thus avoiding skipping right away downloads which
can be resumed correctly after a few attempts. Or maybe, triggering the "skipping" condition only "1" minute after a determined download was put into
a "waiting" or a "stopped" state.
The script does not 'decide' when to skip the download. It is skipped only after the download has stopped. Even if it was not skipped, it will not be retried immediately. It will only be retried by JD after the waittime is over.

The script I have provided does not limit the number of retries, so I don't see any benefit with the system you have suggested. You can always modify the existing script or create a new one to come up with a solution which is acceptable to you. All available methods are listed in the Help menu.

Quote:
As I told you before in private, I played a little bit with less connections/chunks, but doing it that way would suppose wasting available bandwidth
and, consequently, more time.
In my opinion, 320 (16 *20) connections will rarely, if ever, be required to saturate the bandwidth.

The best solution to this problem is to prevent connection issues, either by using less total connections or using the 'automax' advanced setting option, to start new downloads till the bandwidth is saturated.
Reply With Quote
  #1071  
Old 10.02.2020, 10:07
ElCho ElCho is offline
Tornado
 
Join Date: May 2014
Posts: 232
Default

Quote:
As I have alread stated before, some downloads can be started only after the wait time is over. If you want the download to start immediately you have to reset them, instead of resuming them. Simply retrying/resuming them every few seconds will not help in any way.
Yes I know, but since the script omits the error messages with a timer on them, I was wondering whether the downloads could be retried immediately or not; or even be reset if a given amount of retries attempts failed.

Quote:
If the download could not be retried/resumed, it will be remain skipped in order to allow the extension to shut down. That is the purpose of this script.
I didn't know that, and although I don't know how many retries it would take, it makes sense it behaves like that so the system doesn0t keep idling (which is the main issue I'm trying to avoid).

Quote:
The script does not 'decide' when to skip the download. It is skipped only after the download has stopped. Even if it was not skipped, it will not be retried immediately. It will only be retried by JD after the waittime is over.

The script I have provided does not limit the number of retries, so I don't see any benefit with the system you have suggested. You can always modify the existing script or create a new one to come up with a solution which is acceptable to you. All available methods are listed in the Help menu.
All the skipped downloads I saw so far were started right after another currently active download was successfully completed. And before using the script, I usually saw how JD2 did a few retries attempts for problematic downloads; some of them were carried successfully after that, and others were given the message with a timer on it (5'/15'/30').

Anyway, since my original intention was and still is to avoid the system keeps idling just because every now and then one or two files get a looping timer, I think the current script although not perfect, aids in that sense. An ideal one would simply limit to do what I manually do whenever I find a download in such a state, but I know of the message's related limitation.

Regarding the connection performance, I know it is a high amount of connections, but after doing some tests, I noted that if I use a smaller amount, the bandwidth will certainly not be maximized in a constant way, till all downloads are completed.

Anyway, I will try that "automax" feature you mentioned.

Thanks.
Reply With Quote
  #1072  
Old 14.02.2020, 14:11
Heinz Heinz is offline
Vacuum Cleaner
 
Join Date: Feb 2020
Posts: 17
Default

Hi there,

new to jd scripting and need a little help. Im trying to check to which proxy a download is connected and if a condition is met, to disable/enable that proxy.

Additionally changing the proxys priority would also be helpful.

Are there such methods? couldn't find any in the documetation.
How could this be implemented?

Code:
var running = getRunningDownloadLinks();

for (i = 0; i < running.length; i++) {
	var download = running[i];
	
	//get connected proxy
	Proxy proxy = download.getProxy();
	//if condition meets disable
	proxy.setDisabled(true);
	//or if condition meets change priority
	proxy.setPriority(Priority.MAX);
}
Reply With Quote
  #1073  
Old 14.02.2020, 16:14
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by Heinz View Post
... Im trying to check to which proxy a download is connected and if a condition is met, to disable/enable that proxy.

Additionally changing the proxys priority would also be helpful ...
There are no methods which return connection details of a download. There are also no methods or any setting which can be used to assign prioirty to proxies

It is possible to enable/disable/remove the proxy using the 'config' namespace of MYJD API. You can create a event based or interval based script, which can test the proxies in the list and enable/disable/remove them from the it.

There is also a method in eventscripter API, which returns 'banned' proxies, which might be of help to identify problematic proxies. Connections details are also logged in some files which can be found in 'JD\logs' folder, but parsing them might not be very convenient or practical.

By default JD uses the connections in the order they appear in the list. An alternative to priority might be to arrange them in the order of your preference.

You can set/change the proxy selection mode in "GeneralSettings.freeproxybalancemode" (Advanced Setting).
Reply With Quote
  #1074  
Old 14.02.2020, 16:49
Heinz Heinz is offline
Vacuum Cleaner
 
Join Date: Feb 2020
Posts: 17
Default

Quote:
Originally Posted by mgpai View Post
There are no methods which return connection details of a download. There are also no methods or any setting which can be used to assign prioirty to proxies....
Ok, thanks for your reply!

Another approach to solve the problem:

I know we can ckeck if a Proxy is up by using the getPage method in a try catch blog.

But is it possible in any way to measure the transfer speed of the proxy in a simple way?

Code:
//Is proxy up
var browser = getBrowser();
browser.setProxy(...);
browser.getPage("http://www.google.com");

//Is proxy fast
var browser = getBrowser();
browser.setProxy(...);
int time = browser.getLoadTime("http://www.google.com");
if(time....
Reply With Quote
  #1075  
Old 14.02.2020, 16:58
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by Heinz View Post
But is it possible in any way to measure the transfer speed of the proxy in a simple way?
Does this help? :
Code:
var startTime = new Date();
var page = getPage("http://www.google.com");
var endTime = new Date();
var loadTime = endTime - startTime;

alert(loadTime);
Reply With Quote
  #1076  
Old 14.02.2020, 18:37
Heinz Heinz is offline
Vacuum Cleaner
 
Join Date: Feb 2020
Posts: 17
Default

Quote:
Originally Posted by mgpai View Post
Does this help? :
Yes!! Thanks!
Reply With Quote
  #1077  
Old 16.02.2020, 14:41
leotzian leotzian is offline
Baby Loader
 
Join Date: Jun 2018
Posts: 6
Default JD2 and Synology NAS email Sent after Download Finished

Hi to all I open a new thread if anyone has found a solution to this I had searched a lot but I could not find a person who had managed to solve this issue.

I had tried with @mgpai hours in the chat to solve the task I want, I don't know If you have any idea of that.
I want when JD finished a download to sent me an email.
I had installed mail server in the nas that installs postfix sendmail command.
I had managed to get email sent with commands using sunology CLI but the same commands using script manager are not working.
The command that it is working is
sendmail -vt < /mail.txt in mail.txt I have the format
===================
To: reciever@otenet.gr
Subject: JDownloader Downloads
From: sender@gmail.com

Body of the message
====================
This command sents an email with sender reciever in recievers mailbox, with subject and body.

With @mgpai he managed to create the txt file filled with the correct data of the downloaded file ( subject and file details ).
When I run this command using CLI of synology ssh it is working fine
If I make a script with this command in Task scheduler of my nas it is working ok, BUT if I try to add THE SAME COMMAND using script in event scripter, WE had tried 1000 compinations with /r/n etc or different syntax , it is not working, The command cannot access the mail.txt file and the "<" symbol is not recognised.
I had tried to store the mail.txt in several locations with the same result.
I don't if it permision issue.
I had installed JD through the synology community repo through the package manager in my NAS
Do you have any ideas where to look for or what to do?
Another format that is working using CLI is

sendmail -F "Synology DS416Play" -f "sender@gmail.com" -t "reciever@otenet.gr"
Subject: JDownloader Downloads
Download had been finished
EOF

In the CLI I have to press enter after each line but in the script /r/n/ commands are not recognized as line feed or carriage return, by my nas and in the mail server log it seams that I have emails to recievers like - Subject ,Jdownloader,Downloads EOF etc
Very crazy though

If anyone who owns a Synology NAS had managed to make this work please a little help please.

Thanks in advance and sorry for the big post.
Reply With Quote
  #1078  
Old 17.02.2020, 20:29
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 66,455
Default

Merged EventScripter threads.

@leotzian
Your issue is a script issue but not a general JDownloader issue/bug.

Please keep in mind that we do not provide support for individual scripts - they are NOT in any way official parts of our application!
You will have to rely on other users to help you with this.

-psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
JDownloader 2 Setup Download
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #1079  
Old 18.02.2020, 20:06
RPNet-user's Avatar
RPNet-user RPNet-user is offline
Tornado
 
Join Date: Apr 2017
Posts: 231
Default

@mgpai

Is it possible via one of the triggers to have a script automatically crawl and fetch RapidRar(RR) links from the rmz.cr main page matching '1080p VXT' or '1080p RARBG' in the title name and add those links to the linkgrabber queue or a text file and start only from the current date for newly posted titles that match either keyword set?

Code:
**External links are only visible to Support Staff**
Reply With Quote
  #1080  
Old 19.02.2020, 05:42
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by RPNet-user View Post
Is it possible via one of the triggers to have a script automatically crawl and fetch RapidRar(RR) links from the rmz.cr main page matching '1080p VXT' or '1080p RARBG' in the title name and add those links to the linkgrabber queue or a text file and start only from the current date for newly posted titles that match either keyword set?
You can use a script to add the 'source url' to JD at regular intervals. If JD does not find any links, you will need to create linkcrawler rules. Specify 'deeppattern' to grab only those links which match your keyword. If the links are grabbed automatically (without using linkcrawler rule), use the linkgrabber filter rule to block links which do not match your keyword.

Related Script: Post #1002
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 17:22.
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 - 2023, Jelsoft Enterprises Ltd.