file_manager: store file "modified" time as unix time

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-10-21 17:53:08 -04:00
parent 2d77400a65
commit f2fb8d33d4
1 changed files with 3 additions and 3 deletions

View File

@ -262,7 +262,7 @@ class FileManager:
return flist return flist
def _get_path_info(self, path): def _get_path_info(self, path):
modified = time.ctime(os.path.getmtime(path)) modified = os.path.getmtime(path)
size = os.path.getsize(path) size = os.path.getsize(path)
path_info = {'modified': modified, 'size': size} path_info = {'modified': modified, 'size': size}
return path_info return path_info
@ -483,7 +483,7 @@ class FileManager:
def notify_filelist_changed(self, action, fname, base, source_item={}): def notify_filelist_changed(self, action, fname, base, source_item={}):
self._update_file_list(base, do_notify=True) self._update_file_list(base, do_notify=True)
file_info = dict(self.file_lists[base].get( file_info = dict(self.file_lists[base].get(
fname, {'size': 0, 'modified': ""})) fname, {'size': 0, 'modified': 0}))
file_info.update({'path': fname, 'root': base}) file_info.update({'path': fname, 'root': base})
result = {'action': action, 'item': file_info} result = {'action': action, 'item': file_info}
if source_item: if source_item:
@ -527,7 +527,7 @@ class MetadataStorage:
for fname, fdata in filelist.items(): for fname, fdata in filelist.items():
mdata = self.metadata.get(fname, {}) mdata = self.metadata.get(fname, {})
if mdata.get('size', "") == fdata.get('size') \ if mdata.get('size', "") == fdata.get('size') \
and mdata.get('modified', "") == fdata.get('modified'): and mdata.get('modified', 0) == fdata.get('modified'):
# file metadata has already been extracted # file metadata has already been extracted
exisiting_data[fname] = mdata exisiting_data[fname] = mdata
else: else: