mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-01-26 01:10:11 +01:00
playback support from the main list
This commit is contained in:
@@ -3322,18 +3322,21 @@ class Application(Gtk.Application):
|
||||
if srv_type == BqServiceType.IPTV.name:
|
||||
return srv.fav_id.strip()
|
||||
elif srv.picon_id:
|
||||
ref = srv.picon_id.rstrip(".png").replace("_", ":")
|
||||
if self._s_type is SettingsType.ENIGMA_2:
|
||||
return ref
|
||||
elif self._s_type is SettingsType.NEUTRINO_MP:
|
||||
# It may require some correction for cable and terrestrial channels!
|
||||
try:
|
||||
pos, freq = int(self.get_pos_num(srv.pos)) * 10, int(srv.freq)
|
||||
tid, nid, sid = int(ref[: -8], 16), int(ref[-8: -4], 16), int(srv.ssid, 16)
|
||||
except ValueError:
|
||||
log(f"Error getting reference for: {srv}")
|
||||
else:
|
||||
return format((pos + freq * 4 << 48 | tid << 32 | nid << 16 | sid), "x")
|
||||
return self.get_service_ref_data(srv)
|
||||
|
||||
def get_service_ref_data(self, srv):
|
||||
ref = srv.picon_id.rstrip(".png").replace("_", ":")
|
||||
if self._s_type is SettingsType.ENIGMA_2:
|
||||
return ref
|
||||
elif self._s_type is SettingsType.NEUTRINO_MP:
|
||||
# It may require some correction for cable and terrestrial channels!
|
||||
try:
|
||||
pos, freq = int(self.get_pos_num(srv.pos)) * 10, int(srv.freq)
|
||||
tid, nid, sid = int(ref[: -8], 16), int(ref[-8: -4], 16), int(srv.ssid, 16)
|
||||
except ValueError:
|
||||
log(f"Error getting reference for: {srv}")
|
||||
else:
|
||||
return format((pos + freq * 4 << 48 | tid << 32 | nid << 16 | sid), "x")
|
||||
|
||||
def update_info(self, req, cb):
|
||||
""" Updating current info over HTTP API. """
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2018-2021 Dmitriy Yefremov
|
||||
# Copyright (c) 2018-2022 Dmitriy Yefremov
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -118,6 +118,27 @@ class PlayerBox(Gtk.Box):
|
||||
if not self._app.http_api:
|
||||
return
|
||||
|
||||
view = self._app.services_view
|
||||
path, column = view.get_cursor()
|
||||
if path:
|
||||
srv = self._app.current_services.get(view.get_model()[path][Column.SRV_FAV_ID], None)
|
||||
if not srv or not srv.picon_id:
|
||||
return
|
||||
|
||||
ref = self._app.get_service_ref_data(srv)
|
||||
s_type = self._app.app_settings.setting_type
|
||||
error_msg = "No connection to the receiver!"
|
||||
if s_type is SettingsType.ENIGMA_2:
|
||||
def zap(rq):
|
||||
self.on_watch() if rq and rq.get("e2state", False) else self.on_error(None, error_msg)
|
||||
|
||||
self._app.http_api.send(HttpAPI.Request.ZAP, ref, zap)
|
||||
elif self._s_type is SettingsType.NEUTRINO_MP:
|
||||
def zap(rq):
|
||||
self.on_watch() if rq and rq.get("data", None) == "ok" else self.on_error(None, error_msg)
|
||||
|
||||
self._app.http_api.send(HttpAPI.Request.N_ZAP, f"?{ref}", zap)
|
||||
|
||||
def on_iptv_clicked(self, app, mode):
|
||||
if not self._app.http_api:
|
||||
return
|
||||
@@ -283,7 +304,7 @@ class PlayerBox(Gtk.Box):
|
||||
if click_mode is FavClickMode.PLAY:
|
||||
self.on_play_service()
|
||||
elif click_mode is FavClickMode.ZAP_PLAY:
|
||||
self.on_zap(self.on_watch)
|
||||
self._app.on_zap(self.on_watch)
|
||||
elif click_mode is FavClickMode.STREAM:
|
||||
self.on_play_stream()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user