|
42 | 42 | tvh_port = xbmcaddon.Addon().getSetting('tvhport') |
43 | 43 | tvh_usern = xbmcaddon.Addon().getSetting('usern') |
44 | 44 | tvh_passw = xbmcaddon.Addon().getSetting('passw') |
45 | | -tvh_url_base = xbmcaddon.Addon().getSetting('tvhurl') |
46 | 45 | if tvh_usern != "" and tvh_passw != "": |
47 | | - tvh_url = tvh_usern + ":" + tvh_passw + "@" + tvh_url_base |
| 46 | + tvh_url = tvh_usern + ":" + tvh_passw + "@" + xbmcaddon.Addon().getSetting('tvhurl') |
48 | 47 | else: |
49 | | - tvh_url = tvh_url_base |
| 48 | + tvh_url = xbmcaddon.Addon().getSetting('tvhurl') |
50 | 49 |
|
51 | 50 | try: |
52 | 51 | check_url = 'http://' + tvh_url + ':' + tvh_port + '/api/status/connections' |
@@ -993,7 +992,7 @@ def ch_param_edit(ch_uuid_sel, ch_info_list, ch_enabled, ch_autoname, ch_name, c |
993 | 992 | else: |
994 | 993 | param_update = '"icon":"' + sel_ch_icon + '"' |
995 | 994 | if sel_param == 5: |
996 | | - epg_grid_url = 'http://' + tvh_url + ':' + tvh_port + '/api/epggrab/channel/grid?sort=names&dir=ASC&all=1' |
| 995 | + epg_grid_url = 'http://' + tvh_url + ':' + tvh_port + '/api/epggrab/channel/grid?sort=names&dir=ASC&limit=999999999&all=1' |
997 | 996 | epg_grid_load = requests.get(epg_grid_url).json() |
998 | 997 | epg_list_text = [x['names'] for x in epg_grid_load['entries']] |
999 | 998 | epg_list_id = [x['id'] for x in epg_grid_load['entries']] |
@@ -1918,39 +1917,39 @@ def epg(): |
1918 | 1917 | comet_poll = requests.get(comet_poll_url).json() |
1919 | 1918 | comet_poll_logtxt_list = [] |
1920 | 1919 | for t in comet_poll['messages']: |
1921 | | - comet_poll_logtxt_list.insert(0,t['logtxt']) |
| 1920 | + comet_poll_logtxt_list.insert(0,t.get('logtxt', "...")) |
1922 | 1921 | comet_poll_logtxt = '\n'.join(comet_poll_logtxt_list) |
1923 | 1922 | pDialog.update(10, comet_poll_logtxt) |
1924 | 1923 | time.sleep(1) |
1925 | 1924 | if (pDialog.iscanceled()): |
1926 | 1925 | pDialog.close() |
1927 | 1926 | comet_update = False |
1928 | | - comet_poll = requests.get(comet_poll_url).json() |
1929 | | - if comet_poll['messages'] == []: |
1930 | | - comet_poll_logtxt = '\n'.join(comet_poll_logtxt_list) |
1931 | | - pDialog.update(25, comet_poll_logtxt) |
1932 | | - time.sleep(1) |
1933 | | - if (pDialog.iscanceled()): |
1934 | | - pDialog.close() |
1935 | | - perc_update = 30 |
| 1927 | + grabber_success = False |
| 1928 | + perc_update = 10 |
1936 | 1929 | while comet_update == False: |
1937 | 1930 | if (pDialog.iscanceled()): |
1938 | 1931 | pDialog.close() |
| 1932 | + perc_update = perc_update + int((100 - perc_update) * .1) + 1 |
| 1933 | + comet_poll_logtxt_list = [] |
| 1934 | + for t in comet_poll['messages']: |
| 1935 | + comet_poll_logtxt_list.insert(0,t.get('logtxt', "...")) |
| 1936 | + comet_poll_logtxt = '\n'.join(comet_poll_logtxt_list) |
| 1937 | + if "grab took" in comet_poll_logtxt: |
| 1938 | + comet_update = True |
| 1939 | + grabber_success = True |
| 1940 | + if "grab returned no data" in comet_poll_logtxt: |
| 1941 | + comet_update = True |
1939 | 1942 | pDialog.update(perc_update, comet_poll_logtxt) |
1940 | 1943 | comet_poll = requests.get(comet_poll_url).json() |
1941 | | - perc_update = perc_update + 5 |
1942 | | - if comet_poll['messages'] == []: |
1943 | | - comet_update = True |
1944 | | - time.sleep(1) |
1945 | | -# comet_poll = requests.get(comet_poll_url).json() |
1946 | | - for t in comet_poll['messages']: |
1947 | | - comet_poll_logtxt_list.insert(0,t['logtxt']) |
1948 | | - comet_poll_logtxt = '\n'.join(comet_poll_logtxt_list) |
| 1944 | + time.sleep(1) |
1949 | 1945 | pDialog.update(100, comet_poll_logtxt) |
1950 | 1946 | time.sleep(2) |
1951 | 1947 | pDialog.close() |
1952 | | - if dialog.yesno("Internal EPG grabber finished", "Your EPG has been updated.", "Sometimes Kodi needs a restart in order to update the EPG display. Or you can clear the data in the PVR & Live TV settings.", "Would you like to open the PVR & Live TV settings?"): |
1953 | | - xbmc.executebuiltin('ActivateWindow(pvrsettings)') |
| 1948 | + if grabber_success == True: |
| 1949 | + if dialog.yesno("Internal EPG grabber finished", "Your EPG has been updated.", "Sometimes Kodi needs a restart in order to update the EPG display. Or you can clear the data in the PVR & Live TV settings.", "Would you like to open the PVR & Live TV settings?"): |
| 1950 | + xbmc.executebuiltin('ActivateWindow(pvrsettings)') |
| 1951 | + else: |
| 1952 | + dialog.ok("Internal EPG Grabber Error!", "The EPG Grabber failed to return data.", "", "Please check your grabber installation for issues.") |
1954 | 1953 | if sel_epg > 2 : |
1955 | 1954 | epg_param(sel_epg, epg_rename, epg_renumber, epg_reicon, epg_dbsave, epg_intcron, epg_otainit, epg_otacron, epg_otatime) |
1956 | 1955 |
|
@@ -2160,7 +2159,7 @@ def index(): |
2160 | 2159 | }) |
2161 | 2160 | items.append( |
2162 | 2161 | { |
2163 | | - 'label': 'Tvheadend Backend: ' + tvh_url_base + ':' + tvh_port, |
| 2162 | + 'label': 'Tvheadend Backend: ' + tvh_url + ':' + tvh_port, |
2164 | 2163 | 'path': plugin.url_for(u'tvhclient'), |
2165 | 2164 | 'thumbnail':get_icon_path('server'), |
2166 | 2165 | }) |
|
0 commit comments