-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from edit4ever/picons
Picons
- Loading branch information
Showing
6 changed files
with
459 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<addon id="script.module.tvh2kodi" | ||
name="Tvheadend Setup for Kodi" | ||
version="1.9" | ||
version="1.9.6" | ||
provider-name="edit4ever"> | ||
<requires> | ||
<import addon="xbmc.python" version="2.6.0"/> | ||
|
@@ -17,9 +17,7 @@ | |
<description>Tvh2Kodi gives access to the basic Tvheadend settings directly from the Kodi interface. This can be used in place of the Tvheadend web interface to get your Tvheadend backend server configured and running. It is also provides an easy way to scan for new services and channels and to configure your channel EPG sources. | ||
|
||
* minimum version of Tvheadend is 4.2 | ||
v1.9 | ||
- add timeshift options under DVR configuration | ||
- fix epg grabber progress bar | ||
|
||
</description> | ||
<disclaimer>Copyright (C) 2017 edit4ever - [email protected]</disclaimer> | ||
<platform>all</platform> | ||
|
@@ -32,16 +30,9 @@ v1.9 | |
<screenshot>resources/screenshot-03.jpg</screenshot> | ||
</assets> | ||
<news> | ||
v1.8.1 - fix username-password display | ||
v1.8 - add support for IPTV Networks - fix error in muxes when 0 muxes available | ||
v1.7 - add support for Tvh username-password | ||
v1.6 - add backup and import of tvh userdata - add channel icon reset option | ||
v1.5 - add progress bar for internal epg grab - add base tvh config parameters (set dvb scan files and channel icon paths) | ||
v1.4 - fix adapter network issue - add multiple network support to adapter - allow custom Tvh server ip to be recalled | ||
v1.3 - add support for DVB-S mux editing | ||
v1.2 - fix error in network parameters load - fix wrong epg parameter selection | ||
v1.1 - add triggers for OTA and internal grabbers | ||
v1.0 - Initial Release | ||
</news> | ||
1.9.6 - add epg grabber cron wizard | ||
1.9.5 - add picons downloader (test) | ||
1.9 - add timeshift options under DVR configuration - fix epg grabber progress bar | ||
</news> | ||
</extension> | ||
</addon> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
v1.9.6 (2017-11-29) | ||
- add epg grabber cron wizard | ||
|
||
v1.9.5 (2017-08-08) | ||
- add picons downloader (test) | ||
|
||
v1.9 (2017-08-03) | ||
- add timeshift options under DVR configuration - fix epg grabber progress bar | ||
|
||
v1.8.1 (2017-07-28) | ||
- fix username-password display | ||
|
||
v1.6/1.7/1.8 (2017-07-26) | ||
- add backup and import of tvh userdata - add channel icon reset option | ||
- add support for Tvh username-password | ||
- add support for IPTV Networks - fix error in muxes when 0 muxes available | ||
|
||
v1.5 (2017-07-14) | ||
- add progress bar for internal epg grab - add base tvh config parameters (set dvb scan files and channel icon paths) | ||
|
||
v1.4 (2017-07-10) | ||
- fix adapter network issue - add multiple network support to adapter - allow custom Tvh server ip to be recalled | ||
|
||
v1.3 (2017-07-08) | ||
- add support for DVB-S mux editing | ||
|
||
v1.2 (2017-07-08) | ||
- fix error in network parameters load - fix wrong epg parameter selection | ||
|
||
v1.1 (2017-07-07) | ||
- add triggers for OTA and internal grabbers | ||
|
||
v1.0 (2017-07-06) | ||
- Initial Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,23 @@ | ||
#!/usr/bin/env python | ||
################################################################################ | ||
# This file is part of LibreELEC - https://libreelec.tv | ||
# Copyright (C) 2016-2017 Team LibreELEC | ||
# Copyright (C) 2017 Tnds82 ([email protected]) | ||
# | ||
# LibreELEC is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# LibreELEC is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. | ||
################################################################################ | ||
|
||
import xbmc,xbmcaddon,xbmcvfs,xbmcgui,xbmcplugin | ||
import subprocess | ||
from subprocess import Popen | ||
|
@@ -13,8 +33,8 @@ | |
import ast | ||
import zipfile | ||
import datetime | ||
#from requests.exceptions import HTTPError | ||
#from requests.exceptions import ConnectionError | ||
import urllib | ||
import picons | ||
|
||
plugin = Plugin() | ||
dialog = xbmcgui.Dialog() | ||
|
@@ -183,6 +203,45 @@ def _ArchiveDirectory(parentDirectory): | |
_ArchiveDirectory(inputDir) | ||
zipOut.close() | ||
|
||
def picons_param_load(): | ||
url_latest = 'http://cvh.libreelec.tv/picons/latest2.json' | ||
ljson = requests.get(url_latest).json() | ||
picons_source_list = ['Custom URL'] | ||
picons_source_files = ['Custom URL'] | ||
for p in ljson['Picons']['latest']: | ||
picons_source_list.append(p['desc']) | ||
for n in ljson['Picons']['latest']: | ||
picons_source_files.append(n['name']) | ||
picons_source_value = xbmcaddon.Addon().getSetting('psource') | ||
picons_source = picons_source_list[int(picons_source_value)] | ||
picons_file = picons_source_files[int(picons_source_value)] | ||
picons_dest = xbmcaddon.Addon().getSetting('pdest') | ||
picons_url = xbmcaddon.Addon().getSetting('purl') | ||
picons_list = ["Picons Source: " + str(picons_source), "Picons Destination: " + str(picons_dest), "DOWNLOAD PICONS"] | ||
sel_param = dialog.select('Picons Download - Select parameter', list=picons_list) | ||
if sel_param < 0: | ||
return | ||
if sel_param >= 0: | ||
if sel_param == 0: | ||
sel_psource = dialog.select('Select Picons Source', list=picons_source_list) | ||
if sel_psource < 0: | ||
picons_param_load() | ||
else: | ||
picons_source_set = xbmcaddon.Addon().setSetting(id='psource', value=str(sel_psource)) | ||
picons_param_load() | ||
if sel_param == 1: | ||
picons_dest_update = dialog.browse(3, "Select Picons Destination", "files", defaultt=picons_dest) | ||
picons_dest_set = xbmcaddon.Addon().setSetting(id='pdest', value=picons_dest_update) | ||
picons_param_load() | ||
if sel_param == 2: | ||
if picons_source_value == "0": | ||
sel_purl = dialog.input('Enter the Picons URL to Download', defaultt=picons_url,type=xbmcgui.INPUT_ALPHANUM) | ||
if sel_purl != "": | ||
picons_url_set = xbmcaddon.Addon().setSetting(id='purl', value=str(sel_purl)) | ||
picons.url_external(sel_purl) | ||
if picons_source_value > "0": | ||
picons.compare_release(url_latest, picons_file, picons_source_value) | ||
|
||
def dvr_param_load(dvr_uuid_sel): | ||
dvr_url = 'http://' + tvh_url + ':' + tvh_port + '/api/idnode/load?uuid=' + dvr_uuid_sel | ||
dvr_load = requests.get(dvr_url).json() | ||
|
@@ -1077,7 +1136,7 @@ def ch_param_edit(ch_uuid_sel, ch_info_list, ch_enabled, ch_autoname, ch_name, c | |
param_update = '"autoname":' + ch_autoname | ||
if sel_param == 4: | ||
sel_ch_icon = dialog.input('Edit the channel icon URL', defaultt=ch_icon,type=xbmcgui.INPUT_ALPHANUM) | ||
if sel_ch_name == "": | ||
if sel_ch_icon == "": | ||
ch_param_load(ch_uuid_sel) | ||
else: | ||
param_update = '"icon":"' + sel_ch_icon + '"' | ||
|
@@ -1108,6 +1167,45 @@ def ch_param_edit(ch_uuid_sel, ch_info_list, ch_enabled, ch_autoname, ch_name, c | |
ch_param_load(ch_uuid_sel) | ||
|
||
|
||
def cron_edit(epg_intcron): | ||
cron_def_weekday_list = ['Everyday', 'Every Other Day', 'on Sundays', 'on Mondays', 'on Tuesdays', 'on Wednesdays', 'on Thursdays', 'on Fridays', 'on Saturdays'] | ||
cron_def_weekday = {'*':'Everyday', '2-30/2': 'Every Other Day', '0':'on Sundays', '1':'on Mondays', '2':'on Tuesdays', '3':'on Wednesdays', '4':'on Thursdays', '5':'on Fridays', '6':'on Saturdays'} | ||
cron_def_split_hour_list = ['Specific Hour', '2x a Day', '3x a Day', '4x a Day', '6x a Day', '8x a Day', '12x a Day', 'every Hour'] | ||
cron_def_split_hour = {'*':'every Hour', '*/2':'12x a Day', '*/3':'8x a Day', '*/4':'6x a Day','*/6':'4x a Day', '*/8':'3x a Day', '*/12':'2x a Day'} | ||
cron_def_hours = ['12:00AM - Midnight', '1:00AM', '2:00AM', '3:00AM', '4:00AM', '5:00AM', '6:00AM', '7:00AM', '8:00AM', '9:00AM', '10:00AM', '11:00AM', '12:00PM - Noon', '1:00PM', '2:00PM', '3:00PM', '4:00PM', '5:00PM', '6:00PM', '7:00PM', '8:00PM', '9:00PM', '10:00PM', '11:00PM'] | ||
epg_intcron_clean = re.sub('#.*\n', '', epg_intcron) | ||
cron_current = epg_intcron_clean.split(' ') | ||
cron_current_min = str(int(cron_current[0])).zfill(2) | ||
if '*' in cron_current[1]: | ||
cron_current_str = cron_current_min + ' Minutes past the hour, ' + cron_def_split_hour[cron_current[1]] + ', ' + cron_def_weekday[cron_current[2]] | ||
else: | ||
cron_ampm = 'AM' | ||
if cron_current[1] == '00' or cron_current[1] == '0': | ||
cron_current_hour = '12' | ||
elif int(cron_current[1]) > 12: | ||
cron_current_hour = str(24 - int(cron_current[1])) | ||
cron_ampm = 'PM' | ||
else: | ||
cron_current_hour = cron_current[1] | ||
cron_current_str = cron_current_hour + ':' + cron_current_min + cron_ampm + ' - ' + cron_def_weekday[cron_current[2]] | ||
cron_edit_sel = dialog.yesno('Cron edit', 'The grabber is set to run at:', cron_current_str, 'Do you wish to edit this cron setting?') | ||
if cron_edit_sel: | ||
cron_sel_weekday = dialog.select('Select which day(s) to run the grabber', list=cron_def_weekday_list) | ||
if cron_sel_weekday >= 0: | ||
cron_new_weekday = cron_def_weekday.keys()[cron_def_weekday.values().index(cron_def_weekday_list[cron_sel_weekday])] | ||
cron_sel_hour = dialog.select('Select which hour(s) to run the grabber', list=cron_def_split_hour_list) | ||
if cron_sel_hour == 0: | ||
cron_sel_hour_spec = dialog.select('Select which hour(s) to run the grabber', list=cron_def_hours) | ||
cron_new_hour = cron_sel_hour_spec | ||
if cron_sel_hour > 0: | ||
cron_new_hour = cron_def_split_hour.keys()[cron_def_split_hour.values().index(cron_def_split_hour_list[cron_sel_hour])] | ||
cron_new_min = dialog.input('Enter the minutes after the hour to run the grabber', defaultt='0', type=xbmcgui.INPUT_NUMERIC) | ||
cron_update = str(cron_new_min) + ' ' + str(cron_new_hour) + ' ' + cron_new_weekday + ' * *' | ||
return cron_update | ||
else: | ||
return epg_intcron | ||
|
||
|
||
def epg_param(sel_epg, epg_rename, epg_renumber, epg_reicon, epg_dbsave, epg_intcron, epg_otainit, epg_otacron, epg_otatime): | ||
param_update = "" | ||
if sel_epg == 3: | ||
|
@@ -1131,20 +1229,32 @@ def epg_param(sel_epg, epg_rename, epg_renumber, epg_reicon, epg_dbsave, epg_int | |
sel_epg_dbsave = epg_dbsave | ||
param_update = '"epgdb_periodicsave":' + str(sel_epg_dbsave) | ||
if sel_epg == 7: | ||
sel_epg_intcron = dialog.input('Edit the cron multiline for internal grabbers', defaultt=epg_intcron,type=xbmcgui.INPUT_ALPHANUM) | ||
if sel_epg_intcron == "": | ||
sel_epg_intcron = epg_intcron | ||
sel_epg_intcron_type = dialog.yesno('Edit the cron for internal grabbers', 'If you are familiar with cron settings you can manually enter the cron.', '', 'Otherwise use the wizard to select the grabber run times.', 'Wizard', 'Manual') | ||
if sel_epg_intcron_type: | ||
sel_epg_intcron = dialog.input('Edit the cron multiline for internal grabbers', defaultt=epg_intcron,type=xbmcgui.INPUT_ALPHANUM) | ||
if sel_epg_intcron == "": | ||
sel_epg_intcron = epg_intcron | ||
else: | ||
sel_epg_intcron = cron_edit(epg_intcron) | ||
if sel_epg_intcron == "": | ||
sel_epg_intcron = epg_intcron | ||
param_update = '"cron":"' + sel_epg_intcron + '"' | ||
if sel_epg == 8: | ||
sel_epg_otainit = dialog.select('Enable or disable initial EPG grab at startup', list=enabledisable) | ||
if sel_epg_otainit >= 0: | ||
epg_otainit = truefalse[sel_epg_otainit] | ||
param_update = '"ota_initial":' + epg_otainit | ||
if sel_epg == 9: | ||
sel_epg_otacron = dialog.input('Edit the cron multiline for over-the-air grabbers', defaultt=epg_otacron,type=xbmcgui.INPUT_ALPHANUM) | ||
if sel_epg_otacron == "": | ||
sel_epg_otacron = epg_otacron | ||
param_update = '"cron":"' + sel_epg_otacron + '"' | ||
sel_epg_otacron_type = dialog.yesno('Edit the cron for OTA grabbers', 'If you are familiar with cron settings you can manually enter the cron.', '', 'Otherwise use the wizard to select the grabber run times.', 'Wizard', 'Manual') | ||
if sel_epg_otacron_type: | ||
sel_epg_otacron = dialog.input('Edit the cron multiline for over-the-air grabbers', defaultt=epg_otacron,type=xbmcgui.INPUT_ALPHANUM) | ||
if sel_epg_otacron == "": | ||
sel_epg_otacron = epg_otacron | ||
else: | ||
sel_epg_otacron = cron_edit(epg_otacron) | ||
if sel_epg_otacron == "": | ||
sel_epg_otacron = epg_otacron | ||
param_update = '"ota_cron":"' + sel_epg_otacron + '"' | ||
if sel_epg == 10: | ||
sel_epg_otatime = dialog.input('OTA EPG scan timeout in seconds (30-7200)', defaultt=str(epg_otatime),type=xbmcgui.INPUT_NUMERIC) | ||
if sel_epg_otatime == "": | ||
|
@@ -1692,8 +1802,6 @@ def wizard_start(): | |
for adapter_t in adapter_get: | ||
adapter_list.append(adapter_t['text']) | ||
sel_adapter = dialog.select('Select which adapter you would like to setup first', list=adapter_list) | ||
if sel_adapter < 0: | ||
return | ||
if sel_adapter >= 0: | ||
adapter_uuid_sel = adapter_uuid[sel_adapter] | ||
adapter_text_sel = adapter_list[sel_adapter] | ||
|
@@ -1843,8 +1951,6 @@ def adapters(): | |
adapters_full = zip(adapter_text, adapter_enabled) | ||
adapters_list = ["%s %s" % x for x in adapters_full] | ||
sel_adapter = dialog.select('Select which adapter you would like to configure', list=adapters_list) | ||
if sel_adapter < 0: | ||
return | ||
if sel_adapter >= 0: | ||
adapter_uuid_sel = adapter_uuid[sel_adapter] | ||
adapt_param_load(adapter_uuid_sel) | ||
|
@@ -1860,8 +1966,6 @@ def networks(): | |
for net_u in networks['entries']: | ||
net_uuid.append(net_u['uuid']) | ||
sel_network = dialog.select('Select a network to configure', list=net_name) | ||
if sel_network < 0: | ||
return | ||
if sel_network == 0: | ||
net_uuid_sel = network_new() | ||
if net_uuid_sel == "": | ||
|
@@ -1883,8 +1987,6 @@ def muxes(): | |
for net_u in networks['entries']: | ||
net_uuid.append(net_u['uuid']) | ||
sel_network = dialog.select('Select a network to see list of muxes', list=net_name) | ||
if sel_network < 0: | ||
return | ||
if sel_network >= 0: | ||
net_uuid_sel = net_uuid[sel_network] | ||
muxes_load(net_uuid_sel) | ||
|
@@ -2061,7 +2163,7 @@ def tvh(): | |
ch_icon_scheme, ch_icon_scheme_key, ch_icon_scheme_val = find_param_dict(tvh_config_load, 'chiconscheme', 'enum') | ||
picon_path = find_param(tvh_config_load, 'piconpath') | ||
picon_scheme, picon_scheme_key, picon_scheme_val = find_param_dict(tvh_config_load, 'piconscheme', 'enum') | ||
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"] | ||
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"] | ||
param_update = "" | ||
sel_tvh = dialog.select('Select a Tvh configuration parameter to edit', list=tvh_config_info_list) | ||
if sel_tvh < 0: | ||
|
@@ -2173,6 +2275,8 @@ def tvh(): | |
dialog.ok("Unable to Restart Tvheadend Service!", "Unable to restart the Tvheadend service.", "Please enable the service in Kodi addons.") | ||
else: | ||
dialog.ok("Tvheadend Service Still Running!", "Unable to stop the Tvheadend service.", "Unable to complete backup.") | ||
if sel_tvh == 9: | ||
picons_param_load() | ||
if param_update != "": | ||
param_url = 'http://' + tvh_url + ':' + tvh_port + '/api/config/save?node={' + param_update + '}' | ||
param_save = requests.get(param_url) | ||
|
Oops, something went wrong.