Skip to content

Commit

Permalink
Handle id not being present in OPDS response to fix #28
Browse files Browse the repository at this point in the history
  • Loading branch information
steinarb committed Oct 4, 2020
1 parent 766680a commit 763a9ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion calibre_plugin/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def makeMetadataFromParsedOpds(self, books):
def opdsToMetadata(self, opdsBookStructure):
authors = opdsBookStructure.author.replace(u'& ', u'&') if 'author' in opdsBookStructure else ''
metadata = Metadata(opdsBookStructure.title, authors.split(u'&'))
metadata.uuid = opdsBookStructure.id.replace('urn:uuid:', '', 1)
metadata.uuid = opdsBookStructure.id.replace('urn:uuid:', '', 1) if 'id' in opdsBookStructure else ''
rawTimestamp = opdsBookStructure.updated
parsableTimestamp = re.sub('((\.[0-9]+)?\+0[0-9]:00|Z)$', '', rawTimestamp)
metadata.timestamp = datetime.datetime.strptime(parsableTimestamp, '%Y-%m-%dT%H:%M:%S')
Expand Down

0 comments on commit 763a9ad

Please sign in to comment.