def make_new_entry(self, rel_path, id_handler):
"""
Generates a new entry for the specified path.
Note: This will mutate the id_handler!
"""
# Try to match to an existing book.
e_id = id_handler.new_id()
abs_path = os.path.join(read_from_config('media_loc').path, rel_path)
lmtime = os.path.getmtime(abs_path)
added_dt = datetime.utcfromtimestamp(lmtime)
last_modified = added_dt.replace(tzinfo=timezone.utc)
entry_obj = oh.Entry(id=e_id, path=rel_path,
date_added=datetime.now(timezone.utc),
last_modified=last_modified,
type='Book', table=self.BOOK_TABLE_NAME, data_id=None,
hashseed=_rand.randint(0, 2**32))
return entry_obj
评论列表
文章目录