Skip to content

Commit

Permalink
fixes Desi-Tashan, added new host TVLogy
Browse files Browse the repository at this point in the history
  • Loading branch information
coder-alpha committed May 23, 2017
1 parent 594c75a commit 949b3f6
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 28 deletions.
8 changes: 4 additions & 4 deletions Contents/Code/common.py
Original file line number Diff line number Diff line change
@@ -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"
################################################################################
Expand Down Expand Up @@ -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']

####################################################################################################

Expand Down
39 changes: 17 additions & 22 deletions Contents/Code/desitashan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions Contents/Code/desitvbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Binary file added Contents/Resources/icon-tvlogy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions Contents/Services/ServiceInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@
<string>http://watchvideo.+</string>
</array>
</dict>
<key>TvLogy</key>
<dict>
<key>URLPatterns</key>
<array>
<string>http://tvlogy.to/.+</string>
</array>
</dict>
</dict>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Contents/Services/URL/DesiTelly/ServiceCode.pys
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion Contents/Services/URL/Playwire/ServiceCode.pys
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
71 changes: 71 additions & 0 deletions Contents/Services/URL/TvLogy/ServiceCode.pys
Original file line number Diff line number Diff line change
@@ -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))

0 comments on commit 949b3f6

Please sign in to comment.