JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1741  
Old 07.06.2021, 23:10
A-Dude A-Dude is offline
I will play nice!
 
Join Date: Jun 2021
Posts: 3
Default

So today there was an update and the script works fine.

There where two downloads running, first with 25 minutes left and second with 5h 20 min. After the first download was completed, no more download started. The second download was resumable, i stoped it manualy and after some minutes jdownloader did the restart.

How i understand the script, it starts every 10 minutes and if there an update it remove stopmarks and set new once.

And there is my new modification wish. Is it possible after setting stopmarks, to check if the running downloads are resumable, when yes -> stop downloads do the restart?
Reply With Quote
  #1742  
Old 08.06.2021, 13:07
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 71,503
Default

Quote:
Originally Posted by A-Dude View Post
How i understand the script, it starts every 10 minutes and if there an update it remove stopmarks and set new once.
It only sets a new stopmark if none set yet.

Quote:
Originally Posted by A-Dude View Post
And there is my new modification wish. Is it possible after setting stopmarks, to check if the running downloads are resumable, when yes -> stop downloads do the restart?
Should be possible but always keep in mind that this could also mean *loosing* a captcha. Maybe you've solved a captcha just to see JDownloader 2 mins later
to update itself and ask again for a new captcha in my opinion I would just let the running downloads finish and then update JD
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1743  
Old 11.06.2021, 14:47
VanTuz VanTuz is offline
Mega Loader
 
Join Date: Oct 2018
Posts: 64
Default

How to make it so that when downloading from e-hentai fails, a reconnection is automatically started, and then the download of files is restarted?
Reply With Quote
  #1744  
Old 11.06.2021, 15:01
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 71,503
Default

@VanTuz: Why does the download fail? Can you provide a log? Sounds more like we should check/fix the plugin
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1745  
Old 11.06.2021, 15:15
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 58,084
Default

@VanTuz
This is probably not related to our EventScripter feature.
Please post your request via separate thread in this subforum or use older threads related to e(x)hentai e.g. this one.

-psp-
__________________
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?
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
  #1746  
Old 19.06.2021, 15:14
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 100
Default

Goodmorning everyone.

1)

I am using the script to automatically rename the files suggested to me in this topic at the time, and I have noticed that every now and then a file is "skipped"; [I solved it by creating a duplicate of the script commanded by "button"] , but, on a curiosity level, you can write a command inside the script to tell it like "run me N times in a row" ?


2)
is feasible a script (perhaps better by button) which:
-set interrupted - unfinished downloads to "resume"
-start the download
(and do it N times , at each time interval at the end of the download ?)


or a script that at the end of the download of the links of all the packages (not file by file) :
- find if there are interrupted / unfinished downloads
- If Yes --> set then to "resume"
-start the download.


rereading it seems a bit strange speech, but I hope you can understand what I meant.
Reply With Quote
  #1747  
Old 19.06.2021, 15:48
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,263
Default

Quote:
Originally Posted by BJN01 View Post

1)
... you can write a command inside the script to tell it like "run me N times in a row" ?
Can you post the script, or if it is in the forum, a link to it?

Quote:
2)
.. is feasible a script ... set interrupted - unfinished downloads to "resume" ...?
By default JD will retry all pending download for as long/as many times as possible. If for any reason the downloads fail, it will be skipped with relevant status message and only then the download controller will be stopped.

What kind of status messages are displayed for the failed/interrupted downloads?
Reply With Quote
  #1748  
Old 19.06.2021, 17:55
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 100
Default

1) the script is based on this :
https://board.jdownloader.org/showpo...postcount=1155 (page 58 , post n #1155)
but with:
- trigger "Hook packaging"
- change both by name of individual files and by packages
and it's something similar to this:

Spoiler:

Code:
/--------------------------------------------------------
// <Clean Names> ( file + package)
// Trigger: packaged Hook
//
// For Name Of the Package (PACKAGENAME)
//
disablePermissionChecks();
if (name = CupPH = "Clean-up packagenames Hook") {
    getAllCrawledPackages().forEach(function(package) {
        var curName = package.getName();
        var newName = curName;
        var replace = function(find, replace) {
            newName = newName.replace(find, replace);
        }

        replace("-Vol ","-V0");
        replace("Ch ","Ch");
        replace("-Chapter ","-Ch");
        replace("Ch_","Ch");     
        
        
 replace("chapter ","Ch");      
        replace("&amp;","e");
//... omiss..
        replace("&ndash;","-");
        replace("I Can&rsquo;t","I Can't");
//... omiss...
        replace("Won&rsquo;t","Won t");
        replace("Didn&rsquo;t","Didn t");
        replace("I&rsquo;m ","I m ");
        replace("King&rsquo;s","King s");
//.....omisss....
        replace("Chapter_Chapter","Ch");
        replace("ChCh","Ch");
       
        replace("--","-");
        //.....omisss.....
        replace("☆ ",""); 
        replace("【","["); 
        replace("】","]"); 
        replace("①",""); 
        replace(/[~]/g,"-");
        replace(/["]/g," ");
        replace(/[❤:/\*%^°]/g," "); 
        replace("&quot;","");
        replace("《","["); 
        replace("》","]"); 
        replace("「","["); 
        replace("」","]"); 


        if (curName != newName) package.setName(newName);
    })
}
//
// For the name of the file (FILENAME)
//
if (name = CupFH = "Clean-up filenames Hook") {
    getAllCrawledLinks().forEach(function(fileName) {
        var curName = fileName.getName();
        var newName = curName;
        var replace = function(find, replace) {
            newName = newName.replace(find, replace);
        }

        replace("Ch_","Ch");
       //.....omisss.... 
        replace("chapter ","Ch");
        replace("Chapter ","Ch");
        replace(" -Page_","-Page_"); 
        replace(" -Page_h","-Page_");    
            
        
        replace("☆ ","");     
        replace("&amp;","e");
        replace("I Can&rsquo;t","I Can't");
        replace("I&rsquo;m ","I m ");
        replace("King&rsquo;s","King s");
        replace("Chapter_Chapter","Ch");
        //....omiss example ....
        replace("【","["); 
        replace("】","]"); 
        replace("①",""); 
        replace(/[~]/g, "-");
        replace(/["]/g, " ");
        replace(/[❤:/\*%^?<>°]/g, ""); 
        replace("&quot;", "");
        replace("《","["); 
        replace("》","]"); 
        replace("「","["); 
        replace("」","]"); 


        if (curName != newName) fileName.setName(newName);
    })

}


as I said, I solved the "problem" by creating a copy of the scipt combined with "pressed toolbar button" trigger , and clicking on the associated button, the files that are "skipped" from time to time are renamed.


I imagine that if I write a command N times in the script this order is executed N times, but since the "lines" << replace ("AAA", "aaa"); >> are many, the script would become very long , and I would end up getting lost in it to insert other voices.

But could there be some simple lines to add at the end of the script to "double" the effect?

Code:
disablePermissionChecks();
if (name = CupPH = "Clean-up packagenames Hook") {
    getAllCrawledPackages().forEach(function(package) {
        var curName = package.getName();
        var newName = curName;
        var replace = function(find, replace) {
            newName = newName.replace(find, replace);
        }
        replace("-Vol ","-V0");
//..omiss other replace
        if (curName != newName) package.setName(newName);
    })
}

if (name = CupFH = "Clean-up filenames Hook") {
    getAllCrawledLinks().forEach(function(fileName) {
        var curName = fileName.getName();
        var newName = curName;
        var replace = function(find, replace) {
            newName = newName.replace(find, replace);
        }

        replace("Ch_","Ch");
       //.....omisss.... 
        if (curName != newName) fileName.setName(newName);
    })

}

*** repeat "N" times, or
*** execute function "CupFH", execute function "CupPH"



2) yes , after the skipped the dowload stop/end and we have the message of error for the file skipped .

I recently had some skipped files with "file not found" error ;
the files actually exist, but Cloudflare (without captcha) has a hand in it.
But I found that if I set "resume" and restart the dl they are downloaded
(with "restart" the filename changes, it doesn't go through the above script ... and it bothers me).

So I wonder if you can write a script that (at time intervals (e.g. 1 minute)), If detects skipped files :
-set then to "resume"
-start the download.
(a defined number of times (otherwise you risk an infinite loop))
-it there aren't skipped file --> do nothing
Reply With Quote
  #1749  
Old 19.06.2021, 18:43
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,263
Default

Quote:
Originally Posted by BJN01 View Post
... as I said, I solved the "problem" by creating a copy of the scipt combined with "pressed toolbar button" trigger , and clicking on the associated button ...
The original script was for button pressed, so it requires a name check. If you are using it with packagizer hook, that is not required. Also your button pressed script contains errors. You should use the comparison operator (==), not "=" sign which assigns a value.

Your rename skipping can be most likely solved with a single script with some modifications. I will need more info on your current scripts/triggers. Find me in JD Chat when you are free:

Code:
kiwiirc.com/nextclient/irc.freenode.net/#jdownloader

Quote:
... a script that ... detects skipped files ... set then to "resume" ... start the download.
Code:
/*
    Resume offline links
    Trigger: Download Controller Stopped
*/

var started = false;
    
getAllDownloadLinks().forEach(function(link) {
    
    if (link.finalLinkStatus == "OFFLINE") {

        if (!started) {
            startDownloads();
            started = true;
        }

        link.resume();
    }
})

An interval trigger might not be suitable for this use case. While this script runs only when download controller is stopped, it can result in a loop if the files are permanently offline. Can avoid it by using additional check for only those hosts which are affected by the problem described by you.

Last edited by mgpai; 19.06.2021 at 19:24. Reason: Variable was inside the loop. Moved it outside.
Reply With Quote
  #1750  
Old 21.06.2021, 07:03
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,263
Default

Quote:
Originally Posted by BJN01 View Post
But could there be some simple lines to add at the end of the script to "double" the effect?
I couldn't quite understand at first what you meant by skipped. You can use this script to replace all occurrences of a string in the file/package names, with a single click.

Code:
/*
    Cleanup names
    Trigger : Toolbar button pressed
*/

if (name == "Cleanup packagenames") {
    getAllCrawledPackages().forEach(function(i) {
        var replace = function(a, b) {
            i.name = i.name.split(a).join(b);
        }

        replace("-Vol ", "-V0");
    })
}

if (name == "Cleanup filenames") {
    getAllCrawledLinks().forEach(function(i) {
        var replace = function(a, b) {
            i.name = i.name.split(a).join(b);
        }

        replace("Ch_", "Ch");
    })
}
Reply With Quote
  #1751  
Old 25.06.2021, 21:19
Far Far is offline
I will play nice!
 
Join Date: Jun 2021
Posts: 2
Default

Great scripts here, very useful, thanks to all contributors!
Reply With Quote
  #1752  
Old 28.06.2021, 00:34
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 100
Default

@ mgpai
sorry for the late answer , I had unforeseen commitments and didn't have time to try to contact you.

1) x Resume offline links script :

for now I used the code you indicated but with trigger "toolbar button pressed" (I added a button in the toolbar)
Spoiler:

Code:
//Resume offline links and start DL
//trigger: toolbar button pressed
//name scipt =Resume Skipped And DL
//add button "event script" in toolbar and select this script 

var started = false;
    
getAllDownloadLinks().forEach(function(link) {
    
    if (link.finalLinkStatus == "OFFLINE") {

        if (!started) {
            startDownloads();
            started = true;
        }

        link.resume();
    }
})


I tried it and it works. (For what I have to do I have seen that it is enough for now). thanks.
For the trigger "Download Controller Stopped" you have to using additional check for specific hosts , but I don't know how to set them up and probably would be overkill for now.


2) <<...script to automatically rename the files ... every now and then a file is "skipped">>

I try to explain the "phenomenon" I noticed:

- copy link
- JD find the file and hook package
- Now the script "Autorename bla bla" with trigger "packagezer hook" do is job .

So , the package and file they should all be renamed according to the written rules of the script, like :
Code:
original file --------------------------------renamed file          

bla bla bla Vol 1 chapter 55 -----> bla bla bla V01-Ch55 
-fileExample chapter 55 01.jpg--->-fileExample ch-55_01.jpg
-fileExample chapter 55 02.jpg--->-fileExample ch-55_02.jpg
-fileExample chapter 55 03.jpg--->-fileExample ch-55_03.jpg
-fileExample chapter 55 XX.jpg--->-fileExample ch-55_XX.jpg
as I said, the process works perfectly 99% of the time , every now and then a file is "skipped" like this :
Code:
bla bla bla Vol 1 chapter 55 -----> bla bla bla V01-Ch55 
-fileExample chapter 55 01.jpg--->-fileExample ch-55_01.jpg
-fileExample chapter 55 02.jpg--->-fileExample ch-55_02.jpg
-fileExample chapter 55 03.jpg--->-fileExample chapter 55 03.jpg
-fileExample chapter 55 XX.jpg--->-fileExample ch-55_XX.jpg
As I said, I solved the "problem" by creating a copy of the scipt with "pressed toolbar button" trigger + button in toolbar ( and clicking on the associated button, the files that are "skipped" from time to time are renamed)

I would have thought about duplicating the script in order to have a "double" check of the names, but it seemed exaggerated ...
but if I wanted to do this test, is it possible to insert a delay in the execution of the second script?
Reply With Quote
  #1753  
Old 28.06.2021, 04:17
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,263
Default

Quote:
Originally Posted by BJN01 View Post
every now and then a file is "skipped" like this ...
As mentioned before, the original script was written for toolbar button. The 'packagizer hook' is triggered twice. The script has to be modified to run only once. Also, skipping may occur if 'synchronous execution' is disabled when you are using it with 'packagizer hook'.
Reply With Quote
  #1754  
Old 01.07.2021, 19:58
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 100
Default

@mgpai

hi, i have updates:

I have made some attempts to fix the script that renames files trying to fix "==" and the like ... but I have not had noticeable results . (most likely the corrections I should make exceed my knowledge on the subject )

BUT ...
Quote:
Also, skipping may occur if 'synchronous execution' is disabled when you are using it with 'packagizer hook'.
with the script without the corrections I have deselected (unchecked the box) at "synchronous execution"
... and problem solved ! no files are skipped.

So if everything continues to work, I'd say I've solved it for now.


p.s =
Quote:
...The 'packagizer hook' is triggered twice. ....
?? Why ?
I have only one script containing the 2 functions (file name + package name) so it should only run 1 time, or am I wrong / ignoring something I don't know?
Reply With Quote
  #1755  
Old 02.07.2021, 09:55
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 71,503
Default

@BJN01: The packagizer has two stages. One before the linkcheck, one after the linkcheck.
this event has two additional variables, "linkcheckDone" can be true/false and "state" can be "AFTER" and "BEFORE"
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1756  
Old 02.07.2021, 10:37
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,263
Default

Quote:
Originally Posted by Jiaz View Post
@BJN01: The packagizer has two stages. One before the linkcheck, one after the linkcheck.
Before and after linkcheck or before and after packagizer rules are applied? I was of the understanding that it was the latter, since linkcheckDone returns the same value (true) for both BEFORE and AFTER states, while if a package name is set/modified via packagizer rule, it is reflected only in the AFTER state and not in BEFORE state.
Reply With Quote
  #1757  
Old 04.07.2021, 10:06
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 100
Default

@Jiaz / @mgpai : thanks for the clarifications .

rereading the topic from the beginning in search of "inspiration" I found something interesting:

https://board.jdownloader.org/showpo...&postcount=191
Spoiler:
Code:
Code:
// Run external program if package contains 'pdf' file
// Trigger: "Package finished"

var pdf = package.getDownloadLinks().some(function(link) {
    return getPath(link.getDownloadPath()).getExtension() == "pdf";
});

if (pdf) {
    var downloadFolder = package.getDownloadFolder();
    var converter = "f:/downloads/files/pdfConverter.exe";
    callAsync(function() {}, converter, downloadFolder, downloadFolder, "-c", "PNG", "-p", "1", "-pd", "4x5");
}

the script started the conversion of the pdf file after the download took place using specific software indicated by the user of the time.

I would like to modify it so that when DL finished it would open the php file in notepade, and I came up with something like this:

Code:
//trigger = packaged finisched
disablePermissionChecks();/*disable permission checks*/

var php = package.getDownloadLinks().some(function(link) {
    return getPath(link.getDownloadPath()).getExtension() == "php"; // ex "pdf"
});

if (php) {
    var downloadFolder = package.getDownloadFolder();
    //var converter = "f:/downloads/files/pdfConverter.exe";
    var textEditor = "notepad.exe";
//callAsync(function() {}, converter, downloadFolder, downloadFolder, "-c", "PNG", "-p", "1", "-pd", "4x5");
callAsync( textEditor , "????"); // how do i indicate the file to open if the name changes every time?
}
but I get to the error:
<<error : Can't find method org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment.callAsync(string,string,st ring). >>

how do i indicate the file to open if the name changes every time?

I guess I should create a variable like "phpFile" and have something like:
Code:
var phpFile = /*  how to find  php file */
callAsync( textEditor , phpFile );
but how do I locate the file? (path and name can change every time)




2)
in the drop-down menu of the linkgrabber there is the command "open link in browser", would it be possible to open a link with notepad without downloading the file? [ like << Open link in Notepad>> or << Open as Txt> ]

I have made some attempts but I cannot indicate "the link" that notepade has to open. (p.s = I did some tests and if in notepade in the window open / file name you paste the link + enter it opens the linked file, so it should be possible ... or not? )

Code:
// trigger =linkgrabber contextmenu button pressed
disablePermissionChecks();
if (name == "Open as txt"){
   
var textEditor = "notepad.exe";

var links = lgSelection.getLinks();
var urls = [];
for (i = 0; i < links.length; i++) {
        var link = links[i];}
callAsync(textEditor ,/* ???? */ ); // how do i indicate the link of the file to open ??
//alert (/***/); //how do i indicate the link of the file to open ??
}
any suggestions please ?
Reply With Quote
  #1758  
Old 04.07.2021, 14:01
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,263
Default

Quote:
Originally Posted by BJN01 View Post
... when DL finished it would open the php file in notepade...
Code:
/*
    Open php file in text editor
    Trigger : A download stopped
*/

if (link.finished) {
    var file = getPath(link.downloadPath);

    if (file.extension == "php") {
        var editor = "notepad.exe";
        callAsync(null, editor, file);
    }
}

Quote:
Originally Posted by BJN01 View Post
... would it be possible to open a link with notepad without downloading the file? [ like << Open link in Notepad>> or << Open as Txt> ]
What do you mean by "without downloading"? Can you give an example?
Reply With Quote
  #1759  
Old 05.07.2021, 11:05
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 100
Default

@mgpai : thanks x the script, it works perfectly.

Quote:
What do you mean by "without downloading"? Can you give an example?
it's probably not technically possible, but I was thinking something like:

- copy "link / url "
- JD "find" the file
- now the file are in the linkgrabber windows (in packages, with names etc.)


-1 left mouse click on a file
-pop-up menu appears
-in there is a command: "open in browser"

this command opens a browser page with the selected link (this link remains in the linkgrabber page and the file is not downloaded to the hd)

so I was wondering if it was possible to do a similar thing but open the file in notepad (or something similar).


...but I'm afraid I understand that you need to have a physical file on the hd to open it as txt.






as an "alternative" I would also have thought to work around I would have to download a temporary copy (to be deleted) and open it after DL ... but in doing so I would "use" the link in the linkgrabber window (which would then "disappear")...

then after selecting the file and "pressing" the command in the drop-down menu (eg "Open As Txt") , the script should:
- create a copy of the link in the linkgrabber window (assuming it is possible)
- start download the "copy link" as temporary file ( in a specific directory like " temp" os similar)
- open the file as txt in notepade ( or similar , {alert(filetemp)} ?? it's possible ? ) .
-... and finally delete the "temporary" file.
....
..
...I admit that re-reading it makes less and less sense ...
....

Last edited by BJN01; 05.07.2021 at 11:10.
Reply With Quote
  #1760  
Old 05.07.2021, 11:39
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,263
Default

Quote:
Originally Posted by BJN01 View Post
... open the file in notepad (or something similar)
Are they direct links?
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 18:27.
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.