Welcome, Guest
Python Scripts for ComicRack

TOPIC: Priat(Path Reader and InterActive Tagger) V 0.0.9. Bugfix release

Re: Priat(Path Reader and InterActive Tagger) V 0.0.4. Sorting, Sizing and More ... 5 years 4 months ago #24000

  • Kins3
  • Kins3's Avatar
  • Offline
  • Senior Boarder
  • Posts: 43
  • Thank you received: 4
  • Karma: 1
Ok, little example.

Filename:
D:\Anime\Manga\Scanlations\Kodomo no Jikan\[SaHa] Kaworu Watashiya - Kodomo no Jikan Vol.1 (English).cbz

Regex attempt (not complete):
Scanlations\\(?<Series>.*(?=\\))\\\[(?<Editor>.*(?=]))]\s*(?<Writer>\w+(\s+\w+)*)\s*-\s*(?<Title>.*)\s*(Vol(\.*\s*)(?<Volume>\d+))?\s*\(English\)\.cbz

Regex object output:
Match offset: 15
Match length: 89
Matched text: Scanlations\Kodomo no Jikan\[SaHa] Kaworu Watashiya - Kodomo no Jikan Vol.1 (English).cbz
Group 1 offset: 56
Group 1 length: 10
Group 1 text:  Watashiya
Group 2 did not participate in the overall match
Group 3 did not participate in the overall match
Group 4 offset: 27
Group 4 length: 15
Group 4 text: Kodomo no Jikan
Group 5 offset: 44
Group 5 length: 4
Group 5 text: SaHa
Group 6 offset: 50
Group 6 length: 16
Group 6 text: Kaworu Watashiya
Group 7 offset: 69
Group 7 length: 22
Group 7 text: Kodomo no Jikan Vol.1 
Group 8 did not participate in the overall match

All this information can be extracted directly from the .NET match object. Since groups 2 and 3 didn't participate in the match, that tells me that my attempt to isolate the volume section failed, likely due to greedy matching on the Title.

If I alter the regex to:
Scanlations\\(?<Series>.*(?=\\))\\\[(?<Editor>.*(?=]))]\s*(?<Writer>\w+(\s+\w+)*)\s*-\s*(?<Title>[\w\s-]+)\s*(Vol(\.*\s*)(?<Volume>\d+))?\s*\(English\)\.cbz

I get a more complete match:
Match offset: 15
Match length: 89
Matched text: Scanlations\Kodomo no Jikan\[SaHa] Kaworu Watashiya - Kodomo no Jikan Vol.1 (English).cbz
Group 1 offset: 56
Group 1 length: 10
Group 1 text:  Watashiya
Group 2 offset: 85
Group 2 length: 5
Group 2 text: Vol.1
Group 3 offset: 88
Group 3 length: 1
Group 3 text: .
Group 4 offset: 27
Group 4 length: 15
Group 4 text: Kodomo no Jikan
Group 5 offset: 44
Group 5 length: 4
Group 5 text: SaHa
Group 6 offset: 50
Group 6 length: 16
Group 6 text: Kaworu Watashiya
Group 7 offset: 69
Group 7 length: 16
Group 7 text: Kodomo no Jikan 
Group 8 offset: 89
Group 8 length: 1
Group 8 text: 1

Anyway, part of the issue was that I couldn't find the program I had to let me do this regex testing. Since I found it, it's less of an issue, but would still be convenient to pull this info up for individual entries, since there's no easy way to copy/paste out the full path of the ones that fail.
The administrator has disabled public write access.

Re: Priat(Path Reader and InterActive Tagger) V 0.0.4. Sorting, Sizing and More ... 5 years 4 months ago #24005

  • 600WPMPO
  • 600WPMPO's Avatar
  • Offline
  • Moderator
  • Posts: 3788
  • Thank you received: 557
  • Karma: 232
@tcm1998: many thanks for the new update!

+1 karma coming its way! :-)
Now Playing: The ComicRack Manual (Online)

See my new comics & gadgets on: Tumblr!
The administrator has disabled public write access.

Re: Priat(Path Reader and InterActive Tagger) V 0.0.4. Sorting, Sizing and More ... 5 years 4 months ago #24007

  • tcm1998
  • tcm1998's Avatar
  • Offline
  • Expert Boarder
  • Posts: 94
  • Thank you received: 16
  • Karma: 6
Kins3 wrote:
All this information can be extracted directly from the .NET match object.

Thanks for the explanation. I didn't know I could get that much info from the Match object. I will definately play with this examples.
Kins3 wrote:
Anyway, part of the issue was that I couldn't find the program I had to let me do this regex testing. Since I found it, it's less of an issue

Can I ask what program that is? Is that regex buddy or do you have something else to help you figure it out?
Kins3 wrote:
... , but would still be convenient to pull this info up for individual entries, since there's no easy way to copy/paste out the full path of the ones that fail.

If I need a context menu anyway, copying entries should be a breeze. So I'll just consider that as a request too.
Just madly collecting (dutch) comics
The administrator has disabled public write access.

Re: Priat(Path Reader and InterActive Tagger) V 0.0.4. Sorting, Sizing and More ... 5 years 4 months ago #24009

  • Kins3
  • Kins3's Avatar
  • Offline
  • Senior Boarder
  • Posts: 43
  • Thank you received: 4
  • Karma: 1
tcm1998 wrote:
Can I ask what program that is? Is that regex buddy or do you have something else to help you figure it out?

It's just a little demo utility that lets me do quick checks on regexes. Can get it from www.regular-expressions.info/dotnetexample.html

RegexBuddy seemed a bit overkill for my needs back when, but I can see a couple instances where it could be useful (though I'm not sure it's $40 useful).
The administrator has disabled public write access.

Re: Priat(Path Reader and InterActive Tagger) V 0.0.5 Regex details 5 years 4 months ago #24083

  • tcm1998
  • tcm1998's Avatar
  • Offline
  • Expert Boarder
  • Posts: 94
  • Thank you received: 16
  • Karma: 6
Once again. New version released. This time the requested regex details.
I might have gone a little overboard, but I hope it's usefulls.

Enjoy!!
Just madly collecting (dutch) comics
The administrator has disabled public write access.

Re: Priat(Path Reader and InterActive Tagger) V 0.0.5 Regex details 5 years 4 months ago #24105

  • tcm1998
  • tcm1998's Avatar
  • Offline
  • Expert Boarder
  • Posts: 94
  • Thank you received: 16
  • Karma: 6
Oops, had to urgently fix some small bugs. See first post for details, as usual.
Just madly collecting (dutch) comics
The administrator has disabled public write access.

Re: Priat(Path Reader and InterActive Tagger) V 0.0.6. Bugfix release 5 years 3 months ago #24451

  • Kins3
  • Kins3's Avatar
  • Offline
  • Senior Boarder
  • Posts: 43
  • Thank you received: 4
  • Karma: 1
Exception generated while testing a regex in the Regex Match Details window.
IndexOutOfRangeException
Char RightChar()
Index was outside the bounds of the array.
   at System.Text.RegularExpressions.RegexParser.RightChar()
   at System.Text.RegularExpressions.RegexParser.ScanGroupOpen()
   at System.Text.RegularExpressions.RegexParser.ScanRegex()
   at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op)
   at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options, Boolean useCache)
   at Priat.MatchDetailsForm.ProcessRegex(String inputText, String RegexText)
   at Priat.MatchDetailsForm.FillDetails(String inputText, String RegexText)
   at Priat.MatchDetailsForm.txtRegexDisplay_TextChanged(Object sender, EventArgs e)
   at System.Windows.Forms.TextBoxBase.WmReflectCommand(Message& m)
   at System.Windows.Forms.TextBox.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Regex:
Manga\\(?<Series>[a-zA-Z']+( [a-zA-Z']+)*)\s*(?<Number2>(?<Month>\d+)-(?<Year>\d+))(?<q-

File:
D:\Anime\Manga\You're Under Arrest 01-2012 - Copy.cbz


Exception occurred when adding the final - character at the end of the regex (was testing balancing group definitions). CR recovered from the error.
Last Edit: 5 years 3 months ago by Kins3.
The administrator has disabled public write access.

Re: Priat(Path Reader and InterActive Tagger) V 0.0.6. Bugfix release 5 years 3 months ago #24466

  • tcm1998
  • tcm1998's Avatar
  • Offline
  • Expert Boarder
  • Posts: 94
  • Thank you received: 16
  • Karma: 6
Kins3 wrote:
Exception generated while testing a regex in the Regex Match Details window.

Regex:
Manga\\(?<Series>[a-zA-Z']+( [a-zA-Z']+)*)\s*(?<Number2>(?<Month>\d+)-(?<Year>\d+))(?<q-

File:
D:\Anime\Manga\You're Under Arrest 01-2012 - Copy.cbz


Exception occurred when adding the final - character at the end of the regex (was testing balancing group definitions). CR recovered from the error.

Sorry about that. I'll have a look at it after I'm back from holiday, next tuesday.
Just madly collecting (dutch) comics
The administrator has disabled public write access.

Re: Priat(Path Reader and InterActive Tagger) V 0.0.6. Bugfix release 5 years 3 months ago #24628

  • tcm1998
  • tcm1998's Avatar
  • Offline
  • Expert Boarder
  • Posts: 94
  • Thank you received: 16
  • Karma: 6
Kins3 wrote:
Exception generated while testing a regex in the Regex Match Details window.

Regex:
Manga\\(?<Series>[a-zA-Z']+( [a-zA-Z']+)*)\s*(?<Number2>(?<Month>\d+)-(?<Year>\d+))(?<q-

File:
D:\Anime\Manga\You're Under Arrest 01-2012 - Copy.cbz


Exception occurred when adding the final - character at the end of the regex (was testing balancing group definitions). CR recovered from the error.


Should be fixed now. Weird that the exception happened in the constructor of the Regex class, while the IndexOutOfRangeException is not in the documentation for this class. That's why I didn't add a try/catch for it.

Get the download in the first post as usual.

Edit:

Hmm, no, it's not. Got to go now. Have to fix it later (in a couple of hours)
Just madly collecting (dutch) comics
Last Edit: 5 years 3 months ago by tcm1998.
The administrator has disabled public write access.

Re: Priat(Path Reader and InterActive Tagger) V 0.0.6. Bugfix release 5 years 3 months ago #24634

  • tcm1998
  • tcm1998's Avatar
  • Offline
  • Expert Boarder
  • Posts: 94
  • Thank you received: 16
  • Karma: 6
Kins3 wrote:
Exception generated while testing a regex in the Regex Match Details window.

Regex:
Manga\\(?<Series>[a-zA-Z']+( [a-zA-Z']+)*)\s*(?<Number2>(?<Month>\d+)-(?<Year>\d+))(?<q-

File:
D:\Anime\Manga\You're Under Arrest 01-2012 - Copy.cbz


Exception occurred when adding the final - character at the end of the regex (was testing balancing group definitions). CR recovered from the error.

Finally fixed. I missed the remark that is happened in the details view. That made me realise that I should fix it there too. The error could happen in main view and details view. Both are fixed now.

Get it from the first post.
Just madly collecting (dutch) comics
The administrator has disabled public write access.
Time to create page: 0.225 seconds

Who's Online

We have 242 guests and 6 members online