Created
November 24, 2024 19:17
-
-
Save maforget/99b7fa402e36f3d7733c5ef853f29b5e to your computer and use it in GitHub Desktop.
ComicRack Script to export all fields to a CSV file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import clr | |
| clr.AddReferenceByPartialName("System.Windows.Forms") | |
| from System.Windows.Forms import * | |
| import sys | |
| sys.setdefaultencoding("utf8") | |
| # | |
| # Simple SaveFileDialog | |
| # | |
| def GetFileName(comicList): | |
| dlg = SaveFileDialog() | |
| dlg.Filter = "CSV Files (*.csv)|*.csv" | |
| dlg.FileName = comicList | |
| dlg.DefaultExt = ".csv" | |
| dlg.CheckPathExists = True | |
| if dlg.ShowDialog(ComicRack.MainWindow) == DialogResult.Cancel: | |
| return "" | |
| else: | |
| return dlg.FileName | |
| # Saves a CSV list of all the passed comics to a selectable file | |
| # | |
| #@Name Export Book List Full... | |
| #@Hook Books, Library | |
| #@Description Simple script to export all selected Books into a CSV file | |
| def SaveCSVListFull(books): | |
| name = GetFileName("Book List") | |
| if name=="": | |
| return | |
| f=open(name, "w") | |
| # print ComicRack.App.GetComicFields() | |
| # print dir(ComicRack.App) | |
| f.write ('Series' + ';' + 'Title' + ';' + 'Number' + ';' + 'Count' + ';' + 'Volume' + ';' + 'AlternateSeries' + ';' + 'AlternateNumber' + ';' + 'StoryArc' + ';' + 'SeriesGroup' + ';' + 'AlternateCount' + ';' + 'Summary' + ';' + 'Notes' + ';' + 'Review' + ';' + 'Year' + ';' + 'Month' + ';' + 'Day' + ';' + 'Writer' + ';' + 'Penciller' + ';' + 'Inker' + ';' + 'Colorist' + ';' + 'Letterer' + ';' + 'CoverArtist' + ';' + 'Editor' + ';' + 'Publisher' + ';' + 'Imprint' + ';' + 'Genre' + ';' + 'Web' + ';' + 'PageCount' + ';' + 'LanguageISO' + ';' + 'Format' + ';' + 'AgeRating' + ';' + 'BlackAndWhite' + ';' + 'Manga' + ';' + 'Characters' + ';' + 'Teams' + ';' + 'MainCharacterOrTeam' + ';' + 'Locations' + ';' + 'ReleasedTime' + ';' + 'OpenedTime' + ';' + 'AddedTime' + ';' + 'Tags' + ';' + 'SeriesComplete' + ';' + 'NewPages' + ';' + 'BookPrice' + ';' + 'BookAge' + ';' + 'BookCondition' + ';' + 'BookStore' + ';' + 'BookCollectionStatus' + ';' + 'BookNotes' + ';' + 'BookLocation' + ';' + 'ISBN' + ';' + 'CustomValuesStore' + ';' + 'comicvine_issue' + ';' + 'comicvine_volume' + ';' + 'FileFormat' + ';' + 'FileName' + ';' + 'FileSize' + ';' + 'FileDirectory' + ';' + 'Rating' + ';' + 'CommunityRating' + ';' + 'HasBeenRead' + ';' + 'CurrentPage' + ';' + 'LastPageRead' + ';' + 'OpenedCount' + ';' + 'ReadPercentage' + ';' + 'ScanInformation' + ';' + 'EnableProposed' + ';' + 'CustomThumbnailKey' + '\r') | |
| for book in books: | |
| print book.ShadowSeries | |
| f.write ('"' + book.ShadowSeries+ '"' + ";") | |
| # f.write ('"' + book.Series+ '"' + ";") | |
| f.write ('"' + book.ShadowTitle+ '"' + ";") | |
| f.write ('"' + book.ShadowNumber+ '"' + ";") | |
| # f.write ('"' + book.Number+ '"' + ";") | |
| f.write ('"' + unicode(book.ShadowCount) + '"' + ";") | |
| f.write ('"' + unicode(book.ShadowVolume) + '"' + ";") | |
| # f.write ('"' + unicode(book.Volume) + '"' + ";") | |
| f.write ('"' + book.AlternateSeries+ '"' + ";") | |
| f.write ('"' + book.AlternateNumber+ '"' + ";") | |
| f.write ('"' + book.StoryArc+ '"' + ";") | |
| f.write ('"' + book.SeriesGroup+ '"' + ";") | |
| f.write ('"' + unicode(book.AlternateCount) + '"' + ";") | |
| f.write ('"' + book.Summary.decode('unicode-escape').replace('"', '""') + '"' + ";") # NewLine | |
| f.write ('"' + book.Notes.decode('unicode-escape').replace('"', '""') + '"' + ";") # NewLine | |
| f.write ('"' + book.Review.decode('unicode-escape').replace('"', '""') + '"' + ";") # NewLine | |
| f.write ('"' + unicode(book.ShadowYear) + '"' + ";") | |
| # f.write ('"' + unicode(book.Year) + '"' + ";") | |
| f.write ('"' + unicode(book.Month) + '"' + ";") | |
| f.write ('"' + unicode(book.Day) + '"' + ";") | |
| f.write ('"' + book.Writer+ '"' + ";") | |
| f.write ('"' + book.Penciller+ '"' + ";") | |
| f.write ('"' + book.Inker+ '"' + ";") | |
| f.write ('"' + book.Colorist+ '"' + ";") | |
| f.write ('"' + book.Letterer+ '"' + ";") | |
| f.write ('"' + book.CoverArtist+ '"' + ";") | |
| f.write ('"' + book.Editor+ '"' + ";") | |
| f.write ('"' + book.Publisher+ '"' + ";") | |
| f.write ('"' + book.Imprint+ '"' + ";") | |
| f.write ('"' + book.Genre+ '"' + ";") | |
| f.write ('"' + book.Web+ '"' + ";") | |
| f.write ('"' + unicode(book.PageCount) + '"' + ";") | |
| f.write ('"' + book.LanguageISO+ '"' + ";") | |
| f.write ('"' + book.ShadowFormat+ '"' + ";") | |
| # f.write ('"' + book.Format+ '"' + ";") | |
| f.write ('"' + book.AgeRating+ '"' + ";") | |
| f.write ('"' + unicode(book.BlackAndWhite) + '"' + ";") | |
| f.write ('"' + unicode(book.Manga) + '"' + ";") | |
| f.write ('"' + book.Characters+ '"' + ";") | |
| f.write ('"' + book.Teams+ '"' + ";") | |
| f.write ('"' + book.MainCharacterOrTeam+ '"' + ";") | |
| f.write ('"' + book.Locations+ '"' + ";") | |
| f.write ('"' + unicode(book.ReleasedTime) + '"' + ";") | |
| f.write ('"' + unicode(book.OpenedTime) + '"' + ";") | |
| f.write ('"' + unicode(book.AddedTime) + '"' + ";") | |
| f.write ('"' + book.Tags+ '"' + ";") | |
| f.write ('"' + unicode(book.SeriesComplete) + '"' + ";") | |
| f.write ('"' + unicode(book.NewPages) + '"' + ";") | |
| f.write ('"' + unicode(book.BookPrice) + '"' + ";") | |
| f.write ('"' + unicode(book.BookAge) + '"' + ";") | |
| f.write ('"' + unicode(book.BookCondition) + '"' + ";") | |
| f.write ('"' + book.BookStore+ '"' + ";") | |
| f.write ('"' + book.BookCollectionStatus+ '"' + ";") | |
| f.write ('"' + book.BookNotes.decode('unicode-escape').replace('"', '""') + '"' + ";") # NewLine | |
| f.write ('"' + book.BookLocation+ '"' + ";") | |
| f.write ('"' + book.ISBN+ '"' + ";") | |
| f.write ('"' + book.CustomValuesStore+ '"' + ";") | |
| f.write ('"' + unicode(book.GetCustomValue("comicvine_issue")) + '"' + ";") | |
| f.write ('"' + unicode(book.GetCustomValue("comicvine_volume")) + '"' + ";") | |
| f.write ('"' + unicode(book.FileFormat) + '"' + ";") | |
| f.write ('"' + unicode(book.FileName) + '"' + ";") | |
| f.write ('"' + unicode(book.FileSize) + '"' + ";") | |
| f.write ('"' + unicode(book.FileDirectory) + '"' + ";") | |
| f.write ('"' + unicode(book.Rating) + '"' + ";") | |
| f.write ('"' + unicode(book.CommunityRating) + '"' + ";") | |
| f.write ('"' + unicode(book.HasBeenRead) + '"' + ";") | |
| f.write ('"' + unicode(book.CurrentPage) + '"' + ";") | |
| f.write ('"' + unicode(book.LastPageRead) + '"' + ";") | |
| f.write ('"' + unicode(book.OpenedCount) + '"' + ";") | |
| f.write ('"' + unicode(book.ReadPercentage) + '"' + ";") | |
| f.write ('"' + unicode(book.ScanInformation) + '"' + ";") | |
| f.write ('"' + unicode(book.EnableProposed) + '"' + ";") | |
| f.write ('"' + unicode(book.CustomThumbnailKey) + '"' + "\r") | |
| f.close() |
Author
@ucapato No, the script you pointed at isn't the same this is Export Book List Full... . The pre-installed script you pointed at is only limited to Series, Title, Number, Volume & Year. This script outputs all the fields that exists. It comes from reddit, which I modified to prevent an error related to files that had unicode characters in.
Hi @maforget ,
Thanks for the explanation. I took this script of yours and added it to the script folder in CRCE. No, I have it as an additional option from this Automation Menu. I probably had already read somewhere that I could add Python scripts, but I have just done something like that now.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @maforget,
The above script is this one in the Automation Menu: