diff options
Diffstat (limited to 'scripts/mangasort')
-rwxr-xr-x | scripts/mangasort | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/scripts/mangasort b/scripts/mangasort new file mode 100755 index 00000000..d46be69c --- /dev/null +++ b/scripts/mangasort @@ -0,0 +1,56 @@ +#!/bin/python + +import os + +def sxivInput(r1, r2): + return "sxiv " + r1 + " & " + "sxiv " + r2 + " & " + +def calculate(prefix, suffix, num): + r1 = '' + r2 = '' + + i = 1 + while i <= num: # r1 + if i < 10: + ai = "00" + str(i) + elif i < 100: + ai = "0" + str(i) + else: + ai = i + r1 += prefix + str(ai) + suffix + " " + i += 2 + + i = 2 + while i <= num: # ra + if i < 10: + ai = "00" + str(i) + elif i < 100: + ai = "0" + str(i) + else: + ai = i + r2 += prefix + str(ai) + suffix + " " + i += 2 + + return r1, r2 + +def tachiyomi(i): + r1, r2 = calculate('', '.png', i) + os.system(sxivInput(r1, r2)) + +def main(): + titlePrefix = input("Title prefix: ") + titleSuffix = input("Title suffix: ") + numPages = int(input("Number of pages: ")) + + r1, r2 = calculate(titlePrefix, titleSuffix, numPages) + print(sxivInput(r1, r2)) + +if __name__ == '__main__': + contents = os.listdir(os.getcwd()) + c = set(contents) + + if "001.png" in c: + tachiyomi(len(contents)) + else: + main() + |