Skip to content

Commit 32f61c5

Browse files
committed
1.36-20241208 - python 2.7 fixes
1 parent 48811e3 commit 32f61c5

File tree

5 files changed

+96
-89
lines changed

5 files changed

+96
-89
lines changed

BouquetMakerXtream/usr/lib/enigma2/python/Plugins/Extensions/BouquetMakerXtream/buildbouquets.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,22 @@ def deleteExistingRefs(self):
109109
f.seek(0)
110110
f.truncate()
111111

112-
# Patterns to skip
113-
patterns_to_skip = [
114-
"bouquetmakerxtream_live_" + self.safe_name + "_",
115-
"bouquetmakerxtream_vod_" + self.safe_name + "_",
116-
"bouquetmakerxtream_series_" + self.safe_name + "_",
117-
"bouquetmakerxtream_" + self.safe_name + ".tv",
118-
"bouquetmakerxtream_live_" + self.old_name + "_",
119-
"bouquetmakerxtream_vod_" + self.old_name + "_",
120-
"bouquetmakerxtream_series_" + self.old_name + "_",
121-
"bouquetmakerxtream_" + self.old_name + ".tv"
122-
]
123-
124112
for line in lines:
125-
if any(pattern in line for pattern in patterns_to_skip):
113+
if "bouquetmakerxtream_live_" + str(self.safe_name) + "_" in line:
114+
continue
115+
if "bouquetmakerxtream_vod_" + str(self.safe_name) + "_" in line:
116+
continue
117+
if "bouquetmakerxtream_series_" + str(self.safe_name) + "_" in line:
118+
continue
119+
if "bouquetmakerxtream_" + str(self.safe_name) + ".tv" in line:
120+
continue
121+
if "bouquetmakerxtream_live_" + str(self.old_name) + "_" in line:
122+
continue
123+
if "bouquetmakerxtream_vod_" + str(self.old_name) + "_" in line:
124+
continue
125+
if "bouquetmakerxtream_series_" + str(self.old_name) + "_" in line:
126+
continue
127+
if "bouquetmakerxtream_" + str(self.old_name) + ".tv" in line:
126128
continue
127129
f.write(line)
128130

@@ -169,11 +171,11 @@ def makeUrlList(self):
169171
if glob.current_playlist["playlist_info"]["playlist_type"] == "xtream":
170172
player_api = str(glob.current_playlist["playlist_info"]["player_api"])
171173
self.xmltv_api = str(glob.current_playlist["playlist_info"]["xmltv_api"])
172-
173-
next_days = glob.current_playlist["settings"].get("next_days", "0")
174-
175-
if next_days != "0":
176-
self.xmltv_api += "&next_days=" + str(next_days)
174+
try:
175+
if "next_days" in glob.current_playlist["settings"] and glob.current_playlist["settings"]["next_days"] != "0":
176+
self.xmltv_api = str(glob.current_playlist["playlist_info"]["xmltv_api"]) + "&next_days=" + str(glob.current_playlist["settings"]["next_days"])
177+
except:
178+
pass
177179

178180
self.username = glob.current_playlist["playlist_info"]["username"]
179181
self.password = glob.current_playlist["playlist_info"]["password"]

BouquetMakerXtream/usr/lib/enigma2/python/Plugins/Extensions/BouquetMakerXtream/globalfunctions.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/python
22
# -*- coding: utf-8 -*-
33

4-
from .plugin import playlists_json, cfg
4+
from .plugin import playlists_json, cfg, pythonVer
55

66
from enigma import eDVBDB
77
from requests.adapters import HTTPAdapter
@@ -154,7 +154,11 @@ def downloadUrlMulti(url, output_file=None):
154154

155155

156156
def safeName(name):
157-
name = name.encode("ascii", errors="ignore").decode()
157+
if pythonVer == 2:
158+
name = name.decode("utf-8", "ignore").encode("ascii", "ignore")
159+
elif pythonVer == 3:
160+
name = name.encode("ascii", "ignore").decode("ascii")
161+
158162
name = re.sub(r"[\<\>\:\"\/\\\|\?\*]", "_", str(name))
159163
name = re.sub(r" ", "_", name)
160164
name = re.sub(r"_+", "_", name)

BouquetMakerXtream/usr/lib/enigma2/python/Plugins/Extensions/BouquetMakerXtream/update.py

Lines changed: 68 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -42,44 +42,40 @@ def __init__(self, session, runtype):
4242
with open(skin, "r") as f:
4343
self.skin = f.read()
4444
else:
45-
current_width = screenwidth.width()
46-
if current_width <= 1280:
47-
self.skin = """
45+
skin = """
46+
<screen name="Updater" position="0,0" size="1920,1080" backgroundColor="#ff000000" flags="wfNoBorder">
47+
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/BouquetMakerXtream/icons/plugin-icon.png" position="30,25" size="150,60" alphatest="blend" zPosition="4" />
48+
<eLabel position="180,30" size="360,50" backgroundColor="#10232323" transparent="0" zPosition="-1"/>
49+
<widget name="status" position="210,30" size="300,50" font="Regular;24" foregroundColor="#ffffff" backgroundColor="#000000" valign="center" noWrap="1" transparent="1" zPosition="5" />
50+
</screen>"""
51+
52+
if screenwidth.width() <= 1280:
53+
skin = """
4854
<screen name="Updater" position="0,0" size="1280,720" backgroundColor="#ff000000" flags="wfNoBorder">
4955
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/BouquetMakerXtream/icons/plugin-icon_sd.png" position="20,16" size="100,40" alphatest="blend" zPosition="4" />
5056
<eLabel position="120,20" size="240,32" backgroundColor="#10232323" transparent="0" zPosition="-1"/>
5157
<widget name="status" position="140,20" size="200,32" font="Regular;16" foregroundColor="#ffffff" backgroundColor="#000000" valign="center" noWrap="1" transparent="1" zPosition="5" />
5258
</screen>"""
53-
else:
54-
self.skin = """
55-
<screen name="Updater" position="0,0" size="1920,1080" backgroundColor="#ff000000" flags="wfNoBorder">
56-
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/BouquetMakerXtream/icons/plugin-icon.png" position="30,25" size="150,60" alphatest="blend" zPosition="4" />
57-
<eLabel position="180,30" size="360,50" backgroundColor="#10232323" transparent="0" zPosition="-1"/>
58-
<widget name="status" position="210,30" size="300,50" font="Regular;24" foregroundColor="#ffffff" backgroundColor="#000000" valign="center" noWrap="1" transparent="1" zPosition="5" />
59-
</screen>"""
59+
60+
self.skin = skin
6061

6162
self.setup_title = _("Building Bouquets")
6263
self.categories = []
63-
self.live_categories = ""
64-
self.vod_categories = ""
65-
self.series_categories = ""
66-
self.live_streams = ""
67-
self.vod_streams = ""
68-
self.series_streams = ""
64+
self["action"] = Label("")
65+
self["info"] = Label("")
66+
self["status"] = Label("")
67+
self["progress"] = ProgressBar()
68+
6969
self.bouq = 0
7070

71+
if self.runtype == "manual":
72+
self["action"] = Label(_("Building Bouquets..."))
73+
7174
self["actions"] = ActionMap(["BMXActions"], {
7275
"red": self.void,
7376
"cancel": self.void,
7477
}, -2)
7578

76-
if self.runtype == "manual":
77-
self["action"] = Label(_("Building Bouquets..."))
78-
self["info"] = Label("")
79-
self["progress"] = ProgressBar()
80-
81-
self["status"] = Label("")
82-
8379
self.playlists_all = bmx.getPlaylistJson()
8480

8581
if self.playlists_all:
@@ -89,7 +85,7 @@ def __init__(self, session, runtype):
8985
self.bouquets = []
9086
self.bouquets_len = 0
9187

92-
if self.bouquets and epgimporter:
88+
if self.bouquets:
9389
self.looptimer = eTimer()
9490
try:
9591
self.looptimer_conn = self.looptimer.timeout.connect(self.bouquetLoop)
@@ -112,38 +108,38 @@ def loopPlaylists(self):
112108
self.done()
113109

114110
def bouquetLoop(self):
115-
self.live_categories = []
116-
self.vod_categories = []
117-
self.series_categories = []
118-
self.live_streams = []
119-
self.vod_streams = []
120-
self.series_streams = []
111+
glob.current_playlist = self.bouquets[self.bouq]
121112

122-
if self.bouquets:
123-
glob.current_playlist = self.bouquets[self.bouq]
113+
self.bouquet_tv = False
114+
self.userbouquet = False
115+
self.total_count = 0
116+
self.unique_ref = 0
117+
self.progress_value = 0
118+
self.progress_range = 0
124119

125-
self.bouquet_tv = False
126-
self.userbouquet = False
127-
self.total_count = 0
128-
self.unique_ref = 0
129-
self.progress_value = 0
130-
self.progress_range = 0
120+
if glob.current_playlist["playlist_info"]["playlist_type"] == "xtream":
121+
if glob.current_playlist["settings"]["show_live"] is True:
122+
self.progress_range += 2
131123

132-
if glob.current_playlist["playlist_info"]["playlist_type"] == "xtream":
133-
self.progress_range += 2 * sum([
134-
glob.current_playlist["settings"]["show_live"],
135-
glob.current_playlist["settings"]["show_vod"],
136-
glob.current_playlist["settings"]["show_series"]
137-
])
138-
else:
139-
self.progress_range += 1 # Base range for non-xtream playlists
140-
self.progress_range += sum([
141-
glob.current_playlist["settings"]["show_live"],
142-
glob.current_playlist["settings"]["show_vod"],
143-
glob.current_playlist["settings"]["show_series"]
144-
])
124+
if glob.current_playlist["settings"]["show_vod"] is True:
125+
self.progress_range += 2
145126

146-
self.start()
127+
if glob.current_playlist["settings"]["show_series"] is True:
128+
self.progress_range += 2
129+
130+
else:
131+
self.progress_range += 1
132+
133+
if glob.current_playlist["settings"]["show_live"] is True:
134+
self.progress_range += 1
135+
136+
if glob.current_playlist["settings"]["show_vod"] is True:
137+
self.progress_range += 1
138+
139+
if glob.current_playlist["settings"]["show_series"] is True:
140+
self.progress_range += 1
141+
142+
self.start()
147143

148144
def nextJob(self, actiontext, function):
149145
if self.runtype == "manual":
@@ -162,7 +158,6 @@ def start(self):
162158
self["progress"].setValue(self.progress_value)
163159

164160
self.safe_name = bmx.safeName(glob.current_playlist["playlist_info"]["name"])
165-
166161
self["status"].setText(_("Updating Playlist %d of %d") % (self.bouq + 1, self.bouquets_len))
167162
self.deleteExistingRefs()
168163

@@ -172,16 +167,14 @@ def deleteExistingRefs(self):
172167
f.seek(0)
173168
f.truncate()
174169

175-
# Patterns to skip
176-
patterns_to_skip = [
177-
"bouquetmakerxtream_live_" + self.safe_name + "_",
178-
"bouquetmakerxtream_vod_" + self.safe_name + "_",
179-
"bouquetmakerxtream_series_" + self.safe_name + "_",
180-
"bouquetmakerxtream_" + self.safe_name + ".tv"
181-
]
182-
183170
for line in lines:
184-
if any(pattern in line for pattern in patterns_to_skip):
171+
if "bouquetmakerxtream_live_" + str(self.safe_name) + "_" in line:
172+
continue
173+
if "bouquetmakerxtream_vod_" + str(self.safe_name) + "_" in line:
174+
continue
175+
if "bouquetmakerxtream_series_" + str(self.safe_name) + "_" in line:
176+
continue
177+
if "bouquetmakerxtream_" + str(self.safe_name) + ".tv" in line:
185178
continue
186179
f.write(line)
187180

@@ -222,11 +215,11 @@ def makeUrlList(self):
222215
if glob.current_playlist["playlist_info"]["playlist_type"] == "xtream":
223216
player_api = str(glob.current_playlist["playlist_info"]["player_api"])
224217
self.xmltv_api = str(glob.current_playlist["playlist_info"]["xmltv_api"])
225-
226-
next_days = glob.current_playlist["settings"].get("next_days", "0")
227-
228-
if next_days != "0":
229-
self.xmltv_api += "&next_days=" + str(next_days)
218+
try:
219+
if "next_days" in glob.current_playlist["settings"] and glob.current_playlist["settings"]["next_days"] != "0":
220+
self.xmltv_api = str(glob.current_playlist["playlist_info"]["xmltv_api"]) + "&next_days=" + str(glob.current_playlist["settings"]["next_days"])
221+
except:
222+
pass
230223

231224
self.username = glob.current_playlist["playlist_info"]["username"]
232225
self.password = glob.current_playlist["playlist_info"]["password"]
@@ -313,6 +306,14 @@ def processDownloads(self, stream_type, outputtype=None):
313306
output_file = '/var/volatile/tmp/bouquetmakerxtream/temp'
314307

315308
for url in self.url_list:
309+
310+
self.live_categories = []
311+
self.vod_categories = []
312+
self.series_categories = []
313+
self.live_streams = []
314+
self.vod_streams = []
315+
self.series_streams = []
316+
316317
if outputtype == "json":
317318
result = bmx.downloadUrlCategory(url)
318319
else:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.35-20241207
1+
1.36-20241208

CONTROL/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: enigma2-plugin-extensions-bouquetmakerxtream
2-
Version: 1.35-20241207
2+
Version: 1.36-20241208
33
Section: misc
44
Priority: optional
55
Architecture: all

0 commit comments

Comments
 (0)