Welcome, Guest
Python Scripts for ComicRack

TOPIC: Import tags from filename with regular expressions

Re:Import tags from filename with regular expressions 8 years 1 month ago #4552

  • vixenfinder
  • vixenfinder's Avatar
  • Offline
  • Junior Boarder
  • Posts: 35
  • Karma: 2
Okay so this is my first time trying this filename importer and my Mangas are structured like this:
Artist Name - Title Name vol.1 ch.2 (Language) [TranslationGroup].cbz
and I am trying to place them in such a manner:
Writer: Artist Name
Series: Title Name
Publisher: TranslationGroup

And frankly I'm just bumping into walls here so any help would be greatly appreciated. Thank you.
The administrator has disabled public write access.

Re:Import tags from filename with regular expressi 8 years 1 month ago #4555

  • Yellowbox
  • Yellowbox's Avatar
  • Offline
  • Junior Boarder
  • Posts: 25
  • Thank you received: 10
  • Karma: 3
Okay so this is my first time trying this filename importer and my Mangas are structured like this:
Artist Name - Title Name vol.1 ch.2 (Language) [TranslationGroup].cbz
and I am trying to place them in such a manner:
Writer: Artist Name
Series: Title Name
Publisher: TranslationGroup
And frankly I'm just bumping into walls here so any help would be greatly appreciated. Thank you.

Okay, I'll throw you a bone...
(?<Writer>.+?) - (?<Series>.+?) vol.(?<Volume>\d+?) ch.(?<Number>\d+?) \(.+?\) \[(?<Publisher>.+?)\]

If the above needs fine-tuning, I'd suggest downloading the program Expresso that I mention in a previous post, plugging this in and seeing what it does. Code helps those who help themselves. Good luck!
The administrator has disabled public write access.

Re:Import tags from filename with regular expressi 8 years 1 month ago #4556

  • Stonepaw
  • Stonepaw's Avatar
  • Offline
  • Moderator
  • Posts: 921
  • Thank you received: 268
  • Karma: 173
Try this:
(?<Writer>.+) - (?<Title>.+) vol.(?<Volume>\d+) ch.(?<Number>\d+) \(.+\) \[(?<Publisher>.+)\]

It should pull, based on your structure, Writer, Title, Volume#, Number and Publisher.

I haven't actually tested it in ComicRack but it seems to work in Expresso.
The administrator has disabled public write access.

Re:Import tags from filename with regular expressi 8 years 1 month ago #4558

  • vixenfinder
  • vixenfinder's Avatar
  • Offline
  • Junior Boarder
  • Posts: 35
  • Karma: 2
Well there's only one way to find out. So far only the Volume, Number, Publisher, Title are done correctly. The Series is still left out and Writer is filled with the directory location of the file.
example file
Ittabu Himeshi - Samurai Shihio vol.1 ch.1 (English) [Anonymous].cbz

*Also Some don't have any volumes or chapters so i'll have to tweak it a little as well.
Last Edit: 8 years 1 month ago by vixenfinder. Reason: I got problems and doctors can't help me.
The administrator has disabled public write access.

Re:Import tags from filename with regular expressi 8 years 1 month ago #4559

  • Stonepaw
  • Stonepaw's Avatar
  • Offline
  • Moderator
  • Posts: 921
  • Thank you received: 268
  • Karma: 173
Whoops, stupid mistake, it should be Series not Title. Try this, should fix the directory problem too as well as making vol and ch. optional.
(?<Writer>[^\\]+?) - (?<Series>.+?)(?: vol.(?<Volume>\d+?))?(?: ch.(?<Number>\d+?))? \(.+\) \[(?<Publisher>.+?)\]
Last Edit: 8 years 1 month ago by Stonepaw.
The administrator has disabled public write access.

Re:Import tags from filename with regular expressi 8 years 1 month ago #4563

  • vixenfinder
  • vixenfinder's Avatar
  • Offline
  • Junior Boarder
  • Posts: 35
  • Karma: 2
This is great. I really appreciate how much you put into this. It works for example
Chaccu Tiki - Iniocho vol.1 ch.2 (English) [Anon].cbz
but not for
Chaccu Tiki - Iniocho(English) [Anon].cbz
If we clarify that one portion then I can't thank you enough.
And again I appreciate your help again.
The administrator has disabled public write access.

Re:Import tags from filename with regular expressi 8 years 1 month ago #4566

  • Stonepaw
  • Stonepaw's Avatar
  • Offline
  • Moderator
  • Posts: 921
  • Thank you received: 268
  • Karma: 173
Try this, I probably made it way to complex than it needs to be but it should work.

(?<Writer>[^\\]+?)\s?-\s?(?<Series>.+?)(?:\s?vol\.\s?(?<Volume>\d*?))?(?:\s?ch\.\s?(?<Number>\d*?))?\s?\(.+\)\s?\[(?<Publisher>.+?)\]
The administrator has disabled public write access.

Re:Import tags from filename with regular expressi 8 years 1 month ago #4569

  • vixenfinder
  • vixenfinder's Avatar
  • Offline
  • Junior Boarder
  • Posts: 35
  • Karma: 2
Winner winner chicken dinner! This is it! Thanks to you, I can now flush through these comics like I did last night's dinner. But can you tell me what this this Exception has been thrown by the darget of an invocation.
The administrator has disabled public write access.

Re:Import tags from filename with regular expressi 8 years 1 month ago #4570

  • Stonepaw
  • Stonepaw's Avatar
  • Offline
  • Moderator
  • Posts: 921
  • Thank you received: 268
  • Karma: 173
But can you tell me what this this Exception has been thrown by the target of an invocation.

It means something is wrong with the script. If you run ComicRack with the scripting console (add -ssc to end of the target path in the shortcut) it should show what the error is.
The administrator has disabled public write access.

Re:Import tags from filename with regular expressi 8 years 1 month ago #4571

  • Yellowbox
  • Yellowbox's Avatar
  • Offline
  • Junior Boarder
  • Posts: 25
  • Thank you received: 10
  • Karma: 3
vixenfinder wrote:
But can you tell me what this this Exception has been thrown by the darget of an invocation.

Uh oh. Never seen that before. When does this happen for you?
The administrator has disabled public write access.
Time to create page: 0.197 seconds

Who's Online

We have 228 guests and 4 members online