JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 29.10.2019, 07:16
elvis_ef elvis_ef is offline
Modem User
 
Join Date: Oct 2019
Posts: 4
Question Packagizer - change file name basing on regex

Hello.

I've searched a couple of threads, but could not find any good solution.
I can not even make any solution work....

Example file name: "this is a name ? Yes! Caution: this is a new file..."

So.. what would be a regex rule for this ?

I'm using regex everyday at work, but I can not understand how it works in JD... I mean, I do not know how to use it here in JD application.

I need my file contain ONLY: [a-zA-Z0-9-_\s\.]

How would I set this in JD packagizer settings ?

PS.The problem is Im using linux, which does use characters not allowed in Windows (I am using both os'), so ie. ?:"<>*:|\/ are not allowed. But JD downloading in linux need to to know, that a filename should be changed.

Finally, I need my regex to rename files, after adding to the download list, to for instance spaces, or dashes, or underscores... one of these.

Please give me a hint, solution or whatever, because I'm stuck... ;/
Reply With Quote
  #2  
Old 29.10.2019, 16:35
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 66,134
Default

JDownloader uses Java Pattern and there are minor differences but in general they work completely the same.
You can only use for matching groups. In Packagizer you can only use it for match and make use of matching group.



JDownloader automatically replaces all those forbidden/reserved characters. But you cannot customize the replacement yet
I'm not aware of any missing forbidden/reserved character and you should be able to start download on linux and resume on windows without any manual interaction.

As a workaround you might wanna try the Eventscripter extension and a script that does the replacement in custom way, see
https://board.jdownloader.org/showthread.php?t=70525
In case you need help with it, please contact mpgai for help or post in that thread
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 29.10.2019 at 16:39.
Reply With Quote
  #3  
Old 29.10.2019, 22:34
elvis_ef elvis_ef is offline
Modem User
 
Join Date: Oct 2019
Posts: 4
Post Please look at the screenshot attached

Ok, I understand.

I'll show You an example:

file name is: "What is it ???"

And my screenshot with description is:

Is this rule well formed ?
I mean, I tried to set "contains" with regexp active, for this: [a-zA-Z0-9_-\.]+ but... I need something, that will check if the group as I wrote, is the only group of characters that can exist in file names. So every file name with a sign NOT in this group will be replaced by... anything else, maybe underscore, or maybe completely with a new file name generated by me.

These regex's need to be described somewhere, I mean, how t ouse it, visually, maybe on some videos. To say which options to use: "contains", "does not contain", "equal", "different" etc.. and then a couple of examples - something like a topic for eveeryone who want to use Packagizer to do something.

Eval scripting is more advanced - not a problem, but the problem is time. I just want to check for a simple group of chars. Yes, I know I can download all my desired files in Windows, and then all the files will be acceptable in Linux as well as In Windows. But what if I want to download them on... linux ?:huh:
Reply With Quote
  #4  
Old 29.10.2019, 23:06
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 66,134
Default

Quote:
Originally Posted by elvis_ef View Post
Yes, I know I can download all my desired files in Windows, and then all the files will be acceptable in Linux as well as In Windows. But what if I want to download them on... linux ?:huh:
I'm sorry if I didn't explain good enough. The current code works for all supported OS. That means you don't have to take care of forbidden/reserved characters. You can download the file on supported OS X and continue/use on supported OS Y or download on Y and continue on X. You don't have to take care of this by yourself
__________________
JD-Dev & Server-Admin
Reply With Quote
  #5  
Old 29.10.2019, 23:10
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 66,134
Default

Quote:
Originally Posted by elvis_ef View Post
Is this rule well formed ?
I mean, I tried to set "contains" with regexp active, for this: [a-zA-Z0-9_-\.]+ but... I need something, that will check if the group as I wrote, is the only group of characters that can exist in file names. So every file name with a sign NOT in this group will be replaced by... anything else, maybe underscore, or maybe completely with a new file name generated by me.
It's currently NOT possible to REPLACE. You can only make use of matching groups! That's what the linked tickets are for.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #6  
Old 29.10.2019, 23:14
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 66,134
Default

Quote:
Originally Posted by elvis_ef View Post
These regex's need to be described somewhere, I mean, how t ouse it, visually, maybe on some videos. To say which options to use: "contains", "does not contain", "equal", "different" etc.. and then a couple of examples - something like a topic for eveeryone who want to use Packagizer to do something.
I don't understand. You can use those rules with and without regex. I think the terms *contains*,*contains not* or *equals* or *equals not* should be easy to understand?

"Test"
-> contains "Test" -> yes
-> contains "House" -> no

-> contains NOT "House" -> yes
-> contains NOT "Test" -> no

-> equals "Test" -> yes
-> equals "Test2" -> no
__________________
JD-Dev & Server-Admin
Reply With Quote
  #7  
Old 29.10.2019, 23:17
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 66,134
Default

Quote:
Originally Posted by elvis_ef View Post
Is this rule well formed ?
Your example rule does the following
->name - contains - ?
then set
-> set name to "aaaaaa"

so every filename that contains a ? will be "aaaaaa" then.

Packagizer -> you define one/multiple(AND) *if conditions* and may use regex as well
and then set one/multple *set actions* that may make use of defined matching groups
__________________
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 20:15.
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 - 2019, Jelsoft Enterprises Ltd.