From 06959367138b5675c3025c527759a0eaff531933 Mon Sep 17 00:00:00 2001 From: Julien C Date: Fri, 25 Sep 2015 20:32:41 -0400 Subject: [PATCH] Started work on wat.tv authentication but server down --- resources/language/english/strings.xml | 6 +++++- resources/language/french/strings.xml | 6 +++++- resources/lib/channels/allocine.py | 14 +++++++------- resources/lib/channels/arte.py | 4 ++-- resources/lib/channels/canalu.py | 2 +- resources/lib/channels/cherie25.py | 4 ++-- resources/lib/channels/cplus.py | 6 +++--- resources/lib/channels/france24.py | 4 ++-- resources/lib/channels/gulli.py | 5 ++--- resources/lib/channels/lcp.py | 4 ++-- resources/lib/channels/mostviewed.py | 3 +-- resources/lib/channels/nrj12.py | 4 ++-- resources/lib/channels/pluzz.py | 4 ++-- resources/lib/channels/pluzz2.py | 4 ++-- resources/lib/channels/tf1thematiques.py | 2 +- resources/lib/channels/tntv.py | 6 ++---- resources/lib/channels/toutv.py | 2 +- resources/lib/channels/tv5af.py | 6 ++---- resources/lib/channels/wattv.py | 9 +++++++++ resources/lib/utils.py | 10 +++++++--- resources/settings.xml | 4 ++++ 21 files changed, 64 insertions(+), 45 deletions(-) diff --git a/resources/language/english/strings.xml b/resources/language/english/strings.xml index 113bdef..0beeef3 100644 --- a/resources/language/english/strings.xml +++ b/resources/language/english/strings.xml @@ -37,7 +37,11 @@ Advanced Delete catalog cache - Catalog refresh interval(min) + Catalog refresh interval(min) + + Accounts + Wat.tv Login + Wat.tv Password diff --git a/resources/language/french/strings.xml b/resources/language/french/strings.xml index 8400f20..8bc037b 100644 --- a/resources/language/french/strings.xml +++ b/resources/language/french/strings.xml @@ -38,7 +38,11 @@ Avancé Supprimer le cache des catalogues - Rafraichissement des catalogues (min) + Rafraichissement des catalogues (min) + + Comptes + Login Wat.tv + Mot de passe Wat.tv diff --git a/resources/lib/channels/allocine.py b/resources/lib/channels/allocine.py index 693a963..3388d0f 100644 --- a/resources/lib/channels/allocine.py +++ b/resources/lib/channels/allocine.py @@ -28,9 +28,9 @@ def list_shows(channel,folder): elif folder.find('/')==-1 or folder.find('bandes-annonces')!=-1: if folder.find('bandes-annonces')!=-1: - filePath=utils.downloadCatalog('http://www.allocine.fr/video%s' % (folder),'allocine%s1.html' % (folder),False) + filePath=utils.downloadCatalog('http://www.allocine.fr/video%s' % (folder),'allocine%s1.html' % (folder),False,{}) else: - filePath=utils.downloadCatalog('http://www.allocine.fr/video/prgcat-%s/' % (folder),'allocine%s1.html' % (folder),False) + filePath=utils.downloadCatalog('http://www.allocine.fr/video/prgcat-%s/' % (folder),'allocine%s1.html' % (folder),False,{}) html=open(filePath).read().replace('\xe9', 'e').replace('\xe0', 'a').replace('\n', ' ').replace('\r', '') nbPages=1 pages=re.findall('
  • (.*?)
  • ', html) @@ -39,9 +39,9 @@ def list_shows(channel,folder): for i in range(1, nbPages+1): if folder.find('bandes-annonces')!=-1: - filePath=utils.downloadCatalog('http://www.allocine.fr/video%s?page=%s' % (folder,i),'allocine%s%s.html' % (folder,i),False) + filePath=utils.downloadCatalog('http://www.allocine.fr/video%s?page=%s' % (folder,i),'allocine%s%s.html' % (folder,i),False,{}) else: - filePath=utils.downloadCatalog('http://www.allocine.fr/video/prgcat-%s/?page=%s' % (folder,i),'allocine%s%s.html' % (folder,i),False) + filePath=utils.downloadCatalog('http://www.allocine.fr/video/prgcat-%s/?page=%s' % (folder,i),'allocine%s%s.html' % (folder,i),False,{}) html=open(filePath).read().replace('\xe9', 'e').replace('\xe0', 'a').replace('\n', ' ').replace('\r', '') images=re.findall('
    ', html) @@ -62,7 +62,7 @@ def list_shows(channel,folder): shows.append( [channel,item[0], formatTitle(item[1]) ,image ,'folder'] ) j=j+1 else: - filePath=utils.downloadCatalog('http://www.allocine.fr%s' % (folder),'allocine%s.html' % (folder),False) + filePath=utils.downloadCatalog('http://www.allocine.fr%s' % (folder),'allocine%s.html' % (folder),False,{}) html=open(filePath).read().replace('\xe9', 'e').replace('\xe0', 'a').replace('\n', ' ').replace('\r', '') seasons=re.findall('(.*?)', html) @@ -74,7 +74,7 @@ def list_shows(channel,folder): def list_videos(channel,show_url): videos=[] - filePath=utils.downloadCatalog('http://www.allocine.fr%s' % (show_url),'allocine%s.html' % (show_url.replace('/','')),False) + filePath=utils.downloadCatalog('http://www.allocine.fr%s' % (show_url),'allocine%s.html' % (show_url.replace('/','')),False,{}) html=open(filePath).read().replace('\xe9', 'e').replace('\xe0', 'a').replace('\n', ' ').replace('\r', '') items=re.findall('

    ', html) @@ -85,7 +85,7 @@ def list_videos(channel,show_url): return videos def getVideoURL(channel,idVideo): - filePath=utils.downloadCatalog('http://www.allocine.fr/ws/AcVisiondataV4.ashx?media=%s' % (idVideo),'allocine%s.xml' % (idVideo),False) + filePath=utils.downloadCatalog('http://www.allocine.fr/ws/AcVisiondataV4.ashx?media=%s' % (idVideo),'allocine%s.xml' % (idVideo),False,{}) xml=open(filePath).read() diff --git a/resources/lib/channels/arte.py b/resources/lib/channels/arte.py index 66d220c..91addc5 100644 --- a/resources/lib/channels/arte.py +++ b/resources/lib/channels/arte.py @@ -18,7 +18,7 @@ def list_shows(channel,folder): shows=[] d=dict() - filePath=utils.downloadCatalog('http://www.arte.tv/papi/tvguide-flow/sitemap/feeds/videos/F.xml','ARTE.XML',False) + filePath=utils.downloadCatalog('http://www.arte.tv/papi/tvguide-flow/sitemap/feeds/videos/F.xml','ARTE.XML',False,{}) if folder=='none': xml = open(filePath).read() url=common.parseDOM(xml, "url") @@ -78,7 +78,7 @@ def getVideoURL(channel,video_id): def list_videos(channel,show_title): videos=[] - filePath=utils.downloadCatalog('http://www.arte.tv/papi/tvguide-flow/sitemap/feeds/videos/F.xml','ARTE.XML',False) + filePath=utils.downloadCatalog('http://www.arte.tv/papi/tvguide-flow/sitemap/feeds/videos/F.xml','ARTE.XML',False,{}) xml = open(filePath).read() url=common.parseDOM(xml, "url") diff --git a/resources/lib/channels/canalu.py b/resources/lib/channels/canalu.py index c408fbe..5fb3230 100644 --- a/resources/lib/channels/canalu.py +++ b/resources/lib/channels/canalu.py @@ -23,7 +23,7 @@ def list_shows(channel,folder): def list_videos(channel,id): videos=[] - filePath=utils.downloadCatalog('http://www.canal-u.tv/themes/format.rss/theme.%s/podcast.1?xts=248546&xtor=RSS-1' % id, 'canalu%s.xml' % id,False) + filePath=utils.downloadCatalog('http://www.canal-u.tv/themes/format.rss/theme.%s/podcast.1?xts=248546&xtor=RSS-1' % id, 'canalu%s.xml' % id,False,{}) xml=open(filePath).read() items=common.parseDOM(xml, "item") for i in range(0, len(items)): diff --git a/resources/lib/channels/cherie25.py b/resources/lib/channels/cherie25.py index b2ce1eb..1dd6cf4 100644 --- a/resources/lib/channels/cherie25.py +++ b/resources/lib/channels/cherie25.py @@ -16,7 +16,7 @@ def list_shows(channel,folder): shows = [] - filePath = utils.downloadCatalog(url_catalog,'cherie25.html',False) + filePath = utils.downloadCatalog(url_catalog,'cherie25.html',False,{}) html = open(filePath).read().decode("utf-8") line_s = common.parseDOM(html,"div",attrs={"class":u"line replay magazines"}) for line in line_s : @@ -57,7 +57,7 @@ def list_videos(channel,params): titre = fanart videos.append([channel,video_url,titre,'',{'Title':titre},'play']) else : - filePath = utils.downloadCatalog(url_catalog,'cherie25.html',False) + filePath = utils.downloadCatalog(url_catalog,'cherie25.html',False,{}) html = open(filePath).read().decode("utf-8") line_replay = common.parseDOM(html,"div",attrs={"class":u"line replay magazines"}) for line in line_replay : diff --git a/resources/lib/channels/cplus.py b/resources/lib/channels/cplus.py index 3cc213f..ec6d889 100644 --- a/resources/lib/channels/cplus.py +++ b/resources/lib/channels/cplus.py @@ -9,7 +9,7 @@ readyForUse=True def get_token(): - filePath=utils.downloadCatalog('http://service.mycanal.fr/authenticate.json/Android_Tab/1.1?highResolution=1','TokenCPlus.json',False) + filePath=utils.downloadCatalog('http://service.mycanal.fr/authenticate.json/Android_Tab/1.1?highResolution=1','TokenCPlus.json',False,{}) filPrgm=open(filePath).read() jsoncat = json.loads(filPrgm) return jsoncat['token'] @@ -18,7 +18,7 @@ def list_shows(channel,folder): shows=[] if folder=='none': - filePath=utils.downloadCatalog('http://service.mycanal.fr/page/'+get_token()+'/1595.json','CPLUS.json',False) + filePath=utils.downloadCatalog('http://service.mycanal.fr/page/'+get_token()+'/1595.json','CPLUS.json',False,{}) filPrgm=open(filePath).read() jsoncat = json.loads(filPrgm) strates = jsoncat['strates'] @@ -28,7 +28,7 @@ def list_shows(channel,folder): shows.append( [channel,content['onClick']['URLPage'].encode('utf-8'), content['onClick']['displayName'].encode('utf-8'),content['URLImage'].encode('utf-8'),'folder'] ) else: fileName=folder[folder.find('.json')-4:folder.find('.json')+5] - filePath=utils.downloadCatalog(folder,fileName,False) + filePath=utils.downloadCatalog(folder,fileName,False,{}) filPrgm=open(filePath).read() jsoncat = json.loads(filPrgm) strates = jsoncat['strates'] diff --git a/resources/lib/channels/france24.py b/resources/lib/channels/france24.py index 2b189c9..42b5e73 100644 --- a/resources/lib/channels/france24.py +++ b/resources/lib/channels/france24.py @@ -10,7 +10,7 @@ def list_shows(channel,param): shows=[] - filePath=utils.downloadCatalog('http://api.france24.com/fr/services/json-rpc/emission_list?databases=f24fr&key=XXX&start=0&limit=30&edition_limit=8','France24.json',False) + filePath=utils.downloadCatalog('http://api.france24.com/fr/services/json-rpc/emission_list?databases=f24fr&key=XXX&start=0&limit=30&edition_limit=8','France24.json',False,{}) filPrgm=open(filePath).read() jsonParser = json.loads(filPrgm) @@ -22,7 +22,7 @@ def list_shows(channel,param): def list_videos(channel,show): videos=[] - filePath=utils.downloadCatalog('http://api.france24.com/fr/services/json-rpc/emission_list?databases=f24fr&key=XXX&start=0&limit=30&edition_limit=8','France24.json',False) + filePath=utils.downloadCatalog('http://api.france24.com/fr/services/json-rpc/emission_list?databases=f24fr&key=XXX&start=0&limit=30&edition_limit=8','France24.json',False,{}) filPrgm=open(filePath).read() jsonParser = json.loads(filPrgm) diff --git a/resources/lib/channels/gulli.py b/resources/lib/channels/gulli.py index 00c5110..ddf79ea 100644 --- a/resources/lib/channels/gulli.py +++ b/resources/lib/channels/gulli.py @@ -20,7 +20,7 @@ def list_shows(channel,folder): shows.append( [channel,'series','Series et films','','folder'] ) else: d=dict() - filePath=utils.downloadCatalog(urlBase + folder,'gulli' + folder +'.html',False) + filePath=utils.downloadCatalog(urlBase + folder,'gulli' + folder +'.html',False,{}) html=open(filePath).read().replace('\xe9', 'e').replace('\xe0', 'a') replays = common.parseDOM(html,"div",attrs={"class":"img"}) @@ -41,7 +41,7 @@ def list_videos(channel,param): category=param.split('$$')[1] videos=[] - filePath=utils.downloadCatalog(urlBase + folder,'gulli' + folder +'.html',False) + filePath=utils.downloadCatalog(urlBase + folder,'gulli' + folder +'.html',False,{}) html=open(filePath).read().replace('\xe9', 'e').replace('\xe0', 'a').replace("\n", " ") html=' '.join([segment for segment in html.split()]) @@ -55,7 +55,6 @@ def list_videos(channel,param): if match: for t,st,e in match: title=t + '-' + e.replace(' ',' ') - print title.encode("utf-8") #

    Atomic Betty L'âge ingrat
    Saison 3 Episode 135

    img = re.findall('src="(.*?)"',replay) [0] infoLabels={ "Title": title} diff --git a/resources/lib/channels/lcp.py b/resources/lib/channels/lcp.py index b5ab9b4..cdeab44 100644 --- a/resources/lib/channels/lcp.py +++ b/resources/lib/channels/lcp.py @@ -18,7 +18,7 @@ def list_shows(channel,folder): shows.append([channel,'shows',globalvar.LANGUAGE(33011),'','folder']) shows.append([channel,'reportages',globalvar.LANGUAGE(33010),'','shows']) else : - filePath = utils.downloadCatalog(url_catalog,'%s.xml'%(channel),False) + filePath = utils.downloadCatalog(url_catalog,'%s.xml'%(channel),False,{}) fileCat = open(filePath).read().replace('\n','').decode('utf-8') cat = re.findall(''+folder+' + +(.+?) +',fileCat)[0] shows_s = re.findall(' +(.+?) +',cat) @@ -30,7 +30,7 @@ def list_shows(channel,folder): def list_videos(channel,params): videos = [] if params=='reportages' : - filePath = utils.downloadCatalog(url_catalog,'%s.xml'%(channel),False) + filePath = utils.downloadCatalog(url_catalog,'%s.xml'%(channel),False,{}) fileCat = open(filePath).read().replace('\n','').decode('utf-8') cat = re.findall(''+params+' + +(.+?) +',fileCat)[0] else : diff --git a/resources/lib/channels/mostviewed.py b/resources/lib/channels/mostviewed.py index 098c191..e04088e 100644 --- a/resources/lib/channels/mostviewed.py +++ b/resources/lib/channels/mostviewed.py @@ -22,7 +22,7 @@ def list_shows(channel,folder): def list_videos(channel,param): videos=[] - filePath=utils.downloadCatalog('https://docs.google.com/spreadsheets/d/%s/pubhtml' % (param),'%s.HTML' % (param),False) + filePath=utils.downloadCatalog('https://docs.google.com/spreadsheets/d/%s/pubhtml' % (param),'%s.HTML' % (param),False,{}) html=open(filePath).read() match = re.compile(r'(.*?)(.*?)(.*?)',re.DOTALL).findall(html) if match: @@ -31,7 +31,6 @@ def list_videos(channel,param): chan= path[3:pIndex] url=path[pIndex+7:] infoLabels={ "Title": title,"Plot":cnt + ' ' + globalvar.LANGUAGE(33039).encode('utf-8')} - print cnt videos.append( [chan, url,title, os.path.join( globalvar.MEDIA, chan +".png"),infoLabels,'play'] ) return videos diff --git a/resources/lib/channels/nrj12.py b/resources/lib/channels/nrj12.py index ce267e0..9c929ac 100644 --- a/resources/lib/channels/nrj12.py +++ b/resources/lib/channels/nrj12.py @@ -13,7 +13,7 @@ def list_shows(channel,folder): shows=[] - filePath=utils.downloadCatalog('http://www.nrj12.fr/replay-4203/collectionvideo/','NRJ12.html',False) + filePath=utils.downloadCatalog('http://www.nrj12.fr/replay-4203/collectionvideo/','NRJ12.html',False,{}) html=open(filePath).read().replace('\xe9', 'e').replace('\xe0', 'a') if folder=='none': @@ -53,7 +53,7 @@ def getVideoURL(channel,urlPage): def list_videos(channel,show): videos=[] - filePath=utils.downloadCatalog('http://www.nrj12.fr/replay-4203/collectionvideo/','NRJ12.html',False) + filePath=utils.downloadCatalog('http://www.nrj12.fr/replay-4203/collectionvideo/','NRJ12.html',False,{}) html=open(filePath).read().replace('\xe9', 'e').replace('\xe0', 'a') line_replay_s = common.parseDOM(html,"div",attrs={"class":"line replay"}) diff --git a/resources/lib/channels/pluzz.py b/resources/lib/channels/pluzz.py index f9464e5..5a41fe4 100644 --- a/resources/lib/channels/pluzz.py +++ b/resources/lib/channels/pluzz.py @@ -14,7 +14,7 @@ def list_shows(channel,folder): shows=[] - filePath=utils.downloadCatalog('http://webservices.francetelevisions.fr/catchup/flux/flux_main.zip','Pluzz.zip',False) + filePath=utils.downloadCatalog('http://webservices.francetelevisions.fr/catchup/flux/flux_main.zip','Pluzz.zip',False,{}) if folder=='none': zf = zipfile.ZipFile(filePath) @@ -56,7 +56,7 @@ def getVideoURL(channel,video_URL): def list_videos(channel,show_title): videos=[] - filePath=utils.downloadCatalog('http://webservices.francetelevisions.fr/catchup/flux/flux_main.zip','Pluzz.zip',False) + filePath=utils.downloadCatalog('http://webservices.francetelevisions.fr/catchup/flux/flux_main.zip','Pluzz.zip',False,{}) zf = zipfile.ZipFile(filePath) data = zf.read('catch_up_' + channel + '.json') diff --git a/resources/lib/channels/pluzz2.py b/resources/lib/channels/pluzz2.py index fcb1821..feb4b91 100644 --- a/resources/lib/channels/pluzz2.py +++ b/resources/lib/channels/pluzz2.py @@ -15,7 +15,7 @@ def list_shows(channel,folder): shows = [] uniqueItem = dict() - filePath = utils.downloadCatalog(channelCatalog % (channel),'%s.json' % (channel),False) + filePath = utils.downloadCatalog(channelCatalog % (channel),'%s.json' % (channel),False,{}) filPrgm = open(filePath).read() jsonParser = json.loads(filPrgm) emissions = jsonParser['reponse']['emissions'] @@ -42,7 +42,7 @@ def list_shows(channel,folder): def list_videos(channel,folder): videos = [] uniqueItem = dict() - filePath = utils.downloadCatalog(channelCatalog % (channel),'%s.json' % (channel),False) + filePath = utils.downloadCatalog(channelCatalog % (channel),'%s.json' % (channel),False,{}) filPrgm = open(filePath).read() jsonParser = json.loads(filPrgm) emissions = jsonParser['reponse']['emissions'] diff --git a/resources/lib/channels/tf1thematiques.py b/resources/lib/channels/tf1thematiques.py index 9dac3d5..dc2e818 100644 --- a/resources/lib/channels/tf1thematiques.py +++ b/resources/lib/channels/tf1thematiques.py @@ -13,7 +13,7 @@ def list_shows(channel,folder): shows=[] for i in range(0, int(globalvar.ADDON.getSetting('tf1ThemePages'))): - filePath=utils.downloadCatalog('http://www.%s.fr/videos?page=%s' % (channel,i),'%s%s.html' % (channel,i),False) + filePath=utils.downloadCatalog('http://www.%s.fr/videos?page=%s' % (channel,i),'%s%s.html' % (channel,i),False,{}) html=open(filePath).read().replace('\xe9', 'e').replace('\xe0', 'a') items=re.findall(r'src="(.*?)"/>
    (.*?)', html.replace('\n', ' ').replace('\r', '')) diff --git a/resources/lib/channels/tntv.py b/resources/lib/channels/tntv.py index 207bee7..9cc79d2 100644 --- a/resources/lib/channels/tntv.py +++ b/resources/lib/channels/tntv.py @@ -22,7 +22,7 @@ def list_shows(channel,param): def list_videos(channel,show): videos=[] - filePath=utils.downloadCatalog('http://tntv.goodbarber.com/apiv3/getItemsByCategorie/6833037/%s/1/%s/' % (show,nbItems),'tntv%s.json' % (show),False) + filePath=utils.downloadCatalog('http://tntv.goodbarber.com/apiv3/getItemsByCategorie/6833037/%s/1/%s/' % (show,nbItems),'tntv%s.json' % (show),False,{}) jsonParser= json.loads(open(filePath).read()) for item in jsonParser['items'] : @@ -39,9 +39,7 @@ def list_videos(channel,show): def getVideoURL(channel,video_id): urlVideo='' t=video_id.split('-') - print t[0] - print t[1] - filePath=utils.downloadCatalog('http://tntv.goodbarber.com/apiv3/getItemsByCategorie/6833037/%s/1/%s/' % (t[0],nbItems),'tntv%s.json' % (t[0]),False) + filePath=utils.downloadCatalog('http://tntv.goodbarber.com/apiv3/getItemsByCategorie/6833037/%s/1/%s/' % (t[0],nbItems),'tntv%s.json' % (t[0]),False,{}) jsonParser= json.loads(open(filePath).read()) for item in jsonParser['items'] : diff --git a/resources/lib/channels/toutv.py b/resources/lib/channels/toutv.py index 33829a6..6ad1f96 100644 --- a/resources/lib/channels/toutv.py +++ b/resources/lib/channels/toutv.py @@ -10,7 +10,7 @@ def list_shows(channel,param): shows=[] - filePath=utils.downloadCatalog('http://www.tou.tv/presentation/section/a-z?AkamaiDevice=phone&smallWidth=320&mediumWidth=640&largeWidth=640&isPhone=True','TouTV.json',False) + filePath=utils.downloadCatalog('http://www.tou.tv/presentation/section/a-z?AkamaiDevice=phone&smallWidth=320&mediumWidth=640&largeWidth=640&isPhone=True','TouTV.json',False,{}) filPrgm=open(filePath).read() jsonParser = json.loads(filPrgm) diff --git a/resources/lib/channels/tv5af.py b/resources/lib/channels/tv5af.py index f965bed..7e6ec6a 100644 --- a/resources/lib/channels/tv5af.py +++ b/resources/lib/channels/tv5af.py @@ -17,7 +17,7 @@ def list_shows(channel,folder): dType=dict() dTitre=dict() - filePath=utils.downloadCatalog('http://www.tv5mondeplusafrique.com/dotscreen/exportAfrique.xml','TV5AF.XML',False) + filePath=utils.downloadCatalog('http://www.tv5mondeplusafrique.com/dotscreen/exportAfrique.xml','TV5AF.XML',False,{}) xml = open(filePath).read() item=common.parseDOM(xml, "item") lids = common.parseDOM(xml, "item", ret = "lid") @@ -51,7 +51,7 @@ def list_shows(channel,folder): def list_videos(channel,show_title): videos=[] - filePath=utils.downloadCatalog('http://www.tv5mondeplusafrique.com/dotscreen/exportAfrique.xml','TV5AF.XML',False) + filePath=utils.downloadCatalog('http://www.tv5mondeplusafrique.com/dotscreen/exportAfrique.xml','TV5AF.XML',False,{}) xml = open(filePath).read() item=common.parseDOM(xml, "item") lids = common.parseDOM(xml, "item", ret = "lid") @@ -74,8 +74,6 @@ def list_videos(channel,show_title): durees=common.parseDOM(item[i], "duree") if len(durees)>0: sDuree=durees[0] - print sDuree[0:2] - print sDuree[3:5] duree=int(sDuree[0:2])*60+int(sDuree[3:5]) dates=common.parseDOM(item[i], "dateCreation") diff --git a/resources/lib/channels/wattv.py b/resources/lib/channels/wattv.py index 646f07b..fb00d48 100644 --- a/resources/lib/channels/wattv.py +++ b/resources/lib/channels/wattv.py @@ -8,9 +8,18 @@ img = ['wattv'] readyForUse = True +def getToken(): + login=globalvar.ADDON.getSetting('watLogin') + pwd=globalvar.ADDON.getSetting('watPwd') + filePath=utils.downloadCatalog('https://www.wat.tv/v4/appmobile/user/authentication','WatAuth.html',False,{'username':'julien.capestan@socgen.com','password':'prisju2306'}) + jsonFile=open(filePath).read().replace('\xe9', 'e').replace('\xe0', 'a') + print jsonFile + def list_shows(channel,folder): shows=[] if folder=='none': + getToken() + shows.append( [channel,'https://www.wat.tv/v4/appmobile/user/subscriptions/channel', 'My Channels','','folder'] ) shows.append( [channel,'http://www.wat.tv/v4/appmobile/theme/61', 'Replay TV','','folder'] ) shows.append( [channel,'http://www.wat.tv/v4/appmobile/theme/1', 'Musique','','folder'] ) shows.append( [channel,'http://www.wat.tv/v4/appmobile/theme/101', 'Humour','','folder'] ) diff --git a/resources/lib/utils.py b/resources/lib/utils.py index 424c60e..5026465 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -33,7 +33,7 @@ def init(): globalvar.ordered_channels.sort(key=lambda channel: channel[1]) globalvar.dlfolder=globalvar.ADDON.getSetting('dlFolder') -def downloadCatalog(url,fileName,force): +def downloadCatalog(url,fileName,force,dicPost): bDLFile=True fileName=format_filename(fileName) iCtlgRefresh=int(globalvar.ADDON.getSetting('ctlgRefresh')) *60 @@ -43,11 +43,15 @@ def downloadCatalog(url,fileName,force): if os.path.exists(filePath): mtime = os.stat(filePath).st_mtime bDLFile=(time.time()-mtime>iCtlgRefresh) - print fileName,time.time()-mtime else: bDLFile=True if bDLFile: - urllib.urlretrieve(url,filePath) + if dicPost: + data = urllib.urlencode(dicPost) + print data + urllib.urlretrieve(url,filePath,None,data) + else: + urllib.urlretrieve(url,filePath) log.logDLFile(url) return filePath diff --git a/resources/settings.xml b/resources/settings.xml index a9c1f81..b33513f 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -58,6 +58,10 @@ + + + +