Skip to content

Commit

Permalink
fixed list index if going off screen, fixed a 0.0 rating error on vod…
Browse files Browse the repository at this point in the history
…, fixed startmenu playlist if non active lists in your files
  • Loading branch information
kiddac committed Nov 13, 2024
1 parent ddc14dd commit 7fe39b7
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 16 deletions.
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-xklass
Version: 1.19-20241112
Version: 1.20-20241113
Section: misc
Priority: optional
Architecture: all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,18 +319,21 @@ def refresh(self):
self["category_actions"].setEnabled(True)
self["channel_actions"].setEnabled(False)
self["menu_actions"].setEnabled(False)
if self.level == 2:
elif self.level == 2:
self["category_actions"].setEnabled(False)
self["channel_actions"].setEnabled(True)
self["menu_actions"].setEnabled(False)

sameplaylist = True

if self.original_active_playlist["playlist_info"]["full_url"] != glob.active_playlist["playlist_info"]["full_url"]:
if self.level == 1:
self.reset()
if self.level == 2:
elif self.level == 2:
self.back()
self.reset()
glob.active_playlist["data"]["live_streams"] = []
sameplaylist = False

self.initGlobals()

Expand All @@ -344,6 +347,9 @@ def refresh(self):

self.createSetup()

if sameplaylist:
self["main_list"].setIndex(glob.refresh_index)

def makeUrlList(self):
self.url_list = []

Expand Down Expand Up @@ -1292,6 +1298,7 @@ def showPopupMenu(self):
if self.selectedlist == self["epg_short_list"]:
self.back()
from . import channelmenu
glob.refresh_index = self["main_list"].getIndex()
glob.current_list = self.prelist + self.list1 if self.level == 1 else self.list2
glob.current_level = self.level
glob.current_screen = "catchup"
Expand Down
11 changes: 9 additions & 2 deletions XKlass/usr/lib/enigma2/python/Plugins/Extensions/XKlass/live.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,18 +360,21 @@ def refresh(self):
self["category_actions"].setEnabled(True)
self["channel_actions"].setEnabled(False)
self["menu_actions"].setEnabled(False)
if self.level == 2:
elif self.level == 2:
self["category_actions"].setEnabled(False)
self["channel_actions"].setEnabled(True)
self["menu_actions"].setEnabled(False)

sameplaylist = True

if self.original_active_playlist["playlist_info"]["full_url"] != glob.active_playlist["playlist_info"]["full_url"]:
if self.level == 1:
self.reset()
if self.level == 2:
elif self.level == 2:
self.back()
self.reset()
glob.active_playlist["data"]["live_streams"] = []
sameplaylist = False

self.initGlobals()

Expand All @@ -385,6 +388,9 @@ def refresh(self):

self.createSetup()

if sameplaylist:
self["main_list"].setIndex(glob.refresh_index)

def makeUrlList(self):
# print("*** makeurllist ***")
self.url_list = []
Expand Down Expand Up @@ -1879,6 +1885,7 @@ def closeChoiceBoxDialog(self, Answer=None):

def showPopupMenu(self):
from . import channelmenu
glob.refresh_index = self["main_list"].getIndex()
glob.current_list = self.prelist + self.list1 if self.level == 1 else self.list2
glob.current_level = self.level
if self.level == 1 or (self.level == 2 and self.chosen_category not in ["favourites", "recents"]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ def refresh(self):
self["channel_actions"].setEnabled(True)
self["menu_actions"].setEnabled(False)

sameplaylist = True

if (self.original_active_playlist["playlist_info"]["full_url"] != glob.active_playlist["playlist_info"]["full_url"]) or self.tmdbsetting != cfg.TMDB.value:
if self.level == 1:
self.reset()
Expand All @@ -365,6 +367,7 @@ def refresh(self):
self.back()
self.back()
self.reset()
sameplaylist = True

self.initGlobals()

Expand All @@ -380,6 +383,9 @@ def refresh(self):

self.createSetup()

if sameplaylist:
self["main_list"].setIndex(glob.refresh_index)

def makeUrlList(self):
# print("*** makeurllist ***")
self.url_list = []
Expand Down Expand Up @@ -1393,7 +1399,7 @@ def processTMDBDetails(self, result=None):
if "vote_average" in self.tmdbdetails and self.tmdbdetails["vote_average"]:
rating_str = str(self.tmdbdetails["vote_average"])

if rating_str is not None and float(rating_str) != 0:
if rating_str not in [None, 0, 0.0, "0", "0.0"]:
try:
rating = float(rating_str)
rounded_rating = round(rating, 1)
Expand Down Expand Up @@ -2550,6 +2556,7 @@ def closeChoiceBoxDialog(self, Answer=None):

def showPopupMenu(self):
from . import channelmenu
glob.refresh_index = self["main_list"].getIndex()
glob.current_list = self.prelist + self.list1 if self.level == 1 else self.list2
glob.current_level = self.level
glob.current_screen = "series"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,20 +425,32 @@ def createSetupPlaylists(self):

def set_last_playlist(self):
# print("*** set_last_playlist ***")
for p, playlist in enumerate(self.playlists_all):
p = 0

for playlist in self.playlists_all:
playlist_name = playlist["playlist_info"]["name"]

if "user_info" in playlist and "status" in playlist["user_info"]:
status = playlist["user_info"]["status"]
# Check if playlist matches the default
if playlist_name == cfg.lastplaylist.value and any(playlist_name == item[1] for item in self.list2) and status == "Active":

if (
playlist_name == cfg.lastplaylist.value
and any(playlist_name == item[1] for item in self.list2)
and status == "Active"
):

glob.active_playlist = playlist
glob.current_selection = p
glob.active_playlist["data"]["live_streams"] = []

self.original_active_playlist = glob.active_playlist
return

# If no match found, fall back to the first playlist in list2
if status == "Active":
p += 1

fallback_playlist_name = self.list2[0][1]

for p, playlist in enumerate(self.playlists_all):
playlist_name = playlist["playlist_info"]["name"]
if playlist_name == fallback_playlist_name:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.19-20241112
1.20-20241113
21 changes: 16 additions & 5 deletions XKlass/usr/lib/enigma2/python/Plugins/Extensions/XKlass/vod.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,15 @@ def refresh(self):
self["channel_actions"].setEnabled(True)
self["menu_actions"].setEnabled(False)

sameplaylist = True

if self.original_active_playlist["playlist_info"]["full_url"] != glob.active_playlist["playlist_info"]["full_url"]:
if self.level == 1:
self.reset()
elif self.level == 2:
self.back()
self.reset()
sameplaylist = False

self.initGlobals()

Expand All @@ -367,6 +370,9 @@ def refresh(self):

self.createSetup()

if sameplaylist:
self["main_list"].setIndex(glob.refresh_index)

def makeUrlList(self):
# print("*** makeurllist ***")
self.url_list = []
Expand Down Expand Up @@ -1203,13 +1209,16 @@ def processTMDBDetails(self, result=None):

if "vote_average" in self.tmdbdetails:
rating_str = self.tmdbdetails["vote_average"]
if rating_str and rating_str != 0:
if rating_str not in [None, 0, 0.0, "0", "0.0"]:
try:
rating = float(rating_str)
rounded_rating = round(rating, 1)
self.tmdbresults["rating"] = "{:.1f}".format(rounded_rating)
except ValueError:
self.tmdbresults["rating"] = str(rating_str)
except ValueError as e:
print("*** rating1 error ***", e)
self.tmdbresults["rating"] = 0
else:
self.tmdbresults["rating"] = 0

if "genres" in self.tmdbdetails and self.tmdbdetails["genres"]:
genre = " / ".join(str(genreitem["name"]) for genreitem in self.tmdbdetails["genres"][:4])
Expand Down Expand Up @@ -1272,7 +1281,7 @@ def displayTMDB(self):
if self.tmdbresults:
info = self.tmdbresults

rating = float(info.get("rating", 0))
rating = info.get("rating", 0)

rating_texts = {
(0.0, 0.0): "",
Expand Down Expand Up @@ -1313,7 +1322,8 @@ def displayTMDB(self):
rating = float(rating)
rounded_rating = round(rating, 1)
rating = "{:.1f}".format(rounded_rating)
except ValueError:
except Exception as e:
print("*** rating2 error ***", e)
pass

self["rating_text"].setText(str(rating).strip())
Expand Down Expand Up @@ -2217,6 +2227,7 @@ def closeChoiceBoxDialog(self, Answer=None):

def showPopupMenu(self):
from . import channelmenu
glob.refresh_index = self["main_list"].getIndex()
glob.current_list = self.prelist + self.list1 if self.level == 1 else self.list2
glob.current_level = self.level
if self.level == 1 or (self.level == 2 and self.chosen_category not in ["favourites", "recents"]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@
current_level = None
current_screen = None
previous_screen = None
refresh_index = 0

0 comments on commit 7fe39b7

Please sign in to comment.