|
|
@@ -11,6 +11,10 @@ from parsers.episode import episodeParser
|
|
|
from parsers.lesezeichen import lesezeichenParser
|
|
|
from parsers.chapter import chapterParser
|
|
|
from parsers.player import playerParser
|
|
|
+from util.chromecast import ccast
|
|
|
+
|
|
|
+
|
|
|
+baseurl = ''
|
|
|
|
|
|
if os.path.isfile('cookies'):
|
|
|
f = open('cookies','rb')
|
|
|
@@ -45,7 +49,7 @@ def main():
|
|
|
if uin == '1':
|
|
|
user = input('username: ')
|
|
|
pw = getpass('password:' )
|
|
|
- sess = auth.login(user,pw)
|
|
|
+ sess = auth.login(user,pw,config)
|
|
|
print(str(auth.token))
|
|
|
f = open(config['paths']['cookie_jar'],'wb')
|
|
|
pickle.dump(sess.cookies,f)
|
|
|
@@ -63,7 +67,7 @@ def main():
|
|
|
exit()
|
|
|
|
|
|
def chapter(sess,ep):
|
|
|
- url = 'https://proxer.me' + ep['link'].replace('chapter','read').replace('#top','')+'/1'
|
|
|
+ url = baseurl + ep['link'].replace('chapter','read').replace('#top','')+'/1'
|
|
|
response = sess.get(url)
|
|
|
content = response.content
|
|
|
chapPars = chapterParser()
|
|
|
@@ -95,12 +99,12 @@ def chapter(sess,ep):
|
|
|
count +=1
|
|
|
|
|
|
if uin == '2':
|
|
|
- url = 'https://proxer.me' + ep['link'].replace('#top','?format=json&type=reminder&'+ chapPars.token +'=1&title=reminder_next')
|
|
|
+ url = baseurl + ep['link'].replace('#top','?format=json&type=reminder&'+ chapPars.token +'=1&title=reminder_next')
|
|
|
response = sess.post(url,data = {"check":1})
|
|
|
print(str(response.content))
|
|
|
|
|
|
if uin == '5':
|
|
|
- url = 'https://proxer.me' + ep['link'].replace('#top','?format=json&type=reminder&'+ chapPars.token +'=1&title=reminder_this')
|
|
|
+ url = baseurl + ep['link'].replace('#top','?format=json&type=reminder&'+ chapPars.token +'=1&title=reminder_this')
|
|
|
response = sess.post(url,data = {"check":1})
|
|
|
print(str(response.content))
|
|
|
|
|
|
@@ -127,7 +131,7 @@ def chapter(sess,ep):
|
|
|
break
|
|
|
|
|
|
def episode(sess,ep):
|
|
|
- response = sess.get('https://proxer.me'+ep['link'])
|
|
|
+ response = sess.get(baseurl+ep['link'])
|
|
|
content = response.content
|
|
|
epars = episodeParser()
|
|
|
epars.feed(str(content))
|
|
|
@@ -146,17 +150,18 @@ def episode(sess,ep):
|
|
|
print('4 - go to next')
|
|
|
print('5 - go to previous')
|
|
|
print('6 - Details')
|
|
|
+ print('7 - Play on Chromecast')
|
|
|
print('99 - Exit')
|
|
|
path = 'anime/'+ep['name']+'/'
|
|
|
if not os.path.exists(path):
|
|
|
os.makedirs(path)
|
|
|
uin = input('$>: ')
|
|
|
if uin == '1':
|
|
|
- call(["vlc", link])
|
|
|
+ call(["vlc",'-f', link])
|
|
|
if uin == '2':
|
|
|
call(['curl',link,'-o',path+ep['num']+'.mp4'])
|
|
|
if uin == '3':
|
|
|
- url = 'https://proxer.me' + ep['link'].replace('#top','?format=json&type=reminder&'+ epars.token +'=1&title=reminder_next')
|
|
|
+ url = baseurl + ep['link'].replace('#top','?format=json&type=reminder&'+ epars.token +'=1&title=reminder_next')
|
|
|
response = sess.post(url,data = {"check":1})
|
|
|
print(str(response.content))
|
|
|
|
|
|
@@ -168,6 +173,15 @@ def episode(sess,ep):
|
|
|
prev['num'] = str(int(prev['num'])+1)
|
|
|
episode(sess,prev)
|
|
|
|
|
|
+ if uin == '7':
|
|
|
+ #TODO improve discovery and multiple favorites
|
|
|
+
|
|
|
+ cast = ccast(config['devices']['chromecast'])
|
|
|
+
|
|
|
+ if len(cast.getCasts()) <= 0:
|
|
|
+ print('no chromecast found')
|
|
|
+ cast.play(link,cast.getCasts()[0])
|
|
|
+
|
|
|
if uin == '99':
|
|
|
break
|
|
|
|
|
|
@@ -228,8 +242,11 @@ def LesezeichenSingle(sess,mode):
|
|
|
|
|
|
def ReadConfig():
|
|
|
global config
|
|
|
+ global baseurl
|
|
|
config = configparser.ConfigParser()
|
|
|
config.read_file(open('settings.cfg'))
|
|
|
+ baseurl = config['urls']['base_url']
|
|
|
+
|
|
|
|
|
|
def ListLocal():
|
|
|
anime = []
|