Skip to content

Commit

Permalink
add option to play in rtmp mode (default enabled)
Browse files Browse the repository at this point in the history
  • Loading branch information
dersphere committed Nov 1, 2012
1 parent b60d4b9 commit 4141569
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 3 deletions.
5 changes: 4 additions & 1 deletion addon.py
Expand Up @@ -65,7 +65,10 @@ def get_movies(category_id):

@plugin.route('/movie/<stream_path>/')
def play_movie(stream_path):
stream_url = api.get_stream_url(stream_path)
if plugin.get_setting('use_rtmp') == 'true':
stream_url = api.get_rtmp_url(stream_path)
else:
stream_url = api.get_stream_url(stream_path)
return plugin.set_resolved_url(stream_url)

if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.netzkino_de" name="Netzkino.de" version="0.0.1" provider-name="Tristan Fischer (sphere@dersphere.de)">
<addon id="plugin.video.netzkino_de" name="Netzkino.de" version="0.0.2" provider-name="Tristan Fischer (sphere@dersphere.de)">
<requires>
<import addon="xbmc.python" version="2.0"/>
<import addon="script.module.simplejson" version="2.0.10"/>
Expand Down
2 changes: 2 additions & 0 deletions changelog.txt
@@ -1,2 +1,4 @@
0.0.2
- added option to play in rtmp mode (avoids stuttering) default enabled
0.0.1
- initial release
1 change: 1 addition & 0 deletions resources/language/English/strings.xml
Expand Up @@ -2,6 +2,7 @@
<strings>
<!-- Settings -->
<string id="30100">Force ViewMode to Thumbnail</string>
<string id="30101">use RTMP (avoids stuttering)</string>
<!-- Messages -->
<string id="30200">Network Error</string>
</strings>
1 change: 1 addition & 0 deletions resources/language/German/strings.xml
Expand Up @@ -2,6 +2,7 @@
<strings>
<!-- Settings -->
<string id="30100">ViewMode Thumbnail erzwingen</string>
<string id="30101">RTMP benutzen (Verhindert stocken)</string>
<!-- Messages -->
<string id="30200">Netzwerkfehler</string>
</strings>
12 changes: 11 additions & 1 deletion resources/lib/api.py
Expand Up @@ -25,6 +25,7 @@
MAIN_URL = 'http://www.netzkino.de/capi/'
MOVIE_URL = ('http://mf.netzkinomobil.c.nmdn.net/netzkino_mobil'
'/_definst_/mp4:%s/playlist.m3u8')
RTMP_URL = 'rtmp://mf.netzkino.c.nmdn.net/netzkino/_definst_/mp4:%s'

VISIBLE_CATEGORIES = (
('81', 'Neu bei Netzkino'),
Expand Down Expand Up @@ -83,6 +84,12 @@ def clean_tags(bad_str):
bad_str = re.sub(r'<[^>]*?>', '', bad_str)
return bad_str.replace('&#8211;', '-')

def get_image(attachments_list):
for item in attachments_list:
if item.get('url', '') != '':
print item['url']
return item['url']

path = (
'get_category_posts'
'?count=%(movie_count)d'
Expand All @@ -106,14 +113,17 @@ def clean_tags(bad_str):
'title': clean_tags(item.get('title_plain')),
'content': clean_tags(item.get('content')),
'modified': item.get('modified'),
'image': item.get('attachments', [])[0].get('url'),
'image': get_image(item.get('attachments', [])),
'stream_path': item['custom_fields']['Streaming'][0]
})
return movies

def get_stream_url(self, stream_path):
return MOVIE_URL % stream_path

def get_rtmp_url(self, stream_path):
return RTMP_URL % stream_path

def __get_json(self, url, path=None):
if path:
url += path
Expand Down
1 change: 1 addition & 0 deletions resources/settings.xml
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<setting id="force_viewmode" type="bool" label="30100" default="true"/>
<setting id="use_rtmp" type="bool" label="30101" default="true"/>
</settings>

0 comments on commit 4141569

Please sign in to comment.