Skip to content

Object-oriented gkmasToolkit v0.3

Latest
Compare
Choose a tag to compare
@AllenHeartcore AllenHeartcore released this 17 Sep 19:10
· 22 commits to main since this release

An object-oriented refactoring of kishidanatsumi/gkmasToolkit

Example Usage

from gkmasToolkit import GkmasManifest
m = GkmasManifest('EncryptedCache/octocacheevai_v81')
m.export('DecryptedCache/v81/')
m.download("img_general_icon_contest-rank.*",              path="namecard/profile",             categorize=False)
m.download("img_general_meishi_illust_idol.*",             path="namecard/idol/full",           categorize=False)
m.download("img_general_meishi_illust_sd.*",               path="namecard/idol/mini",           categorize=False, img_resize="2:3")
m.download("img_general_cidol.*full.*",                    path="namecard/idol/produce",        categorize=False, img_resize="9:16", img_format="jpg")
m.download("img_general_cidol.*thumb-landscape-large.*",   path="namecard/idol/produce",        categorize=False, img_resize="16:9", img_format="jpg")
m.download("img_general_cidol.*thumb-portrait.*",          path="namecard/idol/produce",        categorize=False, img_resize="3:4")
m.download("img_general_meishi_illust_sign.*",             path="namecard/idol/sign",           categorize=False)
m.download("img_general_csprt.*full.*",                    path="namecard/support",             categorize=False, img_resize="16:9", img_format="jpg")
m.download("img_general_meishi_base_story-bg.*",           path="namecard/base/commu",          categorize=False, img_resize="16:9", img_format="jpg")
m.download("img_general_meishi_base_(?!story-bg).*full.*", path="namecard/base",                categorize=False, img_resize="16:9", img_format="jpg")
m.download("img_general_achievement_char.*",               path="namecard/achievement/idol",    categorize=False)
m.download("img_general_achievement_produce.*",            path="namecard/achievement/produce", categorize=False)
m.download("img_general_achievement_common.*",             path="namecard/achievement/misc",    categorize=False)
m.download("img_general_meishi_illust_music-logo.*",       path="namecard/parts/logo",          categorize=False, img_resize="3:2")
m.download("img_general_meishi_illust_pict-icon.*",        path="namecard/parts/icon",          categorize=False)
m.download("img_general_meishi_illust_stamp.*",            path="namecard/parts/misc",          categorize=False)
m.download("img_general_meishi_illust_event.*",            path="namecard/parts/event",         categorize=False)
m.download("img_general_meishi_illust_highscore.*full.*",  path="namecard/parts/highscore",     categorize=False)
m.download("img_general_skillcard.*",                      path="namecard/produce/skillcard",   categorize=False)
m.download("img_general_pitem.*",                          path="namecard/produce/pitem",       categorize=False)
m.download("img_general_pdrink.*",                         path="namecard/produce/pdrink",      categorize=False)

from gkmasToolkit import ALL_ASSETBUNDLES, ALL_RESOURCES
m.download(ALL_ASSETBUNDLES, ALL_RESOURCES)

Changelog

  • [Feature] Add assetbundle extraction options in blob.GkmasAssetBundle.download()
    • categorize=False prevents categorizing blobs into subfolders
    • extract_img=True attempts to extract a single image from img_.*\.unity3d assetbundles
    • img_format controls the format of output images
      • WARNING: Texture2D's are forcefully converted to RGB mode if alpha channel is not supported in the given format
    • img_resize adjusts the images' aspect ratio when necessary
      • New size is determined in maximize mode
      • ensure_fit and preserve_npixel modes are also available, but the kwargs are not propagated to top level
      • Refer to blob.GkmasAssetBundle._determine_new_size() for details
  • [Feature] Write script for downloading the "customizable namecard kit"
    • Post-categorize selected folders by lambda'ed filenames (that highlights character identifiers)
  • [Fix] Implement manifest diff with utils.Diclist.diff() with ignored fields
  • [Fix] Revise logic in determine_subdir (moved into blob.GkmasResource)
    • Everything after the first number or the first "character identifier" is ignored
    • Subdirectories are split by '_' (allows '-' in subtypes)
  • [Style] Relocate isolated utility functions
    • manifest._list_diff(), manifest._rip_field() -> utils.Diclist
    • manifest._make_diff_manifest() -> manifest.__sub__()
    • blob._ab2png_and_write_bytes(), blob._ab2png() -> blob._export_img()
    • utils.determine_subdir() -> blob._determine_subdir()
    • utils.resize_by_ratio() -> blob._determine_new_size()
  • [Docs] Provide extensive docstrings for all classes and methods