update asset configs

This commit is contained in:
sk1982 2024-04-07 04:13:47 -04:00
parent 41245c42de
commit bae2031360
8 changed files with 30 additions and 32 deletions

View File

@ -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')

17
scripts/assets.apple.yaml Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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',

6
scripts/paths.yaml Normal file
View File

@ -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'