-
Notifications
You must be signed in to change notification settings - Fork 0
/
markScannerPage.py
27 lines (23 loc) · 1.01 KB
/
markScannerPage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python3
from comictagger_utils import *
markScannerAs = PageType.Deleted
def main():
filenames = getFilenames()
for filename in filenames:
ca = getComicArchive(filename)
style = MetaDataStyle.CIX #ComicRack Style metadata
#mark scanner page as Deleted
scannerIndex = ca.getScannerPageIndex()
if scannerIndex is not None and scannerIndex >= 0:
scannerPageName = ca.getPageName(scannerIndex)
md = ca.readMetadata(style)
if md.pages[scannerIndex].get('Type') == markScannerAs:
print('{0}: {1} - already marked as {2}.'.format(filename, scannerPageName, markScannerAs))
else:
print('{0}: {1} - marking as {2}...'.format(filename, scannerPageName, markScannerAs))
md.pages[scannerIndex]['Type'] = markScannerAs
writeMetadata(md, ca, style)
else:
print('{0}: No scanner page found.'.format(filename))
if __name__ == '__main__':
main()