Skip to content

Commit

Permalink
Add option to choose quality
Browse files Browse the repository at this point in the history
  • Loading branch information
koperfieldcz committed Sep 25, 2018
1 parent 08e3208 commit e088600
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<addon id="plugin.video.markiza.sk" name="markiza.sk" provider-name="Maros Ondrasek, refactoring: Peter Zaoral" version="1.2.0">
<addon id="plugin.video.markiza.sk" name="markiza.sk" provider-name="Maros Ondrasek, refactoring: Peter Zaoral" version="1.2.1">
<requires>
<import addon="xbmc.python" version="2.1.0" />
<import addon="script.module.stream.resolver" version="1.6.55" />
Expand Down
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[B]1.2.1:[/B]
- možnost vybrat kvalitu streamu
[B]1.2.0:[/B]
- oprava funkčnosti (změna webu)
[B]1.1.9:[/B]
Expand Down
4 changes: 4 additions & 0 deletions resources/language/Czech/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>
<string id="32000">Abecední řazení</string>
<string id="30050">Kvalita videa</string>
<string id="30051">Zeptat se</string>
<string id="30052">Nejlepší</string>
<string id="30053">Nejhorší</string>
</strings>
4 changes: 4 additions & 0 deletions resources/language/English/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>
<string id="32000">Sort alphabetically</string>
<string id="30050">Video quality</string>
<string id="30051">Always ask</string>
<string id="30052">Best</string>
<string id="30053">Worst</string>
</strings>
4 changes: 4 additions & 0 deletions resources/language/Slovak/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>
<string id="32000">Abecedné triedenie</string>
<string id="30050">Kvalita videa</string>
<string id="30051">Spýtať sa</string>
<string id="30052">Najlepšia</string>
<string id="30053">Najhoršia</string>
</strings>
23 changes: 13 additions & 10 deletions resources/lib/markiza.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,19 @@ def resolve(self, item, captcha_cb=None, select_cb=None):
add_idx = [n for n,s in enumerate(sources) if s not in sources[n+1:]]
playlist = [v for n,v in enumerate(playlist) if n in add_idx]
#print util.json.dumps(playlist, indent=True)
for v in playlist:
item = self.video_item()
item['title'] = v['title'] or details['name']
item['date'] = details['date']
item['duration'] = details['duration']
item['url'] = v['sources'][0]['file']
item['surl'] = v['title']
item['img'] = v['image']
item['plot'] = v['description']
result.append(item)
for pl in playlist:
manifestUrl = "%s"%(pl['sources'][0]['file'])
manifest = util.request(manifestUrl)
itemTitle = "%s"%pl['title']
for m in re.finditer('#EXT-X-STREAM-INF:BANDWIDTH=(?P<bandwidth>\d+),RESOLUTION=(?P<resolution>\d+x\d+)\s(?P<chunklist>[^\s]+)', manifest, re.DOTALL):
item = self.video_item()
item['title']= itemTitle
item['bandwidth'] = int("%s"%m.group('bandwidth'))
item['quality'] = m.group('resolution')
item['resolveTitle'] = "%s - %s"%(item['quality'], itemTitle)
item['url'] = manifestUrl.replace("manifest.m3u8", m.group('chunklist'))
result.append(item)
result.sort(key=lambda x: x['bandwidth'], reverse=True)
if len(result) > 0 and select_cb:
return select_cb(result)
return result
Expand Down
1 change: 1 addition & 0 deletions resources/settings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<setting label="32000" id="sort" type="bool" default="true" />
<setting label="30050" id="quality" type="enum" lvalues="30051|30052|30053" default="0" />
</settings>

0 comments on commit e088600

Please sign in to comment.