JDownloader Community - Appwork GmbH
 

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02.10.2022, 23:02
verheiratet1952 verheiratet1952 is offline
Black Hole
 
Join Date: Jan 2016
Posts: 290
Default special characters renaming with eventscripter

I have some eventscripter using as packagizer hook to rename special characters when crawling content to get clean package names...

it is::
if (state = "AFTER") {
var name = link.getPackageName();
if (name) {
var newName = name;
newName = newName.replace(//g, "");
newName = newName.replace("&", "and");
newName = newName.replace("@", "-");
newName = newName.replace("andamp;", "-");
newName = newName.replace("-r-", "-");
newName = newName.replace(" R-", "-");
newName = newName.replace(" r-", "-");
newName = newName.replace("xpost", "-");
newName = newName.replace("x-post", "-");
newName = newName.replace("https", "-");
newName = newName.replace("http", "-");
newName = newName.replace("-R-", "-");
newName = newName.replace("Xpost", "-");
newName = newName.replace("X-post", "-");
newName = newName.replace("XPost", "-");
newName = newName.replace("X-Post", "-");
newName = newName.replace("XPOST", "-");
newName = newName.replace("X-POST", "-");
newName = newName.replace(" IMG", "-");
newName = newName.replace("-IMG", "-");
newName = newName.replace(/'/g, "");
newName = newName.replace(//gi, "a");
newName = newName.replace(//gi, "e");
newName = newName.replace(//gi, "i");
newName = newName.replace(//gi, "o");
newName = newName.replace(//gi, "u");
newName = newName.replace(//gi, "ae");
newName = newName.replace(//gi, "oe");
newName = newName.replace(//gi, "ue");
newName = newName.replace(//gi, "a");
newName = newName.replace(//gi, "e");
newName = newName.replace(//gi, "i");
newName = newName.replace(//gi, "o");
newName = newName.replace(//gi, "u");
newName = newName.replace(//gi, "a");
newName = newName.replace(//gi, "e");
newName = newName.replace(//gi, "i");
newName = newName.replace(//gi, "o");
newName = newName.replace(//gi, "u");
newName = newName.replace(//gi, "a");
newName = newName.replace(//gi, "n");
newName = newName.replace(//gi, "c");
newName = newName.replace(//gi, "o");
newName = newName.replace(//gi, "o");
newName = newName.replace(//gi, "y");
newName = newName.replace(//gi, "a");
newName = newName.replace(//gi, "e");
newName = newName.replace(//gi, "i");
newName = newName.replace(//g, "ss");
newName = newName.replace(/ł/gi, "l");
newName = newName.replace(//gi, "ae");
newName = newName.replace(//gi, "d");
newName = newName.replace(//gi, "s");
newName = newName.replace(/č/gi, "c");
newName = newName.replace(//gi, "n");
newName = newName.replace(/ş/gi, "s");
newName = newName.replace(/ć/gi, "c");
newName = newName.replace(/ı/gi, "i");
newName = newName.replace(/ř/gi, "r");
newName = newName.replace(/ă/gi, "a");
newName = newName.replace(/İ/gi, "i");
newName = newName.replace(/č/gi, "c");
newName = newName.replace(/ş/gi, "s");
newName = newName.replace(/ć/gi, "c");
newName = newName.replace(/ı/gi, "i");
newName = newName.replace(/[^\x00-\x7F]/g, "-");
newName = newName.replace(/[!(\[)\]]/g, "-");
newName = newName.replace(/[,_{}|=~#%+]/g, "-");

if (name != newName) link.setPackageName(newName);
}
}

and it is:

if (state = "AFTER") {
var name = link.getName();
var newName = name;
var map = {};

if (name) {
map. = "a";
map. = "a";
map. = "e";
map. = "i";
map. = "o";
map. = "u";
map. = "a";
map. = "e";
map. = "i";
map. = "o";
map. = "u";
map. = "ae";
map. = "oe";
map. = "oe";
map. = "ue";
map. = "e";
map. = "i";
map. = "a";
map. = "n";
map. = "c";
map. = "o";
map. = "u";
map. = "o";
map. = "e";
map. = "o";
map. = "o";
map. = "y";
map.$ = "s";
map. = "a";
map. = "i";
map. = "a";
map. = "u";
map. = "ss";
map. = "ae";
map.ł = "l";
map. = "d";
map. = "s";
map.č = "c";
map.ş = "s";
map.ć = "c";
map.ı = "i";
map.ř = "r";
map.č = "c";
map.ă = "a";
map.â = "a";

for (x in map) {
newName = newName.replace(x, map[x]);
}

if (name != newName) link.setName(newName);
}
}


but there are still some special characters for package names !?

example links

**External links are only visible to Support Staff****External links are only visible to Support Staff**
**External links are only visible to Support Staff****External links are only visible to Support Staff**

please tell me, what I am doing wrong!?
Reply With Quote
 

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:18.
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.