Welcome, Guest
Python Scripts for ComicRack

TOPIC: CreateBookList Custom Scrips "options" value (and some of my beta scripts)

CreateBookList Custom Scrips "options" value (and some of my beta scripts) 1 year 3 weeks ago #46406

  • boshuda
  • boshuda's Avatar
  • Offline
  • Gold Boarder
  • Posts: 295
  • Thank you received: 64
  • Karma: 8
Xelloss wrote:
Ok, I don't have much time now to test it correctly, but if you want to give it a try, this is the beta version.

If you have many comics with special characters in the series name, try to see if the script results are correct to the search please :P

In any case, if you can give me volume and comic ids of comics you found problems with (the more and the more different the better) to make some tests, I would be grateful.

edit: I found a more elegant solution to the above... and easier... instead of changing integers to string with str() I now use unicode(), which of course doesn't have problem with unicode characters...

Here the file:


File Attachment:

File Name: SameXDiffe...-2-3.zip
File Size:2 KB


To sum it up:

The problem was that I needed all "x" values in "string" format, because I used them as a string id to make the different groups in a dictionary type. So, as I didn't know if the value was a string, an integer, a float, etc (it could be any of them depending on the values the user used) I just converted "anything" to string with str(). If the value was already an string, it just kept it as it was. OR SO I THOUGHT

The thing is that str() works great with unicode strings (transforming them to "python" strings) UNLESS there is some character that is not an ASCII character in it. In that case, instead of ignoring it, it just give "" as answer for the whole string. This made all "whatever unicode string with an special character" the same for the algorithm, and so they were grouped in the same group (giving false positives)

This all was because I had no idea python has two types of string, Python Strings and Unicode Strings... (as everything works almost the same with the two, but not very well when you mix them).

To solve it (in the last version, in the previous one I did something more complicated with exceptions that worked too) I just used the unicode version of str(), that is unicode(). And just use unicode strings instead of python strings to make the groups. This seemed to work fine with my tests, but I ask you to test it with yours if you can.

IN OTHER WORDS: If you are making an script, and you are working with values with special characters (any text from comicvine), and you want to convert an integer, float, or whatever, to a string type value, use unicode() and not str() - specially if you don't know the type of the thing you are converting

Update the scripts API wiki page. That's some useful info, that's bitten me a few times, too. Usually setting the encoding fixes it, but that's something I hadn't uncovered in my investigations.
The administrator has disabled public write access.
The following user(s) said Thank You: Xelloss

CreateBookList Custom Scrips "options" value (and some of my beta scripts) 1 year 3 weeks ago #46410

  • Xelloss
  • Xelloss's Avatar
  • Online
  • Platinum Boarder
  • Posts: 455
  • Thank you received: 117
  • Karma: 24
Mmmmh... I don't think it is something to add to the API wiki... It is more of a python thing than comirack...

Also, it is more about the str() function, that I used instead of unicode() because I knew only the first one....

All in all is something that will only be usefull when you use this function to convert numbers to strings... AND AT THE SAME TIME USE THE SAME LINE FOR UNICODE STRINGS TO STRINGS... that is quite specific...

about the encoding... that is more usefull, because it lets you manage unicode characters withing the scripts lines... which is something much more common in comicrack scripting...

Something I would really like to be added to the wiki (perhaps some day I will do it) is the COMPLETE list of comic values... There are SO MANY comicrack native fields in the comic and page objetcs not present in the API wiki... I had to make my own script to list them all directly from python...

And not only for scripting, but for using scripts likes this ones that is TERRIBLY useful... (that is why I create this topic originally, for asking comicrack devolopers to add a "list field" options in custom search scripts, so that I could add all this fields in the script for the user to select)
Last Edit: 1 year 3 weeks ago by Xelloss.
The administrator has disabled public write access.

CreateBookList Custom Scrips "options" value (and some of my beta scripts) 1 year 3 weeks ago #46416

  • boshuda
  • boshuda's Avatar
  • Offline
  • Gold Boarder
  • Posts: 295
  • Thank you received: 64
  • Karma: 8
Xelloss wrote:
Something I would really like to be added to the wiki (perhaps some day I will do it) is the COMPLETE list of comic values... There are SO MANY comicrack native fields in the comic and page objetcs not present in the API wiki... I had to make my own script to list them all directly from python...

And not only for scripting, but for using scripts likes this ones that is TERRIBLY useful... (that is why I create this topic originally, for asking comicrack devolopers to add a "list field" options in custom search scripts, so that I could add all this fields in the script for the user to select)

How did you do that? I've looked into it, and thought about poking around until I found what worked, but if you're willing to share your code I would appreciate it.

I guess I didn't really mean the API portion, you're right. But it could be a useful note to add to the general scripting wiki. Especially as the version of Python supported by CR becomes more and more outdated.
The administrator has disabled public write access.

CreateBookList Custom Scrips "options" value (and some of my beta scripts) 1 year 3 weeks ago #46417

  • Xelloss
  • Xelloss's Avatar
  • Online
  • Platinum Boarder
  • Posts: 455
  • Thank you received: 117
  • Karma: 24
I don't know if I have the script... it took me some researching about python types to do it...

I am pretty sure though I have the txt output somewhere at home... I will send it to you when I am there...

I found more useful the "page object" one... as there is almost no info about that in the api wiki... (for example the page resolution is stored there, which helped me a lot for many scripts)

edit: I found it in remote desktop XD

Here is the output for comic object values:
['AddedTime'
'AddedTimeAsText'
'AgeRating'
'AgeRatingIcons'
'AlternateCaption'
'AlternateCount'
'AlternateCountAsText'
'AlternateNumber'
'AlternateNumberAsText'
'AlternateSeries'
'AppendArtistInfo'
'ArtistInfo'
'BlackAndWhite'
'BlackAndWhiteAsText'
'BookAge'
'BookChanged'
'BookCollectionStatus'
'BookCondition'
'BookLocation'
'BookNotes'
'BookOwner'
'BookPrice'
'BookPriceAsText'
'BookStore'
'BookmarkCount'
'BookmarkCountAsText'
'Bookmarks'
'Caption'
'CaptionWithoutFormat'
'CaptionWithoutTitle'
'Characters'
'Checked'
'ClearBookmarks'
'ClearExtraSyncInformation'
'ClipboardFormat'
'Clone'
'ColorAdjustment'
'ColorAdjustmentSpecified'
'Colorist'
'ComicInfoIsDirty'
'ComicProviderCreated'
'CommunityRating'
'CommunityRatingAsText'
'CompareAlternateNumber'
'CompareNumber'
'Container'
'CopyDataFrom'
'CopyFrom'
'CopyTo'
'Count'
'CountAsText'
'CoverArtist'
'CoverAsText'
'CoverKeyFilter'
'Create'
'CreateComicProvider'
'CreateFileHash'
'CreateImageProvider'
'CreateNavigator'
'CurrentPage'
'CurrentPageInfo'
'CustomThumbnailKey'
'CustomValuesStore'
'Day'
'DayAsText'
'Default'
'DefaultAlternateCaptionFormat'
'DefaultCaptionFormat'
'DefaultComicExportFileNameFormat'
'DeleteCustomValue'
'Deserialize'
'DeserializeFull'
'DisplayFileLocation'
'EditMode'
'Editor'
'EnableDynamicUpdate'
'EnableGroupNameCompression'
'EnableProposed'
'EnableProposedAsText'
'Equals'
'ExtraSyncInformation'
'FileCreationTime'
'FileCreationTimeAsText'
'FileDirectory'
'FileFormat'
'FileInfoRetrieved'
'FileIsMissing'
'FileLocation'
'FileModifiedTime'
'FileModifiedTimeAsText'
'FileName'
'FileNameWithExtension'
'FilePath'
'FileRenamed'
'FileSize'
'FileSizeAsText'
'FirstNonCoverPageIndex'
'Format'
'FormatDate'
'FormatFileDate'
'FormatIcons'
'FormatNumber'
'FormatPages'
'FormatRating'
'FormatString'
'FormatTitle'
'FormatVolume'
'FormatYear'
'FrontCoverCount'
'FrontCoverPageIndex'
'Genre'
'GetCustomValue'
'GetCustomValues'
'GetFrontCoverKey'
'GetFrontCoverThumbnailKey'
'GetFullTitle'
'GetHashCode'
'GetIcons'
'GetImageKey'
'GetImprintIconKey'
'GetInfo'
'GetIsoCulture'
'GetLanguageName'
'GetPage'
'GetPageByImageIndex'
'GetPageKey'
'GetPageList'
'GetProperties'
'GetPropertyValue'
'GetPublisherIconKey'
'GetStringPropertyValue'
'GetThumbnailKey'
'GetTranslatedWritableStringProperties'
'GetType'
'GetUntypedPropertyValue'
'GetWritableStringProperties'
'GetYesNoAsText'
'GuidEquality'
'HasBeenOpened'
'HasBeenRead'
'HasBeenReadAsText'
'Hash'
'ISBN'
'Id'
'Imprint'
'InfoText'
'Inker'
'IsDefaultPropertyValue'
'IsDefaultValue'
'IsDynamicSource'
'IsInContainer'
'IsLinked'
'IsLinkedAsText'
'IsSameContent'
'IsSearchable'
'IsValidComicBook'
'IsValidCoverKey'
'LanguageAsText'
'LanguageISO'
'LastOpenedFromListId'
'LastOpenedFromListIdSpecified'
'LastPageRead'
'LastPageReadAsText'
'Letterer'
'LoadFromSidecar'
'Locations'
'MainCharacterOrTeam'
'Manga'
'MangaAsText'
'MapPropertyName'
'MapPropertyNameToAsText'
'MarkAsNotRead'
'MarkAsRead'
'MemberwiseClone'
'Month'
'MonthAsText'
'MovePages'
'NewBooksChecked'
'NewPages'
'NewPagesAsText'
'NoText'
'Notes'
'Number'
'NumberAsText'
'NumberOnly'
'OnBookChanged'
'OnComicProviderCreated'
'OnCreateComicProvider'
'OnFileRenamed'
'OnNewComicPageAdded'
'OnParseFilePath'
'OpenProvider'
'OpenedCount'
'OpenedCountAsText'
'OpenedTime'
'OpenedTimeAsText'
'PageCount'
'Pages'
'PagesAsText'
'PagesAsTextSimple'
'ParseFilePath'
'ParseFilePathEventArgs'
'Penciller'
'PreferredFrontCover'
'ProposedCount'
'ProposedCountAsText'
'ProposedFormat'
'ProposedNakedVolumeAsText'
'ProposedNumber'
'ProposedNumberAsText'
'ProposedSeries'
'ProposedTitle'
'ProposedVolume'
'ProposedVolumeAsText'
'ProposedYear'
'ProposedYearAsText'
'Published'
'PublishedAsText'
'Publisher'
'PublisherIcons'
'Rating'
'RatingAsText'
'ReadPercentage'
'ReadPercentageAsRead'
'ReadPercentageAsText'
'ReferenceEquals'
'RefreshFileProperties'
'RefreshInfoFromFile'
'ReleasedTime'
'ReleasedTimeAsText'
'RemoveFromContainer'
'RenameFile'
'ResetInfoRetrieved'
'ResetPageSequence'
'ResetProperties'
'Review'
'ScanInformation'
'Serialize'
'SerializeFull'
'Series'
'SeriesComplete'
'SeriesCompleteAsText'
'SeriesEquals'
'SeriesGroup'
'SetCustomValue'
'SetFileLocation'
'SetInfo'
'SetPages'
'SetShadowValues'
'SetValue'
'ShadowCount'
'ShadowCountAsText'
'ShadowFormat'
'ShadowNumber'
'ShadowNumberAsText'
'ShadowSeries'
'ShadowTitle'
'ShadowVolume'
'ShadowVolumeAsText'
'ShadowYear'
'ShadowYearAsText'
'SortPages'
'SpecialIcons'
'Status'
'StoryArc'
'Summary'
'TR'
'Tags'
'TargetFilename'
'Teams'
'Title'
'ToArray'
'ToClipboard'
'ToString'
'ToXml'
'TranslateImageIndexToPage'
'TranslatePageToImageIndex'
'TrimExcessPageInfo'
'UpdateBookmark'
'UpdateDynamicPageCount'
'UpdatePageFileSize'
'UpdatePagePosition'
'UpdatePageRotation'
'UpdatePageSize'
'UpdatePageType'
'ValidateData'
'Volume'
'VolumeAsText'
'VolumeOnly'
'Web'
'Week'
'WeekAsText'
'WriteInfoToFile'
'WriteProposedValues'
'Writer'
'Year'
'YearAsText'
'YesRightToLeftText'
'YesText'
'__class__'
'__delattr__'
'__doc__'
'__format__'
'__getattribute__'
'__hash__'
'__init__'
'__new__'
'__reduce__'
'__reduce_ex__'
'__repr__'
'__setattr__'
'__sizeof__'
'__str__'
'__subclasshook__']
'ComicBook' object has no attribute 'Main'

Some of them are also custom object lists... as 'pages' or 'CustomValuesStore', with their own values each...

I will try to find the list for "page object"

The custom values is best to access by the oficial functions in the api
Last Edit: 1 year 3 weeks ago by Xelloss.
The administrator has disabled public write access.
The following user(s) said Thank You: boshuda

CreateBookList Custom Scrips "options" value (and some of my beta scripts) 1 year 3 weeks ago #46418

  • Xelloss
  • Xelloss's Avatar
  • Online
  • Platinum Boarder
  • Posts: 455
  • Thank you received: 117
  • Karma: 24
If someone is interested to give me a hand (I don't have much time anymore for this kind of things now D:) We can analyse what is each value, and add the info to the wiki... (I must admit there are a few I have no idea what they are for)
The administrator has disabled public write access.

CreateBookList Custom Scrips "options" value (and some of my beta scripts) 1 year 3 weeks ago #46451

  • boshuda
  • boshuda's Avatar
  • Offline
  • Gold Boarder
  • Posts: 295
  • Thank you received: 64
  • Karma: 8
Did you find anything that might be used to force the app to go through and update the page information? I don't know if you've noticed, but if you try to get the page count of a book it will often return fewer pages than actually exist. The API only seems to return the number of pages it has 'scanned' from the archive file. So it would be nice, for scripts that want to examine the pages, to make sure that number is up to date.

And that resolution one could be great. I currently have a script that kind of fakes that information by comparing complete file size versus number of pages. If I could instead get the average/median resolution instead, that would be better.
The administrator has disabled public write access.

CreateBookList Custom Scrips "options" value (and some of my beta scripts) 1 year 3 weeks ago #46453

  • Xelloss
  • Xelloss's Avatar
  • Online
  • Platinum Boarder
  • Posts: 455
  • Thank you received: 117
  • Karma: 24
I have indeed worked A LOT in those things because it was that what interested me in the first place for soing scripts...

The thing with pages info is, as I have discovered, that pages only have values in the database if the page is loaded (open in some way). This include resolution and counting (and I don't remember if there was anything else)

That was a BIG problem with my resolutions scripts (which I made to replace the average page size (file size / pages) as a way of findind lo res images) . As when I ask for information on page resolutions, a lot of comics never read in the windows interface had a lot of pages with resolution "0x0" - and this took me a lot of time to discover XD

What I did with this problem is a script that look for comics which have pages with no resolution, then I just go to properties, pages, and I "view" all thmbnails of all pages of all comics in that list (I made a mouse macro to do that, as it is only scroll down and next). It can take some time if you have thousands of comics (it took me hours for me the first time) but if we are talking about hundreds you can do it in minutes quite easily...

Nowadays I have an smart list called "comics with no resolution loaded" with this script. I don't use it often because the first thing I do everytime I upload a comic to the database is to view the "pages" window of each comic (to delete ads and so), but from time to time I miss a comic and appears in that smart list.

It is important to notice that this pages information is indeed saved in the comic xml (if you write the info in your comic files), so when you "view" the pages for the first time the files are then updated with this info.

As for an automatic way of doing it... I haven't found any so far... As it is more of a comicrack internal function than load this info from the files... and the api use the info from that. You can always change these values manually, but I don't know how to know the values to insert without reading the files...

You could also make a python string that externally read each image, decode the attributes someway and add it manually to the comicrack database... but that is just to complex for what it is
Last Edit: 1 year 3 weeks ago by Xelloss.
The administrator has disabled public write access.

CreateBookList Custom Scrips "options" value (and some of my beta scripts) 1 year 2 weeks ago #46486

  • Xelloss
  • Xelloss's Avatar
  • Online
  • Platinum Boarder
  • Posts: 455
  • Thank you received: 117
  • Karma: 24
OK, I made a topic for the Same X Different Y Script "NOT BETA VERSION" where people can download and install it easily...

I keep this topic for its original porpose... Asking for "lists" fields in smart list scripts and other beta scripts discussions XD
The administrator has disabled public write access.

CreateBookList Custom Scrips "options" value (and some of my beta scripts) 11 months 3 days ago #46696

  • Xelloss
  • Xelloss's Avatar
  • Online
  • Platinum Boarder
  • Posts: 455
  • Thank you received: 117
  • Karma: 24
I add this simple script to the topic, it is still beta, so use it under your own risk

It searches for duplicates in tags, characters, teams and locations and delete them...

It is an Automatation Script...
Attachments:
Last Edit: 11 months 3 days ago by Xelloss.
The administrator has disabled public write access.

CreateBookList Custom Scrips "options" value (and some of my beta scripts) 10 months 1 day ago #46812

  • Xelloss
  • Xelloss's Avatar
  • Online
  • Platinum Boarder
  • Posts: 455
  • Thank you received: 117
  • Karma: 24
The administrator has disabled public write access.
Time to create page: 0.218 seconds

Who's Online

We have 365 guests and 7 members online