diff --git a/scripts/asset-extract.py b/scripts/asset-extract.py index a9421fb..13297f3 100644 --- a/scripts/asset-extract.py +++ b/scripts/asset-extract.py @@ -18,7 +18,8 @@ def run(event, func, args): if __name__ == '__main__': parser = argparse.ArgumentParser() - parser.add_argument('--config', help='asset config (default=assets.yaml)', default='assets.yaml') + parser.add_argument('--config', help='asset config (default=assets.fast.yaml)', default='assets.fast.yaml') + parser.add_argument('--paths', help='path config (default=paths.yaml)', default='paths.yaml') parser.add_argument('--processes', type=int, default=cpu_count(), help=f'number of processes to use (default={cpu_count()})') parser.add_argument('--out-dir', '--output-dir', '--output', '-o', help='output directory (default=../public/assets)', default='../public/assets') parser.add_argument('--no-overwrite', '-n', help='don\'t overwrite exising files', action='store_true') diff --git a/scripts/assets.apple.yaml b/scripts/assets.apple.yaml new file mode 100644 index 0000000..e823bf8 --- /dev/null +++ b/scripts/assets.apple.yaml @@ -0,0 +1,17 @@ +# produces audio files compatible with safari + +music: + enable: true + extension: .m4a + ffmpeg_args: ['-b:a', '96k'] + +audio: + enable: true + extension: .m4a + ffmpeg_args: ['-b:a', '96k'] + +images: + enable: false + +jackets: + enable: false diff --git a/scripts/assets.fast.yaml b/scripts/assets.fast.yaml index 43da980..448e0af 100644 --- a/scripts/assets.fast.yaml +++ b/scripts/assets.fast.yaml @@ -1,12 +1,5 @@ # produces decent quality files faster, at the expense of larger file sizes -# path to ffmpeg if it is not on the path -ffmpeg_path: 'ffmpeg' -# path to vgmstream if it is not on the path -# required for some audio conversions -# https://github.com/vgmstream/vgmstream -vgmstream_path: 'vgmstream-cli' - # options for music music: enable: true diff --git a/scripts/assets.faster.yaml b/scripts/assets.faster.yaml index bf45079..3d122c1 100644 --- a/scripts/assets.faster.yaml +++ b/scripts/assets.faster.yaml @@ -1,12 +1,5 @@ # produces decent quality files much faster, at the expense of greatly increased file sizes -# path to ffmpeg if it is not on the path -ffmpeg_path: 'ffmpeg' -# path to vgmstream if it is not on the path -# required for some audio conversions -# https://github.com/vgmstream/vgmstream -vgmstream_path: 'vgmstream-cli' - # options for music music: enable: true diff --git a/scripts/assets.lossless.yaml b/scripts/assets.lossless.yaml index 9b20f7f..4df45ad 100644 --- a/scripts/assets.lossless.yaml +++ b/scripts/assets.lossless.yaml @@ -1,12 +1,5 @@ # produces lossless files -# path to ffmpeg if it is not on the path -ffmpeg_path: 'ffmpeg' -# path to vgmstream if it is not on the path -# required for some audio conversions -# https://github.com/vgmstream/vgmstream -vgmstream_path: 'vgmstream-cli' - # options for music music: enable: true diff --git a/scripts/assets.yaml b/scripts/assets.yaml index 9ddb743..ae18bcd 100644 --- a/scripts/assets.yaml +++ b/scripts/assets.yaml @@ -1,12 +1,5 @@ # produces small-sized, decent quality files at the expense of long encoding times -# path to ffmpeg if it is not on the path -ffmpeg_path: 'ffmpeg' -# path to vgmstream if it is not on the path -# required for some audio conversions -# https://github.com/vgmstream/vgmstream -vgmstream_path: 'vgmstream-cli' - # options for music music: enable: true diff --git a/scripts/extracters/extracter.py b/scripts/extracters/extracter.py index 564e751..69c281c 100644 --- a/scripts/extracters/extracter.py +++ b/scripts/extracters/extracter.py @@ -13,9 +13,11 @@ from collections import defaultdict class Extracter: - def __init__(self, *, config, out_dir, no_overwrite, no_music, no_audio, no_jackets, no_images, **kwargs): + def __init__(self, *, config, paths, out_dir, no_overwrite, no_music, no_audio, no_jackets, no_images, **kwargs): with open(config, 'r') as f: self.config = yaml.safe_load(f) + with open(paths, 'r') as f: + self.paths = yaml.safe_load(f) self.music_enabled = self.config['music']['enable'] self.jackets_enabled = self.config['jackets']['enable'] self.images_enabled = self.config['images']['enable'] @@ -50,7 +52,7 @@ class Extracter: input_file = tmp args = [ - self.config['vgmstream_path'], + self.paths['vgmstream_path'], '-p', input_file ] @@ -83,7 +85,7 @@ class Extracter: input_args[i] = str(arg) args = [ - self.config['ffmpeg_path'], + self.paths['ffmpeg_path'], ('-n' if self.no_overwrite else '-y'), '-hide_banner', '-loglevel', diff --git a/scripts/paths.yaml b/scripts/paths.yaml new file mode 100644 index 0000000..6d3157a --- /dev/null +++ b/scripts/paths.yaml @@ -0,0 +1,6 @@ +# path to ffmpeg if it is not on the path +ffmpeg_path: 'ffmpeg' +# path to vgmstream if it is not on the path +# required for some audio conversions +# https://github.com/vgmstream/vgmstream +vgmstream_path: 'vgmstream-cli'