JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #41  
Old 09.03.2017, 05:14
umax umax is offline
Mega Loader
 
Join Date: Nov 2014
Posts: 68
Default How to suppress dialogs?

How do I suppress and auto-OK dialogs like this one:
"You are trying to add links that are already in your download list" (Yes, i do)
Reply With Quote
  #42  
Old 09.03.2017, 12:32
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,236
Default

You have to change value in Settings-Advanced Settings-LinkgrabberSettings.defaultonaddeddupeslinksaction
LinkgrabberSettings.handledupesonconfirmlatestselection
__________________
JD-Dev & Server-Admin
Reply With Quote
  #43  
Old 09.03.2017, 16:17
umax umax is offline
Mega Loader
 
Join Date: Nov 2014
Posts: 68
Default

Thanks, that worked!

Now I have another annoying dialog to deal with:
Event Scripter permissions required!
[...]The script tries to call the remote API[...]


The window has a checkbox in the lower left ("Don't show this again") but keeps popping up.
I crawled through the "advanced settings" and could not find a solution.
Reply With Quote
  #44  
Old 10.03.2017, 13:57
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,236
Default

The question dialog will show up for each api method once/script. You can use the *don't show again* checkbox.
At the moment there is no generic *disable permission dialogs*
__________________
JD-Dev & Server-Admin
Reply With Quote
  #45  
Old 10.03.2017, 15:16
umax umax is offline
Mega Loader
 
Join Date: Nov 2014
Posts: 68
Default

Again, thanks for you answer!

I am working on a script that checks the recording of an audio-stream - the api calls are only made when there is an interruption in that stream.
My script is intended to work even when I am not in front of the computer and it already works quite well.

Of course, my script does not work AT ALL when those dialogs pop up and wait for confirmation.
You said "the question dialog will show up for each api method once/script"... does that mean, I cannot even make dummy-calls to all needed api methods when jDownloader starts ("JDownloader started"), because that would be from a different script?
Uh...that is very bad news!

It would be very helpful being able to set the properties of a certain script to "permanently disable all permission dialogs".

As a side note:
The examples shown here were very helpful to me. My questions as a newbie seem basic, I was searching for their answers via google and could only find single messages between different topics.
is there an "event scripter discussion page/forum"?
Reply With Quote
  #46  
Old 10.03.2017, 15:28
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,236
Default

JDownloader asks permission for every api call or file access. You don't want to import a script from someone without checking it and voila, it sends personal data to somewhere else and then formats your computer That's why you have to *agree* every such action and there is a *don't show again' checkbox. I will add a script based *grant all* checkbox soon.

There is no specific thread for eventscripter Just open new thread and ask. You may also contact mgpai, he is very talented, a true eventscript master
__________________
JD-Dev & Server-Admin
Reply With Quote
  #47  
Old 10.03.2017, 20:27
BloodyRain2k
Guest
 
Posts: n/a
Default

Could someone give me an example on how I would go about adding self crawled links to the Link Grabber results?

The basic idea is to work around where there's no plugin for a site so I can write a script instead that goes through there and finds them.
I know enough JS for that and I found the right trigger that gets fired when you copy a link with clipboard monitoring.
The only thing I don't know is how to package them up and add them to the list : /

Probably with callAPI() I guess?
Reply With Quote
  #48  
Old 10.03.2017, 21:16
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,529
Default

Have you tried creating 'linkcrawler rules'? It can be used to automatically grab links from sites which do not have dedicated plugins. You can find example rules in the forum.

If you wish to add links using event scripter, you can use my.jdownloader API call
Code:
callAPI("linkgrabberv2", "addLinks", {AddLinksQueryStorable});
e.g.
Code:
callAPI("linkgrabberv2", "addLinks", {
    "links": "https://board.jdownloader.org/images/logo.png http://jdownloader.org/lib/tpl/arctic/images/logo.png",
    "packageName": "Jdownloader Images"
})
my.jdownloader API Doc
Code:
**External links are only visible to Support Staff**
Reply With Quote
  #49  
Old 10.03.2017, 21:42
BloodyRain2k
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by mgpai View Post
Have you tried creating 'linkcrawler rules'? It can be used to automatically grab links from sites which do not have dedicated plugins. You can find example rules in the forum.

If you wish to add links using event scripter, you can use my.jdownloader API call
Code:
callAPI("linkgrabberv2", "addLinks", {AddLinksQueryStorable});
e.g.
Code:
callAPI("linkgrabberv2", "addLinks", {
    "links": "https://board.jdownloader.org/images/logo.png http://jdownloader.org/lib/tpl/arctic/images/logo.png",
    "packageName": "Jdownloader Images"
})
Have not because I didn't know that's a thing but this example looks very like what I was missing :D
I'll try both though, if I can remember which site I needed it for...

But I'm happy that I now have the means to finally get around that if I encounter it again, it bothered me so much in the past :x
Reply With Quote
  #50  
Old 11.03.2017, 20:04
fred_gaou's Avatar
fred_gaou fred_gaou is offline
DSL User
 
Join Date: Mar 2016
Location: France
Posts: 39
Post LINK NAME CLEANER (auto)

Hi,

Here is a script to help you to auto clean/format filename during the link grabbing process. This is done automatically in background for each added link.

You can set some options at the top of the script.

This is useful in any case as soon as you notice a recurring pattern in your filenames that you'll want to get rid of or format.

if you set custom filename for video files such as:
Code:
[*CHANNEL*] (*PLAYLIST_NAME* *PLAYLIST_POSITION[00]*) *DATE[YY.MM.dd]* - *VIDEO_NAME*.*EXT*
it will be perfect for playlist but not for one video file only because then you will end with a filename with empty brackets:
Code:
[Any Youtuber Channel] ( ) 17.03.11 - Video Title
This script will take care of it removing those bracket:
Code:
[Any Youtuber Channel] 17.03.11 - Video Title
Code:
// LINK NAME CLEANER (auto)
// Trigger required: Packagizer Hook
// Version 2017.11.14
/* *************************************************************************
Set the characters that will be removed from both ends of the filename.
Be sure to double escape special chars such as "\\s" instead of "\s".
****************************************************************************/

var leadAndTrailTrimChars = "\\s-_";

/* *************************************************************************
Set the characters that will be replaced with whitespace.
Be sure to double escape special chars such as "\\s" instead of "\s".
****************************************************************************/

var charToSpace = "_";

/* *************************************************************************
Set the words or phrases to remove. Words/phrases must be separated with | such as
"word one|word two|word three"
Be sure to double escape special chars such as "\\s" instead of "\s".
****************************************************************************/

var wordsToRemove = "avec sous-titres";

/***************************************************************************/

if (linkcheckDone) {


    /* =========================== INITIALIZE ============================ */

    var myPackagizerLink = link;
    var fileName = myPackagizerLink.getName();
    var re, ext;

    // Remove the extension from the end and save it for later.
    // And make it lower case at the same time.
    ext = fileName.slice((fileName.lastIndexOf(".") - 1 >>> 0) + 2);
    if (ext !== "") {
        ext = "." + ext.toLowerCase();
    }

    // If extension exists, then we will work with the filename without extension
    fileName = fileName.substr(0, (fileName.length - ext.length));

    /* ========================= REGEX PATTERNS ========================== */

    // Remove these words/phrase : wordsToRemove
    re = new RegExp("\\b(?:" + wordsToRemove + ")\\b", "gi");
    fileName = fileName.replace(re, "");

    // Replace these characters with whitespace : charToSpace
    re = new RegExp("[" + charToSpace + "]", "gi");
    fileName = fileName.replace(re, " ");

    // Delete empty bracket content. "( )", "[ ]" or "{ }" will be removed from filename.    
    re = new RegExp("(\\(\\s+?\\))|(\\[\\s+?\\])|({\\s+?})", "gi");
    fileName = fileName.replace(re, "");

    /* ====== ALWAYS APPLY NEXT REPLACEMENTS AT THE END OF PROCESS ======= */

    // Replace & with &
    re = new RegExp("&", "gi");
    fileName = fileName.replace(re, "&");

    // Remove unwanted characters from both ends of the filename
    re = new RegExp("^[" + leadAndTrailTrimChars + "]*(.+?)[" + leadAndTrailTrimChars + "]*$", "gi");
    fileName = fileName.replace(re, "$1");

    // Replace multiple spaces with only one
    re = new RegExp("\\s\\s+", "gi");
    fileName = fileName.replace(re, " ");

    // Removes whitespace from both ends of the filename (just to be sure)
    fileName = fileName.trim();

    /* ====== APPLY NEW FILE NAME ======= */
    myPackagizerLink.setName(fileName + ext);
}

Last edited by fred_gaou; 14.11.2017 at 22:42. Reason: bug fix
Reply With Quote
  #51  
Old 18.03.2017, 16:56
infkeops infkeops is offline
Super Loader
 
Join Date: Aug 2010
Posts: 29
Default

1) How to set comments based on filenames in downloadlist context menu before starting package download

2) How to set filenames based on comments after finished downloading the links

I have a lot of links that change their name once the download starts and I want to keep them.
Reply With Quote
  #52  
Old 20.03.2017, 01:38
userking
Guest
 
Posts: n/a
Default

hi i look for a script that start my downloads maybe at 9pm and disable if not finished with downloads at 6 am
Reply With Quote
  #53  
Old 20.03.2017, 01:42
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,659
Default

@userking
no need for event scripter, use the scheduler. That's its intended purpose.
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #54  
Old 20.03.2017, 09:46
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,529
Default

Quote:
Originally Posted by infkeops View Post
... I have a lot of links that change their name once the download starts ...
@infkeops,
Please provide example links of hosts where this happens. If it is plugin issue, the developers might be able to look into it. If the ideal solution happens to be a script, I will be happy to help you with it.
Reply With Quote
  #55  
Old 21.03.2017, 02:58
infkeops infkeops is offline
Super Loader
 
Join Date: Aug 2010
Posts: 29
Default

Turned out to be the same problem with the host that I also have reported. Since they were old links I did not think it had anything to do.

Although if is not a lot of work for you I'm still interested in the way a script could handle this situation. It would be helpful to learn and perhaps use for other situations in the future.

Thanks in advance mgpai
Reply With Quote
  #56  
Old 21.03.2017, 12:08
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,529
Default

Quote:
Originally Posted by infkeops View Post
... I'm still interested in the way a script could handle this situation ...
Please PM some example links to me.
Reply With Quote
Old 22.03.2017, 14:11
infkeops
Message deleted by Jiaz.
  #57  
Old 22.03.2017, 14:15
infkeops infkeops is offline
Super Loader
 
Join Date: Aug 2010
Posts: 29
Default

Like I said, now, the problem doesn't exist anymore. When I start the downloads the names remain like it should. But before that, with the attached version of the hoster plugin the names change.

1) Add the links with current version

**External links are only visible to Support Staff****External links are only visible to Support Staff**
**External links are only visible to Support Staff****External links are only visible to Support Staff**
**External links are only visible to Support Staff****External links are only visible to Support Staff**
**External links are only visible to Support Staff****External links are only visible to Support Staff**
**External links are only visible to Support Staff****External links are only visible to Support Staff**
**External links are only visible to Support Staff****External links are only visible to Support Staff**

2) Close the program and change the hoster plugin in order to reproduce the behaviour

3) Restart and then start the downloads or check online availability and now the filenames are changed to

2496786.mp3
2496802.mp3
2496828.mp3
17511121.mp3
17458463.mp3
17364599.mp3

If this was the situation it's easy to rename six files, but for 70-80 per package... So, if it happens again, I thought copy the "desired" filenames to the comment field and when the downloads are finished rename them, the whole package, using that information. E.g.:

Filename: La nit de l'ornitorinc 291013 (1 de 3).mp3
Comment:

copy filename to comment

Filename: La nit de l'ornitorinc 291013 (1 de 3).mp3
Comment: La nit de l'ornitorinc 291013 (1 de 3).mp3

After download

Filename: 2496786.mp3
Comment: La nit de l'ornitorinc 291013 (1 de 3).mp3

copy comment to filename

Filename: La nit de l'ornitorinc 291013 (1 de 3).mp3
Comment: La nit de l'ornitorinc 291013 (1 de 3).mp3
Reply With Quote
  #58  
Old 22.03.2017, 17:05
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,529
Default

@infkeops,

Code:
// Set filename as comment
// Trigger: "Packagizer Hook"

if (link.getHost() == "ivoox.com") {
    link.setComment(link.getName());
}
Code:
// Set comment as file name
// Trigger: "A Download Stopped"

if (link.isFinished() && link.getHost() == "ivoox.com" && link.getName() != link.getComment()) {
    link.setName(link.getComment());
}
Reply With Quote
  #59  
Old 28.03.2017, 01:08
Tyler Tyler is offline
JD Legend
 
Join Date: Jul 2010
Posts: 582
Default

Quote:
Originally Posted by mgpai View Post
Code:
// Auto stop/restart downloads if the current average speed is below limit.
// Trigger Required: "Interval"

var minSpeed = 128; // (KiB/s) <- minimum average download Speed.
var minDuration = 1; // (minutes) <- minimum download duration per link.
var waitTime = 1; // (minutes) <- wait time before restart.

if (running() && getAverageSpeed() < minSpeed * 1024) {
    stopDownloads();
    sleep(waitTime * 60 * 1000);
    startDownloads();
}

// Check if all downloads have been running for atleast the minimum duration.
function running() {
    var links = getRunningDownloadLinks();
    if (links.length > 0) {
        for (i = 0; i < links.length; i++) {
            var link = links[i];
            if (link.getDownloadDuration() < minDuration * 60 * 1000) {
                return false;
            }
        }
        return true;
    } else {
        return false;
    }
}
mgpai could you modify that script for individual links?

like say one link is downloading at 128kb\s leave that alone, but if another is downloading at 50kb/s have it stopped and then started.
Reply With Quote
  #60  
Old 29.03.2017, 07:11
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,529
Default

Quote:
Originally Posted by Tyler View Post
... one link is downloading at 128kb\s leave that alone, but if another is downloading at 50kb/s have it stopped and then started.
Code:
// Stop and restart slow links.
// Trigger Required: "Interval" (Recommended: 30000 or more).
// IMPORTANT: Enable "Synchronous execution of script" (checkbox).

var minSpeed = 128; // (KiB/s) <- minimum download speed per link.
var minDuration = 1; // (minutes) <- minimum download duration per link.

var links = getRunningDownloadLinks();

for (i = 0; i < links.length; i++) {
    var link = links[i];
    if (link.getDownloadDuration() < minDuration * 60 * 1000) continue;
    if (link.getSpeed() > minSpeed * 1024) continue;
    link.abort();
}
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 12: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 - 2024, Jelsoft Enterprises Ltd.