JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #561  
Old 03.02.2019, 17:51
plaintext plaintext is offline
BugMeNot Account
 
Join Date: Sep 2016
Posts: 241
Default

OK, so I have to embed the js code in a jason syntax. But what is the correct identifiert for the trigger?

And jiaz said some years ago that before a reconnect is a problem, as after the update JD "forgets" to reconnect

https://board.jdownloader.org/showpo...26&postcount=7
Reply With Quote
  #562  
Old 03.02.2019, 18:03
plaintext plaintext is offline
BugMeNot Account
 
Join Date: Sep 2016
Posts: 241
Default

Sorry, I should have read the other posts in that thread before I post the "issue" that the two of you discussed 4 years ago.

I embedded the scriptcode in json. It is valid jason (correctly escaped) according to **External links are only visible to Support Staff**... - however jd refused to accept it:
„Sorry, failed to set new value“


Quote:
[{"eventTrigger":"BEFORE_A_RECONNECT",
"enabled":true,
"name":"Script",
"script":"if (callAPI("update", "isUpdateAvailable")) callAPI("update", "restartAndUpdate");",
"eventTriggerSettings":{}}]
Reply With Quote
  #563  
Old 04.02.2019, 01:15
devdaring
Guest
 
Posts: n/a
Default

Thanks for all the very useful scripts!
Reply With Quote
  #564  
Old 04.02.2019, 12:18
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,245
Default

@plaintext: easiest way would be to setup the eventscripter in JDownloader with GUI and then copy/paste the value from Settings-Advanced Settings-EventScripter.scripts
That way you don't have to care about format/encoding yourself
__________________
JD-Dev & Server-Admin
Reply With Quote
  #565  
Old 04.02.2019, 16:55
plaintext plaintext is offline
BugMeNot Account
 
Join Date: Sep 2016
Posts: 241
Default

Oh, The WebUI has a GUI for the event Scripter so I expected it to be the same GUI as the Java Frontend.....

regarding the question before/after reconnect:

If it is done after a reconnect, mgpai said this script would interrupt running downloads that started right after the reconnect.
But: If it is done before a reconnect, how does JD know it has to reconnect after the update?

I want to avoid solving CAPTCHAs just for JD to notice that is has to reconnect. Even worse it might break the reconnect.
And even worse: Lets say download A causes the need to reconnect. As A is waiting for a reconnect, download B does not start. After update & reboot download B starts and A cannot continue as B is running ....

Btw: what is the "APIPanel Visible" option? Jiaz said on page 11 "it shows/hides the api help panel" - but what/whee is the api help panel ?

thank you.
Reply With Quote
  #566  
Old 04.02.2019, 17:38
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,245
Default

Quote:
Originally Posted by plaintext View Post
But: If it is done before a reconnect, how does JD know it has to reconnect after the update?
Before reconnect -> update available -> restart JDownloader and install pending updaten
After installation -> download starts -> detects waiting time -> before reconnect -> no update available -> do reconnect -> continue download
__________________
JD-Dev & Server-Admin
Reply With Quote
  #567  
Old 04.02.2019, 17:40
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,245
Default

Quote:
Originally Posted by plaintext View Post
I want to avoid solving CAPTCHAs just for JD to notice that is has to reconnect. Even worse it might break the reconnect.
Yes, that would be no good and could happen when doing this

so I also think that check/install update on *After Reconnect* trigger would be better idea and the script can be in sync mode and other downloads would not start then
__________________
JD-Dev & Server-Admin
Reply With Quote
  #568  
Old 04.02.2019, 17:41
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,245
Default

Quote:
Originally Posted by plaintext View Post
Btw: what is the "APIPanel Visible" option? Jiaz said on page 11 "it shows/hides the api help panel" - but what/whee is the api help panel ?
It's the api documentation for the GUI script editor available in GUI version
__________________
JD-Dev & Server-Admin
Reply With Quote
  #569  
Old 04.02.2019, 18:00
plaintext plaintext is offline
BugMeNot Account
 
Join Date: Sep 2016
Posts: 241
Default

Quote:
Originally Posted by Jiaz View Post
It's the api documentation for the GUI script editor available in GUI version
So it is quite intresting having this option available in the non-advanced section of the WebUI :D
Thank you for clarification.
Reply With Quote
  #570  
Old 05.02.2019, 10:06
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,245
Default

There is no differentiation between gui and headless version for setting interfaces and the webui just shows generic interface for all available settings
__________________
JD-Dev & Server-Admin
Reply With Quote
  #571  
Old 05.02.2019, 14:47
RedNapalm RedNapalm is offline
Ultra Loader
 
Join Date: Dec 2017
Posts: 49
Default

Would it be possible to request a script that finds duplicate within the download list and another to verify that it has been downloaded? Having major issues organizing and cleaning mine after a few user screw ups.
Reply With Quote
  #572  
Old 05.02.2019, 17:05
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,618
Default

Quote:
Originally Posted by RedNapalm View Post
Would it be possible to request a script that finds duplicate within the download list and another to verify that it has been downloaded? Having major issues organizing and cleaning mine after a few user screw ups.
Can you contact me in JD Chat?
Reply With Quote
  #573  
Old 08.02.2019, 00:45
almanteka almanteka is offline
Registered / Inactive
 
Join Date: Feb 2019
Posts: 9
Default Send Package Name to Batch

i'm trying to send package name to a batch file to send a push notification! the notification works as expected, but i like to include the package name, here are the scripts i'm testing

event scripter:
Code:
// TRIGGER = Package Finished
disablePermissionChecks();
var myFilePackage = package;
var myString = myFilePackage.getName();
callAsync(function(exitCode, stdOut, errOut) {}, "F:\\link to\\file.bat", "myString");

batch:
Code:
@echoff
myString=$1
curl -X POST -d "payload={\"text\": \"JDownloader: A file "'$myString'" has been completed!\"}" "**External links are only visible to Support Staff**

message received at notification service:
Code:
JDownloader: A file '$myString' has been completed!

any help will be appreciated! thanks in advance!

:attention:
Reply With Quote
  #574  
Old 08.02.2019, 01:21
almanteka almanteka is offline
Registered / Inactive
 
Join Date: Feb 2019
Posts: 9
Default

well, found out the errors in my scripts:

event scripter:
Code:
// TRIGGER = Package Finished
disablePermissionChecks();
var myFilePackage = package;
var myString = myFilePackage.getName();
callAsync(function(exitCode, stdOut, errOut) {}, "F:\\link to\\file.bat", myString);
batch:
Code:
@echoff
%1
curl -g -v -k -X POST -d "payload={\"text\": \"JDownloader: The file "'%1'" has been completed!\"}" "**External links are only visible to Support Staff**

message received at notification service:
Code:
JDownloader: The file 'Example FilePackage Name' has been completed!

:woot:

Last edited by almanteka; 08.02.2019 at 01:26.
Reply With Quote
  #575  
Old 08.02.2019, 06:19
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,618
Default

Quote:
Originally Posted by almanteka View Post
well, found out the errors in my scripts:
Event scripter also has a postPage() method, which can be used instead of the batch file in this script.

Code:
var myString = postPage(myString/*URL*/, myString/*PostData*/);/*Loads a website (METHOD: POST) and returns the source code*/
/* Example: */var myhtmlSourceString = postPage("http://support.jdownloader.org/index.php","searchquery=captcha");
Reply With Quote
  #576  
Old 08.02.2019, 06:51
almanteka almanteka is offline
Registered / Inactive
 
Join Date: Feb 2019
Posts: 9
Default

Quote:
Originally Posted by mgpai View Post
Event scripter also has a postPage() method, which can be used instead of the batch file in this script.

Code:
var myString = postPage(myString/*URL*/, myString/*PostData*/);/*Loads a website (METHOD: POST) and returns the source code*/
/* Example: */var myhtmlSourceString = postPage("http://support.jdownloader.org/index.php","searchquery=captcha");
thanks for your suggestions! can you provide an example using my scripts above? really appreciate your help!
Reply With Quote
  #577  
Old 08.02.2019, 07:23
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,618
Default

Quote:
Originally Posted by almanteka View Post
... can you provide an example using my scripts above?
Example:
Code:
var url = "hxxp://notification.service";
var data = "payload={\"text\": \"JDownloader: The file " + package.getName() + " has been completed!\"}";
postPage(url, data);
Reply With Quote
  #578  
Old 08.02.2019, 07:41
almanteka almanteka is offline
Registered / Inactive
 
Join Date: Feb 2019
Posts: 9
Default

Quote:
Originally Posted by mgpai View Post
Example:
Code:
var url = "hxxp://notification.service";
var data = "payload={\"text\": \"JDownloader: The file " + package.getName() + " has been completed!\"}";
postPage(url, data);
WOW! worked perfectly! thank you very much!
Reply With Quote
  #579  
Old 08.02.2019, 19:46
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,245
Default

@almanteka: just out of interest, what notification service do you use?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #580  
Old 08.02.2019, 19:54
almanteka almanteka is offline
Registered / Inactive
 
Join Date: Feb 2019
Posts: 9
Default

Quote:
Originally Posted by Jiaz View Post
@almanteka: just out of interest, what notification service do you use?
i'm using Synology Chat.
Reply With Quote
  #581  
Old 08.02.2019, 20:31
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,245
Default

Is that an app for synology and you can push notifications to it? is it a real message service?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #582  
Old 08.02.2019, 21:14
almanteka almanteka is offline
Registered / Inactive
 
Join Date: Feb 2019
Posts: 9
Default

Quote:
Originally Posted by Jiaz View Post
Is that an app for synology and you can push notifications to it? is it a real message service?
yes, it's an app to connect to your own synology server. you can push notifications using web hooks & slash commands, chat with other users using the app from windows desktop, android & iOS. i think it's not a real message service because you need a synology server for it to work, but it provides what i need after using slack & pushbullet and obtained the same experience. i used slack & pushbullet just to receive push notifications on my cell phones, now, i integrated those to my synology server.
Attached Thumbnails
jdchat.jpg  

Last edited by almanteka; 08.02.2019 at 21:23.
Reply With Quote
  #583  
Old 11.02.2019, 12:36
Simon* Simon* is offline
Verified Account
 
Join Date: Feb 2017
Posts: 47
Default

Hi almanteka

Would you mind PMing me about what kind of notifications you're setting this up for? Is it purely for download finished or something else?

I also had this same idea recently, so I've build this functionality into the iOS MyJDownloader app.

In the next iOS update users can simply tick boxes for various push notifications, and the app sets up the event scripter script as needed.

At the moment I provide 11 push notification types (package started, package finished, downloads stopped etc..), but users are free to set up their own custom notifications based on the ones I've made (with mgpai's help), they just won't be able to turn them on/off through the app ui.

I'm interested to know what other types of notifications users are wanting, and if you have any scripts you're willing to share that would be great.
Reply With Quote
  #584  
Old 12.02.2019, 12:49
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,245
Default

@almanteka: Thanks! Didn't know it before
@Simon: I'm sorry for huge delay :(
__________________
JD-Dev & Server-Admin
Reply With Quote
  #585  
Old 13.02.2019, 06:39
almanteka almanteka is offline
Registered / Inactive
 
Join Date: Feb 2019
Posts: 9
Default

Quote:
Originally Posted by Simon* View Post
Hi almanteka

Would you mind PMing me about what kind of notifications you're setting this up for? Is it purely for download finished or something else?

I also had this same idea recently, so I've build this functionality into the iOS MyJDownloader app.

In the next iOS update users can simply tick boxes for various push notifications, and the app sets up the event scripter script as needed.

At the moment I provide 11 push notification types (package started, package finished, downloads stopped etc..), but users are free to set up their own custom notifications based on the ones I've made (with mgpai's help), they just won't be able to turn them on/off through the app ui.

I'm interested to know what other types of notifications users are wanting, and if you have any scripts you're willing to share that would be great.
for now, i'm using the notifications for Package Finished and Before a Captcha Challenge triggers. i'm sure that it will work for all the triggers available on jdownloader.
Reply With Quote
  #586  
Old 13.02.2019, 10:37
Simon* Simon* is offline
Verified Account
 
Join Date: Feb 2017
Posts: 47
Default

Quote:
Originally Posted by Jiaz View Post
@Simon: I'm sorry for huge delay :(
Np. Do you have an idea of when you'll be free to look into it for me? Eager to push this version out.
Reply With Quote
  #587  
Old 15.02.2019, 21:49
pinko
Guest
 
Posts: n/a
Default

I saw that one of the triggers is "A new file has been created". How would I make script, witch would be add number before name of new file. Number will be: number of files in folder+1.

Second thing: I try to create history of downloaded links, using #7, but I get message that variable "link" is not define. What am I doing wrong?
Reply With Quote
  #588  
Old 16.02.2019, 06:06
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,618
Default

Quote:
Originally Posted by pinko View Post
I saw that one of the triggers is "A new file has been created". How would I make script, witch would be add number before name of new file. Number will be: number of files in folder+1.
The event will be triggered each time a download is finished or an archive is extracted. It will return any array of 'created' files, which will contain a single item when it is created by the download controller or single/multiple items (depends on the number of files in the archive) if it is created by the extractor. As such, the number of files in folder (assuming folder = folder on disk) will vary and might not be suitable for the task you specified.

Quote:
Originally Posted by pinko View Post
Second thing: I try to create history of downloaded links, using **External links are only visible to Support Staff**..., but I get message that variable "link" is not define. What am I doing wrong?
I had immediately replied (via PM) to your email. If you still have issues running the script, find me in JD Chat.

Last edited by mgpai; 16.02.2019 at 06:15.
Reply With Quote
  #589  
Old 16.02.2019, 19:30
TheDeath24
Guest
 
Posts: n/a
Default

Hello together,

i want to ask if somebody can help me with a script.

I want to set the download path of a new package wich is over 20gb to filme and all other bigger than 500mb to serien.

As event i used "A new link has been added"

var myLong = myPackagizerLink.getBytesTotal();
var filme = "E:\HD Filme";
var serien = "E:\Serien";


if (myLong > '20000000000') {
myPackagizerLink.setDownloadFolder(filme);
}

No error comes but it does not working.
Can anybody help?

Regards
Reply With Quote
  #590  
Old 16.02.2019, 19:51
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,618
Default

You have to use escape the backslash character:
Code:
var filme = "E:\\HD Filme";

or use (forward) slash as path separator.
Code:
var filme = "E:/HD Filme";

Tried packagizer? You can create rules to set download folder (among other things) based on file size.
Reply With Quote
  #591  
Old 17.02.2019, 01:02
almanteka almanteka is offline
Registered / Inactive
 
Join Date: Feb 2019
Posts: 9
Default

hi! i'm trying to adapt these two scripts to move the original "un-extracted" package to another folder after the extraction ocurred! i know that jdownloader can move the original files to the recycle bin, but i'm looking to move the original "un-extracted" package to another folder instead! thanks in advance for your suggestions & help!


ArchiveExtracted.js
Code:
var script = 'F:\\JDownloader v2.0\\JDTest3.bat'

var myFilePackage = package;
var path = myFilePackage.getDownloadFolder()
var name = myFilePackage.getName()
var label = myFilePackage.getComment() ? myFilePackage.getComment() : 'N/A'
var links = myFilePackage.getDownloadLinks() ? myFilePackage.getDownloadLinks() : []

function isReallyFinished() {
	for (var i = 0; i < links.length; i++) {
		if (links[i].getArchive() != null && links[i].getExtractionStatus() != "SUCCESSFUL" || !package.isFinished()) {
			return false
		}
	}
	return true
}

if (isReallyFinished()) {
	var command = [script, path, name, label, 'PACKAGE_FINISHED']
	log(command)
	log(callSync(command))
}

maybe this one?
Code:
//Trigger: "Archive Extraction Finished"

var packageFinished = archive.getDownloadLinks()[0].getPackage().isFinished();

var folder = archive.getDownloadLinks()[0].getPackage().getDownloadFolder();
var name = archive.getDownloadLinks()[0].getPackage().getName();


if (packageFinished) {
    alert("External Command " + " Parameter1: " + folder + " Parameter2: " + name);
}

JDTest3.bat
Code:
@ECHO OFF

set ARG_NAME=%1

move "F:\\JD Downloads\\%ARG_NAME%" "F:\\!TRASH!"

:thumbup:
Reply With Quote
  #592  
Old 17.02.2019, 07:43
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,618
Default

Quote:
Originally Posted by almanteka View Post
... i'm looking to move the original "un-extracted" package to another folder instead ...
Code:
// Move archive files after extraction
// Trigger: Archive Extraction Finished

var links = archive.getDownloadLinks() || [];

links.forEach(function(link) {
    var filePath = getPath(link.getDownloadPath());
    filePath.moveTo(filePath.getParent().toString().replace("JD Downloads", "!TRASH!"));
});

Last edited by mgpai; 17.02.2019 at 08:00.
Reply With Quote
  #593  
Old 17.02.2019, 08:25
almanteka almanteka is offline
Registered / Inactive
 
Join Date: Feb 2019
Posts: 9
Default

Quote:
Originally Posted by mgpai View Post
Code:
// Move archive files after extraction
// Trigger: Archive Extraction Finished

var links = archive.getDownloadLinks() || [];

links.forEach(function(link) {
    var filePath = getPath(link.getDownloadPath());
    filePath.moveTo(filePath.getParent().toString().replace("JD Downloads", "!TRASH!"));
});
WOW! you're the scripts hero! test with single and multiple files worked perfectly! thanks for all your help!

Last edited by almanteka; 17.02.2019 at 09:06. Reason: tested with multiple files too!
Reply With Quote
  #594  
Old 17.02.2019, 10:46
TheDeath24
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by mgpai View Post
You have to use escape the backslash character:
Code:
var filme = "E:\\HD Filme";

or use (forward) slash as path separator.
Code:
var filme = "E:/HD Filme";

Tried packagizer? You can create rules to set download folder (among other things) based on file size.
I used now this
var filme = "E:/HD Filme";

But nothing happend.

I can´t use packagizerbecause there is no option to filter by package size only by file size. I want to filter the packagesize.

Or i must i use a different var? myDownloadLink?

Regards
Reply With Quote
  #595  
Old 17.02.2019, 11:06
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,618
Default

Quote:
Originally Posted by TheDeath24 View Post
var myLong = myPackagizerLink.getBytesTotal();
This returns only the link size, not the package size.

Quote:
Originally Posted by TheDeath24 View Post
I can´t use packagizerbecause there is no option to filter by package size only by file size. I want to filter the packagesize.
Only the following methods return package size:
Code:
var myLong = myCrawledPackage.getBytesTotal();
var myLong = myFilePackage.getBytesTotal();

Only "Package Finished" trigger returns the "package" sandbox. In all other cases you have to get the "package" sandbox using methods which return packages or links.
Reply With Quote
  #596  
Old 17.02.2019, 16:00
TheDeath24
Guest
 
Posts: n/a
Default

Thanks mgpai,

now i use myCrawledPackage.getBytesTotal();

All working. Thanks for your help.
Reply With Quote
  #597  
Old 20.02.2019, 00:30
pinko
Guest
 
Posts: n/a
Default

Is it possible to create script for disable "LinkgrabberSettings: Various Package" if package name is "Some_Package_Name".
I want to disable it when am downloading from some selected youtube channels.
Reply With Quote
  #598  
Old 20.02.2019, 11:10
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,245
Default

@pinko: you can create a Settings-Packagizer rule to avoid links going into the various package. If you can explain what exactly you're trying to achieve, I can try to help
__________________
JD-Dev & Server-Admin
Reply With Quote
  #599  
Old 20.02.2019, 15:44
Cyberavater Cyberavater is offline
JD Legend
 
Join Date: Feb 2019
Posts: 732
Default

I was told to ask mgpai for help with eventscript from here, https://board.jdownloader.org/showthread.php?t=79841
So,
@mgpai Can U make me a eventscript which will automatically grab proxies from here **External links are only visible to Support Staff****External links are only visible to Support Staff**
Thanks in advance.
Reply With Quote
  #600  
Old 20.02.2019, 16:59
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,618
Default

Quote:
Originally Posted by Cyberavater View Post
Can U make me a eventscript which will automatically grab proxies from here ...
Sorry, I have to decline your request.

Hope you have tried the bulk proxies import feature in JD Connection Manager. I can create a script which can automatically download the lists at specific intervals, but I guess it wont help you much.
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:25.
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.