JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 07.02.2025, 17:31
Kell-Conerem Kell-Conerem is offline
Junior Loader
 
Join Date: Nov 2022
Posts: 12
Default Limit Folder Length (Package name length)

Hallo JD legt die Ordnernamen vor Downloadstart auf verschiedene Wege fest.

Ich möchte nun bevor der Ordner erstellt wird das JD nochmals überprüft wie lange der zu erstellende Ordner ist und diesen dann wenn notwendig auf maximal 30 Stellen kürzt. (Wenn möglich individuell einstellbar im script)

Ich möchte dadurch zu Lange und unübersichtliche Ordner vermeiden.

Mit den Packagizer ist dies nicht mögllich, deswegen wurde ich auf den Eventscripter verwiesen.

Da ich vom scripten keinen Plan habe wollte ich fragen ob da jemand eine lösung für mich hätte.

Gruß
Kell

ENG:
Hello,

JD determines the folder names in different ways before starting the download.

I would like JD to check the length of the folder name before it is created and, if necessary, shorten it to a maximum of 30 characters. (Ideally, this should be adjustable in the script.)

My goal is to avoid excessively long and cluttered folder names.

This is not possible with the Packagizer, which is why I was referred to the EventScripter.

Since I have no experience with scripting, I wanted to ask if someone has a solution for me.

Best regards,
Kell
Reply With Quote
  #2  
Old 07.02.2025, 19:08
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,682
Default

Quote:
Originally Posted by Kell-Conerem View Post
I would like JD to check the length of the folder name before it is created and, if necessary, shorten it to a maximum of 30 characters. (Ideally, this should be adjustable in the script.)
Code:
/*
    limit package name
    trigger : a new link has been added
    IMPORTANT : disable 'synchronous execution' check box in the top panel'
*/

crawledLink.package.name = crawledLink.package.name.replace(/(.{30}).+/,"$1 (...)");

The download folder will no longer be 'dynamic', if it is set in the script. So, it only modifies the package name. Use a sub-folder by package name rule to set it as the download folder.

Trailing 'dots' are replace by JD, so the script uses (...). You can replace it with characters of your choosing.
Reply With Quote
  #3  
Old 08.02.2025, 09:12
Kell-Conerem Kell-Conerem is offline
Junior Loader
 
Join Date: Nov 2022
Posts: 12
Default

Thank you very much! It worked perfectly.

After some experimenting, I got the result I prefer.

crawledLink.package.name = crawledLink.package.name.replace(/(.{30}).+/,"(...) $1");
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 03:14.
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 - 2025, Jelsoft Enterprises Ltd.