Skip to content

Commit

Permalink
1.15-20240331 fixed errors with menu items and epg next days crash
Browse files Browse the repository at this point in the history
  • Loading branch information
kiddac committed Mar 31, 2024
1 parent 9109015 commit ad6c593
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -521,4 +521,20 @@ def writeJsonFile(self):

def exit(self, answer=None):
if glob.finished:
self.clearCaches()
self.clearSeries()
self.close(True)

def clearSeries(self):
playlists_all = bmx.getPlaylistJson()

if playlists_all:
x = 0
for playlists in playlists_all:
self.playlists_all[x]["data"]["live_streams"] = []
self.playlists_all[x]["data"]["vod_streams"] = []
self.playlists_all[x]["data"]["series_streams"] = []
x += 1

with open(playlists_json, "w") as f:
json.dump(playlists_all, f)
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(self, session):
if glob.current_playlist["settings"]["show_series"] is True and glob.current_playlist["data"]["series_categories"]:
self.progress_range += 1

self.updateJson()
self.playlists_all = bmx.getPlaylistJson()

self.starttimer = eTimer()
try:
Expand Down Expand Up @@ -182,8 +182,11 @@ def makeUrlList(self):
player_api = str(glob.current_playlist["playlist_info"]["player_api"])

self.xmltv_api = str(glob.current_playlist["playlist_info"]["xmltv_api"])
if glob.current_playlist["settings"]["next_days"] != "0":
self.xmltv_api = str(glob.current_playlist["playlist_info"]["xmltv_api"]) + "&next_days=" + str(glob.current_playlist["settings"]["next_days"])
try:
if "next_days" in glob.current_playlist["settings"] and glob.current_playlist["settings"]["next_days"] != "0":
self.xmltv_api = str(glob.current_playlist["playlist_info"]["xmltv_api"]) + "&next_days=" + str(glob.current_playlist["settings"]["next_days"])
except:
pass

self.username = glob.current_playlist["playlist_info"]["username"]
self.password = glob.current_playlist["playlist_info"]["password"]
Expand Down Expand Up @@ -213,7 +216,6 @@ def makeUrlList(self):

else:
self.finished()
return

elif glob.current_playlist["playlist_info"]["playlist_type"] == "external":
self.external_url_list.append([glob.current_playlist["playlist_info"]["full_url"], 6, "text"])
Expand Down Expand Up @@ -309,15 +311,13 @@ def loadLive(self):
self.nextJob(_("Downloading series data..."), self.downloadSeries)
else:
self.finished()
return
else:
if glob.current_playlist["settings"]["show_vod"] is True and glob.current_playlist["data"]["vod_categories"]:
self.nextJob(_("Process VOD data..."), self.loadVod)
elif glob.current_playlist["settings"]["show_series"] is True and glob.current_playlist["data"]["series_categories"]:
self.nextJob(_("Processing series data..."), self.loadSeries)
else:
self.finished()
return

if live_categories and self.live_streams:
x = 0
Expand Down Expand Up @@ -487,15 +487,13 @@ def loadLive(self):
self.nextJob(_("Downloading series data..."), self.downloadSeries)
else:
self.finished()
return
else:
if glob.current_playlist["settings"]["show_vod"] is True and glob.current_playlist["data"]["vod_categories"]:
self.nextJob(_("Process VOD data..."), self.loadVod)
elif glob.current_playlist["settings"]["show_series"] is True and glob.current_playlist["data"]["series_categories"]:
self.nextJob(_("Processing series data..."), self.loadSeries)
else:
self.finished()
return

def loadVod(self):
self.vod_stream_data = []
Expand All @@ -516,13 +514,11 @@ def loadVod(self):
self.nextJob(_("Downloading series data..."), self.downloadSeries)
else:
self.finished()
return
else:
if glob.current_playlist["settings"]["show_series"] is True and glob.current_playlist["data"]["series_categories"]:
self.nextJob(_("Processing series data..."), self.loadSeries)
else:
self.finished()
return

if vod_categories and self.vod_streams:
x = 0
Expand Down Expand Up @@ -659,13 +655,11 @@ def loadVod(self):
self.nextJob(_("Downloading series data..."), self.downloadSeries)
else:
self.finished()
return
else:
if glob.current_playlist["settings"]["show_series"] is True and glob.current_playlist["data"]["series_categories"]:
self.nextJob(_("Processing series data..."), self.loadSeries)
else:
self.finished()
return

def loadSeries(self):
stream_list = []
Expand All @@ -676,7 +670,6 @@ def loadSeries(self):
# Return if there are no series categories or if all categories are hidden
if not series_categories or len(series_categories) == len(glob.current_playlist["data"]["series_categories_hidden"]):
self.finished()
return

# Sort series categories alphabetically
if series_categories and glob.current_playlist["settings"]["vod_category_order"] == "alphabetical":
Expand All @@ -700,7 +693,6 @@ def loadSeries(self):
if series_simple_result and "#EXTM3U" in str(series_simple_result):
self.session.open(MessageBox, _("Your provider does not have the 'simple' API call\nUnable to build series.\nAlternative method might be added in the future."), MessageBox.TYPE_INFO, timeout=10)
self.finished()
return

max_series_count = int(cfg.max_series.value)
series_url_name_list = []
Expand Down Expand Up @@ -848,7 +840,6 @@ def loadSeries(self):
self["progress"].setValue(self.progress_value)

self.finished()
return

def parseM3u8Playlist(self, response=None):
self.live_streams, self.vod_streams, self.series_streams = parsem3u.parseM3u8Playlist(response)
Expand Down Expand Up @@ -968,8 +959,6 @@ def exit(self, answer=None):
self.close(True)

def updateJson(self):
self.playlists_all = bmx.getPlaylistJson()

if self.playlists_all:
x = 0
for playlists in self.playlists_all:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ def buildListEntry(self, index, name, url, expires, status, active, activenum, m
return (index, str(name), str(url), str(expires), str(status), pixmap, str(active), str(activenum), str(maxc), str(maxnum), str(fullurl), str(playlist_type))

def quit(self):
self.clearSeries()
self.close()

def deleteServer(self, answer=None):
Expand Down Expand Up @@ -563,17 +562,4 @@ def checkOnePlaylist(self):

def exit(self, answer=None):
if glob.finished and cfg.auto_close.getValue() is True:
self.clearSeries()
self.close(True)

def clearSeries(self):
if self.playlists_all:
x = 0
for playlists in self.playlists_all:
self.playlists_all[x]["data"]["live_streams"] = []
self.playlists_all[x]["data"]["vod_streams"] = []
self.playlists_all[x]["data"]["series_streams"] = []
x += 1

with open(playlists_json, "w") as f:
json.dump(self.playlists_all, f)
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def processFiles():
epg_alternative = False
epg_alternative_url = ""

next_days = 0
next_days = "0"

directsource = "Standard"

Expand Down Expand Up @@ -227,7 +227,7 @@ def processFiles():
if "vod_stream_order" not in playlist["settings"]:
playlist["settings"]["vod_stream_order"] = vod_stream_order

if "next_days" not in playlist["settings"]:
if ("next_days" not in playlist["settings"]) or ("next_days" in playlist["settings"] and playlist["settings"]["next_days"] == 0):
playlist["settings"]["next_days"] = next_days

playlist["playlist_info"]["name"] = name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,11 @@ def makeUrlList(self):
player_api = str(glob.current_playlist["playlist_info"]["player_api"])

self.xmltv_api = str(glob.current_playlist["playlist_info"]["xmltv_api"])
if glob.current_playlist["settings"]["next_days"] != "0":
self.xmltv_api = str(glob.current_playlist["playlist_info"]["xmltv_api"]) + "&next_days=" + str(glob.current_playlist["settings"]["next_days"])
try:
if "next_days" in glob.current_playlist["settings"] and glob.current_playlist["settings"]["next_days"] != "0":
self.xmltv_api = str(glob.current_playlist["playlist_info"]["xmltv_api"]) + "&next_days=" + str(glob.current_playlist["settings"]["next_days"])
except:
pass

self.username = glob.current_playlist["playlist_info"]["username"]
self.password = glob.current_playlist["playlist_info"]["password"]
Expand Down Expand Up @@ -1045,8 +1048,6 @@ def finished(self):
self.loopPlaylists()

def updateJson(self):
self.playlists_all = bmx.getPlaylistJson()

if self.playlists_all:
x = 0
for playlists in self.playlists_all:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.14-20240327
1.15-20240331
2 changes: 1 addition & 1 deletion CONTROL/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: enigma2-plugin-extensions-bouquetmakerxtream
Version: 1.14-20240327
Version: 1.15-20240331
Section: misc
Priority: optional
Architecture: all
Expand Down

0 comments on commit ad6c593

Please sign in to comment.