the world is gonna roll me

This commit is contained in:
Connor Olding 2014-04-27 07:05:51 -07:00
parent 6a1562c5f5
commit 1a2c9ae1e6

View File

@ -62,21 +62,20 @@ def filterext(paths, exts):
yield p
def shouldsync(md):
rating = -1
sync = u''
if safetydance(md, 'rating'):
try:
rating = int(md['rating'][0])
except ValueError:
pass
if safetydance(md, 'sync'):
sync = md['sync'][0].lower()
rating = safetydance(md, 'rating')
sync = safetydance(md, 'sync')
if rating != None:
rating = int(rating[0])
if sync:
sync = sync[0].lower()
else:
sync = u''
if sync == u'no' or sync == u'space':
return False
if sync == u'yes' or sync == u'share':
return True
if rating >= 3:
if rating != None and rating >= 3:
return True
return False
@ -93,7 +92,7 @@ def findmatching(haystack, needle):
def run(args):
if not len(args) in (2, 3):
print("I need a path or two!", file=sys.stderr)
sys.exit(1)
return 1
inonly = len(args) == 2
@ -109,7 +108,7 @@ def run(args):
if inonly: print(p)
else: tosync.append(md)
if inonly: return
if inonly: return 0
print("Beginning matching...", file=sys.stderr)
outdir = args[2]
@ -127,7 +126,11 @@ def run(args):
# TODO: just delete missing ones here
print("MISSING", p)
return 0
ret = 0
try:
run(sys.argv)
ret = run(sys.argv)
except KeyboardInterrupt:
sys.exit(1)
sys.exit(ret)