Skip to content

Commit a41c60d

Browse files
committed
[plugin.video.nrk] 4.9.2
1 parent e9eef09 commit a41c60d

7 files changed

Lines changed: 41 additions & 22 deletions

File tree

plugin.video.nrk/addon.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
@plugin.route('/')
3535
def root():
3636
items = [
37-
(plugin.url_for(live), ListItem("Direkte"), True),
37+
(plugin.url_for(live_tv), ListItem("Direkte TV"), True),
38+
(plugin.url_for(live_radio), ListItem("Direkte radio"), True),
3839
(plugin.url_for(recommended), ListItem("Anbefalt"), True),
3940
(plugin.url_for(popular), ListItem("Mest sett"), True),
4041
(plugin.url_for(mostrecent), ListItem("Sist sendt"), True),
@@ -45,8 +46,8 @@ def root():
4546
endOfDirectory(plugin.handle)
4647

4748

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

62+
endOfDirectory(plugin.handle)
63+
64+
65+
@plugin.route('/live_radio')
66+
def live_radio():
6167
for rd in nrktv.radios():
6268
li = ListItem(rd.title)
6369
li.setProperty('mimetype', "audio/mpeg")
6470
li.setProperty('isplayable', 'true')
6571
li.setArt({'thumb': rd.thumb, 'fanart': rd.fanart})
66-
li.setInfo('video', {'title': ch.title})
72+
li.setInfo('video', {'title': rd.title})
6773
li.addStreamInfo('audio', {'codec': 'aac', 'channels': 2})
6874
addDirectoryItem(plugin.handle,
6975
plugin.url_for(live_resolve, rd.manifest.split('/')[-1]), li, False)
@@ -80,7 +86,7 @@ def live_resolve(id):
8086
setResolvedUrl(plugin.handle, success, li)
8187

8288

83-
def set_steam_details(item, li):
89+
def set_stream_details(item, li):
8490
li.setProperty('isplayable', 'true')
8591
li.addStreamInfo('video', {'codec': 'h264', 'width': 1280, 'height': 720, 'duration': item.duration})
8692
li.addStreamInfo('audio', {'codec': 'aac', 'channels': 2})
@@ -112,7 +118,7 @@ def view(items, update_listing=False, urls=None):
112118
set_common_properties(item, li)
113119
playable = plugin.route_for(url) == play
114120
if playable:
115-
set_steam_details(item, li)
121+
set_stream_details(item, li)
116122
li.setInfo('video', {'count': i, 'title': item.title, 'mediatype': 'video'})
117123
addDirectoryItem(plugin.handle, url, li, not playable, total)
118124
endOfDirectory(plugin.handle, updateListing=update_listing)
@@ -130,7 +136,7 @@ def show_episode_list(episodes):
130136
for i, item in enumerate(episodes):
131137
li = ListItem("%s - %s" % (item.episode, item.title))
132138
set_common_properties(item, li)
133-
set_steam_details(item, li)
139+
set_stream_details(item, li)
134140
li.setInfo('video', {
135141
'title': item.title,
136142
'count': i,
@@ -150,7 +156,7 @@ def show_plug_list(items):
150156
title += " (%s)" % item.episode
151157
li = ListItem(title)
152158
set_common_properties(item, li)
153-
set_steam_details(item, li)
159+
set_stream_details(item, li)
154160
li.setInfo('video', {
155161
'title': title,
156162
'count': i,

plugin.video.nrk/addon.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
22
<addon id="plugin.video.nrk"
33
name="NRK Nett-TV"
4-
version="4.8.0"
4+
version="4.9.2"
55
provider-name="takoi+a99b">
66
<requires>
7-
<import addon="xbmc.python" version="3.0.1"/>
7+
<import addon="xbmc.python" version="3.0.0"/>
88
<import addon="script.module.requests" version="1.0.4"/>
99
<import addon="script.module.routing" version="0.1.0"/>
1010
</requires>
@@ -16,11 +16,10 @@
1616
<language>no</language>
1717
<summary lang="en">Watch NRK Web TV</summary>
1818
<summary lang="no">Se NRK Nett-TV</summary>
19-
<summary lang="it">Guarda NRK (in Norvegia)</summary>
2019
<description lang="en">NRK Web TV gives you the opportunity to watch live TV as well as recordings of many shows.</description>
2120
<description lang="no">NRK Nett-TV gir deg muligheten til å se mange av NRKs programmer både direkte og i opptak.</description>
22-
<description lang="it">Questo addon per NRK rende possibile la visione di molti programmi di NRK sia in diretta che in differita.</description>
23-
<license>GPL-3.0-only</license>
21+
<description lang="it">Questo addon per Kodi rende possibile la visione di molti programmi di NRK sia in diretta che in differita.</description>
22+
<license>GPL-3.0-or-later</license>
2423
<forum>https://forum.kodi.tv/showthread.php?tid=52824</forum>
2524
<source>https://github.com/tamland/xbmc-addon-nrk</source>
2625
<assets>

plugin.video.nrk/changelog.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1-
[B]4.7.99[/B]
2-
- Adattato a Kodi 20 by a99b ^zZz^
1+
[B]4.9.2[/B]
2+
- use hardcoded username to fix github action
3+
4+
[B]4.9.1[/B]
5+
- exclude github actions when publishing to kodi repo
6+
7+
[B]4.9.0[/B]
8+
- Update license to SPDX format in addon.xml
9+
- Fix radio title
10+
- Create kodi-addon-submitter.yml
11+
- Split live TV and radio shows into separate submenus
12+
13+
[B]4.8.0[/B]
14+
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
315

416
[B]4.7.0[/B]
517
- Fikset plugin etter API-endringer

plugin.video.nrk/fanart.jpg

-123 KB
Loading

plugin.video.nrk/icon.png

-2.05 KB
Loading

plugin.video.nrk/nrktv.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#
1515
# You should have received a copy of the GNU General Public License
1616
# along with this program. If not, see <http://www.gnu.org/licenses/>.
17-
# adattato a kodi 20.0 da a99b
17+
1818

1919

2020
import datetime
@@ -140,16 +140,16 @@ def from_response(r):
140140
media_urls = []
141141

142142
manifest = _get('/playback/manifest/{}'.format(r.get('id')))
143-
# adapted to Kodi 20.0 by a99b
143+
144144
try:
145145
if manifest.json()['playability'] == 'playable':
146146
media_urls = list( map(lambda x: x['url'], manifest.json()['playable']['assets']) )
147147
media_urls
148-
except: # the manifest seems to already be a dict
148+
except:
149149
if manifest['playability'] == 'playable':
150150
media_urls = list( map(lambda x: x['url'], manifest['playable']['assets']) )
151151
media_urls
152-
########## end modification ##########
152+
153153
images = _image_url_key_standardize(r.get('image', {}).get('webImages', None))
154154
duration = _duration_to_seconds(r.get('duration', 0))
155155
legal_age = r.get('legalAge', None)

plugin.video.nrk/subs.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import os
1919
import re
2020
import xbmc
21-
import xbmcvfs # a99b https://github.com/xbmc/xbmc/pull/19301
21+
import xbmcvfs # 4.8.0 https://github.com/xbmc/xbmc/pull/19301
2222
import requests
2323
from io import StringIO
2424

@@ -34,8 +34,10 @@ def get_subtitles(video_id):
3434
return None
3535

3636
content = _vtt_to_srt(subs)
37-
filename = os.path.join(xbmcvfs.translatePath("special://temp"), 'nor.srt') # a99b https://github.com/xbmc/xbmc/pull/19301
38-
# filename = os.path.join(xbmc.translatePath("special://temp"), 'nor.srt') # a99b https://github.com/xbmc/xbmc/pull/19301
37+
try:
38+
filename = os.path.join(xbmc.translatePath("special://temp"), 'nor.srt') # deprecated already in Kodi v19
39+
except:
40+
filename = os.path.join(xbmcvfs.translatePath("special://temp"), 'nor.srt') # 4.8.0 https://github.com/xbmc/xbmc/pull/19301
3941
with open(filename, 'w' ,encoding='utf8') as f:
4042
f.write(content)
4143
return filename

0 commit comments

Comments
 (0)