Skip to content

Commit

Permalink
Fix watermark stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
noDRM committed Nov 29, 2021
1 parent ca6ec8f commit 09a34cf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion DeDRM_plugin/epubwatermark.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ def removeOPFwatermarks(object, path_to_ebook):
# This regex replaces all "idX_Y" IDs with "id_Y", removing the watermark IDs.
pre_remove = container_str_new
container_str_new = re.sub(r'((\r\n|\r|\n)\s*)?\<\!\-\-\s*Wygenerowane przez elibri dla zamówienia numer [0-9a-fA-F]+\s*\-\-\>', '', container_str_new)
container_str_new = re.sub(r'\=\"id[0-9]+_([0-9]+)\"', r'="id_\1"', container_str_new)
if pre_remove != container_str_new:
# To prevent this Regex from applying to books without that watermark, only do that if the watermark above was found.
container_str_new = re.sub(r'\=\"id[0-9]+_([0-9]+)\"', r'="id_\1"', container_str_new)
if pre_remove != container_str_new:
had_elibri = True

Expand Down

0 comments on commit 09a34cf

Please sign in to comment.