Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #38 and fix compatibility with calibre-web #40

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions calibre_plugin/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ def downloadOpdsRootCatalog(self, gui, opdsUrl, displayDialogOnErrors):
reason = str(exception.reason)
error_dialog(gui, _('Failed opening the OPDS URL'), message, reason, displayDialogOnErrors)
return (None, {})
self.serverHeader = feed.headers['server']
if 'server' in feed.headers:
self.serverHeader = feed.headers['server']
else:
self.serverHeader = "none"
print("serverHeader: %s" % self.serverHeader)
print("feed.entries: %s" % feed.entries)
catalogEntries = {}
Expand Down Expand Up @@ -148,7 +151,10 @@ 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) if 'id' in opdsBookStructure else ''
rawTimestamp = opdsBookStructure.updated
try:
rawTimestamp = opdsBookStructure.updated
except AttributeError:
rawTimestamp = "1980-01-01T00:00:00+00:00"
parsableTimestamp = re.sub('((\.[0-9]+)?\+0[0-9]:00|Z)$', '', rawTimestamp)
metadata.timestamp = datetime.datetime.strptime(parsableTimestamp, '%Y-%m-%dT%H:%M:%S')
tags = []
Expand Down
2 changes: 1 addition & 1 deletion calibre_plugin/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ def show_dialog(self):
d.show()

def apply_settings(self):
from config import prefs
from calibre_plugins.opds_client.config import prefs
prefs