add option to force rescan all files

This commit is contained in:
j 2014-03-02 13:52:31 +01:00
parent 91a85ebbc4
commit b950c187f4
2 changed files with 6 additions and 5 deletions

View file

@ -342,7 +342,7 @@ class Client(object):
else:
self.set_encodes(site, files)
def scan_file(self, path):
def scan_file(self, path, rescan=False):
conn, c = self._conn()
update = True
@ -357,8 +357,8 @@ class Client(object):
created = row[4]
update = False
break
if update:
info = utils.avinfo(path)
if update or rescan:
info = utils.avinfo(path, cached=not rescan)
'''
if 'error' in info or info['size'] == 0:
#print info
@ -470,6 +470,7 @@ class Client(object):
return volumes
def scan(self, args):
rescan = '--rescan' in args
print "checking for new files ..."
volumes = self.active_volumes()
for name in sorted(volumes):

View file

@ -39,9 +39,9 @@ class AspectRatio(fractions.Fraction):
def ratio(self):
return "%d:%d" % (self.numerator, self.denominator)
def avinfo(filename):
def avinfo(filename, cached=True):
if os.path.getsize(filename):
info = ox.avinfo(filename)
info = ox.avinfo(filename, cached=cached)
if 'video' in info and info['video'] and 'width' in info['video'][0]:
if not 'display_aspect_ratio' in info['video'][0]:
dar = AspectRatio(info['video'][0]['width'], info['video'][0]['height'])