wyvern icon indicating copy to clipboard operation
wyvern copied to clipboard

Download everything into folders per game

Open sluedecke opened this issue 3 years ago • 0 comments

So far wyvern down and wyvern extras both support the --output flag. But wyvern down -a does not create folders per game. wyvern extras does, so one might end up with a folder full of install files, patch files and a bunch of subdirs for extras. And still wyvern extras needs to be called per game.

I have > 50 games on gog so this is not tidy enough for me. It would be very nice for wyvern to have an option to automatically create one folder per game based on the metadata received from gog.com (e.g. game title).

Until then this script might come in handy (it mentions zsh, but should run on bash, too) (it requires: wyvern, json_pp and jq):

#!/bin/bash

GAMESDIR=SOMEPLACE/gog-games
(
    cd $GAMESDIR
    wyvern ls --json | json_pp > ALLGAMES

    for row in `jq -r '.games[].ProductInfo | {title: .title, id: .id} | @base64' ALLGAMES`
    do 
        R=`echo ${row} | base64 --decode`
        D=`echo $R | jq -r '.title'`
        I=`echo $R | jq -r '.id'`
        echo Downloading $D
        mkdir "$D"
        cd "$D"
        wyvern down -D -r -w --id $I
        wyvern extras -a --id $I
        cd -
    done

) 2>&1 | tee -a $GAMESDIR/log-`date +%Y-%m-%d`.log 

Update: redirection of stderr fixed, uses bash

sluedecke avatar Dec 17 '20 15:12 sluedecke