JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1661  
Old 27.02.2021, 12:51
plip plip is offline
Wind Gust
 
Join Date: Jun 2016
Posts: 42
Default

Hi. I hope someone could tell me what I'm doing wrong here.

I found this script which replaces characters in filenames when added to linkgrabber:
https://board.jdownloader.org/showpo...0&postcount=50

I'm altering it to suit my own needs. I can mostly do what I want with filenames without problems.

1. (Although I would like to know how to check if there's a letter/number right after 】or right before【, and add a space if a letter/number is there)

2. My big problem is this.

I want to do replacing of characters in the package/download folder too. Mostly the same replacements, but with a few differences.

I cannot figure out how to get the package/download folder name linkgrabber generates so that I can do replacements on that package/download folder name.

The file name is grabbed in the script like this:
Code:
    var myPackagizerLink = link;
    var fileName = myPackagizerLink.getName();
The file name can be modified after that no problem.

All my attempts to grab the package/folder apparently get a "null" error when actually trying to do a replacement. I don't know why.

I swear the following was working for a short while, but after restarting JD2 it just seems to store "null":
Code:
    var packageName = myPackagizerLink.getPackageName();
This doesn't work either:
Code:
    var packageName = myPackagizerLink.getDownloadFolder();

How do you capture the package/folder name so you can modify it, in the same manner as the filename is modified in that script I linked?

I know how to do the actual replacements and set the modified package name, if only I could reliably get the package/folder name in the first place.

Last edited by plip; 27.02.2021 at 12:59.
Reply With Quote
  #1662  
Old 28.02.2021, 08:47
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by plip View Post
All my attempts to grab the package/folder apparently get a "null" error when actually trying to do a replacement. I don't know why.
Package name will be 'null' unless it is set by the API/plugin/packagizer rule. Same with folder, 'null' if it is not set (default folder will be used when the link is sent to download tab). If placeholder is used (e.g. <jd:packagename>) that will be returned instead of the actual location. It will be replaced by the actual directory, when the links are sent to the download tab. If you have enabled subfolder by package name rule, replacing characters in folder will not be required, since it will be already replaced in package name.

Synchronous execution should be enabled for this to work correctly. Also note, the linked script is executed twice, since it does not query the 'state' property.
Reply With Quote
  #1663  
Old 02.03.2021, 18:00
dramaman dramaman is offline
JD Addict
 
Join Date: May 2013
Posts: 151
Default

I have the following URLs


Code:
**External links are only visible to Support Staff**...
I want to retain folder structure starting from root%20folder (but will accept starting with 12.111.11.111)

I don't need these grouped in packages, as long as each file ends up in the right directory

Last edited by dramaman; 02.03.2021 at 18:08.
Reply With Quote
  #1664  
Old 02.03.2021, 18:12
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by dramaman View Post
I want to retain folder structure starting from root%20folder ...
I'll be needing working examples. If you cannot share them in the forum, you can PM it to me, here or in JD Chat.

Code:
kiwiirc.com/nextclient/irc.freenode.net/#jdownloader
Reply With Quote
  #1665  
Old 02.03.2021, 19:13
dramaman dramaman is offline
JD Addict
 
Join Date: May 2013
Posts: 151
Default

Quote:
Originally Posted by mgpai View Post
I'll be needing working examples. If you cannot share them in the forum, you can PM it to me, here or in JD Chat.

Code:
kiwiirc.com/nextclient/irc.freenode.net/#jdownloader
Sent
Reply With Quote
  #1666  
Old 02.03.2021, 22:05
dramaman dramaman is offline
JD Addict
 
Join Date: May 2013
Posts: 151
Default

When we add a file in link grabber, can we change the name of package to
<jd:packagename>"-"<jd:simpledate:yyyy-MM-dd'T'HH:mm:ss.SSSXXX>?

So the name of file appended to the dated added
To be clear, Change the name of the package , but not the download folder

Last edited by dramaman; 02.03.2021 at 22:27.
Reply With Quote
  #1667  
Old 03.03.2021, 06:07
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by dramaman View Post
When we add a file in link grabber, can we change the name of package to
<jd:packagename>"-"<jd:simpledate:yyyy-MM-dd'T'HH:mm:ss.SSSXXX>?

So the name of file appended to the dated added
To be clear, Change the name of the package , but not the download folder
Using timestamp with seconds precision will (most likely) generate one package per link, which might not be a desirable outcome. To avoid 'wrong' grouping generate the package name using part(s) of the url.
Reply With Quote
  #1668  
Old 03.03.2021, 09:59
dramaman dramaman is offline
JD Addict
 
Join Date: May 2013
Posts: 151
Default

that is exactly what I wanted, to force files to a separate package.
I have a other script running that handles folder structure, but it broke when files have the same name.
using date and time in package name fixed the issue.

Last edited by dramaman; 03.03.2021 at 10:23.
Reply With Quote
  #1669  
Old 03.03.2021, 10:33
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by dramaman View Post
that is exactly what I wanted, to force files to a separate package.
I have a other script running that handles folder structure, but it broke when files have the same name.
using date and time in package name fixed the issue.
I see you have used milliseconds precision time stamp, so it will be not 'most likely' but 'definitely' one package per file. Add a few files with same name to JD using the following rule:
Quote:
File name -> contains -> *
Then set -> Package Name -> <jd:orgfilenamewithoutext> - <jd:simpledate:yyyy-MM-dd'T'HH:mm:ss.SSSXXX>


Even though the package name is same, the time stamp value will be different for each link which is added so they will be named/packaged accordingly. Without the rule they would have same name, and hence JD would have put them in a single package.
Reply With Quote
  #1670  
Old 03.03.2021, 20:23
dramaman dramaman is offline
JD Addict
 
Join Date: May 2013
Posts: 151
Default

Quote:
Originally Posted by mgpai View Post
I see you have used milliseconds precision time stamp, so it will be not 'most likely' but 'definitely' one package per file. Add a few files with same name to JD using the following rule:




Even though the package name is same, the time stamp value will be different for each link which is added so they will be named/packaged accordingly. Without the rule they would have same name, and hence JD would have put them in a single package.
works perfect, thx
Reply With Quote
  #1671  
Old 27.03.2021, 14:47
nicolau nicolau is offline
Baby Loader
 
Join Date: Mar 2021
Posts: 6
Default

Can anybody help me? I use several proxies to go through the download limit, however the connection of a new link takes around 5 minutes due to the quality of my proxy. To avoid blocking captchas I always leave a maximum of 3 active downloads at a time. I would like the script to start the connection process for a new download when 5 minutes are left to complete an active download, calling this script:
Code:
setDownloadsPaused(false);
My script:
Code:
// Keep always 3 active downloads
// Trigger Required: "Interval"
var links = getRunningDownloadLinks();
var minDuration = 1;
var n = 0;

// Check active downloads
if (links.length > 0) {
    for (i = 0; i < links.length; i++) {
        var link = links[i];
        if (link.getDownloadDuration() > minDuration * 60 * 1000) {
            n++;
        }
    }
}

// Downloads manager
if (n >= 3 && isDownloadControllerPaused() == false) {
    setDownloadsPaused(true);
}

if (n < 3 && isDownloadControllerPaused() == true) {
    setDownloadsPaused(false);
}
Note: Captchas are solved automatically

Last edited by nicolau; 27.03.2021 at 14:57.
Reply With Quote
  #1672  
Old 27.03.2021, 15:34
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by nicolau View Post
I would like the script to start the connection process for a new download when 5 minutes are left to complete an active download
Code:
/*
    Start new downloads based of ETA of running downloads
    Trigger: Interval
*/    

var links = getRunningDownloadLinks();

if (links.length == 3) {
    links.some(function(link) {
        if (link.getEta() < 60 * 5) {
            setMax(4);
            setMax(3);
            return true;
        }
    })
}

function setMax(int) {
    var interfaceName = "org.jdownloader.settings.GeneralSettings";
    var key = "MaxSimultaneDownloads";
    callAPI("config", "set", interfaceName, null, key, int);
}
Reply With Quote
  #1673  
Old 30.03.2021, 18:50
epikk epikk is offline
Modem User
 
Join Date: Mar 2021
Posts: 4
Default artcover attached to mp3

Hi guys, how can an mp3 be saved along with its picture (cover picture) from Soundcloud? it saves the artwork as a separate image file,. I want an mp3 file with its picture (artwork/cover) embedded in the file? so when you play it you can see the cover.
is it possible to do? do I need a script for that?
it doesn't make sense to attach each artwork to each song one by one with another software as i have 1000 songs....
thank you in advance : )
Reply With Quote
  #1674  
Old 30.03.2021, 19:11
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by epikk View Post
... it doesn't make sense to attach each artwork to each song one by one with another software ...
It is possible only by using an external program in eventscripter. Find one which accepts command-line arguments and call it in a script to automatically perform the task.
Reply With Quote
  #1675  
Old 31.03.2021, 11:35
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,084
Default

@mgpai: ffmpeg can be used for that, eg a script that checks for download finish and then checks for file + cover file and merge them
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1676  
Old 31.03.2021, 12:18
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by Jiaz View Post
@mgpai: ffmpeg can be used for that, eg a script that checks for download finish and then checks for file + cover file and merge them
What is the ffmpeg command?
Reply With Quote
  #1677  
Old 31.03.2021, 12:32
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,084
Default

@mgpai: best would be to check search engine of your choice
eg stackoverflow.com/questions/54717175/how-do-i-add-a-custom-thumbnail-to-a-mp4-file-using-ffmpeg
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1678  
Old 31.03.2021, 13:30
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by Jiaz View Post
@mgpai: best would be to check search engine of your choice
eg stackoverflow.com/questions/54717175/how-do-i-add-a-custom-thumbnail-to-a-mp4-file-using-ffmpeg
Sure. But almost always I end up spending more time than I'd like to, to get it working.
Reply With Quote
  #1679  
Old 31.03.2021, 16:32
drjs5x drjs5x is offline
Baby Loader
 
Join Date: Nov 2015
Posts: 8
Default i need a event code script

hi dears

i need a event code script.

i have got a package named "Films ".

how can script a package with name force start with interval 30 minutes.


please help me.

Last edited by drjs5x; 31.03.2021 at 18:19.
Reply With Quote
  #1680  
Old 31.03.2021, 17:08
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,084
Default

@drjs5x:
You mean wait 30 secs before each download in package x ?
__________________
JD-Dev & Server-Admin
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 13:31.
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.