log.error('Failed adding index %s: %s',(index_name,traceback.format_exc()))
defdeleteDocument(self,**kwargs):
db=self.getDB()
@ -138,21 +160,62 @@ class Database(object):
'success':success
}
defcompact(self,**kwargs):
defcompact(self,try_repair=True,**kwargs):
success=False
db=self.getDB()
# Removing left over compact files
db_path=sp(db.path)
forfinos.listdir(sp(db.path)):
forxin['_compact_buck','_compact_stor']:
iff[-len(x):]==x:
os.unlink(os.path.join(db_path,f))
success=True
try:
start=time.time()
db=self.getDB()
size=float(db.get_db_details().get('size',0))
log.debug('Compacting database, current size: %sMB',round(size/1048576,2))
db.compact()
new_size=float(db.get_db_details().get('size',0))
log.debug('Done compacting database in %ss, new size: %sMB, saved: %sMB',(round(time.time()-start,2),round(new_size/1048576,2),round((size-new_size)/1048576,2)))
success=True
except(IndexException,AttributeError):
iftry_repair:
log.error('Something wrong with indexes, trying repair')
# Remove all indexes
old_indexes=self.indexes.keys()
forindex_nameinold_indexes:
try:
db.destroy_index(index_name)
exceptIndexNotFoundException:
pass
except:
log.error('Failed removing old index %s',index_name)
# Try to find quality in profile, if not found: a quality we do not want is lower than anything else
try:
@ -446,6 +451,9 @@ class QualityPlugin(Plugin):
'/movies/BluRay HDDVD H.264 MKV 720p EngSub/QuiQui le fou (criterion collection #123, 1915)/QuiQui le fou (1915) 720p x264 BluRay.mkv':{'size':5500,'quality':'720p'},
'C:\\movies\QuiQui le fou (collection #123, 1915)\QuiQui le fou (1915) 720p x264 BluRay.mkv':{'size':5500,'quality':'720p'},
'C:\\movies\QuiQui le fou (collection #123, 1915)\QuiQui le fou (1915) half-sbs 720p x264 BluRay.mkv':{'size':5500,'quality':'720p','is_3d':True},