MrV2K / WHDLoad-Download-Tool

A tool to help manage and download Retroplay's WHDLoad archives.
134 stars 4 forks source link

Feature request: optional extraction #6

Closed mcdope closed 1 year ago

mcdope commented 1 year ago

I'm aware this is kinda out of scope, but then again - not THAT far...

It would be nice if there would be an optional extract feature for the downloaded archives. Like you set a target folder and it extracts to that folder with configured folder structure (like already existing, a-z etc as options - could and maybe even should use the same options then the download dir) either after download finished, or after clicking a button.

This would allow an easier workflow to update the WHD collection.

MrV2K commented 1 year ago

The difficulty is that windows dislikes some file names and can mess about with file permissions. This can break some games. The safest way is to share the download folder in WinUAE and create a batch file to extract the lha files straight to the Amiga drive in workbench. The amigados command LIST is very good for generating lists of files and using the LFORMAT option can easily generate a script that will extract all the archives with the lha command line tool.

mcdope commented 1 year ago

Thanks for your LFORMAT hint, I created myself a little script for extracting.

In case anyone feels the need for it:

; README
;
; Licence: GPLv2 <https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>
; Author: McDope <mcdope@mcdope.org>
;
; It expects your downloads to be like "Games/A/AgameStartingWithA" / "Demos/D/DemoStartingWithD" etc. 
; You need to adjust the pattern if that doesn't match your config.
;
; If you don't use A-Z sub directories:        use #?/#? instead of #?/#?/#?
; If you have all archive in the same folder:  use #? instead of #?/#?/#?
;
; After generating the extraction scripts it will automatically run them, and delete them again when done.
; (ofc you need lha and lzx for this)

ECHO "Generating extraction scripts..."
LIST #?/#?/#?.lha TO WHD:extract_lha.script ALL FILES LFORMAT="lha -F -T x %P%N WHD:Extracted/%P%M/"
LIST #?/#?/#?.lzx TO WHD:extract_lzx.script ALL FILES LFORMAT="lzx -F -m x %P%N WHD:Extracted/%P%M/"

ECHO "Making generated scripts executable..."
PROTECT WHD:extract_lha.script +se
PROTECT WHD:extract_lzx.script +se

ECHO "Running extraction scripts..."
; Next line is to skip faulty archives
FAILAT 21 
EXECUTE WHD:extract_lha.script
EXECUTE WHD:extract_lzx.script
DELETE FORCE QUIET WHD:extract_lha.script
DELETE FORCE QUIET WHD:extract_lzx.script
; Restore FAILAT default
FAILAT 10

ECHO ""
ECHO "Finished!"