Skip to content

Commit

Permalink
1.0.1: fix bugs
Browse files Browse the repository at this point in the history
specifically: fix function name typo in propeller.py; ensure working
directory is correct before calling propeller.py from airship.py;
recursively iterate through directories in icloud.py get_file_names();
sync all profiles for Banner Saga
  • Loading branch information
Carlos Liam committed Apr 24, 2015
1 parent 860795a commit 843579f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
7 changes: 5 additions & 2 deletions airship.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import os
import sys
import subprocess

os.chdir(os.path.dirname(os.path.abspath(__file__)))

games = [{ # The Banner Saga
'regex': '(resume|sav_(chapter[1235]|(leaving)?(einartoft|frostvellr)|(dengl|dund|hridvaldy|radormy|skog)r|bjorulf|boersgard|finale|grofheim|hadeborg|ingrid|marek|ridgehorn|sigrholm|stravhs|wyrmtoe))\.save\.json',
'folder': 'save/saga1/0',
'regex': '[0-4]/(resume|sav_(chapter[1235]|(leaving)?(einartoft|frostvellr)|(dengl|dund|hridvaldy|radormy|skog)r|bjorulf|boersgard|finale|grofheim|hadeborg|ingrid|marek|ridgehorn|sigrholm|stravhs|wyrmtoe))\.save\.json',
'folder': 'save/saga1',
'steamcloudid': '237990',
'icloudid': 'MQ92743Y4D~com~stoicstudio~BannerSaga'
}]
Expand Down
14 changes: 12 additions & 2 deletions icloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def set_folder(folder):
icloudfolder = folder

def will_work():
if platform.system() == 'Darwin' and platform.mac_ver()[0].startswith('10.10') and os.path.isdir(os.path.expanduser('~/Library/Mobile Documents')):
if platform.mac_ver()[0].startswith('10.10') and os.path.isdir(os.path.expanduser('~/Library/Mobile Documents')):
global icloudpath
if 'icloudfolder' in globals():
icloudpath = os.path.expanduser('~/Library/Mobile Documents/' + icloudbundleid + '/' + icloudfolder)
Expand All @@ -22,7 +22,17 @@ def will_work():
return False

def get_file_names():
return os.listdir(icloudpath)
filenames = []
def recursive_dir_contents(dir):
dircontents = os.listdir(icloudpath if dir is None else icloudpath + '/' + dir )
for item in dircontents:
if os.path.isdir(icloudpath + '/' + item if dir is None else icloudpath + '/' + dir + '/' + item):
recursive_dir_contents(item if dir is None else dir + '/' + item)
else:
filenames.append(item if dir is None else dir + '/' + item)

recursive_dir_contents(None)
return filenames

def get_file_timestamp(filename):
return int(os.path.getmtime(icloudpath + '/' + filename))
Expand Down
6 changes: 3 additions & 3 deletions propeller.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import time
import hashlib

parser = argparse.ArgumentParser(description = 'Helper process for airship.py. Not meant for manual use.')
parser.add_argument('--regex', required = True)
parser = argparse.ArgumentParser(description='Helper process for airship.py. Not meant for manual use.')
parser.add_argument('--regex', required=True)
parser.add_argument('--folder')

possiblemodules = ['icloud', 'steamcloud']
Expand Down Expand Up @@ -80,4 +80,4 @@ def add_module(modulename):
if highesttimestampdata is not None:
for moduleindex in range(len(modules)):
if moduleindex != highesttimestampindex and filetimestamps[filename][moduleindex] < highesttimestamp:
modules[moduleindex].file_write(filename, highesttimestampdata)
modules[moduleindex].write_file(filename, highesttimestampdata)

0 comments on commit 843579f

Please sign in to comment.