#1
|
||||
|
||||
Rename packages with spaces
Is it possible using packagizer rules to auto-rename package names with spaces between the words with periods?, for example: word1 word2 word3 and replace with word1.word2.word3
|
#2
|
||||
|
||||
for memory the back end should remove periods and underscores automatically.
the only time it wont is if plugins are involved and property is set to prevent cleanup from happening. do you have any example test links?
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#3
|
||||
|
||||
Quote:
I have created two other package rules that are working properly. One that removes .www dot website dot com from all files inside package and a 2nd one to rename jpg files the same as package name, however, the third rule to substitute the spaces between the words with periods(.) is giving me some trouble. I can use .* in the condition but all combos I tried to 'set' for package name are either _._ or _. etc. I think I may need to use the 'package key pattern' for this third rule. Last edited by RPNet-user; 29.02.2020 at 03:44. |
#4
|
||||
|
||||
Not sure which plugin psp deleted (haven't updated workspace), but the original and newer one(not sure why dupe was created) both set package names. this is from website material.
To rename package name or filename you would need to reconstruct it from source thats correct, or you could guess and place it in, though this could take more work. Not sure if a single generic rule would work, most likely not. You would then need multiple rules for every combination you can think of. one space, two spaces, three spaces, etc
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#5
|
||||
|
||||
Ok i finally got it working but that is a lot of asterisks and a lot of package patterns just for that package, the problem is different packages will have different amount of spaces so this rule will only work for packages that have seven spaces, hopefully there is an easier method that covers any amount of spaces like a regex.
Code:
If Package name: * * * * * * * * Then set Package name: <jd:orgpackagename:1>.<jd:orgpackagename:2>.<jd:orgpackagename:3>.<jd:orgpackagename:4>.<jd:orgpackagename:5>.<jd:orgpackagename:6>.<jd:orgpackagename:7>.<jd:orgpackagename:8> Last edited by RPNet-user; 29.02.2020 at 04:38. |
#6
|
||||
|
||||
thats where a generic single rule fails. which i kinda hinted that you would need a rule for each possibility.
duplicate the rule and just remove one * listener and reference call
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#7
|
||||
|
||||
Yes the 'duplicate rule' is a time saver but there are some packages that have 10+ spaces, I just tested one with 11. Its is too bad I cannot use something like this in the package field rule that would cover all rules for spaces: (/\s/g, ".")
|
#8
|
||||
|
||||
you could look at the event scripter, it would allow for more flexibility. you could just use in java .replace(" ", "."). I'm sure there is a equivalent in javascript w3schools.com/jsref/jsref_replace.asp
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#9
|
||||
|
||||
Thanks raztoki, good idea, I will check it out.
|
#10
|
||||
|
||||
The script does change the entire package name by replacing all the spaces with periods immediately after it finishes, the only problem is that it only changes it in the downloads list and not the actual downloaded folder:
Code:
Event Trigger: Package Finished package.setName(package.name.replace(/\s/g, ".")) |
#11
|
||||
|
||||
if you're using sub directory as pakagename that is set on entry into linkgrabber, which is prior to event scripter. just reset the save path after the rename.
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#12
|
||||
|
||||
What do you mean "reset the save path"?
|
#13
|
||||
|
||||
well from you previous response & the download I assume that your using sub directory as package name. that is set at entry into linkgrabber, you alter with js the package name thus the wrong save name now, so you need to re-set it so align with your new package name
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#14
|
||||
|
||||
My default folder path is set for C:\JD2\<jd:packagename>.
Whether I use or not use '<jd:packagename>' the results are the same. Disabling both JD2 predefined package rules of 'create subfolder by packagname' and 'adopt folder structure' did not make any difference. Other than this, I have no idea how/where to 'reset' this path/packagename. |
#15
|
||||
|
||||
you do this in javascript, along wiht your renaming function
as save path is set at the time into linkgrabber, since you are altering the packagename after it adds (previous save path is of the original name) you then need to reset the save path to reflect you changes.
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#16
|
|||
|
|||
Use a script with "Packagizer Hook" trigger.
|
#17
|
||||
|
||||
I think that what I'm trying to accomplish may be too complex:
I'm trying to: 1. Rename the packages by replacing spaces with periods 2. Remove the .**External links are only visible to Support Staff**www.website.com appended to video files within the package 3. Rename the jpg file with same name as the video files including the periods between words Using packagizer rules only I have been able to accomplish only two of three in different scenarios: Scenario-1 1. Able to rename package by replacing spaces with periods 2. Able to remove all .**External links are only visible to Support Staff**www.website.com from all video files 3. Unable to rename jpg with the same name as video files and include the periods between words(same as video files) Scenario-2 1. Able to remove all .**External links are only visible to Support Staff**www.website.com from all video files 2. Able to Rename jpg file with same name as the video files from packagename except for the periods between words 3. Unable to replace spaces with periods for both packagename and jpg |
#18
|
|||
|
|||
Script:
Code:
gist.github.com/mgpai/aed241abcc28b34ea640250c84a794e1 Find me in JD Chat if you need any modifications. |
#19
|
||||
|
||||
Once again mgpai, thanks for your script and support assistance through the chat, this script does everything perfectly.
|
Thread Tools | |
Display Modes | |
|
|