the world is gonna roll me
This commit is contained in:
parent
6a1562c5f5
commit
1a2c9ae1e6
1 changed files with 16 additions and 13 deletions
27
unsync.py
27
unsync.py
|
@ -62,21 +62,20 @@ def filterext(paths, exts):
|
|||
yield p
|
||||
|
||||
def shouldsync(md):
|
||||
rating = -1
|
||||
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 safetydance(md, 'rating'):
|
||||
try:
|
||||
rating = int(md['rating'][0])
|
||||
except ValueError:
|
||||
pass
|
||||
if safetydance(md, 'sync'):
|
||||
sync = md['sync'][0].lower()
|
||||
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue