JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1921  
Old 11.10.2021, 14:16
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,485
Default

@TomNguyen: Thank you so much for your help/time. Do you still have the postID to each script/or page? Then you could easily link the script/post directly?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1922  
Old 11.10.2021, 14:17
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,485
Default

@JDL1059: list of links? where does the new link come from then? is it normal text/website with links on it or how do you expect JDownloader to check for new links? more details are required in order to help/answer you
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1923  
Old 11.10.2021, 14:22
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,485
Default

@BillyCool: can you share the script/trigger? you can also send details to support@jdownloader.org
Most likely you are trying to access a special *retry* link in linkcrawler?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1924  
Old 12.10.2021, 03:20
BillyCool BillyCool is offline
Super Loader
 
Join Date: Sep 2016
Location: Australia
Posts: 28
Default

@Jiaz

Here's a basic version that replicates the issue:
Code:
disablePermissionChecks();
setNotifyOnException(true);

// Run one at a time
test1(); // Causes: Security Violation --> Security Violation org.appwork.exceptions.WTFException
//test2(); // Causes: WTFException --> what the like just happened here? no lastValidFilePackage

function test1() {
    try {
        getAllCrawledLinks().forEach(function(link) {
            log(link.getPackage().getDownloadFolder()); // null when download path is default, otherwise works
            log(link.getDownloadPath()); // never works
        });
    } catch (ex) {
        log(ex);
    }
}

function test2() {
    getAllCrawledLinks().forEach(function(link) {
        log(link.getPackage().getDownloadFolder()); // null when download path is default, otherwise works
        log(link.getDownloadPath()); // never works
    });
}

function log(text) {
    writeFile(JD_HOME + '/testing.txt', text + getEnvironment().getNewLine(), true);
}
How I'm running it:
  • Running on 'None' trigger, as it's a work in progress (for now)
  • I run the script manually via 'Test Run' (for now)
  • As for the links, I'm testing with plain standard youtube links, but have tried others as well with the same results. Tried both single and multiple links in the same package.

Further findings/thoughts:
  • I get a more detailed error when not running in a try-catch, see comment in script. I'm not sure why, the exception doesn't seem to get caught as I get nothing in the log file.
  • Getting the download path through the package works when the download path is not your default download location. It might be intended to return null if it's the default, and the expectation is to get the default download path from settings using the API. For now, this is my workaround.
  • I'm not sure a crawled link should have "getDownloadPath()" in the first place. You can't change the download path of a link individually without changing it for the entire package. So it makes sense to me that if you want to get or set the download path, you do that via the package, not the link.
Reply With Quote
  #1925  
Old 12.10.2021, 04:31
TomNguyen TomNguyen is offline
DSL Light User
 
Join Date: Jul 2017
Posts: 33
Default

Quote:
Originally Posted by Jiaz View Post
@TomNguyen: Thank you so much for your help/time. Do you still have the postID to each script/or page? Then you could easily link the script/post directly?
I only save the name as the script can be found via search function at https://board.jdownloader.org/search...threadid=70525
I will try to update the list when new script posted by mgpai
Reply With Quote
  #1926  
Old 12.10.2021, 10:06
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,485
Default

@TomNguyen: Thanks for the followup!

@BillyCool: Thanks for the feedback. Both will be fixed with next core update.

Quote:
Originally Posted by BillyCool View Post
[*]Getting the download path through the package works when the download path is not your default download location. It might be intended to return null if it's the default, and the expectation is to get the default download path from settings using the API. For now, this is my workaround.
-> with next core update the full absolute path will be returned and no longer need to build the path for yourself



Quote:
Originally Posted by BillyCool View Post
[*]I'm not sure a crawled link should have "getDownloadPath()" in the first place. You can't change the download path of a link individually without changing it for the entire package. So it makes sense to me that if you want to get or set the download path, you do that via the package, not the link.
-> was designed that way to be able to use the same *way* for DownloadLink or CrawledLink instances. It's just a get method, there are no intentions to support setting of path
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 12.10.2021 at 10:43.
Reply With Quote
  #1927  
Old 12.10.2021, 10:51
BillyCool BillyCool is offline
Super Loader
 
Join Date: Sep 2016
Location: Australia
Posts: 28
Default

@Jiaz Cheers
Reply With Quote
  #1928  
Old 12.10.2021, 10:55
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,485
Default

@BillyCool: update will be available in about 5 minutes
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1929  
Old 12.10.2021, 13:28
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,545
Default

Quote:
Originally Posted by Jiaz View Post
@JDL1059: list of links? where does the new link come from then? is it normal text/website with links on it or how do you expect JDownloader to check for new links? more details are required in order to help/answer you
@Jiaz: What is this about? Can't seem to find related post in this thread.
Reply With Quote
  #1930  
Old 12.10.2021, 13:42
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,485
Default

@mgpai: see, https://board.jdownloader.org/showpo...postcount=1919
deleted it by accident
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1931  
Old 12.10.2021, 17:25
BillyCool BillyCool is offline
Super Loader
 
Join Date: Sep 2016
Location: Australia
Posts: 28
Default

@Jiaz Tested and confirmed working. Thanks again!
Reply With Quote
  #1932  
Old 12.10.2021, 18:44
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,485
Default

@BillyCool: Thanks for the feedback and you're welcome
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1933  
Old 13.10.2021, 19:52
Crais Crais is offline
Baby Loader
 
Join Date: Jan 2021
Posts: 6
Default

Hello folks,

Hello folks,
I would like to move a package after downloading (and automatically unpacking) to another directory, e.g. for a video download the whole folder including content.
Can anyone help me?

Reference: https://board.jdownloader.org/showthread.php?t=88774

Last edited by Jiaz; 14.10.2021 at 11:07.
Reply With Quote
  #1934  
Old 14.10.2021, 13:00
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,545
Default

Quote:
Originally Posted by Crais View Post
... move a package after downloading ...
Code:
/*
    Move extracted files
    Trigger: Archive extraction finished
*/

var source = "c:\\downloading";
var destination = "d:\\finished";

archive.extractedFilePaths.forEach(function(filePath) {
    var newFolder = filePath.parent.toString().replace(source,destination);
    filePath.moveTo(newFolder);
})
Reply With Quote
  #1935  
Old 14.10.2021, 18:16
Crais Crais is offline
Baby Loader
 
Join Date: Jan 2021
Posts: 6
Default

Unfortunately, this does not work. jD gives the error message "missing; before statement (#1)"
Reply With Quote
  #1936  
Old 15.10.2021, 09:41
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,485
Default

@Crais: Just copied/pasted and working fine here. Please make sure to copy the script only, the information in comment section is how to setup the script
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1937  
Old 16.10.2021, 07:53
BillyCool BillyCool is offline
Super Loader
 
Join Date: Sep 2016
Location: Australia
Posts: 28
Default

@Jiaz I actually found another issue with CrawledLink.getDownloadPath(). It looks like name changes do not reflect in the output. Here's a sample script with 'None' trigger:

Code:
disablePermissionChecks();

getAllCrawledLinks().forEach(function(link) {
    log("BEFORE: Download path: " + link.getDownloadPath()); // Correct
    log("BEFORE: Name: " + link.getName()); // Correct
    
    link.setName(link.getName() + ".temp");
    
    log("AFTER: Download path: " + link.getDownloadPath()); // Incorrect, still outputs old name in the download path
    log("AFTER: Name: " + link.getName()); // Correct
})

function log(text) {
    writeFile(JD_HOME + '/testing.txt', text + getEnvironment().getNewLine(), true);
}
The script simply appends ".temp" to all files in the link grabber. It logs the download path and name before and after the change. The name is updated, the download path is not. In the UI and when downloading those files, the updated name is shown/used, so no issues there. Workaround is simple, we can construct the correct download path using package folder and link name.
Reply With Quote
  #1938  
Old 17.10.2021, 06:02
JDL1059 JDL1059 is offline
Junior Loader
 
Join Date: Oct 2021
Posts: 10
Default

Quote:
Originally Posted by Jiaz View Post
@JDL1059: list of links? where does the new link come from then? is it normal text/website with links on it or how do you expect JDownloader to check for new links? more details are required in order to help/answer you

Hi Jiaz - it would be a list of links i manually input (it could be added to a textfile, or pasted into the jdownloader app itself). I'm not sure exactly the best method, but essentially say i have a list of 10 links that i would like jdownloader to check maybe once a day / week if new files have been added. Over time i would add more links to that said text file.
Reply With Quote
  #1939  
Old 18.10.2021, 09:48
schnacke schnacke is offline
Modem User
 
Join Date: Oct 2021
Posts: 3
Default

Hello i need some help,
i'm running jd2 on a docker container and filebot in another docker container, now i want to run filebot after extraction, i wrote a shell script with a ssh command.
My script is running from the command line but in jd2 i got a failure.

Thanks for help an sorry for my english
Attached Images
File Type: png script.png (12.1 KB, 1 views)
File Type: png alert_message_eventscripter.png (73.4 KB, 1 views)
Reply With Quote
  #1940  
Old 18.10.2021, 11:21
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,485
Default

@BillyCool: thanks for the report. Will be fixed with next update

@schnacke: sure you have tested that script from within your container (join container and run manually)? the error comes directly from script/environment and looks like some missing environment variables, see
superuser.com/questions/782509/unable-to-ssh-cannot-create-dev-null-ssh
stackoverflow.com/questions/27663032/boot2docker-command-works-on-shell-but-not-in-script

@JDL1059: thanks for the feedback, try to ask mgpai for help with this
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 18.10.2021 at 11:29.
Reply With Quote
  #1941  
Old 18.10.2021, 12:12
schnacke schnacke is offline
Modem User
 
Join Date: Oct 2021
Posts: 3
Default

Hey Jiaz,

this helps a lot
Quote:
Originally Posted by Jiaz View Post
superuser.com/questions/782509/unable-to-ssh-cannot-create-dev-null-ssh
I changed the home directory in /etc/passwd and now it's working.

Thanks!
Reply With Quote
  #1942  
Old 18.10.2021, 12:23
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,485
Default

Quote:
Originally Posted by schnacke View Post
Hey Jiaz,
this helps a lot
I changed the home directory in /etc/passwd and now it's working.
Thanks!
Thanks for the feedback!
Let me guess, it was /dev/null ?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1943  
Old 18.10.2021, 13:09
schnacke schnacke is offline
Modem User
 
Join Date: Oct 2021
Posts: 3
Default

Yes you're right
Reply With Quote
  #1944  
Old 20.10.2021, 22:03
Bilkoff Bilkoff is offline
Junior Loader
 
Join Date: Sep 2019
Posts: 10
Default

Is it possible to count the number of files in a local folder?

EDIT: Like 3h searching and after 5 minutes of posting I found it:
Code:
var folder = getPath("C:\\folder\\");
alert(folder.getChildren().length);

Last edited by Bilkoff; 20.10.2021 at 22:18.
Reply With Quote
  #1945  
Old 21.10.2021, 08:26
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,545
Default

@Bilkoff: The array returned by that method can include both files and folders. isFile() and isDirectory() methods can be used to check the type of object in that array.
Reply With Quote
  #1946  
Old 21.10.2021, 19:04
reddy.shyam reddy.shyam is offline
Fibre Channel User
 
Join Date: Aug 2013
Posts: 123
Default

Quote:
Originally Posted by TomNguyen View Post
As I went through all pages the other day, I have made a list of event scripts created by @mgpai. It seems can be a temp index. Hope this helps.
Thanks @TomNguyen for all the hardwork. We appreciate it!
Reply With Quote
  #1947  
Old 21.10.2021, 19:07
reddy.shyam reddy.shyam is offline
Fibre Channel User
 
Join Date: Aug 2013
Posts: 123
Default

Hi @mgpai, can you help me with script to download files at random with all the other conditions in tact i.e. total number of downloads, no of downloads per host etc... please?
Reply With Quote
  #1948  
Old 22.10.2021, 04:25
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,545
Default

Quote:
Originally Posted by reddy.shyam View Post
... download files at random
Code:
/*
    Randomize download order
    Trigger: Download controller started
*/

var index, priorities = ["HIGHEST", "HIGHER", "HIGH", "DEFAULT", "LOW", "LOWER", "LOWEST"];

getAllDownloadLinks().forEach(function(link) {
    if (!link.finshed) {
        index = Math.floor(Math.random() * priorities.length);
        link.priority = priorities[index];
    }
})
Reply With Quote
  #1949  
Old 22.10.2021, 09:49
reddy.shyam reddy.shyam is offline
Fibre Channel User
 
Join Date: Aug 2013
Posts: 123
Default

Quote:
Originally Posted by mgpai View Post
Code:
/*
    Randomize download order
    Trigger: Download controller started
*/

var index, priorities = ["HIGHEST", "HIGHER", "HIGH", "DEFAULT", "LOW", "LOWER", "LOWEST"];

getAllDownloadLinks().forEach(function(link) {
    if (!link.finshed) {
        index = Math.floor(Math.random() * priorities.length);
        link.priority = priorities[index];
    }
})
Wow! Thanks @mgpai! That was quick! Really appreciate it!

From what I understand of the code, this will just effect what the container holds when the download controller is started and does not include the new links added after the trigger is started. Isn't it?

Edit: I have also added the same script to Trigger "LinkGrabber Bottom Button Pressed". Will this do?

Last edited by reddy.shyam; 22.10.2021 at 11:02.
Reply With Quote
  #1950  
Old 22.10.2021, 11:10
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,485
Default

@mgpai: nice solution my first thought was to randomize the order of the links within the packages
@reddy.shyam: you could even use "download started" as trigger the script does not rely on any special trigger objects
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1951  
Old 22.10.2021, 11:38
reddy.shyam reddy.shyam is offline
Fibre Channel User
 
Join Date: Aug 2013
Posts: 123
Default

Quote:
Originally Posted by Jiaz View Post
@mgpai: nice solution my first thought was to randomize the order of the links within the packages
@reddy.shyam: you could even use "download started" as trigger the script does not rely on any special trigger objects
Hi @Jiaz, thanks for replying. I too assumed it would be some kind of sorting. Looks like @mgpai is altogether at a different level.

Regarding your solution, If "download started" trigger means every time a new download starts, then don't you think "LinkGrabber Bottom Bar Button Pressed" is better? With "Download started" the list gets re-sorted everytime a new download begins irrespective of new links added or not but with "LinkGrabber Bottom Bar Button Pressed" trigger, re-sorting is done only when new links are added.

Is my understanding wrong?
Reply With Quote
  #1952  
Old 22.10.2021, 11:51
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,485
Default

@reddy.shyam: the list is not sorted but the links priorites are getting changed and thus the download core redo the *what to download next* calculations with each new download.
"LinkGrabber Bottom Bar Button Pressed" -> you will have to add a script/action to the button bar for this to work. It's not about new links added. You can customize the buttom bar with custom actions and then assign scripts to them.
You could also use "Download stopped" to only re-prioritize them when a download stopps
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1953  
Old 22.10.2021, 12:16
reddy.shyam reddy.shyam is offline
Fibre Channel User
 
Join Date: Aug 2013
Posts: 123
Default

Quote:
Originally Posted by Jiaz View Post
@reddy.shyam: the list is not sorted but the links priorites are getting changed and thus the download core redo the *what to download next* calculations with each new download.
"LinkGrabber Bottom Bar Button Pressed" -> you will have to add a script/action to the button bar for this to work. It's not about new links added. You can customize the buttom bar with custom actions and then assign scripts to them.
You could also use "Download stopped" to only re-prioritize them when a download stopps
Thanks @Jiaz, I see what you mean. In that case, "Download starts"/"Download stops" seems better idea than "Download controller started". I feel "Download starts" better option because if we use "Download stops" there might be performance impact of setting the priority before another download begins. Isn't it?
Reply With Quote
  #1954  
Old 22.10.2021, 12:25
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 71,047
Default

@mgpai
lol creative solution
__________________
JD Supporter, Plugin Dev. & Community Manager

Erste Schritte & Tutorials || 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?
Reply With Quote
  #1955  
Old 22.10.2021, 12:33
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,485
Default

Quote:
Originally Posted by reddy.shyam View Post
there might be performance impact of setting the priority before another download begins. Isn't it?
doesn't matter if before or after, it's the same
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1956  
Old 22.10.2021, 13:07
reddy.shyam reddy.shyam is offline
Fibre Channel User
 
Join Date: Aug 2013
Posts: 123
Default

Quote:
Originally Posted by Jiaz View Post
doesn't matter if before or after, it's the same
Thanks @Jiaz. Will do a 'inky pinky ponky' and pick up.
Reply With Quote
  #1957  
Old 25.10.2021, 12:38
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,485
Default

@reddy.shyam: You're welcome. Whenever you need help, just ask
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1958  
Old 28.10.2021, 00:00
tb21 tb21 is offline
Junior Loader
 
Join Date: Oct 2021
Posts: 14
Question How to read Archive Extractor setting?

Hi folks! o)

A quick question, how do I get the following boolean setting by script?
"Archive Extractor -> Extract archives after download"
(Attached image also shows what setting I am looking for.)

I can't find the key for the setting anywhere on github or config files of JD.

I was able to find correct api, storage and key strings for other settings like:
"Archive Extractor -> Enabled"
"Archive Extractor -> Extract to following folder"
"Archive Extractor -> Extract to.."

Any help appreciated! Thank you! o)
Attached Images
File Type: png jdown_settings.png (54.6 KB, 1 views)
Reply With Quote
  #1959  
Old 28.10.2021, 00:05
dawebbreb dawebbreb is offline
Baby Loader
 
Join Date: Oct 2021
Posts: 8
Default

Hi mgpai,

I was referred over by Jiaz from another thread, do you have a script available that can enable or disable "Silent Mode" (or Settings->Advanced Settings->SoundSettings.captchasoundenabled) on a time basis.

Basically I want to stop the captchas from waking up the entire household while everyone's asleep.
Reply With Quote
  #1960  
Old 28.10.2021, 00:35
tb21 tb21 is offline
Junior Loader
 
Join Date: Oct 2021
Posts: 14
Default

It can be done by an "Interval" event script (once a minute e.g.).

I would suggest lowering the volume of the whole system though, as other applications could make weird sounds as well, it may be easier for you as well, if you can't write scripts (yet).

There is a tool called "nircmd.exe" out there, create a scheduled task and run it at bed time start to bring the volume down.
>nircmd.exe setvolume 0 0 0
Create another scheduled task to bring volume back to normal.
>nircmd.exe setvolume 0 65535 65535

Nircmds setvolume reference here: nircmd.nirsoft.net/setvolume.html
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 11: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.