JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 22.03.2021, 07:19
plaintext plaintext is offline
BugMeNot Account
 
Join Date: Sep 2016
Posts: 241
Default [EventScripter] Filter download list with file_size/video_length "on the go"

Hello,
I have a lot of files in my downloadlist. I have fast link check enabled, so the file sizes are not visible until i perform link check or start the download. (And I do not want to perform link check first, bcos it will take a long time, instead i would like to filter while downloading.)

I would like to filter the download list by file size, and only download files less than, say 20mb.

Is there a way to filter on-the-go? If not would you be open to adding it.

Basically, i want to be able to just set the file size limit somewhere, then start the download, it will perform the linkcheck and get the file size, if the file size is less than the threshold it will be downloaded, otherwise the file will be disabled/skipped (not deleted).

If possible, i would also like this to work with video lengths. So, i can set up the filter -
file.size < 20mb || video.length < 5min
(here i am using || because I assume that it will only be possible to get video length from some hosts and not all, so in that case file.size would work.)
Reply With Quote
  #2  
Old 22.03.2021, 14:10
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 59,285
Default

Eventscripter -> Interval script that checks all running downloads and aborts/skips them on certain conditions

-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
  #3  
Old 22.03.2021, 14:37
plaintext plaintext is offline
BugMeNot Account
 
Join Date: Sep 2016
Posts: 241
Default

I came up with this

(function() {
if (!getRunningDownloadLinks().length) return;

var bytesLoaded = 0;

getAllDownloadLinks().forEach(function(link) {
if(!link.isFinished() && link.getBytesLoaded() > 0 && link.getBytesTotal() >= 10*1024*1024) link.setSkipped(true);
});
})();

Can it be simplified or optimized?
Reply With Quote
  #4  
Old 22.03.2021, 15:02
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,341
Default

Code:
/*
    Trigger : A Download Started
*/

while (link.isRunning() && link.getBytesTotal() == -1) {
    sleep(1000);
}

if (link.getBytesTotal() >= 1024 * 1024 * 20) {
    link.setEnabled(false);
}
Reply With Quote
  #5  
Old 23.03.2021, 05:15
plaintext plaintext is offline
BugMeNot Account
 
Join Date: Sep 2016
Posts: 241
Default

Quote:
Originally Posted by mgpai View Post
Code:
/*
    Trigger : A Download Started
*/

while (link.isRunning() && link.getBytesTotal() == -1) {
    sleep(1000);
}

if (link.getBytesTotal() >= 1024 * 1024 * 20) {
    link.setEnabled(false);
}

Thank you
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 21:23.
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 - 2021, Jelsoft Enterprises Ltd.