JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1401  
Old 14.06.2020, 04:33
Fritjof Larsson Fritjof Larsson is offline
Modem User
 
Join Date: Jun 2020
Posts: 1
Default Make the infobar appear only when a download is running

I've positioned the panel in the bottom right corner, but it's still taking a valuable space. I want to write a script that makes it appear when a download starts, and another script that makes it disappear when all downloads stop--all this with the help of the Event Scripter of course. Easy if you are a Java programmer, not so much if you were me.

I've actually checked the forum and found this script: https://board.jdownloader.org/showpo...39&postcount=8
but it doesn't exactly suit my needs.

Anyone that can provide me with these two scripts please?
Reply With Quote
  #1402  
Old 14.06.2020, 21:01
radiolex radiolex is offline
Modem User
 
Join Date: Jun 2020
Posts: 1
Default

Hello,
When I paste below and enter in my app token and user key, I get an error from JDownloader:unterminated string literal....
What does this mean?



Quote:
Originally Posted by Wicküler View Post
Don't know if this should be posted since it's so simple, but I wanted a way of getting notifications on my phone via pushover when a package had finished. It was quite easy and using the code
Code:
postPage("**External links are only visible to Support Staff**,
"token=appToken&user=userKey&message="
+ package.getName() +
" finished.");
with the Trigger "Package finished" is all that was needed. The userKey is located in your pushover-profile-page and the appToken can be generated there as well via "Create an API token" (somewhere near the bottom under "Your applications").

Works like a charm but if this thread is meant for more elaborate scripts, feel free to move or delete this post. Since I didn't find any other hints or tutorials for using pushover for jdownloader-notifications, I thought I'd just leave it here.
Reply With Quote
  #1403  
Old 15.06.2020, 16:17
sherbee sherbee is offline
JD Fan
 
Join Date: Mar 2019
Posts: 76
Default

Quote:
Originally Posted by sherbee View Post
Thank! Will try soon! Hope it works.
Is possible to get 'extract to' value from Archive extractor setting?
Reply With Quote
  #1404  
Old 15.06.2020, 18:12
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,495
Default

Quote:
Originally Posted by sherbee View Post
Is possible to get 'extract to' value from Archive extractor setting?
I am assuming you are asking this with respect to archives extracted manually.

From what I know, manual extraction will use "Subfolder pattern" from archive extractor setting wherever possible (e.g. %ARCHIVENAME%, $DATE:dd.MM.yyyy$), but it does not use the "Extract to" folder setting from it.

The files will be extracted to the same location as the archive, which can be accessed by the "var myString = myArchive.getExtractToFolder();" method.

If you haven't found a solution to replace your existing script, it is possible to do it using the extracted file paths method. Let me know if you need any help with it.
Reply With Quote
  #1405  
Old 15.06.2020, 18:54
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 69,629
Default

@Fritjof Larsson
Merged EventScripter threads.

-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
  #1406  
Old 15.06.2020, 19:34
sherbee sherbee is offline
JD Fan
 
Join Date: Mar 2019
Posts: 76
Default

Quote:
Originally Posted by mgpai View Post
I am assuming you are asking this with respect to archives extracted manually.

From what I know, manual extraction will use "Subfolder pattern" from archive extractor setting wherever possible (e.g. %ARCHIVENAME%, $DATE:dd.MM.yyyy$), but it does not use the "Extract to" folder setting from it.
Yes. Its bug: https://board.jdownloader.org/showpo...19&postcount=3

I can hardcode unpack folder in script but it better and dynamic if possible to take from 'extract to' from extractor settings.
Reply With Quote
  #1407  
Old 15.06.2020, 19:45
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,495
Default

Quote:
Originally Posted by sherbee View Post
Is possible to get 'extract to' value from Archive extractor setting?
So you just want to get the "extract to" value from "Archive Extractor" setting, not the 'extracted' archive?
Reply With Quote
  #1408  
Old 15.06.2020, 19:56
sherbee sherbee is offline
JD Fan
 
Join Date: Mar 2019
Posts: 76
Default

Quote:
Originally Posted by mgpai View Post
So you just want to get the "extract to" value from "Archive Extractor" setting, not the 'extracted' archive?
I confused.
Trigger is after extract or before? Yes because bug I want get extract folder from setting and set in script.
Reply With Quote
  #1409  
Old 15.06.2020, 21:24
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 624
Default Choose a special variant of the resolution of 100 YouTube video in a single step?

Is there a way in the link grabber window to choose a special variant of the resolution of more than a single YouTube video in a single step? For example, all (selected, may be 100) videos in the link grabber shall be downloaded with 480p.

https://board.jdownloader.org/showth...557#post467557
__________________
Aktuelles Windows
Reply With Quote
  #1410  
Old 15.06.2020, 21:59
sherbee sherbee is offline
JD Fan
 
Join Date: Mar 2019
Posts: 76
Default

Quote:
Originally Posted by sherbee View Post
I confused.
Trigger is after extract or before? Yes because bug I want get extract folder from setting and set in script.
My script use 'Archive extrction finished'. So too late for set extraction path.
Can do with trigger "Any extraction event' to set extraction path to "extract to" value from "Archive Extractor" setting?
Reply With Quote
  #1411  
Old 16.06.2020, 15:55
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,495
Default

Quote:
Originally Posted by Fritjof Larsson View Post
... I want to write a script that makes it appear when a download starts, and another script that makes it disappear when all downloads stop ...
Code:
// Auto-show/Auto-hide infobar
// Trigger: Remote API Event fired

if (event.publisher == "downloadwatchdog") {
    var id = event.id;

    if (id == "RUNNING" || id == "STOPPED") {
        var interfaceName = "org.jdownloader.extensions.infobar.InfoBarConfig",
            storage = "cfg/org.jdownloader.extensions.infobar.InfoBarExtension";

        callAPI("config", "set", interfaceName, storage, "windowvisible", id == "RUNNING");
    }
}
Reply With Quote
  #1412  
Old 16.06.2020, 16:55
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,495
Default

Quote:
Originally Posted by radiolex View Post
... I get an error from JDownloader:unterminated string literal ...
URL in that post has been obfuscated. Try this:

Code:
postPage("https" + "://api.pushover.net/1/messages.json",
"token=appToken&user=userKey&message="
+ package.getName() +
" finished.");
Reply With Quote
  #1413  
Old 16.06.2020, 17:30
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,495
Default

Quote:
Originally Posted by sherbee View Post
... Can do with trigger "Any extraction event' to set extraction path to "extract to" value from "Archive Extractor" setting?
Not possible with trigger/methods currently available. You will have to move the files after they have been extracted, using extracted files/filepath methods.

Function:
Code:
// Function to get extract to folder from extractor settings

var customExtractionPath = function() {
    var interfaceName = "org.jdownloader.extensions.extraction.ExtractionConfig",
        storage = "cfg/org.jdownloader.extensions.extraction.ExtractionExtension";
        
    return callAPI("config", "get", interfaceName, storage, "CustomExtractionPath");
}

alert(customExtractionPath());

Feel free to let me know if I can help in any way with your script.
Reply With Quote
  #1414  
Old 16.06.2020, 18:07
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,495
Default

Quote:
Originally Posted by Fragmata View Post
... I would like a script for a custom button, that when pressed, will check my Files and Folders if they exist, then compare them with the Files in my Linkgrabber and then ... simply delete them from the Linkgrabber list ...
Note: This script will remove links from the download list. Backup the link list before testing/running the script.

Code:
// Remove links - from download list, if a file with matching name + size exists in user-specified folders
// Trigger: Toolbar Button Pressed
// Customize toolbar > add new "Eventscripter Trigger" button > rename it to "remove links" (without quotes, case-sensitive) > change icon (optional)

var folders = ["c:/downloads", "c:/video", "c:/audio", "c:/other"]; // <- Folders to check

if (name == "remove links") {
    getAllDownloadLinks().forEach(function(link) {
        if (!link.bytesLoaded && !link.running) {
            folders.some(function(folder) {
                var file = getPath(folder + "/" + link.name);
                if (file.exists() && file.size == link.bytesTotal) {
                    link.remove();
                    return true;
                }
            })
        }
    })
}
Reply With Quote
  #1415  
Old 16.06.2020, 18:29
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,495
Default

Quote:
Originally Posted by Dockel View Post
Is there a way in the link grabber window to choose a special variant of the resolution of more than a single YouTube video in a single step? For example, all (selected, may be 100) videos in the link grabber shall be downloaded with 480p.
Possible only if the exact same variant is available for all the 100 links in the selection, which considering the long list of variants, is very unlikely. It might be easier to add a selection of multiple variants of a link to the list and then use a script or the side bar view filter to discard the unwanted ones.

Can you not achieve the desired result tweaking the YT variant selection algorithm in advanced settings? It is highly configurable.
Reply With Quote
  #1416  
Old 16.06.2020, 18:48
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,627
Default

re: youtube change variant, might be just easier to change plugin settings just delete the entries, add them back again. There is cache so they wont have to scrape each video again. All info is retained in memory, so this will work on assumption you just added them.
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #1417  
Old 17.06.2020, 14:41
Fragmata Fragmata is offline
Modem User
 
Join Date: Jan 2020
Posts: 2
Default

Quote:
Originally Posted by mgpai View Post
Note: This script will remove links from the download list. Backup the link list before testing/running the script.

Code:
// Remove links - from download list, if a file with matching name + size exists in user-specified folders
// Trigger: Toolbar Button Pressed
// Customize toolbar > add new "Eventscripter Trigger" button > rename it to "remove links" (without quotes, case-sensitive) > change icon (optional)

var folders = ["c:/downloads", "c:/video", "c:/audio", "c:/other"]; // <- Folders to check

if (name == "remove links") {
    getAllDownloadLinks().forEach(function(link) {
        if (!link.bytesLoaded && !link.running) {
            folders.some(function(folder) {
                var file = getPath(folder + "/" + link.name);
                if (file.exists() && file.size == link.bytesTotal) {
                    link.remove();
                    return true;
                }
            })
        }
    })
}
@mgpai
Thank you very much for this script, unfortunatly it doesn't do anything.
Reply With Quote
  #1418  
Old 17.06.2020, 14:58
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,495
Default

Quote:
Originally Posted by Fragmata View Post
... unfortunatly it doesn't do anything.
Make sure you are using the correct trigger, have created a custom button in the toolbar as instructed, and replaced the example folders in the script with your own.

If you need help setting the script up, you can find me in JD Chat:
Code:
kiwiirc.com/nextclient/irc.freenode.net/#jdownloader
Reply With Quote
  #1419  
Old 19.06.2020, 19:00
SMS SMS is offline
Mega Loader
 
Join Date: Jun 2019
Posts: 64
Default

In a script with the trigger "a download started", I'm trying to do
Code:
var url = link.getURL();
but I get TypeError: Cannot find function getURL in object DownloadLink Instance.
Where can I see what methods are available for `link`?
Edit: Looks like it's getURL (uppercase) for "packagizer hook", but getUrl for "a download started".

Last edited by SMS; 19.06.2020 at 19:03.
Reply With Quote
  #1420  
Old 19.06.2020, 20:29
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,495
Default

Quote:
Originally Posted by SMS View Post
Where can I see what methods are available for `link`?
Click 'Show/Hide Help' in the main menu of the script editor.

Please note, getUrl() does not necessarily return the download url. It will return the url as per the 'downloadlink url display' selection in 'user interface' settings. It will also return null, if the download url is obtained from an encrypted source.

If you want to always access the download url, use the content url method as the primary source and plugin url method as fallback.
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:36.
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 - 2023, Jelsoft Enterprises Ltd.