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

Do not edit raw sidecar when restoring to KOReader #52

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 0 additions & 5 deletions action.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,6 @@ def push_metadata_to_koreader_sidecar(self, book_uuid, path):
}
sidecar_dict = json.loads(sidecar_metadata)
sidecar_lua = lua.encode(sidecar_dict)
# not certain if tabs need to be replaced with spaces but it can't hurt
sidecar_lua = sidecar_lua.replace("\t", " ")
# something is happening in the decoding/encoding which is replacing [1] with ["1"]
# which ofc breaks the settings file; this regex strips the "" marks
sidecar_lua = re.sub(r'\["([0-9])+"\]', r'[\1]', sidecar_lua)
sidecar_lua_formatted = f"-- we can read Lua syntax here!\nreturn {sidecar_lua}\n"
try:
os.makedirs(os.path.dirname(path))
Expand Down