|
| 1 | +#!/usr/bin/env python |
| 2 | +################################################################################ |
| 3 | +# This file is part of LibreELEC - https://libreelec.tv |
| 4 | +# Copyright (C) 2016-2017 Team LibreELEC |
| 5 | +# Copyright (C) 2017 Tnds82 (tndsrepo@gmail.com) |
| 6 | +# |
| 7 | +# LibreELEC is free software: you can redistribute it and/or modify |
| 8 | +# it under the terms of the GNU General Public License as published by |
| 9 | +# the Free Software Foundation, either version 2 of the License, or |
| 10 | +# (at your option) any later version. |
| 11 | +# |
| 12 | +# LibreELEC is distributed in the hope that it will be useful, |
| 13 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | +# GNU General Public License for more details. |
| 16 | +# |
| 17 | +# You should have received a copy of the GNU General Public License |
| 18 | +# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. |
| 19 | +################################################################################ |
| 20 | + |
1 | 21 | import xbmc,xbmcaddon,xbmcvfs,xbmcgui,xbmcplugin
|
2 | 22 | import subprocess
|
3 | 23 | from subprocess import Popen
|
|
13 | 33 | import ast
|
14 | 34 | import zipfile
|
15 | 35 | import datetime
|
16 |
| -#from requests.exceptions import HTTPError |
17 |
| -#from requests.exceptions import ConnectionError |
| 36 | +import urllib |
| 37 | +import picons |
18 | 38 |
|
19 | 39 | plugin = Plugin()
|
20 | 40 | dialog = xbmcgui.Dialog()
|
@@ -183,6 +203,48 @@ def _ArchiveDirectory(parentDirectory):
|
183 | 203 | _ArchiveDirectory(inputDir)
|
184 | 204 | zipOut.close()
|
185 | 205 |
|
| 206 | +def picons_param_load(): |
| 207 | + picons_source_list = ["CvH Picons - Name", "CvH Picons - Frequency", "ati711 - Color", "ait711 - Black", "ati711 - White", "URL"] |
| 208 | + picons_source_value = xbmcaddon.Addon().getSetting('psource') |
| 209 | + picons_source = picons_source_list[int(picons_source_value)] |
| 210 | + picons_dest = xbmcaddon.Addon().getSetting('pdest') |
| 211 | + picons_url = xbmcaddon.Addon().getSetting('purl') |
| 212 | + picons_list = ["Picons Source: " + str(picons_source), "Picons Destination: " + str(picons_dest), "DOWNLOAD PICONS"] |
| 213 | + sel_param = dialog.select('Picons Download - Select parameter', list=picons_list) |
| 214 | + if sel_param < 0: |
| 215 | + return |
| 216 | + if sel_param >= 0: |
| 217 | + if sel_param == 0: |
| 218 | + sel_psource = dialog.select('Select Picons Source', list=picons_source_list) |
| 219 | + if sel_psource < 0: |
| 220 | + picons_param_load() |
| 221 | + else: |
| 222 | + picons_source_set = xbmcaddon.Addon().setSetting(id='psource', value=str(sel_psource)) |
| 223 | + picons_param_load() |
| 224 | + if sel_param == 1: |
| 225 | + picons_dest_update = dialog.browse(3, "Select Picons Destination", "files", defaultt=picons_dest) |
| 226 | + picons_dest_set = xbmcaddon.Addon().setSetting(id='pdest', value=picons_dest_update) |
| 227 | + picons_param_load() |
| 228 | + if sel_param == 2: |
| 229 | + addon = xbmcaddon.Addon(id='script.module.tvh2kodi') |
| 230 | + addonname = addon.getAddonInfo('name') |
| 231 | + addonfolder = addon.getAddonInfo('path') |
| 232 | + addonicon = os.path.join(addonfolder, 'resources/icon.png') |
| 233 | + addondata = xbmc.translatePath(addon.getAddonInfo('profile')) |
| 234 | + snp_json = os.path.join(addondata, 'data/snp.json') |
| 235 | + srp_json = os.path.join(addondata, 'data/srp.json') |
| 236 | + url_latest = 'http://cvh.libreelec.tv/picons/latest2.json' |
| 237 | + latest_json = urllib.urlopen(url_latest) |
| 238 | + if picons_source_value == "0": |
| 239 | + picons.compare_release_snp(snp_json) |
| 240 | + if picons_source_value == "1": |
| 241 | + picons.compare_release_srp(srp_json) |
| 242 | + if picons_source_value == "5": |
| 243 | + sel_purl = dialog.input('Enetr the Picons URL to Download', defaultt=picons_url,type=xbmcgui.INPUT_ALPHANUM) |
| 244 | + if sel_purl != "": |
| 245 | + picons_url_set = xbmcaddon.Addon().setSetting(id='purl', value=str(sel_purl)) |
| 246 | + picons.picons_ext(sel_purl) |
| 247 | + |
186 | 248 | def dvr_param_load(dvr_uuid_sel):
|
187 | 249 | dvr_url = 'http://' + tvh_url + ':' + tvh_port + '/api/idnode/load?uuid=' + dvr_uuid_sel
|
188 | 250 | dvr_load = requests.get(dvr_url).json()
|
@@ -2061,7 +2123,7 @@ def tvh():
|
2061 | 2123 | ch_icon_scheme, ch_icon_scheme_key, ch_icon_scheme_val = find_param_dict(tvh_config_load, 'chiconscheme', 'enum')
|
2062 | 2124 | picon_path = find_param(tvh_config_load, 'piconpath')
|
2063 | 2125 | picon_scheme, picon_scheme_key, picon_scheme_val = find_param_dict(tvh_config_load, 'piconscheme', 'enum')
|
2064 |
| - tvh_config_info_list = ["DVB scan path: " + str(dvb_scan_path), "Prefer picon: " + str(prefer_picon), "Channel icon path: " + str(ch_icon_path), "Channel icon scheme: " + str(ch_icon_scheme), "Picon path: " + str(picon_path), "Picon scheme: " + str(picon_scheme), "RESET ALL CHANNEL ICONS", "BACKUP TVHEADEND USERDATA", "IMPORT TVHEADEND USERDATA"] |
| 2126 | + tvh_config_info_list = ["DVB scan path: " + str(dvb_scan_path), "Prefer picon: " + str(prefer_picon), "Channel icon path: " + str(ch_icon_path), "Channel icon scheme: " + str(ch_icon_scheme), "Picon path: " + str(picon_path), "Picon scheme: " + str(picon_scheme), "RESET ALL CHANNEL ICONS", "BACKUP TVHEADEND USERDATA", "IMPORT TVHEADEND USERDATA", "DOWNLOAD PICONS"] |
2065 | 2127 | param_update = ""
|
2066 | 2128 | sel_tvh = dialog.select('Select a Tvh configuration parameter to edit', list=tvh_config_info_list)
|
2067 | 2129 | if sel_tvh < 0:
|
@@ -2173,6 +2235,8 @@ def tvh():
|
2173 | 2235 | dialog.ok("Unable to Restart Tvheadend Service!", "Unable to restart the Tvheadend service.", "Please enable the service in Kodi addons.")
|
2174 | 2236 | else:
|
2175 | 2237 | dialog.ok("Tvheadend Service Still Running!", "Unable to stop the Tvheadend service.", "Unable to complete backup.")
|
| 2238 | + if sel_tvh == 9: |
| 2239 | + picons_param_load() |
2176 | 2240 | if param_update != "":
|
2177 | 2241 | param_url = 'http://' + tvh_url + ':' + tvh_port + '/api/config/save?node={' + param_update + '}'
|
2178 | 2242 | param_save = requests.get(param_url)
|
|
0 commit comments