aboutsummaryrefslogtreecommitdiff
path: root/scripts/mangasort
diff options
context:
space:
mode:
authorVidhu Kant Sharma <bokuwakanojogahoshii@yahoo.com>2020-11-22 17:08:11 +0530
committerVidhu Kant Sharma <bokuwakanojogahoshii@yahoo.com>2020-11-22 17:08:11 +0530
commit026b290aa60d01b28da56abc2d19f92d914c4361 (patch)
tree44204c73641f772fb4386e6ff01f2a20fe3860c3 /scripts/mangasort
parenta17a692c0abe5bfa6365be41129088fae87a0125 (diff)
added mangasort script to satisfy my weebshit needs
Diffstat (limited to 'scripts/mangasort')
-rwxr-xr-xscripts/mangasort56
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()
+