def create_evernote_notes(self, evernote_guids=None, use_local_db_only=False): """ Create EvernoteNote objects from Evernote GUIDs using EvernoteNoteFetcher.getNote(). Will prematurely return if fetcher.getNote fails :rtype : EvernoteNoteFetcherResults :param evernote_guids: :param use_local_db_only: Do not initiate API calls :return: EvernoteNoteFetcherResults """ if not hasattr(self, 'evernote_guids') or evernote_guids: self.evernote_guids = evernote_guids if not use_local_db_only: self.check_ancillary_data_up_to_date() action_str_base = 'Create' action_str = 'Creation Of' info = stopwatch.ActionInfo(action_str, 'Evernote Notes', report_if_empty=False) tmr = stopwatch.Timer(evernote_guids, info=info, label='Add\\Evernote-%sNotes' % (action_str_base)) fetcher = EvernoteNoteFetcher(self, use_local_db_only=use_local_db_only) if not evernote_guids: fetcher.results.Status = EvernoteAPIStatus.EmptyRequest; return fetcher.results if in_anki(): fetcher.evernoteQueryTags = SETTINGS.EVERNOTE.QUERY.TAGS.fetch().replace(',', ' ').split() fetcher.keepEvernoteTags = SETTINGS.ANKI.TAGS.KEEP_TAGS.fetch() fetcher.deleteQueryTags = SETTINGS.ANKI.TAGS.DELETE_EVERNOTE_QUERY_TAGS.fetch() fetcher.tagsToDelete = SETTINGS.ANKI.TAGS.TO_DELETE.fetch().replace(',', ' ').split() for evernote_guid in self.evernote_guids: if not fetcher.getNote(evernote_guid): return fetcher.results tmr.reportSuccess() tmr.step(fetcher.result.Note.FullTitle) tmr.Report() return fetcher.results
def create_evernote_notes(self, evernote_guids=None, use_local_db_only=False): """ Create EvernoteNote objects from Evernote GUIDs using EvernoteNoteFetcher.getNote(). Will prematurely return if fetcher.getNote fails :rtype : EvernoteNoteFetcherResults :param evernote_guids: :param use_local_db_only: Do not initiate API calls :return: EvernoteNoteFetcherResults """ if not hasattr(self, 'evernote_guids') or evernote_guids: self.evernote_guids = evernote_guids if not use_local_db_only: self.check_ancillary_data_up_to_date() action_str_base = 'Create' action_str = 'Creation Of' info = stopwatch.ActionInfo(action_str, 'Evernote Notes', report_if_empty=False) tmr = stopwatch.Timer(evernote_guids, info=info, label='Add\\Evernote-%sNotes' % (action_str_base)) fetcher = EvernoteNoteFetcher(self, use_local_db_only=use_local_db_only) if not evernote_guids: fetcher.results.Status = EvernoteAPIStatus.EmptyRequest return fetcher.results if in_anki(): fetcher.evernoteQueryTags = SETTINGS.EVERNOTE.QUERY.TAGS.fetch( ).replace(',', ' ').split() fetcher.keepEvernoteTags = SETTINGS.ANKI.TAGS.KEEP_TAGS.fetch() fetcher.deleteQueryTags = SETTINGS.ANKI.TAGS.DELETE_EVERNOTE_QUERY_TAGS.fetch( ) fetcher.tagsToDelete = SETTINGS.ANKI.TAGS.TO_DELETE.fetch( ).replace(',', ' ').split() for evernote_guid in self.evernote_guids: if not fetcher.getNote(evernote_guid): return fetcher.results tmr.reportSuccess() tmr.step(fetcher.result.Note.FullTitle) tmr.Report() return fetcher.results