Skip to content

Commit

Permalink
Merge pull request #3 from KampfKeks502/v1.3
Browse files Browse the repository at this point in the history
improved batch files and error catching when backup dir is empty
  • Loading branch information
KampfKeks502 authored Aug 5, 2021
2 parents 000afc0 + e63f4c6 commit bb21a30
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
7 changes: 5 additions & 2 deletions Beats2Save.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ def restore(save_dir, game_dir, backup_dir, version):
dirs_raw = os.listdir(backup_dir)
dirs = []
# filter dir list

for d in dirs_raw:
if d.find('BeatSaber_') != -1:
dirs.append(d)

if not dirs:
logging.info("error no backups found")
sys.exit()
i = 1
logging.info("Please select your desired backup and hit ENTER [e.g. 1, 2, 3, ...]")
for d in dirs:
Expand Down Expand Up @@ -220,7 +223,7 @@ def bs_size(game_path, save_path):
if __name__ == "__main__":
if not args.restore and not args.create and not args.info:
sys.exit()
logging.info("Beats2Save 1.2 by KampfKeks502")
logging.info("Beats2Save 1.3 by KampfKeks502")

print()
check_dir(args.save_dir)
Expand Down
12 changes: 11 additions & 1 deletion _backup.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
@echo off
title Beats2Save - backup
python Beats2Save.py -g "G:/Steam/steamapps/common" -s "C:/Users/KampfKeks/AppData/LocalLow/Hyperbolic Magnetism" -b "G:\Beat Saber backups" -c -n 8

rem only change these 4 variables ================= no backslashes! ==============

set gamedir="G:/Steam/steamapps/common"
set savedir="C:/Users/KampfKeks/AppData/LocalLow/Hyperbolic Magnetism"
set backupdir="G:/Beat Saber backups"
set max_backups=8

rem =================================================================================

python Beats2Save.py -g %gamedir% -s %savedir% -b %backupdir% -c -n %max_backups%
pause
11 changes: 10 additions & 1 deletion _info.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
@echo off
title Beats2Save - info
python Beats2Save.py -g "G:/Steam/steamapps/common" -s "C:/Users/KampfKeks/AppData/LocalLow/Hyperbolic Magnetism" -b "G:\Beat Saber backups" -i

rem only change these 3 variables ================= no backslashes! ==============

set gamedir="G:/Steam/steamapps/common"
set savedir="C:/Users/KampfKeks/AppData/LocalLow/Hyperbolic Magnetism"
set backupdir="G:/Beat Saber backups"

rem =================================================================================

python Beats2Save.py -g %gamedir% -s %savedir% -b %backupdir% -i
pause

rem show informations about Beat Saber (BS-Version, Size, Backup dir size)
14 changes: 12 additions & 2 deletions _restore.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
@echo off
title Beats2Save - restore
python Beats2Save.py -g "G:/Steam/steamapps/common" -s "C:/Users/KampfKeks/AppData/LocalLow/Hyperbolic Magnetism" -b "G:\Beat Saber backups" -r
pause


rem only change these 3 variables ================= no backslashes! ==============

set gamedir="G:/Steam/steamapps/common"
set savedir="C:/Users/KampfKeks/AppData/LocalLow/Hyperbolic Magnetism"
set backupdir="G:/Beat Saber backups"

rem =================================================================================

python Beats2Save.py -g %gamedir% -s %savedir% -b %backupdir% -r
pause

0 comments on commit bb21a30

Please sign in to comment.