def P_update_tree(self, user, archive_path): # private, plex can't use _var
"""update the cache of the dir read state for everything between cb_path and archive_path."""
Log.Debug('updating tree {}'.format(archive_path))
base = Prefs['cb_path']
x = difflib.SequenceMatcher(a=base, b=archive_path)
for tag, i1, i2, j1, j2 in x.get_opcodes():
if tag == 'insert':
try:
diff = os.path.split(archive_path[j1:j2])[0]
d = diff.replace('\\', '/').split('/')[1]
path = os.path.join(base, d)
Log.Debug('archive root: {}'.format(path))
if os.path.abspath(base) == os.path.abspath(path):
Log.Debug('item is in root dir. skipping.')
else:
state = self.dir_read_state(user, path, True)
except Exception as e:
Log.Error('P_update_tree {}'.format(e))
return
评论列表
文章目录