Refactor music sections

This commit is contained in:
2Shirt 2023-10-22 15:46:49 -07:00
parent ab5766ff4f
commit 9b5c453552
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
5 changed files with 4 additions and 131 deletions

View file

@ -5,7 +5,6 @@ from . import hw
from . import launchers
from . import log
from . import main
from . import music
from . import net
from . import repairs
from . import setup

View file

@ -1,76 +0,0 @@
"""WizardKit: Config - Music Sources"""
# vim: sts=2 sw=2 ts=2
MUSIC_MOD = (
('33432', 'ambrozia.xm'),
('33460', 'amigatre.mod'),
('34594', 'CHARIOT.S3M'),
('34596', 'BUTTERFL.XM'),
('34654', 'CTGOBLIN.S3M'),
('35151', 'bananasplit.mod'),
('35280', 'DEADLOCK.XM'),
('38591', 'compo_liam.xm'),
('39987', 'crystald.s3m'),
('40475', 'ELYSIUM.MOD'),
('42146', 'enigma.mod'),
('42519', 'GHOST2.MOD'),
('42560', 'GSLINGER.MOD'),
('42872', 'existing.xm'),
('50427', 'nf-stven.xm'),
('51549', 'overture.mod'),
('54250', 'SATELL.S3M'),
('54313', 'realmk.s3m'),
('55789', 'scrambld.mod'),
('57934', 'spacedeb.mod'),
('59344', 'stardstm.mod'),
('60395', '2ND_PM.S3M'),
('66187', 'external.xm'),
('66343', 'beek-substitutionology.it'),
('67561', 'radix-unreal_superhero.xm'),
('70829', 'inside_out.s3m'),
('83779', 'beyond_music.mod'),
('104208', 'banana_boat.mod'),
('114971', 'tilbury_fair.mod'),
('132563', 'ufo_tune.mod'),
('135906', 'magnetik_girl.xm'),
('140628', 'autumn_in_budapest.xm'),
('143198', 'summer_memories_3.xm'),
('144405', 'hillbilly_billyboy.xm'),
('154795', '4mat_-_eternity.xm'),
('155845', 'bookworm.mo3'),
('155914', 'battleofsteel.xm'),
('158975', '1_channel_moog.it'),
('165495', 'trans.s3m'),
('168513', 'necros_-_introspection.s3m'),
('169628', 'radix_-_feng_shui_schematics.xm'),
('175238', 'unknown48_-_twilight.mod'),
)
MUSIC_SNES = (
'actr',
'crock',
'ct',
'dkc',
'dkq',
'ff6',
'fz',
'loz3',
'mmx',
'ptws',
'scv4',
'sf',
'sf2',
'sgng',
'smk',
'smw',
'yi',
'zamn',
)
MUSIC_SNES_BAD = {
'ct': ['ct-s*', 'ct-v*'],
}
if __name__ == '__main__':
print("This file is not meant to be called directly.")
# vim: sts=2 sw=2 ts=2

View file

@ -11,7 +11,6 @@ import re
from wk.cfg.launchers import LAUNCHERS
from wk.cfg.main import ARCHIVE_PASSWORD, KIT_NAME_FULL
from wk.cfg.music import MUSIC_MOD, MUSIC_SNES, MUSIC_SNES_BAD
from wk.cfg.sources import SOURCES
from wk.exe import popen_program, run_program, wait_for_procs
from wk.io import copy_file, delete_item, recursive_copy, rename_item
@ -470,57 +469,6 @@ def download_xmplay() -> None:
delete_from_temp('xmp-rar.zip')
delete_from_temp('Innocuous.zip')
def download_xmplay_music() -> None:
"""Download XMPlay Music."""
music_tmp = TMP_DIR.joinpath('music')
music_tmp.mkdir(exist_ok=True)
current_dir = os.getcwd()
os.chdir(music_tmp)
url_mod = 'https://api.modarchive.org/downloads.php'
url_rsn = 'http://snesmusic.org/v2/download.php'
# Download music
for song_id, song_name in MUSIC_MOD:
download_file(
music_tmp.joinpath(f'MOD/{song_name}'),
f'{url_mod}?moduleid={song_id}#{song_name}',
)
for game in MUSIC_SNES:
download_file(
music_tmp.joinpath(f'SNES/{game}.rsn'),
f'{url_rsn}?spcNow={game}',
)
# Extract SNES archives
for item in music_tmp.joinpath('SNES').iterdir():
cmd = [
SEVEN_ZIP,
'x', item, f'-oSNES\\{item.stem}',
'-bso0', '-bse0', '-bsp0',
]
run_program(cmd)
delete_item(item)
# Remove bad songs
for game, globs in MUSIC_SNES_BAD.items():
for glob in globs:
for item in music_tmp.joinpath(f'SNES/{game}').glob(glob):
delete_item(item)
# Compress music
cmd = [
SEVEN_ZIP,
'a', '-t7z', '-mx=9',
'-bso0', '-bse0', '-bsp0',
BIN_DIR.joinpath('XMPlay/music.7z'),
'MOD', 'SNES',
]
run_program(cmd)
os.chdir(current_dir)
# Cleanup
delete_from_temp('music')
# "Main" Function
def build_kit() -> None:
@ -565,7 +513,6 @@ def build_kit() -> None:
try_print.run('WinSCP...', download_winscp)
try_print.run('Windows Repair AIO...', download_windows_repair_aio)
try_print.run('WizTree...', download_wiztree)
try_print.run('XMPlay Music...', download_xmplay_music)
try_print.run('XMPlay...', download_xmplay)
try_print.run('Snappy Driver Installer...', download_snappy_driver_installer_origin)

View file

@ -1114,7 +1114,10 @@ def open_windows_updates() -> None:
def open_xmplay() -> None:
"""Open XMPlay."""
sleep(2)
run_tool('XMPlay', 'XMPlay', 'music.7z', cwd=True, popen=True)
xmplay_path = get_tool_path('XMPlay', 'XMPlay')
music_path = xmplay_path.parent.joinpath('music')
cmd = [xmplay_path, *[str(item) for item in music_path.glob('**/')]]
popen_program(cmd)
def run_shutup_10():

Binary file not shown.