From 949b3f666a9bfcdf3c176bce16c2d36f43b81256 Mon Sep 17 00:00:00 2001 From: coder-alpha Date: Mon, 22 May 2017 20:42:08 -0400 Subject: [PATCH] fixes Desi-Tashan, added new host TVLogy --- Contents/Code/common.py | 8 +- Contents/Code/desitashan.py | 39 +++++----- Contents/Code/desitvbox.py | 2 + Contents/Resources/icon-tvlogy.png | Bin 0 -> 2317 bytes Contents/Services/ServiceInfo.plist | 7 ++ .../Services/URL/DesiTelly/ServiceCode.pys | 2 +- .../Services/URL/Playwire/ServiceCode.pys | 2 +- Contents/Services/URL/TvLogy/ServiceCode.pys | 71 ++++++++++++++++++ 8 files changed, 103 insertions(+), 28 deletions(-) create mode 100644 Contents/Resources/icon-tvlogy.png create mode 100644 Contents/Services/URL/TvLogy/ServiceCode.pys diff --git a/Contents/Code/common.py b/Contents/Code/common.py index 84d7ab7..b656fea 100644 --- a/Contents/Code/common.py +++ b/Contents/Code/common.py @@ -1,6 +1,6 @@ ################################################################################ TITLE = L('Title') -VERSION = '0.05' # Release notation (x.y - where x is major and y is minor) +VERSION = '0.06' # Release notation (x.y - where x is major and y is minor) GITHUB_REPOSITORY = 'coder-alpha/DesiTelly.bundle' PREFIX = "/video/desitelly" ################################################################################ @@ -86,9 +86,9 @@ #DesiTashan TV_NEWS = 'TV News' -VALID_SOURCES_DOMAIN = ['dailymotion.','playwire.','vidshare.','openload.','playu.', 'cloudy.', 'vmg.','watchvideo'] -VALID_SOURCES = ['Dailymotion','Flash Player','Flash','Playwire','Letwatch','Openload','PlayU','StreamHD','HDStream','Watchvideo'] -VALID_SOURCES_ICONS = ['dailymotion','playwire','playwire','playwire','letwatchus','openload','playu','vmg','vmg','source-watchvideo'] +VALID_SOURCES_DOMAIN = ['dailymotion.','playwire.','vidshare.','openload.','playu.', 'cloudy.', 'vmg.','watchvideo','tvlogy'] +VALID_SOURCES = ['Dailymotion','Flash Player','Flash','Playwire','Letwatch','Openload','PlayU','StreamHD','HDStream','Watchvideo','TvLogy'] +VALID_SOURCES_ICONS = ['dailymotion','playwire','playwire','playwire','letwatchus','openload','playu','vmg','vmg','source-watchvideo','tvlogy'] #################################################################################################### diff --git a/Contents/Code/desitashan.py b/Contents/Code/desitashan.py index 443a7d9..5a826ec 100644 --- a/Contents/Code/desitashan.py +++ b/Contents/Code/desitashan.py @@ -3,7 +3,7 @@ import re SITETITLE = 'Desi-Tashan' -SITEURL = 'http://www.desi-tashan.com/' +SITEURL = 'http://www.desi-tashan.ms/' SITETHUMB = 'icon-desitashan.png' PREFIX = common.PREFIX @@ -21,7 +21,7 @@ def ChannelsMenu(url): html = HTML.ElementFromURL(url) - for item in html.xpath("//ul[@id='menu-indian-menu']//li//a"): + for item in html.xpath("//ul[@id='menu-3']//li//a"): try: # Channel title channel = item.xpath("text()")[0] @@ -68,7 +68,7 @@ def ShowsMenu(url, title): #Log("Shows Menu: " + url + ":" + title) html = HTML.ElementFromURL(url) - for item in html.xpath("//div[contains(@class,'fusion-one-fourth fusion-layout-column fusion-spacing-yes ')]//div[@class='fusion-column-wrapper']//h4//a"): + for item in html.xpath(".//*[@id='td-outer-wrap']//div//td//li//a"): #Log("item "+ etree.tostring(item, pretty_print=True)) try: # Show title @@ -103,39 +103,31 @@ def EpisodesMenu(url, title): html = HTML.ElementFromURL(pageurl) - for item in html.xpath("//div[contains(@class,'fusion-one-fourth fusion-layout-column fusion-spacing-yes ')]//div[@class='fusion-column-wrapper']//h4//a"): + for item in html.xpath(".//div[@class='td-block-span6']//h3[@class='entry-title td-module-title']//a"): try: # Episode title episode = unicode(str(item.xpath("text()")[0].strip())) - if("Written Episode" in episode): - continue + # episode link link = item.xpath("@href")[0] if link.startswith("http") == False: link = SITEURL + link.lstrip('/') - #Log("Episode: " + episode + " Link: " + link) + Log("Episode: " + episode + " Link: " + link) except: continue # Add the found item to the collection - if 'Written Episode' not in episode: + if 'Watch'.lower() in episode.lower(): + episode = episode.replace(' Video Watch...','') oc.add(PopupDirectoryObject(key=Callback(PlayerLinksMenu, url=link, title=episode, type=L('Tv')), title=episode)) # Find the total number of pages next_page = ' ' try: - next_page = html.xpath(".//div[@class='pagination clearfix']//a[@class='pagination-next']/@href")[0] + next_page = html.xpath("(.//div[@class='page-nav td-pb-padding-side']//a[not (@class='page') and not (@class='last')]//@href)[last()]") + oc.add(DirectoryObject(key=Callback(EpisodesMenu, url=next_page, title=title), title=L('Pages'))) except: pass - if next_page.startswith("http") == False: - if (len(next_page.split('/')) == 3): - next_page = pageurl + next_page - else: - next_page = SITEURL + next_page.lstrip('/') - - # Add the next page link if exists - if ' ' not in next_page: - oc.add(DirectoryObject(key=Callback(EpisodesMenu, url=next_page, title=title), title=L('Pages'))) # If there are no channels, warn the user if len(oc) == 0: @@ -173,9 +165,9 @@ def PlayerLinksMenu(url, title, type): if '/images/xfuture.png.pagespeed.ic.WVkcd7CGfW.png' in content: return ObjectContainer(header=title, message=L('ComingSoonWarning')) - sources = html.xpath(".//h2[@class='vidLinks'][contains(text(),'HD')]//text()") - if len(sources) == 0: - sources = html.xpath(".//h2[contains(text(),'HD')]//text()") + sources = html.xpath(".//div[@class='td-post-content td-pb-padding-side']//span[contains(text(),'HD')]//text()") + #if len(sources) == 0: + # sources = html.xpath(".//h2[contains(text(),'HD')]//text()") for source in sources: s_source, i = common_fnc.GetArrayItemMatchInString(common.VALID_SOURCES, source.lower(), False) if s_source <> None: @@ -196,6 +188,8 @@ def PlayerLinksMenu(url, title, type): # If there are no channels, warn the user if len(oc) == 0: return ObjectContainer(header=title, message=L('PlayerWarning')) + + oc.objects.sort(key=lambda obj: obj.title, reverse=False) return oc @@ -260,7 +254,8 @@ def EpisodeLinksMenu(url, title, type, thumb): def GetParts(html, keyword): - xpath_str = ".//h2[@class='vidLinks'][contains(text(),'"+keyword+"')]/following-sibling::p[@class='vidLinksContent'][1]//a" + xpath_str = ".//div[@class='td-post-content td-pb-padding-side']//span[contains(text(),'"+keyword+"')]//following::p[1]//a" + #Log(xpath_str) try: items = html.xpath(xpath_str) diff --git a/Contents/Code/desitvbox.py b/Contents/Code/desitvbox.py index bf94440..78500b9 100644 --- a/Contents/Code/desitvbox.py +++ b/Contents/Code/desitvbox.py @@ -174,6 +174,8 @@ def PlayerLinksMenu(url, title, type): # If there are no channels, warn the user if len(oc) == 0: return ObjectContainer(header=title, message=L('PlayerWarning')) + + oc.objects.sort(key=lambda obj: obj.title, reverse=False) return oc diff --git a/Contents/Resources/icon-tvlogy.png b/Contents/Resources/icon-tvlogy.png new file mode 100644 index 0000000000000000000000000000000000000000..d2c224f0ea415954e8c9960a03c01225c9744174 GIT binary patch literal 2317 zcmV+o3G()dP)CbsVw!HegKj$*8dFQ8n z`9$?kI)B||h=^~UG2r3F{A1fV%Q*i2Vb8IXH1b&+W2JxGy%G{gWja5S8xt)#B)7Ed zR$M7=wJZ`!-K7e2ELyudRo5jOgB)5nZ*kkr2+|;yA&fJEQYkGiT{@9c86&&}k)MU1AD#1j-tY6g&wI+|KP1`W1>W!XhX#q$dgOyr zx`)H;Ok6nWu=ibqXL0d7=U2tGuMh|2{#hyA%Ly#A4lwN`z{1HM&TkRd_8TVwUf?a+ z5k}~^=_J6Ek(}og02^A$k2R1kf&@B3`;v5EOFaXLG@Y8*h)4p4 zs3{h8$0YNyTFSliY^UXz&*jcsQ6g^ri?J9{wT`!yfWA=;pru#SxAd5&cfYr{Xq>Bu z0{{?wYFy8M=`}!!r)Jr5dw*1pUhgZTczJVfMfB8AHM>AlyB^yHuigXw`ldRB*#!Y$ z{hQ@Xe~beN0>ub2H3!-ywerwGRBhqSEx@rV&|Cf002p2nFL7~3i_Jm53E*uC_l@Sx z_E6ZTu5fo8#J*d(8yI;CzcUq7AH4wDtl7zHE7xxzSFE;Y6NyABjF=H zPZfpC=UfCq`L zrWaY5c1Xr%Ku!61!+cf21yU1WTe*vy;_XBSz=kw+&lER)G*3WODOUuC_)9ZkB4|0M~4}cq2&a?|&H2@mn z3&aq9Y6`U3rz!35#lukpKoEp-dX5t~0Tnt@8-OgUYda7u>HzrDe2n_&C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GE$%kNKh!C0}jg-*_@wX z`!azzN)I?r;EF_I%#94ouk1tTO+cxG$S9igE}*3Uw@Zfv001Bizz_tZe=6)7+-w;( nMH@c>0000000000007_tw&yHE!x|(`00000NkvXXu0mjfS&Auh literal 0 HcmV?d00001 diff --git a/Contents/Services/ServiceInfo.plist b/Contents/Services/ServiceInfo.plist index 84be88b..419486d 100644 --- a/Contents/Services/ServiceInfo.plist +++ b/Contents/Services/ServiceInfo.plist @@ -74,6 +74,13 @@ http://watchvideo.+ + TvLogy + + URLPatterns + + http://tvlogy.to/.+ + + diff --git a/Contents/Services/URL/DesiTelly/ServiceCode.pys b/Contents/Services/URL/DesiTelly/ServiceCode.pys index 6cc5586..afd5fd9 100644 --- a/Contents/Services/URL/DesiTelly/ServiceCode.pys +++ b/Contents/Services/URL/DesiTelly/ServiceCode.pys @@ -15,7 +15,7 @@ def MetadataObjectForURL(url): thumb1 = COVER thumb2 = ART - return VideoClipObject( + return MovieObject( title=d['title'], thumb=Resource.ContentsOfURLWithFallback(thumb1, COVER), art=Resource.ContentsOfURLWithFallback(thumb2, ART), diff --git a/Contents/Services/URL/Playwire/ServiceCode.pys b/Contents/Services/URL/Playwire/ServiceCode.pys index e812c38..6f6056e 100644 --- a/Contents/Services/URL/Playwire/ServiceCode.pys +++ b/Contents/Services/URL/Playwire/ServiceCode.pys @@ -78,7 +78,7 @@ def MetadataObjectForURL(url): duration = durr ) - vc = VideoClipObject() + vc = MovieObject() vc.title = title vc.thumb = Resource.ContentsOfURLWithFallback([thumb, COVER]) vc.art = Resource.ContentsOfURLWithFallback([thumb, ART]) diff --git a/Contents/Services/URL/TvLogy/ServiceCode.pys b/Contents/Services/URL/TvLogy/ServiceCode.pys new file mode 100644 index 0000000..c2e5ed8 --- /dev/null +++ b/Contents/Services/URL/TvLogy/ServiceCode.pys @@ -0,0 +1,71 @@ +import string, re + +HTTP_HEADERS = { + 'Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', + 'Accept-Encoding: gzip, deflate', + 'Accept-Language: en-US,en;q=0.5', + 'Connection: keep-alive', + 'Referer: http://www.tvlogy.to', + 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0' +} + +ART = 'http://i.imgur.com/GwSnkxE.jpg' +COVER = 'http://i.imgur.com/0snKSZt.png' + +######################################################################################## +def NormalizeURL(url): + + return url + +#################################################################################################### +def MetadataObjectForURL(url): + + try: + page_data = HTTP.Request(url).content + + img = re.findall(r'http.*jpg', page_data)[0] + thumb = img + except: + thumb = url + + title = 'TvLogy Redirect Page' + summary = 'Summary info Page' + + return VideoClipObject( + title = title, + summary = summary, + art = Resource.ContentsOfURLWithFallback([thumb,ART]), + thumb = Resource.ContentsOfURLWithFallback([thumb,COVER]) + ) + +#################################################################################################### +def MediaObjectsForURL(url): + + return [ + MediaObject( + video_codec = VideoCodec.H264, + audio_codec = AudioCodec.AAC, + audio_channels = 2, + video_resolution = '720', + optimized_for_streaming = True, + parts = [PartObject(key=Callback(PlayVideo, url=url, quality='hd'))] + ) + ] + +#################################################################################################### +@indirect +def PlayVideo(url, quality): + + try: + page_data = HTTP.Request(url).content + #Log(page_data) + match = re.findall(r'http.*m3u8', page_data)[0] + if '.m3u8.m3u8' in match: + match = re.findall(r'http.(.+http).(.+m3u8).m3u8', page_data)[2] + + #Log(match) + url0 = match + except: + url0 = url + + return IndirectResponse(VideoClipObject, key=HTTPLiveStreamURL(url0))