11#!/usr/bin/env python
2- # -*- coding: utf-8 -*-
3- #
4- # Copyright (C) 2012 Tristan Fischer (sphere@dersphere.de)
5- #
6- # This program is free software: you can redistribute it and/or modify
7- # it under the terms of the GNU General Public License as published by
8- # the Free Software Foundation, either version 3 of the License, or
9- # (at your option) any later version.
10- #
11- # This program is distributed in the hope that it will be useful,
12- # but WITHOUT ANY WARRANTY; without even the implied warranty of
13- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14- # GNU General Public License for more details.
15- #
16- # You should have received a copy of the GNU General Public License
17- # along with this program. If not, see <http://www.gnu.org/licenses/>.
18- #
2+ '''
3+ * Copyright (C) 2019- enen92 (enen92@kodi.tv)
4+ * Copyright (C) 2012-2019 Tristan Fischer (sphere@dersphere.de)
5+ * This file is part of plugin.audio.radio_de
6+ *
7+ * SPDX-License-Identifier: GPL-2.0-only
8+ * See LICENSE.txt for more information.
9+ '''
10+
1911from xbmcswift2 import Plugin , xbmc , listitem
2012from resources .lib .api import RadioApi , RadioApiError
2113
@@ -61,34 +53,54 @@ def show_root_menu():
6153 items = (
6254 {'label' : _ ('local_stations' ), 'icon' : plugin .icon ,
6355 'fanart' : __get_plugin_fanart (),
64- 'path' : plugin .url_for ('show_local_stations' , page = 1 )},
56+ 'path' : plugin .url_for ('show_local_stations' , page = 1 ),
57+ 'offscreen' : True
58+ },
6559 {'label' : _ ('editorials_recommendations' ), 'icon' : plugin .icon ,
6660 'fanart' : __get_plugin_fanart (),
67- 'path' : plugin .url_for ('show_recommendation_stations' )},
61+ 'path' : plugin .url_for ('show_recommendation_stations' ),
62+ 'offscreen' : True
63+ },
6864 {'label' : _ ('top_stations' ), 'icon' : plugin .icon ,
6965 'fanart' : __get_plugin_fanart (),
70- 'path' : plugin .url_for ('show_top_stations' , page = 1 )},
66+ 'path' : plugin .url_for ('show_top_stations' , page = 1 ),
67+ 'offscreen' : True
68+ },
7169 {'label' : _ ('browse_by_genre' ), 'icon' : plugin .icon ,
7270 'fanart' : __get_plugin_fanart (),
73- 'path' : plugin .url_for ('show_genres' )},
71+ 'path' : plugin .url_for ('show_genres' ),
72+ 'offscreen' : True
73+ },
7474 {'label' : _ ('browse_by_topic' ), 'icon' : plugin .icon ,
7575 'fanart' : __get_plugin_fanart (),
76- 'path' : plugin .url_for ('show_topics' )},
76+ 'path' : plugin .url_for ('show_topics' ),
77+ 'offscreen' : True
78+ },
7779 {'label' : _ ('browse_by_country' ), 'icon' : plugin .icon ,
7880 'fanart' : __get_plugin_fanart (),
79- 'path' : plugin .url_for ('show_countries' )},
81+ 'path' : plugin .url_for ('show_countries' ),
82+ 'offscreen' : True
83+ },
8084 {'label' : _ ('browse_by_city' ), 'icon' : plugin .icon ,
8185 'fanart' : __get_plugin_fanart (),
82- 'path' : plugin .url_for ('show_cities_submenu' )},
86+ 'path' : plugin .url_for ('show_cities_submenu' ),
87+ 'offscreen' : True
88+ },
8389 {'label' : _ ('browse_by_language' ), 'icon' : plugin .icon ,
8490 'fanart' : __get_plugin_fanart (),
85- 'path' : plugin .url_for ('show_languages' )},
91+ 'path' : plugin .url_for ('show_languages' ),
92+ 'offscreen' : True
93+ },
8694 {'label' : _ ('search_for_station' ), 'icon' : plugin .icon ,
8795 'fanart' : __get_plugin_fanart (),
88- 'path' : plugin .url_for ('search' )},
96+ 'path' : plugin .url_for ('search' ),
97+ 'offscreen' : True
98+ },
8999 {'label' : _ ('my_stations' ), 'icon' : plugin .icon ,
90100 'fanart' : __get_plugin_fanart (),
91- 'path' : plugin .url_for ('show_my_stations' )},
101+ 'path' : plugin .url_for ('show_my_stations' ),
102+ 'offscreen' : True
103+ },
92104 )
93105 return plugin .finish (items )
94106
@@ -106,7 +118,8 @@ def show_local_stations(page=1):
106118 'page' : page ,
107119 'total_pages' : total_pages ,
108120 'icon' : plugin .icon ,
109- 'fanart' : __get_plugin_fanart ()
121+ 'fanart' : __get_plugin_fanart (),
122+ 'offscreen' : True
110123 }
111124
112125 return __add_stations (stations , browse_more = next_page )
@@ -130,7 +143,8 @@ def show_top_stations(page=1):
130143 'page' : page ,
131144 'total_pages' : total_pages ,
132145 'icon' : plugin .icon ,
133- 'fanart' : __get_plugin_fanart ()
146+ 'fanart' : __get_plugin_fanart (),
147+ 'offscreen' : True
134148 }
135149 return __add_stations (stations , browse_more = next_page )
136150
@@ -156,7 +170,8 @@ def search_result(search_string, page):
156170 'page' : page ,
157171 'total_pages' : total_pages ,
158172 'icon' : plugin .icon ,
159- 'fanart' : __get_plugin_fanart ()
173+ 'fanart' : __get_plugin_fanart (),
174+ 'offscreen' : True
160175 }
161176 return __add_stations (stations , browse_more = next_page )
162177
@@ -215,6 +230,7 @@ def show_genres():
215230 category = 'genres' ,
216231 value = genre ["systemEnglish" ]
217232 ),
233+ 'offscreen' : True
218234 })
219235 finish_kwargs = {
220236 'sort_methods' : [
@@ -237,6 +253,7 @@ def show_topics():
237253 category = 'topics' ,
238254 value = topic ["systemEnglish" ]
239255 ),
256+ 'offscreen' : True
240257 })
241258 finish_kwargs = {
242259 'sort_methods' : [
@@ -259,6 +276,7 @@ def show_countries():
259276 category = 'countries' ,
260277 value = country ["systemEnglish" ]
261278 ),
279+ 'offscreen' : True
262280 })
263281 finish_kwargs = {
264282 'sort_methods' : [
@@ -281,6 +299,7 @@ def show_languages():
281299 category = 'languages' ,
282300 value = lang ["systemEnglish" ]
283301 ),
302+ 'offscreen' : True
284303 })
285304 finish_kwargs = {
286305 'sort_methods' : [
@@ -296,12 +315,16 @@ def show_cities_submenu():
296315 'fanart' : __get_plugin_fanart (),
297316 'path' : plugin .url_for (
298317 'show_cities_list' ,
299- option = 'country' )},
318+ option = 'country' ),
319+ 'offscreen' : True
320+ },
300321 {'label' : _ ('az' ), 'icon' : plugin .icon ,
301322 'fanart' : __get_plugin_fanart (),
302323 'path' : plugin .url_for (
303324 'show_cities_list' ,
304- option = 'az' )}
325+ option = 'az' ),
326+ 'offscreen' : True
327+ }
305328 )
306329 finish_kwargs = {
307330 'sort_methods' : [
@@ -324,6 +347,7 @@ def show_cities_list(option):
324347 'show_cities_by_country' ,
325348 country = country ["systemEnglish" ],
326349 ),
350+ 'offscreen' : True
327351 })
328352 else :
329353 cities = radio_api .get_cities ()
@@ -337,6 +361,7 @@ def show_cities_list(option):
337361 category = 'cities' ,
338362 value = city ["systemEnglish" ],
339363 ),
364+ 'offscreen' : True
340365 })
341366 finish_kwargs = {
342367 'sort_methods' : [
@@ -358,7 +383,8 @@ def show_cities_by_country(country):
358383 'show_popular_and_az' ,
359384 category = 'cities' ,
360385 value = city ["systemEnglish" ],
361- )
386+ ),
387+ 'offscreen' : True
362388 })
363389 finish_kwargs = {
364390 'sort_methods' : [
@@ -378,15 +404,19 @@ def show_popular_and_az(category, value):
378404 option = 'popular' ,
379405 category = category ,
380406 value = value ,
381- page = 1 )},
407+ page = 1 ),
408+ 'offscreen' : True
409+ },
382410 {'label' : _ ('az' ), 'icon' : plugin .icon ,
383411 'fanart' : __get_plugin_fanart (),
384412 'path' : plugin .url_for (
385413 'sub_menu_entry' ,
386414 option = 'az' ,
387415 category = category ,
388416 value = value ,
389- page = 1 )}
417+ page = 1 ),
418+ 'offscreen' : True
419+ }
390420 )
391421 finish_kwargs = {
392422 'sort_methods' : [
@@ -413,7 +443,8 @@ def list_stations_by_city(city, option, page=1):
413443 'page' : page ,
414444 'total_pages' : total_pages ,
415445 'icon' : plugin .icon ,
416- 'fanart' : __get_plugin_fanart ()
446+ 'fanart' : __get_plugin_fanart (),
447+ 'offscreen' : True
417448 }
418449 return __add_stations (stations , browse_more = next_page )
419450
@@ -467,7 +498,8 @@ def sub_menu_entry(option, category, value, page=1):
467498 'page' : page ,
468499 'total_pages' : total_pages ,
469500 'icon' : plugin .icon ,
470- 'fanart' : __get_plugin_fanart ()
501+ 'fanart' : __get_plugin_fanart (),
502+ 'offscreen' : True
471503 }
472504 return __add_stations (stations , browse_more = next_page )
473505
@@ -496,6 +528,7 @@ def get_stream_url(station_id):
496528 icon = station ['thumbnail' ],
497529 thumbnail = station ['thumbnail' ],
498530 fanart = __get_plugin_fanart (),
531+ offscreen = True
499532 )
500533 )
501534
@@ -544,7 +577,8 @@ def __add_stations(stations, add_custom=False, browse_more=None):
544577 'is_playable' : True ,
545578 'properties' : {
546579 'StationName' : station .get ('name' , '' ) # Matrix++ only
547- }
580+ },
581+ 'offscreen' : True
548582 })
549583 if add_custom :
550584 items .append ({
@@ -557,7 +591,8 @@ def __add_stations(stations, add_custom=False, browse_more=None):
557591 'label' : '[B]%s[/B]' % _ ('next_page' ) % (browse_more ['page' ], browse_more ['total_pages' ]),
558592 'path' : browse_more ['url' ],
559593 'icon' : browse_more ['icon' ],
560- 'fanart' : browse_more ['fanart' ]
594+ 'fanart' : browse_more ['fanart' ],
595+ 'offscreen' : True
561596 })
562597
563598
0 commit comments