JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1801  
Old 03.08.2021, 21:16
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 113
Default

done, but it doesn't work, it doesn't do anything.

to get something I have to insert the replace + below, after "if" , where I left the <//.....> in the code posted ...
and I have the feeling that in that position you modify all the links, not just the ones that interest me.

could I have misinterpreted the chain between "if ..." and {}?
I always have problems with (and {...




@Jiaz :it would be nice, but I'm not knowledgeable on the subject
Reply With Quote
  #1802  
Old 03.08.2021, 21:24
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Quote:
Originally Posted by BJN01 View Post
done, but it doesn't work, it doesn't do anything.
You are querying crawled packages instead of crawled links (I didn't notice it earlier).

Edit: Guess you want to modify the package name after all. You will have to query the download host, but replace 'link.package.name'. Please note, the package may contain links from multiple hosts, in which case it could be overwritten for each matching host.

Last edited by mgpai; 03.08.2021 at 21:47.
Reply With Quote
  #1803  
Old 04.08.2021, 13:45
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Code:
/*
    View extracted files
    Trigger : Downloadlist contextmenu button pressed
    Customize context menu > Add a new "Eventscripter Trigger" button > Rename it to "View extracted files"
*/

if (name == "View extracted files") {
    try {
        var output = getPath(JD_HOME + "/tmp/archive_info.htm");
        var archive = dlSelection.contextLink.archive;
        var files = archive.info.extractionInfo.files
        var htm = "<table border=\"1\" align=center cellspacing=0 cellpadding=5]><th>" + archive.name + "</th>";

        files.forEach(function(file) {
            htm += "<tr><td>" + file + "</td></tr>";
        })
        
        output.delete();
        writeFile(output, htm, true);
        openURL("file://" + output);
    } catch (e) {};
}

Last edited by mgpai; 04.08.2021 at 16:51. Reason: Added button name check
Reply With Quote
  #1804  
Old 04.08.2021, 14:02
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,007
Default

@mgpai: please note that this only works for extraction within the running session. After restart, those details are not available anymore
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1805  
Old 04.08.2021, 14:09
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Quote:
Originally Posted by Jiaz View Post
@mgpai: please note that this only works for extraction within the running session. After restart, those details are not available anymore
It was/is working after a restart. Had also tested it before posting the script. Related files still seem to be present in the cfg/archives folder after a restart. Can you please check and confirm?
Reply With Quote
  #1806  
Old 04.08.2021, 14:14
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,007
Default

@mgpai: you are absolute right!
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1807  
Old 04.08.2021, 15:36
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 113
Default

I did some testing and I guess the problem arises from the fact that I can't recover the host name. (through alert I always see "undefined" ...) ...

----------
getDownloadHost , or getContainerURL , or downloadHost
---------- > "undefined"

I can't find the host of the link that generated the package.

Summing up :

I go to the web page that interests me, copy the "initial link" I am looking for
---> jd works, finds the files and packages them (OK).

now ,
when the package is finished my script <should> check if the <"initial link"> that generated the package is == to a given host, [or what if the packet "arrives" from a given host? ] (p.s= the files contained in the package are all from the same host)
if so make some changes to the package name.


.... but at the moment I get "undefined" ... so how do I locate this damn Hostname of the package / starting link (I'm in the CrawledLink / linkgabber window) ???
Reply With Quote
  #1808  
Old 04.08.2021, 16:06
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Quote:
Originally Posted by BJN01 View Post
... I can't recover the host name.
Code:
getAllCrawledPackages().forEach(function(package) {
    var hosts = [];

    package.getDownloadLinks().forEach(function(link) {
        var host = link.downloadHost;

        if (hosts.indexOf(host) == -1) {
            hosts.push(host);
        }
    })

    if (hosts.length == 1) {
        host = hosts[0];

        if (host == "myhost.com") {
            package.name = package.name.replace("old_string", "new_string");
        }
    }
})
Reply With Quote
  #1809  
Old 05.08.2021, 11:45
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Code:
/*
    Remove orphaned archive settings files from "cfg/archives" folder
    Trigger : Toolbar button pressed
    Customize toolbar > Add a new "Eventscripter Trigger" button > Rename it to "Remove archive settings files"
*/

if (name == "Remove archive settings files") {
    var ids = [];

    getAllFilePackages().forEach(function(package) {
        package.archives.forEach(function(archive) {
            ids.push(archive.settingsID);
        })
    })

    getPath(JD_HOME + "/cfg/archives").children.forEach(function(filePath) {
        try {
            var id = filePath.toString().match(/v2_(.+)\.json/)[1];

            if (ids.indexOf(id) == -1) {
                filePath.delete();
            }
        } catch (e) {};
    })
}
Reply With Quote
  #1810  
Old 06.08.2021, 00:30
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 113
Default

@mgpai = thanks, it works perfectly.
Reply With Quote
  #1811  
Old 06.08.2021, 10:37
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,007
Default

Big THANKS to mgpai for his great help/support and his time!
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1812  
Old 13.08.2021, 09:24
ThatGuy ThatGuy is offline
Registered / Inactive
 
Join Date: Feb 2021
Posts: 5
Default

Quote:
Originally Posted by mgpai View Post
Code:
/*
    Move extracted files
    Trigger : Archive extraction finished
*/    

archive.extractedFilePaths.forEach(function(filePath) {
    filePath.moveTo(archive.folder);
    filePath.parent.delete();
})
Thanks! This is very close to what I want. The only thing that isn't working is that now the files go to the same folder that the archive is set to download to, however I want it to go into a folder named after the archive. I've tried to work around this by combining it with the subfolder tickbox in the browser, and then it works perfectly. The only issue then is that it creates folders to contain non-archive files too, like a single video. I'm very close, I think I just need to add another line into your code to create a subfolder within (archive.folder), but I'm not sure how to do that.

Thanks again for the help so far!
Reply With Quote
  #1813  
Old 13.08.2021, 10:22
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Quote:
Originally Posted by ThatGuy View Post
... I want it to go into a folder named after the archive.
Code:
/*
    Move extracted files
    Trigger : Archive extraction finished
*/    

archive.extractedFilePaths.forEach(function(filePath) {
    filePath.moveTo(archive.folder + "/" + archive.name);
    filePath.parent.delete();
})
Reply With Quote
  #1814  
Old 14.08.2021, 06:43
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 700
Default

Is there a script enabling to download files from zippy and uloz?
__________________
Aktuelles Windows
Reply With Quote
  #1815  
Old 14.08.2021, 07:54
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Quote:
Originally Posted by Dockel View Post
Is there a script enabling to download files from zippy and uloz?
If you mean bypass geo-block, I believe there is already a script elsewhere in the forum which uses proxies to do just that.
Reply With Quote
  #1816  
Old 14.08.2021, 08:11
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 700
Default

Yes, exactly, that is what I meant. So it is not in this thread here, I assume...cannot find one else...keywords to look for are geo blocking script / script geo-block / zippy blocking...or any else?
__________________
Aktuelles Windows
Reply With Quote
  #1817  
Old 18.08.2021, 17:16
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,007
Default

@Dockel: You will have to use working proxies/VPN to bypass the geo restriction by zippy/uloz.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1818  
Old 18.08.2021, 18:28
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 700
Default

OK, it does not appear to be that easy to do it.
__________________
Aktuelles Windows
Reply With Quote
  #1819  
Old 19.08.2021, 07:19
iLITT iLITT is offline
I will play nice!
 
Join Date: Aug 2021
Posts: 4
Default

Hello! Can someone please make a script as follows...? In case when the download stops on dropped network connection, script makes program to unlimitedly auto force-start retry every 5 seconds untill connection is restored and downlod is finished. Please do not ask why the script is needed as there is not usual network connditions where I am located. Thanks!
Reply With Quote
  #1820  
Old 19.08.2021, 11:58
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,007
Default

@Dockel: I would just setup working proxy in Settings->Connections that work fine with those hosters. No script required.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1821  
Old 21.08.2021, 16:58
Shawn26 Shawn26 is offline
Junior Loader
 
Join Date: Aug 2021
Posts: 12
Default

@mgpai

Hi. I need an automatism to copy ready extracted files from download folder to a folder on my NAS.

Is there a way?

Many thanks for every help.

Shawn26
Reply With Quote
  #1822  
Old 21.08.2021, 18:23
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Quote:
Originally Posted by Dockel View Post
Is there a script enabling to download files from zippy and uloz?
Quote:
Originally Posted by Jiaz View Post
@Dockel: You will have to use working proxies/VPN to bypass the geo restriction by zippy/uloz.
Quote:
Originally Posted by Dockel View Post
OK, it does not appear to be that easy to do it.
You may not find working proxies using the script which I linked to you via PM, since it might be using a proxy list which most likely has not been updated since Jun 15 2021.
Reply With Quote
  #1823  
Old 21.08.2021, 18:28
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Quote:
Originally Posted by iLITT View Post
In case when the download stops on dropped network connection, script makes program to unlimitedly auto force-start retry every 5 seconds untill connection is restored and downlod is finished.
A force-download may not be required. Should be enough to use a script to check connection availability and stop/start the downloads accordingly.

What message is displayed in the status column for such downloads?
Reply With Quote
  #1824  
Old 21.08.2021, 18:38
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Quote:
Originally Posted by Shawn26 View Post
I need an automatism to copy ready extracted files from download folder to a folder on my NAS.
@Shawn26: Hi.

You can use packagizer rule to move files after extraction. If you want to preserve the folder structure for extracted files which have sub-folders, you will have to use a script in eventscripter. Provide me example strings of source and destination folders if you need one.
Reply With Quote
  #1825  
Old 21.08.2021, 22:14
iLITT iLITT is offline
I will play nice!
 
Join Date: Aug 2021
Posts: 4
Default

Quote:
Originally Posted by mgpai View Post
A force-download may not be required. Should be enough to use a script to check connection availability and stop/start the downloads accordingly.

What message is displayed in the status column for such downloads?
Quote:
Originally Posted by mgpai View Post
A force-download may not be required. Should be enough to use a script to check connection availability and stop/start the downloads accordingly.

What message is displayed in the status column for such downloads?
Ok, when I press right click and take resume option, I additionally need to press start afterwards, then download continues as well. But with force start, it just starts immediately. The main thing is - I am located at location, where you need to login to network with account, before internet connection is established. When you log out, internet connection is dropped. And if you try to open page, it just redirects to login page, where you have to login in order to get connected to internet again. But the good thing is - when SOMEONE esle logins into network, I get internet connection too, and dont have to login with my account to enjoy internet. I don't think, that the script should be checking for internet connection, because it will redirect to login page... The problemo with progam is - when connection is dropped- error pops up @ downloader and thats why I need it to auto-check it every 5 seconds, untill someone logs in and internet comes back on. There is error - An Error occured. Try restarting this link. It is because, when noone is logged in network it auto redirects to login page, where you need to login in order to establish connection to internet. But when someone is logged in, download continues without any problem, because there is network connection and thus no redirect to login page ... I just need that download retries automaticly and starts downloading automaticly every 5 seconds, so I don't have to wait, when someone is logged in and do resume-download manually.... I hope you understand me...
The log when error pops up -
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="**External links are only visible to Support Staff**>here</a>.</p>
<hr>
<address>Apache/2.2.22 (Debian) Server at update3.jdownloader.org Port 54322</address>
</body></html>
; line: 1, column: 2]
Reply With Quote
  #1826  
Old 22.08.2021, 06:36
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Quote:
Originally Posted by iLITT View Post
The log when error pops up -
Quote:
Originally Posted by mgpai View Post
What message is displayed in the status column for such downloads?
I agree on your problem but differ on the solution. The developers have implemented checks and balances for a good reason. Overriding them by blindly force starting downloads every 5 seconds is neither a good idea nor will I provide such a script. You are however free to implement such solution on your own.

I need the status message of downloads (not the log error) to know when to check for connection availability and take appropriate action via script. You can also contact me in JD Chat when you have such downloads on the list.

Code:
kiwiirc.com/nextclient/irc.libera.chat/#jdownloader
Reply With Quote
  #1827  
Old 22.08.2021, 10:21
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

@iLITT: Try this script. If it does not solve your problem, find me in JD Chat.

Code:
/*
    Monitor connection
    Trigger: JDownloader started
*/

monitorConnection();

function monitorConnection() {
    var browser, connected, running = isDownloadControllerRunning();

    try {
        browser = getBrowser();
        browser.getPage("http" + "://1.1.1.1");
        connected = browser.responseCode == 301;
    } catch (e) {};

    running && !connected && stopDownloads();
    connected && !running && startDownloads();

    sleep(5000);
    monitorConnection();
}
Reply With Quote
  #1828  
Old 22.08.2021, 10:29
iLITT iLITT is offline
I will play nice!
 
Join Date: Aug 2021
Posts: 4
Default

Quote:
Originally Posted by mgpai View Post
I agree on your problem but differ on the solution. The developers have implemented checks and balances for a good reason. Overriding them by blindly force starting downloads every 5 seconds is neither a good idea nor will I provide such a script. You are however free to implement such solution on your own.

I need the status message of downloads (not the log error) to know when to check for connection availability and take appropriate action via script. You can also contact me in JD Chat when you have such downloads on the list.

Code:
kiwiirc.com/nextclient/irc.libera.chat/#jdownloader
I don't get it... You think, I would ask here, if I knew how to make such a script? Thats why I am kindly asking in this forum, so someone could make it for me. As mentioned in my previous post - status message of download - "... An Error occured. Try restarting this link." This error comes up, because as I told, when someone logs out of network, internet connection is dropped, thus redirecting to login page....
Reply With Quote
  #1829  
Old 22.08.2021, 12:19
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Quote:
Originally Posted by iLITT View Post
I don't get it... You think, I would ask here, if I knew how to make such a script? Thats why I am kindly asking in this forum, so someone could make it for me.
Ok. Understood. Sorry I thought an alternative solution would also be acceptable to you.
Reply With Quote
  #1830  
Old 22.08.2021, 19:42
iLITT iLITT is offline
I will play nice!
 
Join Date: Aug 2021
Posts: 4
Default

Quote:
Originally Posted by mgpai View Post
Ok. Understood. Sorry I thought an alternative solution would also be acceptable to you.
Sorry, at the time while I was writing my previous reply, I did not see, that you
already provided script latter-on. And my previous reply were posted latter
anywaysÂ…
Yes, of course I am open to other solutions... Just the manner you replied - "I
will not make such script you asking for". Anyways, I will try the script and
contact you @ chat regarding whether it worked or not... Thanks!
Reply With Quote
  #1831  
Old 23.08.2021, 10:20
Shawn26 Shawn26 is offline
Junior Loader
 
Join Date: Aug 2021
Posts: 12
Default

Quote:
Originally Posted by mgpai View Post
@Shawn26: Hi.

You can use packagizer rule to move files after extraction. If you want to preserve the folder structure for extracted files which have sub-folders, you will have to use a script in eventscripter. Provide me example strings of source and destination folders if you need one.
@mgpai

I find the packagizer rulez. How can i realise it that i only move special files not all files and than without subfolders (only files)?

Many thanks.

Shawn26
Reply With Quote
  #1832  
Old 23.08.2021, 10:30
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Quote:
Originally Posted by Shawn26 View Post
How can i realise it that i only move special files not all files and than without subfolders (only files)?
You can specify the conditions in the 'if' section of the packagizer rule and move extracted files only when those conditions match.
Reply With Quote
  #1833  
Old 23.08.2021, 10:48
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Quote:
Originally Posted by iLITT View Post
I don't get it... You think, I would ask here, if I knew how to make such a script?
Quote:
Originally Posted by iLITT View Post
... I am open to other solutions... Just the manner you replied - "I will not make such script you asking for".
I have not mocked your request. I have merely declined to implement your solution by clearly stating my reasons for doing so. Cannot say the same about your response though, even after I offered to help you find alternative solutions.
Reply With Quote
  #1834  
Old 23.08.2021, 16:32
Shawn26 Shawn26 is offline
Junior Loader
 
Join Date: Aug 2021
Posts: 12
Default

Quote:
Originally Posted by mgpai View Post
You can specify the conditions in the 'if' section of the packagizer rule and move extracted files only when those conditions match.
But i only wanna move files downloaded from a special URL. But this isnt possible, right?


Many Thanks.

Shawn26
Reply With Quote
  #1835  
Old 23.08.2021, 16:36
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Quote:
Originally Posted by Shawn26 View Post
But i only wanna move files downloaded from a special URL. But this isnt possible, right?
It is possible. You have to enter the url matching pattern in downloadurl or sourceurl field, depending on what you want to match.

You can provide the url if you need help with the rule.
Reply With Quote
  #1836  
Old 23.08.2021, 18:15
Shawn26 Shawn26 is offline
Junior Loader
 
Join Date: Aug 2021
Posts: 12
Default

I will download it from SJ.org and will be forwarded to ddownload.com.

But for me, SJ.org is important and not that they are downloaded from ddownload.com. Is this variant also possible?

Or is it possible to copy files only from a special folder. Then I would create a rule to move the "wrong" files to another folder and then move the "right" files to my NAS after unzipping them.

Many Thanks

Shawn26

Last edited by Shawn26; 23.08.2021 at 18:19.
Reply With Quote
  #1837  
Old 23.08.2021, 18:43
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Quote:
Originally Posted by Shawn26 View Post
But for me, SJ.org is important and not that they are downloaded from ddownload.com. Is this variant also possible?
Something like this should work.
Code:
if > sourceurls(s) > contains > sj.org
then > move to > /path/to/nas/folder
Reply With Quote
  #1838  
Old 24.08.2021, 05:26
Shawn26 Shawn26 is offline
Junior Loader
 
Join Date: Aug 2021
Posts: 12
Default

I had already tried this variant. But it doesn't seem to be "allowed".
I get the message ...
"You should know that...
... You cannot use the source or the condition of origin to perform an "after unpacking" action. "
Then the check mark next to "Source URL (s) contains" is removed again.

What am I doing wrong?

Shawn26
Reply With Quote
  #1839  
Old 24.08.2021, 08:30
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,590
Default

Quote:
Originally Posted by Shawn26 View Post
What am I doing wrong?
My mistake. I didn't know "that".

If there are identifiers in file/package name or download url, can also use that in the rule instead. Source urls can be used in script, provided such url is stored by JD, which in turn depends on how the links were added.

Find me in JD Chat if you could not find a working solution.
Code:
kiwiirc.com/nextclient/irc.libera.chat/#jdownloader
Reply With Quote
  #1840  
Old 24.08.2021, 14:45
Tomrich Tomrich is offline
Wind Gust
 
Join Date: Aug 2020
Posts: 43
Default

Hi,

i've tried this script to update jdownloader (headless on my raspberry pi) when there is nothing to to. i'm not sure its working correctly. whats the "interval" settings? is this the time jdownloader is waiting after the last download finished?

i can see "60 * 60 * 1000" in the script. if this is in milliseconds the time jdownloader waits should be 60min. if this is correct jdownloader should be updated every night. but the last 2 days i hade update notification at the morning. is there a log file where i can check whether jdownloader was updated?
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 15:28.
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.