瀏覽代碼

chapter stuff

Phil 5 年之前
父節點
當前提交
678f2a3e41
共有 1 個文件被更改,包括 16 次插入4 次删除
  1. 16 4
      main.py

+ 16 - 4
main.py

@@ -1,4 +1,5 @@
 import auth as auth
+from tqdm import tqdm
 import os
 from getpass import getpass
 import requests
@@ -69,11 +70,19 @@ def chapter(sess,ep):
     if not os.path.exists(path):
         os.makedirs(path)
     print(chapPars.serverurl)
-    for p in chapPars.images:
-        call(['curl',chapPars.serverurl + p['file'],'-o',path+p['file']])
+    count = 0
+    print("1 - Download")
+    print("2 - mark as read")
+    uin = input('$>: ')
+    if uin == '1':
+        for p in tqdm(chapPars.images):
+            call(['curl',chapPars.serverurl + p['file'],'-o',path+str(count).zfill(3)+p['file'][p['file'].rindex('.'):]])
+            count +=1
 
+    if uin == '2':
+        sess.post('https://proxer.me/chapter/'+ 'id'+ '/'+ ep['num'] + '/en?format=json&type=reminder&'+'token'+'=1&title=reminder_next')
 
-def episode(sess,episode):
+def episode(sess,ep):
     response = sess.get('https://proxer.me'+ep['link'])
     content = response.content
     epars = episodeParser()
@@ -83,11 +92,14 @@ def episode(sess,episode):
     print(link)
     print('1 - open with vlc')
     print('2 - download')
+    path = 'anime/'+ep['name']+'/'
+    if not os.path.exists(path):
+        os.makedirs(path)
     uin = input('$>: ')
     if uin == '1':
         call(["vlc", link])
     if uin == '2':
-        call(['curl',link,'-o',ep['title']+'.mp4'])
+        call(['curl',link,'-o',path+ep['num']+'.mp4'])
  
 def episode_test():
     f = open('dummys/episode.html','r')