Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions plugin.video.nrk/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
@plugin.route('/')
def root():
items = [
(plugin.url_for(live), ListItem("Direkte"), True),
(plugin.url_for(live_tv), ListItem("Direkte TV"), True),
(plugin.url_for(live_radio), ListItem("Direkte radio"), True),
(plugin.url_for(recommended), ListItem("Anbefalt"), True),
(plugin.url_for(popular), ListItem("Mest sett"), True),
(plugin.url_for(mostrecent), ListItem("Sist sendt"), True),
Expand All @@ -45,8 +46,8 @@ def root():
endOfDirectory(plugin.handle)


@plugin.route('/live')
def live():
@plugin.route('/live_tv')
def live_tv():
for ch in nrktv.channels():
li = ListItem(ch.title)
li.setProperty('mimetype', "application/vnd.apple.mpegurl")
Expand All @@ -58,12 +59,17 @@ def live():
addDirectoryItem(plugin.handle,
plugin.url_for(live_resolve, ch.manifest.split('/')[-1]), li, False)

endOfDirectory(plugin.handle)


@plugin.route('/live_radio')
def live_radio():
for rd in nrktv.radios():
li = ListItem(rd.title)
li.setProperty('mimetype', "audio/mpeg")
li.setProperty('isplayable', 'true')
li.setArt({'thumb': rd.thumb, 'fanart': rd.fanart})
li.setInfo('video', {'title': ch.title})
li.setInfo('video', {'title': rd.title})
li.addStreamInfo('audio', {'codec': 'aac', 'channels': 2})
addDirectoryItem(plugin.handle,
plugin.url_for(live_resolve, rd.manifest.split('/')[-1]), li, False)
Expand All @@ -80,7 +86,7 @@ def live_resolve(id):
setResolvedUrl(plugin.handle, success, li)


def set_steam_details(item, li):
def set_stream_details(item, li):
li.setProperty('isplayable', 'true')
li.addStreamInfo('video', {'codec': 'h264', 'width': 1280, 'height': 720, 'duration': item.duration})
li.addStreamInfo('audio', {'codec': 'aac', 'channels': 2})
Expand Down Expand Up @@ -112,7 +118,7 @@ def view(items, update_listing=False, urls=None):
set_common_properties(item, li)
playable = plugin.route_for(url) == play
if playable:
set_steam_details(item, li)
set_stream_details(item, li)
li.setInfo('video', {'count': i, 'title': item.title, 'mediatype': 'video'})
addDirectoryItem(plugin.handle, url, li, not playable, total)
endOfDirectory(plugin.handle, updateListing=update_listing)
Expand All @@ -130,7 +136,7 @@ def show_episode_list(episodes):
for i, item in enumerate(episodes):
li = ListItem("%s - %s" % (item.episode, item.title))
set_common_properties(item, li)
set_steam_details(item, li)
set_stream_details(item, li)
li.setInfo('video', {
'title': item.title,
'count': i,
Expand All @@ -150,7 +156,7 @@ def show_plug_list(items):
title += " (%s)" % item.episode
li = ListItem(title)
set_common_properties(item, li)
set_steam_details(item, li)
set_stream_details(item, li)
li.setInfo('video', {
'title': title,
'count': i,
Expand Down
9 changes: 4 additions & 5 deletions plugin.video.nrk/addon.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.nrk"
name="NRK Nett-TV"
version="4.8.0"
version="4.9.2"
provider-name="takoi+a99b">
<requires>
<import addon="xbmc.python" version="3.0.1"/>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.requests" version="1.0.4"/>
<import addon="script.module.routing" version="0.1.0"/>
</requires>
Expand All @@ -16,11 +16,10 @@
<language>no</language>
<summary lang="en">Watch NRK Web TV</summary>
<summary lang="no">Se NRK Nett-TV</summary>
<summary lang="it">Guarda NRK (in Norvegia)</summary>
<description lang="en">NRK Web TV gives you the opportunity to watch live TV as well as recordings of many shows.</description>
<description lang="no">NRK Nett-TV gir deg muligheten til å se mange av NRKs programmer både direkte og i opptak.</description>
<description lang="it">Questo addon per NRK rende possibile la visione di molti programmi di NRK sia in diretta che in differita.</description>
<license>GPL-3.0-only</license>
<description lang="it">Questo addon per Kodi rende possibile la visione di molti programmi di NRK sia in diretta che in differita.</description>
<license>GPL-3.0-or-later</license>
<forum>https://forum.kodi.tv/showthread.php?tid=52824</forum>
<source>https://github.com/tamland/xbmc-addon-nrk</source>
<assets>
Expand Down
16 changes: 14 additions & 2 deletions plugin.video.nrk/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
[B]4.7.99[/B]
- Adattato a Kodi 20 by a99b ^zZz^
[B]4.9.2[/B]
- use hardcoded username to fix github action

[B]4.9.1[/B]
- exclude github actions when publishing to kodi repo

[B]4.9.0[/B]
- Update license to SPDX format in addon.xml
- Fix radio title
- Create kodi-addon-submitter.yml
- Split live TV and radio shows into separate submenus

[B]4.8.0[/B]
Tilpasninger for Kodi v20 Nexus. Noe småfikser etter API-endringer // Adaptations for Kodi v20 Nexus. Some small fixes after some changes in the API

[B]4.7.0[/B]
- Fikset plugin etter API-endringer
Expand Down
Binary file modified plugin.video.nrk/fanart.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified plugin.video.nrk/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions plugin.video.nrk/nrktv.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# adattato a kodi 20.0 da a99b



import datetime
Expand Down Expand Up @@ -140,16 +140,16 @@ def from_response(r):
media_urls = []

manifest = _get('/playback/manifest/{}'.format(r.get('id')))
# adapted to Kodi 20.0 by a99b

try:
if manifest.json()['playability'] == 'playable':
media_urls = list( map(lambda x: x['url'], manifest.json()['playable']['assets']) )
media_urls
except: # the manifest seems to already be a dict
except:
if manifest['playability'] == 'playable':
media_urls = list( map(lambda x: x['url'], manifest['playable']['assets']) )
media_urls
########## end modification ##########

images = _image_url_key_standardize(r.get('image', {}).get('webImages', None))
duration = _duration_to_seconds(r.get('duration', 0))
legal_age = r.get('legalAge', None)
Expand Down
8 changes: 5 additions & 3 deletions plugin.video.nrk/subs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import os
import re
import xbmc
import xbmcvfs # a99b https://github.com/xbmc/xbmc/pull/19301
import xbmcvfs # 4.8.0 https://github.com/xbmc/xbmc/pull/19301
import requests
from io import StringIO

Expand All @@ -34,8 +34,10 @@ def get_subtitles(video_id):
return None

content = _vtt_to_srt(subs)
filename = os.path.join(xbmcvfs.translatePath("special://temp"), 'nor.srt') # a99b https://github.com/xbmc/xbmc/pull/19301
# filename = os.path.join(xbmc.translatePath("special://temp"), 'nor.srt') # a99b https://github.com/xbmc/xbmc/pull/19301
try:
filename = os.path.join(xbmc.translatePath("special://temp"), 'nor.srt') # deprecated already in Kodi v19
except:
filename = os.path.join(xbmcvfs.translatePath("special://temp"), 'nor.srt') # 4.8.0 https://github.com/xbmc/xbmc/pull/19301
with open(filename, 'w' ,encoding='utf8') as f:
f.write(content)
return filename
Expand Down