From 71329a7cab1bd2c66823a1e4865d1e25f4c0fa6b Mon Sep 17 00:00:00 2001 From: MinchinWeb Date: Wed, 3 Jun 2015 22:01:37 -0600 Subject: [PATCH] [Dayone] maintain metadata on edited entries; Fixes #358, See also #159 --- jrnl/DayOneJournal.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/jrnl/DayOneJournal.py b/jrnl/DayOneJournal.py index 53709694..1c73518d 100644 --- a/jrnl/DayOneJournal.py +++ b/jrnl/DayOneJournal.py @@ -184,8 +184,26 @@ class DayOne(Journal.Journal): if matched_entries: # This entry is an existing entry match = matched_entries[0] + # merge existing tags with tags pulled from the entry body entry.tags = list(set(entry.tags + match.tags)) + + # extended Dayone metadata + if hasattr(match, "creator_device_agent"): + entry.creator_device_agent = match.creator_device_agent + if hasattr(match, "creator_generation_date"): + entry.creator_generation_date = match.creator_generation_date + if hasattr(match, "creator_host_name"): + entry.creator_host_name = match.creator_host_name + if hasattr(match, "creator_os_agent"): + entry.creator_os_agent = match.creator_os_agent + if hasattr(match, "creator_software_agent"): + entry.creator_software_agent = match.creator_software_agent + if hasattr(match, 'location'): + entry.location = match.location + if hasattr(match, 'weather'): + entry.weather = match.weather + if match != entry: self.entries.remove(match) entry.modified = True