the world is gonna roll me
This commit is contained in:
parent
6a1562c5f5
commit
1a2c9ae1e6
1 changed files with 16 additions and 13 deletions
29
unsync.py
29
unsync.py
|
@ -62,21 +62,20 @@ def filterext(paths, exts):
|
||||||
yield p
|
yield p
|
||||||
|
|
||||||
def shouldsync(md):
|
def shouldsync(md):
|
||||||
rating = -1
|
rating = safetydance(md, 'rating')
|
||||||
sync = u''
|
sync = safetydance(md, 'sync')
|
||||||
if safetydance(md, 'rating'):
|
if rating != None:
|
||||||
try:
|
rating = int(rating[0])
|
||||||
rating = int(md['rating'][0])
|
if sync:
|
||||||
except ValueError:
|
sync = sync[0].lower()
|
||||||
pass
|
else:
|
||||||
if safetydance(md, 'sync'):
|
sync = u''
|
||||||
sync = md['sync'][0].lower()
|
|
||||||
|
|
||||||
if sync == u'no' or sync == u'space':
|
if sync == u'no' or sync == u'space':
|
||||||
return False
|
return False
|
||||||
if sync == u'yes' or sync == u'share':
|
if sync == u'yes' or sync == u'share':
|
||||||
return True
|
return True
|
||||||
if rating >= 3:
|
if rating != None and rating >= 3:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -93,7 +92,7 @@ def findmatching(haystack, needle):
|
||||||
def run(args):
|
def run(args):
|
||||||
if not len(args) in (2, 3):
|
if not len(args) in (2, 3):
|
||||||
print("I need a path or two!", file=sys.stderr)
|
print("I need a path or two!", file=sys.stderr)
|
||||||
sys.exit(1)
|
return 1
|
||||||
|
|
||||||
inonly = len(args) == 2
|
inonly = len(args) == 2
|
||||||
|
|
||||||
|
@ -109,7 +108,7 @@ def run(args):
|
||||||
if inonly: print(p)
|
if inonly: print(p)
|
||||||
else: tosync.append(md)
|
else: tosync.append(md)
|
||||||
|
|
||||||
if inonly: return
|
if inonly: return 0
|
||||||
print("Beginning matching...", file=sys.stderr)
|
print("Beginning matching...", file=sys.stderr)
|
||||||
|
|
||||||
outdir = args[2]
|
outdir = args[2]
|
||||||
|
@ -127,7 +126,11 @@ def run(args):
|
||||||
# TODO: just delete missing ones here
|
# TODO: just delete missing ones here
|
||||||
print("MISSING", p)
|
print("MISSING", p)
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
ret = 0
|
||||||
try:
|
try:
|
||||||
run(sys.argv)
|
ret = run(sys.argv)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
sys.exit(ret)
|
||||||
|
|
Loading…
Reference in a new issue