Welcome, Guest
Python Scripts for ComicRack
  • Page:
  • 1
  • 2

TOPIC: Problem with scripting filename parsing

Problem with scripting filename parsing 9 years 3 months ago #1430

  • Flugan
  • Flugan's Avatar
  • Offline
  • Junior Boarder
  • Posts: 28
  • Karma: -2
I have a problem with scripted filename parsing. It seems to be working fairly well and I have managed to automatically parse probably more than 99% of my collection. Everything seems to be working fine until I close the application. Note when I close all values are still grey because I didn't change anything. When I start the application again the whole library is using the built-in parsing and the only way to get my nice parsing back is to re-import the whole library. It seems like the program doesn't save gray values because they are cheap to calculate again but then forgets to apply the custom parsing script when working with an existing library.

I am in the process of scripting filename parsing also suitable for manga using regular expressions. I have not tried to make it fault proof just make it parse the many variations of name schemes used in my collection and falling back to standard parsing when it fails. Current code is in a WIP state where I set the year to an known but invalid state to track which regular expression is used for a particular file if I it's not handled correctly.

File Attachment:

File Name: Mine.zip
File Size:2 KB
The administrator has disabled public write access.

Re:Problem with scripting filename parsing 9 years 3 months ago #1431

  • Flugan
  • Flugan's Avatar
  • Offline
  • Junior Boarder
  • Posts: 28
  • Karma: -2
Just want to thank you for a great program and if I can get file parsing to work I can actually start using it for the first time. Before the task of manually entering all metadata was detering
The administrator has disabled public write access.

Re:Problem with scripting filename parsing 9 years 3 months ago #1432

  • cYo
  • cYo's Avatar
  • Offline
  • Moderator
  • Posts: 3476
  • Thank you received: 675
  • Karma: 181
thanks for your work.
I'll look into the problem.

UPDATE: yes there is a problem. Script engine gets initialized to late. I will fix it in the next release.
Last Edit: 9 years 3 months ago by cYo.
The administrator has disabled public write access.

Re:Problem with scripting filename parsing 9 years 3 months ago #1433

  • Flugan
  • Flugan's Avatar
  • Offline
  • Junior Boarder
  • Posts: 28
  • Karma: -2
I'm using x64 if that affects things, Do you have any documentation for accessing pages pagecount and page filenames. I'm mostly concerned with pagecounts atm but I want to make sure to read the correct value. Saw someone using GetSafePage() function and I tried Pages.Count but that only seems to give the right value if the comic is "active" while PageCount probably does what I want.

I'm just curious if you have any resource other than the scripting guide or If I should just use ildasm to find the available methods that way. I might be ignoring some option. Would be nice to be able to script page tagging for certain common circumstances.
The administrator has disabled public write access.

Re:Problem with scripting filename parsing 9 years 3 months ago #1434

  • cYo
  • cYo's Avatar
  • Offline
  • Moderator
  • Posts: 3476
  • Thank you received: 675
  • Karma: 181
the file parser should edit the values in the proposed object (sample). That's the reason why there is no comic object :)

PageCount and the whole page collection is calculated on the fly when ComicRack works with the file. This is because accessing single files in packed archives is rather slow.

No need to set it or change it.
The administrator has disabled public write access.

Re:Problem with scripting filename parsing 9 years 3 months ago #1435

  • Flugan
  • Flugan's Avatar
  • Offline
  • Junior Boarder
  • Posts: 28
  • Karma: -2
It seems like the fileparser script is only called during import which means that the values proposed by the script is only temporary as the next time the application is run the proposed values is calculated without using the fileparser script.

Be aware that I'm interpolating the visible behaviour to a likely reason. I have no way of telling why the proposed values isn't saved between sessions.

The reason I'm looking at the PageCount at all is for an unrelated script. I'm interested in the equivalent of a stacked detail view where instead of looking at pagecounts for individual series it will show the sum of all pages in a series. Basically a Book, Library script where I plan to use Windows forms to sort and manipulate series instead of individual files.

The initial script intends just to calculate the total page count of selected books. Therefore I need to know that CR has the correct pagecount available or force CR to parse the file. Generally CR will parse the page count for everything if you let it but I havn't checked wheter it's saved in the xml structure.
The administrator has disabled public write access.

Re:Problem with scripting filename parsing 9 years 3 months ago #1436

  • Flugan
  • Flugan's Avatar
  • Offline
  • Junior Boarder
  • Posts: 28
  • Karma: -2
Just read the xml data and pagecount is saved nicely :) Although almost nothing else which means that unless the proposed valuse are always calculated using my script all that metadata will be lost.
The administrator has disabled public write access.

Re:Problem with scripting filename parsing 9 years 3 months ago #1437

  • cYo
  • cYo's Avatar
  • Offline
  • Moderator
  • Posts: 3476
  • Thank you received: 675
  • Karma: 181
You where right with your guess. Proposed values are not saved. So changing the script will change all the proposed values for each eComic. This is by design. Proposed values should only be "proposed" and not stored.

As stated above, 0.9.82 has a bug, that hooks too late into the file parser script after the first run over all eComics was already completed (proposed values are internally cached, of course - so your method has only be called for newly added items.)
0.9.83 has the fix.

Except PDF files, all eComics have correct page counts from the moment they are in the library.

The Pages collection does not have to be valid, only the PageCount property.
The administrator has disabled public write access.

Re:Problem with scripting filename parsing 9 years 3 months ago #1439

  • Flugan
  • Flugan's Avatar
  • Offline
  • Junior Boarder
  • Posts: 28
  • Karma: -2
Just to comfirm this is the behaviour I'm seeing in the most basic test case. I was running with -dso -ssc and Could clearly see that the script was only called for one of the files the second time the program was opened. When browsing the files using the folder tab they were scanned there and then and again when I added them to the library. After adding to the library the folder tab shows the same data as the library tab as intended including the bug.

None of the suggested data is stored in the xml files when I checked and they shouldn't.
The administrator has disabled public write access.

Re:Problem with scripting filename parsing 9 years 3 months ago #1440

  • Flugan
  • Flugan's Avatar
  • Offline
  • Junior Boarder
  • Posts: 28
  • Karma: -2
The image failed to upload so here it comes zipped.

File Attachment:

File Name: library_image.zip
File Size:27 KB


I did miss your edit earlier so some things said are probably redundant since the bug was located.
Last Edit: 9 years 3 months ago by Flugan.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.197 seconds

Who's Online

We have 216 guests and 6 members online