Skip to content

Commit

Permalink
Add more type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
oxdef committed Nov 25, 2023
1 parent db4f9f8 commit 0e2f8c2
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 98 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.PHONY: lint
PYTHON := $(shell poetry env info -p)/bin/python

lint:
mypy --python-executable="$(PYTHON)" lib2opds
1 change: 1 addition & 0 deletions config.ini-example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ library_dir =
opds_dir =
library_base_uri = /library/
opds_base_uri = /opds/
root_filename = index.xml
library_title = My Library
cover_width = 500
cover_height = 500
Expand Down
2 changes: 1 addition & 1 deletion lib2opds/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_utime_dir(dpath: Path) -> datetime:
return updated


def cli():
def cli() -> None:
parser = argparse.ArgumentParser(
description="Generate OPDS catalog for local e-book library"
)
Expand Down
6 changes: 6 additions & 0 deletions lib2opds/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ class Config:
clear_opds_dir: bool = True
feeds_dir: Path = field(default_factory=Path)
publication_freshness_days = 14
root_filename: str = "index.xml"
feed_by_directory_title: str = "Folders"
feed_new_publications_title: str = "New Books"
feed_all_publications_title: str = "All Books"
feed_by_author_title: str = "Authors"

def load_from_file(self, config_path: Path) -> bool:
if not config_path.exists():
Expand All @@ -35,6 +40,7 @@ def load_from_file(self, config_path: Path) -> bool:
self.publication_freshness_days = config["General"].getint(
"publication_freshness_days", 14
)
self.root_filename = config["General"].get("root_filename")

return True

Expand Down
Loading

0 comments on commit 0e2f8c2

Please sign in to comment.