Skip to content

CrescentApricot/hcapy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hcapy

hca2wav wrapper working on Python3.

概要

@NyagamonさんのHCADecoderをベースにしたhcaデコーダ、hca2wavのPython3ラッパーです。

依存

  • Python3
  • C++11

インストール

pip3 install git+ssh://git@github.com/CrescentApricot/hcapy.git

使い方

import hcapy

d = hcapy.Decoder(961961961961961)  # 鍵指定

d.decode_file("target_file.hca")  # target_file.hcaを指定した鍵でデコード

try:
  with open("target_file.hca", "rb") as f, open("decoded.wav", "wb") as f2:
    f2.write(d.decode(f.read()).read())  # bytesからデコード、io.BytesIOでリターンする
except hcapy.InvalidHCAError:
  print("invalid hca!")

鍵について

上記コードでは 961961961961961 のようなintで指定していますが、"0x36ae63907b9e9"のような形式でも、"36ae63907b9e9"のような形式でも、"3907b9e9", "36ae"のような形式でも指定可能です。

出力ファイルパスについて

decode_file の場合、出力ファイルパスを引数 dest に指定することができますが、指定しないこともできます。指定しない場合、src と同じディレクトリに生成されます。

実装予定

  • bytes からのデコード (無理やり実装済み)
  • コマンドラインツール
  • パッケージ構成の正規化(hcapy.Decoder, hcapy.exceptions.Invalid...)

About

hca2wav wrapper working on Python3.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages