JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 24.11.2018, 19:47
tt_1111 tt_1111 is offline
Linkgrabbing Monster
 
Join Date: Apr 2011
Posts: 86
Default Batch-Umbennung von Archivdatein

Situation:
Ein Paket aus vielen Archiven (z.B. *.rar Dateien) wird auf mehreren Hostern angeboten.

Problem:
Die Hoster gehen bei der Namensvergabe nicht einheitlich vor. Manche akzeptieren Leerzeichen, manche ersetzen diese durch Unterstriche (_), Punkte (.) o.ä. Oder aber der Uploader selbst hat sein Paket im Laufe der Jahre ergänzt und nicht auf einheitliche Benamsung geachtet.

Soll nun doppelter Download vermieden und trotzdem alle vorhandenen Hoster genutzt werden (insbesondere ohne Premium-Accounts wichtig), müssen am einfachsten alle Dateien eines (oder sogar mehrerer Hoster) umbenannt werden. Derzeit geht das nur einzeln Datei für Datei. Selbst mit Copy + Paste eine auf Dauer ziemlich ermüdende Tätigkeit.

Mein Wunsch daher: Eine Batch-Umbenennung für alle Archive innerhalb eines Pakets (Zeichenfolge + fortlaufende Nummer). Oder alternativ eine Suchen-/Ersetzen-Funktion, optimalerweise mit RegEx. Ich vermute mal, ersteres ist einfacher zu realisieren.

Last edited by tt_1111; 25.11.2018 at 11:29.
Reply With Quote
  #2  
Old 25.11.2018, 11:45
tt_1111 tt_1111 is offline
Linkgrabbing Monster
 
Join Date: Apr 2011
Posts: 86
Default

Edit 1: Habe gerade erst gesehen, dass etwas versteckt im Kontextmenü unter
Einstellungen -> Umbenennen
bzw. kürzer unter dem Shortcut <F2> obiger Vorschlag 2 (Suche/Ersetzen mit RegEx) bereits realisiert ist.

Ich modifiziere meinen Vorschlag daher dahingehend: Im Umbenennungs-Menü wäre eine Option »fortlaufende Nummer« eine schöne Sache.

Last edited by tt_1111; 25.11.2018 at 12:05.
Reply With Quote
  #3  
Old 25.11.2018, 12:09
tt_1111 tt_1111 is offline
Linkgrabbing Monster
 
Join Date: Apr 2011
Posts: 86
Default

Edit 2:
Die Suchen/Ersetzen Funktion scheint einen kleinen Bug zu enthalten.
Wenn ich nach zwei aufeinanderfolgenden Leerzeichen suche ('__') und diese durch ein einfaches Leerzeichen ersetze ('_'), werden im Ergebnis-String Leerzeichen hinzugefügt statt gestrichen. Oder manchmal werden sie auch durch Unterstriche ersetzt.

Mit der folgenden RegEx-Suche klappt es hingegen wie gewünscht:
Ersetze ein oder mehrere Worttrennzeichen ('\s+') durch ein einzelnes Leerzeichen (' ') .
Reply With Quote
  #4  
Old 25.11.2018, 12:20
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,549
Default

You can use <jd:indexof> placeholder in the rename dialog or packagzier extension, to generate/add the numerical index to the filename based on its position in the package.

You can also check the Event Scripter Extension, to search and replace characters/strings in file/package names using Javascript functions.
Reply With Quote
  #5  
Old 25.11.2018, 17:19
tt_1111 tt_1111 is offline
Linkgrabbing Monster
 
Join Date: Apr 2011
Posts: 86
Default

Hi mgpai!

Didn't know of the <jd:indexof> placeholder.

However I'm not quite sure how to use it. When I put it into the 'replace with' field it only creates '1' within all files of the package. What am I doing wrong?

I don't want to use a general packagizer (applying to all new downloades) rule as this is only relevant when there are differently named but identical files within one package.
Reply With Quote
  #6  
Old 25.11.2018, 17:50
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,549
Default

Original:
file.txt
file.txt
file.txt

Select all files

Rename Dialog:
Search For: ^file\.txt (Default Regex)
Replace With: file <jd:indexof>.txt

Result:
file 1.txt
file 2.txt
file 3.txt

The placeholder (can be in any position in the replace with expression) will be replaced with the numeric index matching the position of the file in the package. It will be automatically padded with necessary leading zeros based on the total number of files in the package.
Reply With Quote
  #7  
Old 25.11.2018, 19:05
tt_1111 tt_1111 is offline
Linkgrabbing Monster
 
Join Date: Apr 2011
Posts: 86
Default

Thanks, that worked.

Was a bit confused first cause in the rename preview only the peaked bracket placeholder <jd:indexof> is shown. But when executing the S&R the correct numbers are inserted.

Topic thus may be closed.
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 04:51.
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 - 2024, Jelsoft Enterprises Ltd.