Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Barrandov + Nova movies list #23

Merged
merged 2 commits into from Aug 4, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 10 additions & 22 deletions engines/barrandov.py
Expand Up @@ -2,7 +2,7 @@
#
__author__ = "Jakub Lužný"
__desc__ = "TV Barrandov (Video archív)"
__url__ = r"https?://(www.)?barrandov\.tv/(\d+)-.+"
__url__ = r"https?://(www.)?barrandov\.tv/video/(\d+)-.+"

import re,os.path
import xml.etree.ElementTree as ElementTree
Expand All @@ -13,19 +13,15 @@ class BarrandovEngine:
def __init__(self, url):
id = re.findall(__url__, url)[0][1]
self.page = urlopen(url).read().decode('utf-8')
self.playlist = ElementTree.fromstring( urlopen('http://www.barrandov.tv/special/videoplayerdata/'+id).read().decode('utf-8') )

def movies(self):
return [ ('0', re.findall(r'<title>(.+?) - Video Archív - TV Barrandov', self.page)[0]) ]
return [ ('0', re.findall(r'<meta property="og:title" content="(.*) \| Barrandov', self.page)[0]) ]

def qualities(self):
q = []

if self.playlist.find('hashdquality').text == 'true':
q.append( ('hd', 'HD' ) )

if self.playlist.find('hasquality').text == 'true':
q.append( ('high', 'Vysoká' ) )
if "720p HD" in re.findall(r"label: \"(.+?)\"", self.page):
q.append( ('hd', 'HD' ) )

q.append( ('low', 'Nízká') )

Expand All @@ -35,18 +31,10 @@ def download(self, quality, movie):
if not quality:
quality = self.qualities()[0][0]

playpath = self.playlist.find('streamname').text
hostname = self.playlist.find('hostname').text
if quality == 'high':
playpath = playpath.replace('500', '1000')
elif quality == 'hd':
playpath = playpath.replace('500', 'HD')

rtmp = 'rtmpe://' + hostname + '/' + playpath


filename = os.path.basename(playpath)[4:-3] + 'flv'
playpath = re.findall(r"file: \"(.+?)\",", self.page)[0] #/video/2013/06/13102000060046_600_wide.mp4

if quality == 'hd':
playpath = playpath.replace('600_wide', 'HD_wide')

return ("rtmp", filename , { 'url' : rtmp,
'token' : '#ed%h0#w@1',
'rtmpdump_args' : '--live' } )
filename = os.path.basename(playpath)
return ("http", filename, {"url" : "http://www.barrandov.tv"+playpath})
2 changes: 1 addition & 1 deletion engines/nova.py
Expand Up @@ -39,7 +39,7 @@ def qualities(self):
return q

def movies(self):
return [ ('0', re.findall(r'<title>(.+?) - Voyo.cz', self.page)[0]) ]
return [ ('0', re.findall(r'<meta property="og:title" content="(.+?)"/>', self.page)[0]) ]

def get_playlist(self):
self.media_id = re.search(r'mainVideo = new mediaData\(\d+, \d+, (\d+),', self.page ).group(1)
Expand Down