mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-03-06 12:31:57 +01:00
test implementation of remove all unavailable iptv streams
This commit is contained in:
@@ -117,6 +117,7 @@ class MainAppWindow:
|
||||
"on_service_edit": self.on_service_edit,
|
||||
"on_services_add_new": self.on_services_add_new,
|
||||
"on_iptv": self.on_iptv,
|
||||
"on_remove_all_unavailable": self.on_remove_all_unavailable,
|
||||
"on_fav_iptv_mode": self.on_fav_iptv_mode,
|
||||
"on_drawing_area_realize": self.on_drawing_area_realize,
|
||||
"on_player_press": self.on_player_press,
|
||||
@@ -953,10 +954,7 @@ class MainAppWindow:
|
||||
if path:
|
||||
row = self._fav_model[path][:]
|
||||
if row[5] == BqServiceType.IPTV.value:
|
||||
profile = Profile(self._profile)
|
||||
data = row[7].split(":" if profile is Profile.ENIGMA_2 else "::")
|
||||
url = data[-3 if profile is Profile.ENIGMA_2 else 0]
|
||||
url = url.replace("%3a", ":") if profile is Profile.ENIGMA_2 else url
|
||||
url = self.get_iptv_url(row)
|
||||
if not url:
|
||||
return
|
||||
|
||||
@@ -975,6 +973,33 @@ class MainAppWindow:
|
||||
self._is_played = True
|
||||
self._player.play()
|
||||
|
||||
def get_iptv_url(self, row):
|
||||
profile = Profile(self._profile)
|
||||
data = row[7].split(":" if profile is Profile.ENIGMA_2 else "::")
|
||||
url = data[-3 if profile is Profile.ENIGMA_2 else 0]
|
||||
|
||||
return url.replace("%3a", ":") if profile is Profile.ENIGMA_2 else url
|
||||
|
||||
@run_idle
|
||||
def on_remove_all_unavailable(self, item):
|
||||
from urllib.request import Request, urlopen
|
||||
from urllib.error import URLError
|
||||
|
||||
to_delete = []
|
||||
for row in self._fav_model:
|
||||
if row[5] == BqServiceType.IPTV.value:
|
||||
url = self.get_iptv_url(row)
|
||||
req = Request(url)
|
||||
try:
|
||||
urlopen(req)
|
||||
except URLError as e:
|
||||
to_delete.append(self._fav_model.get_iter(row.path))
|
||||
|
||||
bq_selected = self.get_selected_bouquet()
|
||||
if bq_selected:
|
||||
fav_bouquet = self._bouquets.get(bq_selected, None)
|
||||
self.remove_favs(fav_bouquet, to_delete, self._fav_model)
|
||||
|
||||
def on_player_stop(self, item):
|
||||
if self._player:
|
||||
self._player.stop()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<!-- Generated with glade 3.19.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<object class="GtkMenu" id="bouquets_popup_menu">
|
||||
@@ -112,6 +112,11 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-find</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-remove</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="insert_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
@@ -271,6 +276,16 @@
|
||||
<signal name="activate" handler="on_iptv" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="fav_remove_all_unavailable_popup_item">
|
||||
<property name="label" translatable="yes">Remove all unavailable</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="image">image1</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_remove_all_unavailable" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
Reference in New Issue
Block a user