booxtream-epub-drm-remover icon indicating copy to clipboard operation
booxtream-epub-drm-remover copied to clipboard

wm2() variation

Open olberg opened this issue 6 years ago • 1 comments

There seems to be a variation where search string should be "belongs to" instead of "is licensed to".

olberg avatar Mar 14 '18 16:03 olberg

Replacement version for wm2:

def wm2():
	global prefix
	print('\n\n === Removing \'licensing\' watermark (WM2) === \n\n')
	references = set(searchDirectoryForString('.', "is licensed to"))
	references.update(searchDirectoryForString('.', "belongs to"))
	for reference in references:
		soup, tags = findTagsInFile(reference)
		for tag in tags:
			if len(tag.findChildren()) == 0: # No <p> with other <p> inside them
				text_tag = cure_2txt(tag)
				if "is licensed to" in text_tag or "belongs to" in text_tag:
					print("Found match in file: {0}".format(tag))
					removeTagFromFile(reference, soup, tag)
	print('\nOK')

Artoria2e5 avatar Mar 15 '18 01:03 Artoria2e5