From: Fred T. Hamster Date: Thu, 21 Nov 2024 02:26:21 +0000 (-0500) Subject: super nice cleanup, regularized X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=8db50085445bceef68337bb5bfac34693750aadc;p=feisty_meow.git super nice cleanup, regularized should work for any host and any of our two steam users now, given the proper path exists to the photos dir. --- diff --git a/scripts/customize/fred/scripts/games/save_f76_pics.sh b/scripts/customize/fred/scripts/games/save_f76_pics.sh index 5a5ba846..00c85fdb 100644 --- a/scripts/customize/fred/scripts/games/save_f76_pics.sh +++ b/scripts/customize/fred/scripts/games/save_f76_pics.sh @@ -5,52 +5,63 @@ # pull in the feisty scripts. source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" -# figure out where we are. the script must have at least one side be local, -# so we are planning for that to be the source side. -source_host="$(hostname)" - # constant-like variables... DESTINATION_HOST=greendragon -# decide where we're copying based on the source. -if [[ "$source_host" =~ clemens* ]]; then - character="chronical_pc" - identity="8836c852c8a647ba8ca45808a73c3fbb" -elif [[ "$source_host" =~ orpheus* ]]; then - character="spoonburg_pc" - identity="8f99c06443f04f6f8270604369bb78eb" -elif [[ "$source_host" =~ cuboid* ]]; then - character="spoonburg_pc" - identity="8f99c06443f04f6f8270604369bb78eb" -else - echo " -Could not determine the proper character name for the fallout 76 images based -on your source host of '$source_host' . Can you add the details of your hostname -to this script? - => script is at '$0' -" - exit 1 -fi +# copies all photos found for the steam identity, which we store under the +# character's name in our remote storage folder. +function copy_f76_photos_from_src_to_dest() +{ + local src_top="$1"; shift + local identity="$1"; shift + local character="$1"; shift + local dest_top="$1"; shift -if [ "$OS" != "Windows_NT" ]; then - src_dir="$HOME/data/photos_fallout76/${identity}" -else - src_dir="$HOME/data/wind_goods/My Games/Fallout 76/Photos/${identity}" -fi -dest_dir="fred@${DESTINATION_HOST}:/z/walrus/media/pictures/metaverse/fallout_76/${character}" + if [ -z "$src_top" -o -z "$identity" -o -z "$character" -o -z "$dest_top" ]; then + echo "Not enough parameters in the copy_f76_photos_from_src_to_dest function." + exit 1 + fi + + local src_dir="$src_top/$identity" + local dest_dir="fred@${DESTINATION_HOST}:$dest_top/${character}" echo "src is: '$src_dir'" echo "dest is: '$dest_dir'" -if [ ! -d "$src_dir" ]; then - echo "Could not find the source directory: $src_dir" + if [ ! -d "$src_dir" ]; then + echo "(No photo directory found for $character)" + return 1 + fi + + echo "Copying photos for $character..." + netcp "$src_dir"/*[0-9].png "$dest_dir"/ + if [ $? -ne 0 ]; then + echo A problem occurred during the copy. + return 1 + fi +} + +# top directories for our home rig. +src_top="$HOME/data/photos_fallout76" +dest_top="/z/walrus/media/pictures/metaverse/fallout_76" + +if [ ! -d "$src_top" ]; then + echo " +The source directory: +$src_dir +cannot be located. Please ensure that exists. +It is tricky, and needs to be based on the game's +secret number in steam. For example, I set this up recently +on cuboid with: +ln -s \"/home/fred/.steam/steam/steamapps/compatdata/1151340/pfx/drive_c/users/steamuser/Documents/My Games/Fallout 76/Photos\" ~/data/photos_fallout76 +Gnarly, but simpler than older schemes. +" exit 1 fi -#if [ ! -d "$dest_dir" ]; then -# echo "Could not find the destination directory: $dest_dir" -# exit 1 -#fi -netcp "$src_dir"/*[0-9].png "$dest_dir"/ +# now run through our permutations for users... + +copy_f76_photos_from_src_to_dest "$src_top" "8836c852c8a647ba8ca45808a73c3fbb" "chronical_pc" "$dest_top" +copy_f76_photos_from_src_to_dest "$src_top" "8f99c06443f04f6f8270604369bb78eb" "spoonburg_pc" "$dest_top"