mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-05-09 11:36:20 +02:00
Compare commits
33 Commits
1.0.7-a1-w
...
1.0.10-b1-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7732806fc3 | ||
|
|
45d01397ce | ||
|
|
909bf81ea4 | ||
|
|
58d59e472c | ||
|
|
b82132c7b1 | ||
|
|
cb3dbde620 | ||
|
|
f98503b62b | ||
|
|
01b0b6f7f0 | ||
|
|
bca138993a | ||
|
|
a7a2809028 | ||
|
|
42d50572d5 | ||
|
|
123e14b250 | ||
|
|
b0d4c5de1b | ||
|
|
00a0cab1aa | ||
|
|
1d30f5f43c | ||
|
|
7e3c7e5def | ||
|
|
bed94f0bd3 | ||
|
|
737b3ec896 | ||
|
|
21d96cef3d | ||
|
|
9da5db3e63 | ||
|
|
c2c0215c74 | ||
|
|
a9666ba735 | ||
|
|
5d324425c5 | ||
|
|
2c0be17738 | ||
|
|
0589e0bbf5 | ||
|
|
a3b33b2bac | ||
|
|
ce912631b1 | ||
|
|
7801c50ae4 | ||
|
|
89e2d0d72c | ||
|
|
e076bfffce | ||
|
|
06f110c29a | ||
|
|
c4d2b7747a | ||
|
|
df4e8a2520 |
@@ -68,7 +68,8 @@ app = BUNDLE(coll,
|
||||
'CFBundleDisplayName': 'DemonEditor',
|
||||
'CFBundleGetInfoString': "Enigma2 channel and satellites editor",
|
||||
'LSApplicationCategoryType': 'public.app-category.utilities',
|
||||
'CFBundleShortVersionString': "1.0.7 Beta (Build: {})".format(BUILD_DATE),
|
||||
'LSMinimumSystemVersion': '10.13',
|
||||
'CFBundleShortVersionString': "1.0.10 Beta (Build: {})".format(BUILD_DATE),
|
||||
'NSHumanReadableCopyright': u"Copyright © 2021, Dmitriy Yefremov",
|
||||
'NSRequiresAquaSystemAppearance': 'false'
|
||||
})
|
||||
|
||||
36
README.md
36
README.md
@@ -1,26 +1,33 @@
|
||||
# <img src="app/ui/icons/hicolor/96x96/apps/demon-editor.png" width="32" /> DemonEditor
|
||||
[](LICENSE) 
|
||||
## Enigma2 channel and satellite list editor for macOS (experimental).
|
||||
|
||||

|
||||
## Enigma2 channel and satellite list editor for macOS.
|
||||
[<img src="https://user-images.githubusercontent.com/7511379/119127827-76924180-ba3d-11eb-8ba8-1dc3bdc7f191.png" width="655"/>](https://user-images.githubusercontent.com/7511379/119127827-76924180-ba3d-11eb-8ba8-1dc3bdc7f191.png)
|
||||
|
||||
Experimental support of Neutrino-MP or others on the same basis (BPanther, etc).
|
||||
Focused on the convenience of working in lists from the keyboard. The mouse is also fully supported (Drag and Drop etc).
|
||||
**The functionality and performance of this version may be different from the [Linux version](https://github.com/DYefremov/DemonEditor)!**
|
||||
|
||||
## Main features of the program
|
||||
* Editing bouquets, channels, satellites.
|
||||
* Import function.
|
||||
* Backup function.
|
||||
* Editing bouquets, channels, satellites.
|
||||
[<img src="https://user-images.githubusercontent.com/7511379/119127978-b822ec80-ba3d-11eb-8720-e458f0ccf60e.png" width="480"/>](https://user-images.githubusercontent.com/7511379/119127978-b822ec80-ba3d-11eb-8720-e458f0ccf60e.png)
|
||||
* Import function.
|
||||
[<img src="https://user-images.githubusercontent.com/7511379/119128084-d852ab80-ba3d-11eb-8bf9-d40f4f59314b.png" width="480"/>](https://user-images.githubusercontent.com/7511379/119128084-d852ab80-ba3d-11eb-8bf9-d40f4f59314b.png)
|
||||
* Backup function.
|
||||
[<img src="https://user-images.githubusercontent.com/7511379/119128119-e4d70400-ba3d-11eb-88b4-86e6bea21314.png" width="480"/>](https://user-images.githubusercontent.com/7511379/119128119-e4d70400-ba3d-11eb-88b4-86e6bea21314.png)
|
||||
* Support of picons.
|
||||
[<img src="https://user-images.githubusercontent.com/7511379/119128127-e99bb800-ba3d-11eb-93d9-3444b7332778.png" width="480"/>](https://user-images.githubusercontent.com/7511379/119128127-e99bb800-ba3d-11eb-93d9-3444b7332778.png)
|
||||
* Importing services, downloading picons and updating satellites from the Web.
|
||||
[<img src="https://user-images.githubusercontent.com/7511379/119128104-de488c80-ba3d-11eb-800c-e070f476f6a8.png" width="250"/>](https://user-images.githubusercontent.com/7511379/119128104-de488c80-ba3d-11eb-800c-e070f476f6a8.png)
|
||||
[<img src="https://user-images.githubusercontent.com/7511379/119128066-d2f56100-ba3d-11eb-864a-bf2c22c74d5e.png" width="259"/>](https://user-images.githubusercontent.com/7511379/119128066-d2f56100-ba3d-11eb-864a-bf2c22c74d5e.png)
|
||||
* Extended support of IPTV.
|
||||
* Support of picons.
|
||||
* Importing services, downloading picons and updating satellites from the Web.
|
||||
* Import to bouquet(Neutrino WEBTV) from m3u.
|
||||
* Export of bouquets with IPTV services in m3u.
|
||||
* Assignment of EPGs from DVB or XML for IPTV services (only Enigma2, experimental).
|
||||
* Preview (playback) of IPTV or other streams directly from the bouquet list (should be installed [VLC](https://www.videolan.org/vlc/)).
|
||||
* Control panel with the ability to view EPG and manage timers (via HTTP API, experimental).
|
||||
* Simple FTP client (experimental).
|
||||
* Playback of IPTV or other streams directly from the bouquet list (should be installed [VLC](https://www.videolan.org/vlc/)).
|
||||
* Control panel with the ability to view EPG and manage timers (via HTTP API, experimental).
|
||||
[<img src="https://user-images.githubusercontent.com/7511379/119128157-f28c8980-ba3d-11eb-975e-cdbac32349ed.png" width="480"/>](https://user-images.githubusercontent.com/7511379/119128157-f28c8980-ba3d-11eb-975e-cdbac32349ed.png)
|
||||
* Simple FTP client (experimental).
|
||||
[<img src="https://user-images.githubusercontent.com/7511379/119128176-f7e9d400-ba3d-11eb-813d-08972d103cce.png" width="480"/>](https://user-images.githubusercontent.com/7511379/119128176-f7e9d400-ba3d-11eb-813d-08972d103cce.png)
|
||||
|
||||
#### Keyboard shortcuts
|
||||
* **⌘ + X** - only in bouquet list.
|
||||
@@ -45,15 +52,14 @@ Clipboard is **"rubber"**. There is an accumulation before the insertion!
|
||||
For **multiple** selection with the mouse, press and hold the **⌘** key!
|
||||
|
||||
## Minimum requirements
|
||||
*Python >= 3.5.2, GTK+ >= 3.16 with PyGObject bindings, python3-requests.*
|
||||
*Python >= 3.5.2, GTK+ >= 3.22 with PyGObject bindings, python3-requests.*
|
||||
|
||||
## Installation and Launch
|
||||
To run the program on macOS, you need to install [brew](https://brew.sh/).
|
||||
Then install the required components via terminal:
|
||||
```brew install python3 gtk+3 pygobject3 adwaita-icon-theme```
|
||||
```pip3 install requests```
|
||||
#### Optional:
|
||||
```brew install wget```
|
||||
#### Optional:
|
||||
```pip3 install pillow, pyobjc```
|
||||
|
||||
To start the program, just download the [archive](https://github.com/DYefremov/DemonEditor/archive/experimental-mac.zip), unpack and run it from the terminal
|
||||
@@ -78,7 +84,7 @@ and in the root dir run command:
|
||||
|
||||
```pyinstaller DemonEditor.spec```
|
||||
## Important
|
||||
**This version is not fully tested and has experimental status!**
|
||||
**This version may not be fully tested!**
|
||||
|
||||
Terrestrial(DVB-T/T2) and cable(DVB-C) channels are only supported for Enigma2.
|
||||
Main supported *lamedb* format is version **4**. Versions **3** and **5** has only **experimental** support!
|
||||
|
||||
@@ -510,6 +510,7 @@ class HttpAPI:
|
||||
INFO = "about"
|
||||
SIGNAL = "signal"
|
||||
STREAM = "stream.m3u?ref="
|
||||
STREAM_TS = "ts.m3u?file="
|
||||
STREAM_CURRENT = "streamcurrent.m3u"
|
||||
CURRENT = "getcurrent"
|
||||
TEST = None
|
||||
@@ -531,6 +532,10 @@ class HttpAPI:
|
||||
# Timer
|
||||
TIMER = ""
|
||||
TIMER_LIST = "timerlist"
|
||||
# Recordings
|
||||
RECORDINGS = "movielist?dirname="
|
||||
REC_DIRS = "getlocations"
|
||||
REC_CURRENT = "getcurrlocation"
|
||||
# Screenshot
|
||||
GRUB = "grab?format=jpg&"
|
||||
|
||||
@@ -557,6 +562,17 @@ class HttpAPI:
|
||||
WAKEUP = "4"
|
||||
STANDBY = "5"
|
||||
|
||||
PARAM_REQUESTS = {Request.REMOTE,
|
||||
Request.POWER,
|
||||
Request.VOL,
|
||||
Request.EPG,
|
||||
Request.TIMER,
|
||||
Request.RECORDINGS}
|
||||
|
||||
STREAM_REQUESTS = {Request.STREAM,
|
||||
Request.STREAM_CURRENT,
|
||||
Request.STREAM_TS}
|
||||
|
||||
def __init__(self, settings):
|
||||
from concurrent.futures import ThreadPoolExecutor as PoolExecutor
|
||||
self._executor = PoolExecutor(max_workers=self.__MAX_WORKERS)
|
||||
@@ -577,18 +593,14 @@ class HttpAPI:
|
||||
url = self._base_url + req_type.value
|
||||
data = self._data
|
||||
|
||||
if req_type is self.Request.ZAP or req_type is self.Request.STREAM:
|
||||
if req_type is self.Request.ZAP or req_type in self.STREAM_REQUESTS:
|
||||
url += urllib.parse.quote(ref)
|
||||
elif req_type is self.Request.PLAY or req_type is self.Request.PLAYER_REMOVE:
|
||||
url += "{}{}".format(ref_prefix, urllib.parse.quote(ref).replace("%3A", "%253A"))
|
||||
elif req_type is self.Request.GRUB:
|
||||
data = None # Must be disabled for token-based security.
|
||||
url = "{}/{}{}".format(self._main_url, req_type.value, ref)
|
||||
elif req_type in (self.Request.REMOTE,
|
||||
self.Request.POWER,
|
||||
self.Request.VOL,
|
||||
self.Request.EPG,
|
||||
self.Request.TIMER):
|
||||
elif req_type in self.PARAM_REQUESTS:
|
||||
url += ref
|
||||
|
||||
def done_callback(f):
|
||||
@@ -632,7 +644,7 @@ class HttpAPI:
|
||||
def get_response(req_type, url, data=None):
|
||||
try:
|
||||
with urlopen(Request(url, data=data), timeout=10) as f:
|
||||
if req_type is HttpAPI.Request.STREAM or req_type is HttpAPI.Request.STREAM_CURRENT:
|
||||
if req_type in HttpAPI.STREAM_REQUESTS:
|
||||
return {"m3u": f.read().decode("utf-8")}
|
||||
elif req_type is HttpAPI.Request.GRUB:
|
||||
return {"img_data": f.read()}
|
||||
@@ -648,6 +660,11 @@ def get_response(req_type, url, data=None):
|
||||
elif req_type is HttpAPI.Request.TIMER_LIST:
|
||||
return {"timer_list": [{el.tag: el.text for el in el.iter()} for el in
|
||||
ETree.fromstring(f.read().decode("utf-8")).iter("e2timer")]}
|
||||
elif req_type is HttpAPI.Request.REC_DIRS:
|
||||
return {"rec_dirs": [el.text for el in ETree.fromstring(f.read().decode("utf-8")).iter("e2location")]}
|
||||
elif req_type is HttpAPI.Request.RECORDINGS:
|
||||
return {"recordings": [{el.tag: el.text for el in el.iter()} for el in
|
||||
ETree.fromstring(f.read().decode("utf-8")).iter("e2movie")]}
|
||||
else:
|
||||
return {el.tag: el.text for el in ETree.fromstring(f.read().decode("utf-8")).iter()}
|
||||
except HTTPError as e:
|
||||
|
||||
@@ -1,3 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2018-2021 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
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
# Author: Dmitriy Yefremov
|
||||
#
|
||||
|
||||
from app.commons import run_task
|
||||
from app.settings import SettingsType
|
||||
from .ecommons import Service, Satellite, Transponder, Bouquet, Bouquets, is_transponder_valid
|
||||
@@ -32,6 +59,15 @@ def get_bouquets(path, s_type):
|
||||
return get_neutrino_bouquets(path)
|
||||
|
||||
|
||||
def write_bouquet(path, bq, s_type):
|
||||
if s_type is SettingsType.ENIGMA_2:
|
||||
writer = BouquetsWriter(path, None)
|
||||
writer.write_bouquet(path + "userbouquet.{}.{}".format(bq.name, bq.type), bq.name, bq.services)
|
||||
elif s_type is SettingsType.NEUTRINO_MP:
|
||||
from .neutrino.bouquets import write_bouquet
|
||||
write_bouquet(path, bq)
|
||||
|
||||
|
||||
@run_task
|
||||
def write_bouquets(path, bouquets, s_type, force_bq_names=False):
|
||||
if s_type is SettingsType.ENIGMA_2:
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2018-2021 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
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
# Author: Dmitriy Yefremov
|
||||
#
|
||||
|
||||
|
||||
""" Module for working with Enigma2 bouquets. """
|
||||
import re
|
||||
from collections import Counter
|
||||
@@ -166,6 +194,11 @@ class BouquetsReader:
|
||||
|
||||
for num, srv in enumerate(srvs, start=1):
|
||||
srv_data = srv.strip().split(":")
|
||||
data_len = len(srv_data)
|
||||
if data_len < 10:
|
||||
log("The bouquet [{}] service [{}] has the wrong data format: [{}]".format(bq_name, num, srv))
|
||||
continue
|
||||
|
||||
s_type = srv_data[1]
|
||||
if s_type == "64":
|
||||
m_data, sep, desc = srv.partition("#DESCRIPTION")
|
||||
@@ -186,7 +219,7 @@ class BouquetsReader:
|
||||
else:
|
||||
fav_id = "{}:{}:{}:{}".format(srv_data[3], srv_data[4], srv_data[5], srv_data[6])
|
||||
name = None
|
||||
if len(srv_data) == 12:
|
||||
if data_len == 12:
|
||||
name, sep, desc = str(srv_data[-1]).partition("\n#DESCRIPTION")
|
||||
services.append(BouquetService(name, BqServiceType.DEFAULT, fav_id.upper(), num))
|
||||
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2018-2021 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
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
# Author: Dmitriy Yefremov
|
||||
#
|
||||
|
||||
|
||||
import copy
|
||||
import json
|
||||
import locale
|
||||
@@ -13,6 +41,7 @@ HOME_PATH = str(Path.home())
|
||||
CONFIG_PATH = HOME_PATH + "/.config/demon-editor/"
|
||||
CONFIG_FILE = CONFIG_PATH + "config.json"
|
||||
DATA_PATH = HOME_PATH + "/DemonEditor/data/"
|
||||
GTK_PATH = os.environ.get("GTK_PATH", None)
|
||||
|
||||
IS_DARWIN = sys.platform == "darwin"
|
||||
|
||||
@@ -619,11 +648,14 @@ class Settings:
|
||||
@property
|
||||
@lru_cache(1)
|
||||
def dark_mode(self):
|
||||
import subprocess
|
||||
if IS_DARWIN:
|
||||
import subprocess
|
||||
|
||||
cmd = ["defaults", "read", "-g", "AppleInterfaceStyle"]
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
|
||||
return "Dark" in str(p[0])
|
||||
cmd = ["defaults", "read", "-g", "AppleInterfaceStyle"]
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
|
||||
return "Dark" in str(p[0])
|
||||
|
||||
return self._settings.get("dark_mode", False)
|
||||
|
||||
@dark_mode.setter
|
||||
def dark_mode(self, value):
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2018-2021 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
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
# Author: Dmitriy Yefremov
|
||||
#
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
from abc import ABC, abstractmethod
|
||||
@@ -341,7 +369,7 @@ class VlcPlayer(Player):
|
||||
self._player = vlc.Instance(args).media_player_new()
|
||||
vlc.libvlc_video_set_key_input(self._player, False)
|
||||
vlc.libvlc_video_set_mouse_input(self._player, False)
|
||||
except (OSError, AttributeError) as e:
|
||||
except (OSError, AttributeError, NameError) as e:
|
||||
log("{}: Load library error: {}".format(__class__.__name__, e))
|
||||
raise ImportError("No VLC is found. Check that it is installed!")
|
||||
else:
|
||||
@@ -420,7 +448,7 @@ class VlcPlayer(Player):
|
||||
elif sys.platform == "darwin":
|
||||
self._player.set_nsobject(self.get_window_handle(video_widget))
|
||||
else:
|
||||
log("Video widget initialization error: platform '{}' is not supported. ".format(sys.platform))
|
||||
self._player.set_hwnd(self.get_window_handle(video_widget))
|
||||
|
||||
|
||||
class Recorder:
|
||||
|
||||
@@ -1,14 +1,43 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2018-2021 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
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
# Author: Dmitriy Yefremov
|
||||
#
|
||||
|
||||
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
from collections import namedtuple
|
||||
from html.parser import HTMLParser
|
||||
|
||||
import requests
|
||||
|
||||
from app.commons import run_task, log
|
||||
from app.settings import SettingsType
|
||||
from app.settings import SettingsType, GTK_PATH
|
||||
from .satellites import _HEADERS
|
||||
|
||||
_ENIGMA2_PICON_KEY = "{:X}:{:X}:{}"
|
||||
@@ -18,6 +47,178 @@ Provider = namedtuple("Provider", ["logo", "name", "pos", "url", "on_id", "ssid"
|
||||
Picon = namedtuple("Picon", ["ref", "ssid"])
|
||||
|
||||
|
||||
class PiconsError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class PiconsCzDownloader:
|
||||
""" The main class for loading picons from the https://picon.cz/ source (by Chocholoušek). """
|
||||
|
||||
_PERM_URL = "https://picon.cz/download/7337"
|
||||
_BASE_URL = "https://picon.cz/download/"
|
||||
_BASE_LOGO_URL = "https://picon.cz/picon/0/"
|
||||
_HEADER = {"User-Agent": "DemonEditor/1.0.10", "Referer": ""}
|
||||
_LINK_PATTERN = re.compile(r"((.*)-\d+x\d+)-(.*)_by_chocholousek.7z$")
|
||||
_FILE_PATTERN = re.compile(b"\\s+(1_.*\\.png).*")
|
||||
|
||||
def __init__(self, picon_ids=set(), appender=log):
|
||||
self._perm_links = {}
|
||||
self._providers = {}
|
||||
self._provider_logos = {}
|
||||
self._picon_ids = picon_ids
|
||||
self._appender = appender
|
||||
|
||||
def init(self):
|
||||
""" Initializes dict with values: download_id -> perm link and provider data. """
|
||||
if self._perm_links:
|
||||
return
|
||||
|
||||
self._HEADER["Referer"] = self._PERM_URL
|
||||
|
||||
with requests.get(url=self._PERM_URL, headers=self._HEADER, stream=True) as request:
|
||||
if request.reason == "OK":
|
||||
logo_map = self.get_logos_map()
|
||||
name_map = self.get_name_map()
|
||||
|
||||
for line in request.iter_lines():
|
||||
l_id, perm_link = line.decode(encoding="utf-8", errors="ignore").split(maxsplit=1)
|
||||
self._perm_links[str(l_id)] = str(perm_link)
|
||||
data = re.match(self._LINK_PATTERN, perm_link)
|
||||
if data:
|
||||
sat_pos = data.group(3)
|
||||
# Logo url.
|
||||
logo = logo_map.get(data.group(2), None)
|
||||
l_name = name_map.get(sat_pos, None) or sat_pos.replace(".", "")
|
||||
logo_url = "{}{}/{}.png".format(self._BASE_LOGO_URL, logo, l_name) if logo else None
|
||||
|
||||
prv = Provider(None, data.group(1), sat_pos, self._BASE_URL + l_id, l_id, logo_url, None, False)
|
||||
if sat_pos in self._providers:
|
||||
self._providers[sat_pos].append(prv)
|
||||
else:
|
||||
self._providers[sat_pos] = [prv]
|
||||
else:
|
||||
log("{} [get permalinks] error: {}".format(self.__class__.__name__, request.reason))
|
||||
raise PiconsError(request.reason)
|
||||
|
||||
@property
|
||||
def providers(self):
|
||||
return self._providers
|
||||
|
||||
def get_sat_providers(self, url):
|
||||
return self._providers.get(url, [])
|
||||
|
||||
def download(self, provider, picons_path, picon_ids=None):
|
||||
self._HEADER["Referer"] = provider.url
|
||||
with requests.get(url=provider.url, headers=self._HEADER, stream=True) as request:
|
||||
if request.reason == "OK":
|
||||
dest = "{}{}.7z".format(picons_path, provider.on_id)
|
||||
self._appender("Downloading: {}\n".format(provider.url))
|
||||
with open(dest, mode="bw") as f:
|
||||
for data in request.iter_content(chunk_size=1024):
|
||||
f.write(data)
|
||||
self._appender("Extracting: {}\n".format(provider.on_id))
|
||||
self.extract(dest, picons_path, picon_ids)
|
||||
else:
|
||||
log("{} [download] error: {}".format(self.__class__.__name__, request.reason))
|
||||
|
||||
def extract(self, src, dest, picon_ids=None):
|
||||
""" Extracts 7z archives. """
|
||||
# TODO: think about https://github.com/miurahr/py7zr
|
||||
exe = "./7zr" if GTK_PATH else "7zr"
|
||||
cmd = [exe, "l", src]
|
||||
try:
|
||||
out, err = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
|
||||
if err:
|
||||
log("{} [extract] error: {}".format(self.__class__.__name__, err))
|
||||
raise PiconsError(err)
|
||||
except OSError as e:
|
||||
log("{} [extract] error: {}".format(self.__class__.__name__, e))
|
||||
raise PiconsError(e)
|
||||
|
||||
is_filter = bool(picon_ids)
|
||||
ids = picon_ids or self._picon_ids
|
||||
to_extract = []
|
||||
|
||||
for o in re.finditer(self._FILE_PATTERN, out):
|
||||
p_id = o.group(1).decode("utf-8", errors="ignore")
|
||||
if p_id in ids:
|
||||
to_extract.append(p_id)
|
||||
|
||||
if is_filter and not to_extract:
|
||||
if os.path.isfile(src):
|
||||
os.remove(src)
|
||||
raise PiconsError("No matching picons found!")
|
||||
|
||||
cmd = [exe, "e", src, "-o{}".format(dest), "-y", "-r"]
|
||||
cmd.extend(to_extract)
|
||||
try:
|
||||
out, err = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
|
||||
if err:
|
||||
log("{} [extract] error: {}".format(self.__class__.__name__, err))
|
||||
raise PiconsError(err)
|
||||
else:
|
||||
if os.path.isfile(src):
|
||||
os.remove(src)
|
||||
except OSError as e:
|
||||
log(e)
|
||||
raise PiconsError(e)
|
||||
|
||||
def get_logo_data(self, url):
|
||||
""" Returns the logo data if present. """
|
||||
return self._provider_logos.get(url, None)
|
||||
|
||||
def get_provider_logo(self, url):
|
||||
""" Retrieves package logo. """
|
||||
# Getting package logo.
|
||||
logo = self._provider_logos.get(url, None)
|
||||
if logo:
|
||||
return logo
|
||||
|
||||
try:
|
||||
with requests.get(url=url, stream=True) as logo_request:
|
||||
if logo_request.reason == "OK":
|
||||
data = logo_request.content
|
||||
self._provider_logos[url] = data
|
||||
return data
|
||||
else:
|
||||
log("Downloading package logo error: {}".format(logo_request.reason))
|
||||
except requests.exceptions.ConnectionError as e:
|
||||
log("{} error [get provider logo]: {}".format(self.__class__.__name__, e))
|
||||
|
||||
def get_logos_map(self):
|
||||
return {"piconblack": "b50",
|
||||
"picontransparent": "t50",
|
||||
"piconwhite": "w50",
|
||||
"piconmirrorglass": "mr100",
|
||||
"piconnoName": "n100",
|
||||
"piconsrhd": "srhd100",
|
||||
"piconfreezeframe": "ff220",
|
||||
"piconfreezewhite": "fw100",
|
||||
"piconpoolrainbow": "r100",
|
||||
"piconsimpleblack": "s220",
|
||||
"piconjustblack": "jb220",
|
||||
"picondirtypaper": "dp220",
|
||||
"picongray": "g400",
|
||||
"piconmonochrom": "m220",
|
||||
"picontransparentwhite": "tw100",
|
||||
"picontransparentdark": "td220",
|
||||
"piconoled": "o96",
|
||||
"piconblack80": "b50",
|
||||
"piconblack3d": "b50"
|
||||
}
|
||||
|
||||
def get_name_map(self):
|
||||
return {"antiksat": "ANTIK",
|
||||
"digiczsk": "DIGI",
|
||||
"DTTitaly": "picon_trs-it",
|
||||
"dvbtCZSK": "picon_trs",
|
||||
"PolandDTT": "picon_trs-pl",
|
||||
"freeSAT": "UPC DIRECT",
|
||||
"orangesat": "ORANGE TV",
|
||||
"skylink": "M7 GROUP",
|
||||
}
|
||||
|
||||
|
||||
class PiconsParser(HTMLParser):
|
||||
""" Parser for package html page. (https://www.lyngsat.com/packages/*provider-name*.html) """
|
||||
_BASE_URL = "https://www.lyngsat.com"
|
||||
|
||||
@@ -61,6 +61,10 @@
|
||||
<attribute name="label" translatable="yes">Save</attribute>
|
||||
<attribute name="action">app.on_data_save</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Save as</attribute>
|
||||
<attribute name="action">app.on_data_save_as</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
|
||||
@@ -8,7 +8,7 @@ from enum import Enum
|
||||
|
||||
from app.commons import run_idle
|
||||
from app.settings import SettingsType
|
||||
from app.ui.dialogs import show_dialog, DialogType
|
||||
from app.ui.dialogs import show_dialog, DialogType, get_builder
|
||||
from app.ui.main_helper import append_text_to_tview
|
||||
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, KeyboardKey, MOD_MASK
|
||||
|
||||
@@ -30,10 +30,7 @@ class BackupDialog:
|
||||
"on_resize": self.on_resize,
|
||||
"on_key_release": self.on_key_release}
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain("demon-editor")
|
||||
builder.add_from_file(UI_RESOURCES_PATH + "backup_dialog.glade")
|
||||
builder.connect_signals(handlers)
|
||||
builder = get_builder(UI_RESOURCES_PATH + "backup_dialog.glade", handlers)
|
||||
|
||||
self._settings = settings
|
||||
self._s_type = settings.setting_type
|
||||
|
||||
@@ -325,6 +325,11 @@ Author: Dmitriy Yefremov
|
||||
<property name="icon_name">view-refresh</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="remove_recording_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">user-trash-symbolic</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="restart_gui_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
@@ -386,8 +391,8 @@ Author: Dmitriy Yefremov
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin_left">10</property>
|
||||
<property name="margin_right">10</property>
|
||||
<property name="margin_left">5</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="margin_bottom">10</property>
|
||||
<property name="stack">stack</property>
|
||||
@@ -1720,6 +1725,103 @@ audio-volume-medium-symbolic</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="recordings_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="recordings_view_scrolled_window">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkViewport" id="recordings_view_port">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="recordings_list_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="selection_mode">multiple</property>
|
||||
<property name="activate_on_single_click">False</property>
|
||||
<signal name="button-press-event" handler="on_recordings_press" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="recordings_dir_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<signal name="changed" handler="on_recordings_dir_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="recordings_action_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="recordings_filter_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="primary_icon_name">edit-find-replace-symbolic</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">False</property>
|
||||
<property name="placeholder_text" translatable="yes">Filter</property>
|
||||
<signal name="search-changed" handler="on_recording_filter_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="recordings_remove_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Remove</property>
|
||||
<property name="action_name">app.on_recording_remove</property>
|
||||
<property name="image">remove_recording_image</property>
|
||||
<property name="always_show_image">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">recordings</property>
|
||||
<property name="title" translatable="yes">Recordings</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
||||
@@ -6,10 +6,10 @@ from urllib.parse import quote
|
||||
|
||||
from gi.repository import GLib
|
||||
|
||||
from .dialogs import get_dialogs_string, show_dialog, DialogType, get_message
|
||||
from .dialogs import show_dialog, DialogType, get_message, get_builder
|
||||
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, Column
|
||||
from ..commons import run_task, run_with_delay, log, run_idle
|
||||
from ..connections import HttpAPI
|
||||
from ..connections import HttpAPI, UtfFTP
|
||||
from ..eparser.ecommons import BqServiceType
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ class ControlBox(Gtk.HBox):
|
||||
EPG = "epg"
|
||||
TIMERS = "timers"
|
||||
TIMER = "timer"
|
||||
RECORDINGS = "recordings"
|
||||
|
||||
class EpgRow(Gtk.ListBoxRow):
|
||||
def __init__(self, event: dict, **properties):
|
||||
@@ -84,8 +85,7 @@ class ControlBox(Gtk.HBox):
|
||||
|
||||
self._timer = timer
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_string(get_dialogs_string(self._UI_PATH))
|
||||
builder = get_builder(self._UI_PATH, None, use_str=True)
|
||||
row_box = builder.get_object("timer_row_box")
|
||||
name_label = builder.get_object("timer_name_label")
|
||||
description_label = builder.get_object("timer_description_label")
|
||||
@@ -112,6 +112,75 @@ class ControlBox(Gtk.HBox):
|
||||
EVENT = 1
|
||||
CHANGE = 2
|
||||
|
||||
class RecordingsRow(Gtk.ListBoxRow):
|
||||
def __init__(self, movie: dict, **properties):
|
||||
super().__init__(**properties)
|
||||
|
||||
self._movie = movie
|
||||
h_box = Gtk.HBox()
|
||||
h_box.set_orientation(Gtk.Orientation.VERTICAL)
|
||||
|
||||
self._service = movie.get("e2servicename")
|
||||
service_label = Gtk.Label()
|
||||
service_label.set_markup("<b>{}</b>".format(self._service))
|
||||
|
||||
self._title = movie.get("e2title", "")
|
||||
title_label = Gtk.Label(self._title)
|
||||
|
||||
self._desc = movie.get("e2description", "")
|
||||
description = Gtk.Label()
|
||||
description.set_markup("<i>{}</i>".format(self._desc))
|
||||
description.set_line_wrap(True)
|
||||
description.set_max_width_chars(25)
|
||||
|
||||
start_time = datetime.fromtimestamp(int(movie.get("e2time", "0")))
|
||||
start_time_label = Gtk.Label()
|
||||
start_time_label.set_margin_top(5)
|
||||
start_time_label.set_markup("<b>{}</b>".format(start_time.strftime("%A, %H:%M")))
|
||||
|
||||
time_label = Gtk.Label()
|
||||
time_label.set_margin_top(5)
|
||||
time_label.set_markup("<b>{}</b>".format(movie.get("e2length", "0")))
|
||||
|
||||
info_box = Gtk.HBox()
|
||||
info_box.set_orientation(Gtk.Orientation.HORIZONTAL)
|
||||
info_box.set_spacing(10)
|
||||
info_box.pack_start(start_time_label, False, True, 5)
|
||||
info_box.pack_end(time_label, False, True, 5)
|
||||
|
||||
h_box.add(service_label)
|
||||
h_box.add(title_label)
|
||||
h_box.add(description)
|
||||
h_box.add(info_box)
|
||||
sep = Gtk.Separator()
|
||||
sep.set_margin_top(5)
|
||||
h_box.add(sep)
|
||||
h_box.set_spacing(5)
|
||||
|
||||
self.set_tooltip_text(movie.get("e2filename", ""))
|
||||
self.add(h_box)
|
||||
self.show_all()
|
||||
|
||||
@property
|
||||
def movie(self):
|
||||
return self._movie
|
||||
|
||||
@property
|
||||
def service(self):
|
||||
return self._service or ""
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
return self._title or ""
|
||||
|
||||
@property
|
||||
def desc(self):
|
||||
return self._desc or ""
|
||||
|
||||
@property
|
||||
def file(self):
|
||||
return self._movie.get("e2filename", "")
|
||||
|
||||
def __init__(self, app, http_api, settings, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
@@ -128,11 +197,12 @@ class ControlBox(Gtk.HBox):
|
||||
"on_epg_press": self.on_epg_press,
|
||||
"on_epg_filter_changed": self.on_epg_filter_changed,
|
||||
"on_timers_press": self.on_timers_press,
|
||||
"on_timers_drag_data_received": self.on_timers_drag_data_received}
|
||||
"on_timers_drag_data_received": self.on_timers_drag_data_received,
|
||||
"on_recordings_press": self.on_recordings_press,
|
||||
"on_recording_filter_changed": self.on_recording_filter_changed,
|
||||
"on_recordings_dir_changed": self.on_recordings_dir_changed}
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_file(UI_RESOURCES_PATH + "control.glade")
|
||||
builder.connect_signals(handlers)
|
||||
builder = get_builder(UI_RESOURCES_PATH + "control.glade", handlers)
|
||||
|
||||
self.add(builder.get_object("main_box_frame"))
|
||||
self._stack = builder.get_object("stack")
|
||||
@@ -186,6 +256,11 @@ class ControlBox(Gtk.HBox):
|
||||
# DnD initialization for the timer list.
|
||||
self._timers_list_box.drag_dest_set(Gtk.DestDefaults.ALL, [], Gdk.DragAction.DEFAULT | Gdk.DragAction.COPY)
|
||||
self._timers_list_box.drag_dest_add_text_targets()
|
||||
# Recordings.
|
||||
self._recordings_list_box = builder.get_object("recordings_list_box")
|
||||
self._recordings_list_box.set_filter_func(self.recording_filter_function)
|
||||
self._recordings_filter_entry = builder.get_object("recordings_filter_entry")
|
||||
self._recordings_dir_box = builder.get_object("recordings_dir_box")
|
||||
|
||||
self.init_actions(app)
|
||||
self.connect("hide", self.on_hide)
|
||||
@@ -223,6 +298,8 @@ class ControlBox(Gtk.HBox):
|
||||
app.set_action("on_timer_cancel", self.on_timer_cancel)
|
||||
app.set_action("on_timer_begins_set", self.on_timer_begins_set)
|
||||
app.set_action("on_timer_ends_set", self.on_timer_ends_set)
|
||||
# Recordings
|
||||
app.set_action("on_recording_remove", self.on_recording_remove)
|
||||
|
||||
@property
|
||||
def update_epg(self):
|
||||
@@ -235,6 +312,9 @@ class ControlBox(Gtk.HBox):
|
||||
if tool is self.Tool.TIMERS:
|
||||
self.update_timer_list()
|
||||
|
||||
if tool is self.Tool.RECORDINGS:
|
||||
self.update_recordings_list()
|
||||
|
||||
if tool is not self.Tool.TIMER:
|
||||
self._last_tool = tool
|
||||
|
||||
@@ -681,3 +761,66 @@ class ControlBox(Gtk.HBox):
|
||||
self._timer_service_ref_entry.set_text(service.picon_id.rstrip(".png").replace("_", ":"))
|
||||
self.on_timer_add()
|
||||
context.finish(True, False, time)
|
||||
|
||||
# *********************** Recordings *************************** #
|
||||
|
||||
def on_recordings_press(self, list_box, event):
|
||||
if event.get_event_type() == Gdk.EventType.DOUBLE_BUTTON_PRESS and len(list_box) > 0:
|
||||
row = list_box.get_selected_row()
|
||||
if row:
|
||||
self._http_api.send(HttpAPI.Request.STREAM_TS,
|
||||
row.movie.get("e2filename", ""),
|
||||
self.on_play_recording)
|
||||
|
||||
def on_recording_filter_changed(self, entry):
|
||||
self._recordings_list_box.invalidate_filter()
|
||||
|
||||
def recording_filter_function(self, row):
|
||||
txt = self._recordings_filter_entry.get_text().upper()
|
||||
return any((not txt, txt in row.service.upper(), txt in row.title.upper(), txt in row.desc.upper()))
|
||||
|
||||
def on_recording_remove(self, action, value=None):
|
||||
""" Removes recordings via FTP. """
|
||||
if show_dialog(DialogType.QUESTION, self._app._main_window) != Gtk.ResponseType.OK:
|
||||
return
|
||||
|
||||
rows = self._recordings_list_box.get_selected_rows()
|
||||
if rows:
|
||||
settings = self._app._settings
|
||||
|
||||
with UtfFTP(host=settings.host, user=settings.user, passwd=settings.password) as ftp:
|
||||
ftp.encoding = "utf-8"
|
||||
for r in rows:
|
||||
resp = ftp.delete_file(r.file)
|
||||
if resp.startswith("2"):
|
||||
GLib.idle_add(self._recordings_list_box.remove, r)
|
||||
else:
|
||||
show_dialog(DialogType.ERROR, transient=self._app._main_window, text=resp)
|
||||
break
|
||||
|
||||
def on_recordings_dir_changed(self, box: Gtk.ComboBoxText):
|
||||
self._http_api.send(HttpAPI.Request.RECORDINGS, quote(box.get_active_id()), self.update_recordings_data)
|
||||
|
||||
def update_recordings_list(self):
|
||||
if not len(self._recordings_dir_box.get_model()):
|
||||
self._http_api.send(HttpAPI.Request.REC_CURRENT, "", self.update_current_rec_dir)
|
||||
|
||||
def update_current_rec_dir(self, current):
|
||||
cur = current.get("e2location", None)
|
||||
if cur:
|
||||
self._recordings_dir_box.append(cur, cur)
|
||||
self._http_api.send(HttpAPI.Request.REC_DIRS, "", self.update_rec_dirs)
|
||||
|
||||
def update_rec_dirs(self, dirs):
|
||||
for d in dirs.get("rec_dirs", []):
|
||||
self._recordings_dir_box.append(d, d)
|
||||
|
||||
@run_idle
|
||||
def update_recordings_data(self, recordings):
|
||||
list(map(self._recordings_list_box.remove, (r for r in self._recordings_list_box)))
|
||||
list(map(lambda r: self._recordings_list_box.add(self.RecordingsRow(r)), recordings.get("recordings", [])))
|
||||
|
||||
def on_play_recording(self, m3u):
|
||||
url = self._app.get_url_from_m3u(m3u)
|
||||
if url:
|
||||
self._app.play(url)
|
||||
|
||||
@@ -40,11 +40,10 @@ Author: Dmitriy Yefremov
|
||||
<property name="icon_name">system-help</property>
|
||||
<property name="type_hint">normal</property>
|
||||
<property name="program_name">DemonEditor</property>
|
||||
<property name="version">1.0.7 Beta</property>
|
||||
<property name="version">1.0.10 Beta</property>
|
||||
<property name="copyright">2018-2021 Dmitriy Yefremov
|
||||
</property>
|
||||
<property name="comments" translatable="yes">Enigma2 channel and satellite list editor for MacOS.
|
||||
(Experimental)</property>
|
||||
<property name="comments" translatable="yes">Enigma2 channel and satellite list editor for MacOS.</property>
|
||||
<property name="website">https://github.com/DYefremov/DemonEditor/tree/experimental-mac</property>
|
||||
<property name="license" translatable="yes">Это приложение распространяется без каких-либо гарантий.
|
||||
Подробнее в <a href="http://opensource.org/licenses/mit-license.php">The MIT License (MIT)</a>.</property>
|
||||
|
||||
@@ -183,5 +183,26 @@ def get_dialogs_string(path):
|
||||
return "".join(f)
|
||||
|
||||
|
||||
def get_builder(path, handlers=None, use_str=False, objects=None):
|
||||
""" Creates and returns a Gtk.Builder instance. """
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain(TEXT_DOMAIN)
|
||||
|
||||
if use_str:
|
||||
if objects:
|
||||
builder.add_objects_from_string(get_dialogs_string(path).format(use_header=IS_GNOME_SESSION), objects)
|
||||
else:
|
||||
builder.add_from_string(get_dialogs_string(path).format(use_header=IS_GNOME_SESSION))
|
||||
else:
|
||||
if objects:
|
||||
builder.add_objects_from_file(path, objects)
|
||||
else:
|
||||
builder.add_from_file(path)
|
||||
|
||||
builder.connect_signals(handlers or {})
|
||||
|
||||
return builder
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
|
||||
@@ -8,7 +8,7 @@ from app.settings import SettingsType
|
||||
from app.ui.backup import backup_data, restore_data
|
||||
from app.ui.main_helper import append_text_to_tview
|
||||
from app.ui.settings_dialog import show_settings_dialog
|
||||
from .dialogs import show_dialog, DialogType, get_message
|
||||
from .dialogs import show_dialog, DialogType, get_message, get_builder
|
||||
from .uicommons import Gtk, UI_RESOURCES_PATH
|
||||
|
||||
|
||||
@@ -27,9 +27,7 @@ class DownloadDialog:
|
||||
"on_remove_unused_bouquets_toggled": self.on_remove_unused_bouquets_toggled,
|
||||
"on_info_bar_close": self.on_info_bar_close}
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_file(UI_RESOURCES_PATH + "download_dialog.glade")
|
||||
builder.connect_signals(handlers)
|
||||
builder = get_builder(UI_RESOURCES_PATH + "download_dialog.glade", handlers)
|
||||
|
||||
self._dialog_window = builder.get_object("download_dialog_window")
|
||||
self._dialog_window.set_transient_for(transient)
|
||||
|
||||
@@ -8,13 +8,14 @@ from enum import Enum
|
||||
from urllib.error import HTTPError, URLError
|
||||
|
||||
from gi.repository import GLib
|
||||
|
||||
from app.commons import run_idle, run_task
|
||||
from app.connections import download_data, DownloadType
|
||||
from app.eparser.ecommons import BouquetService, BqServiceType
|
||||
from app.tools.epg import EPG, ChannelsParser
|
||||
from app.ui.dialogs import get_message, show_dialog, DialogType
|
||||
from app.ui.dialogs import get_message, show_dialog, DialogType, get_builder
|
||||
from .main_helper import on_popup_menu, update_entry_data
|
||||
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, TEXT_DOMAIN, Column, EPG_ICON, KeyboardKey, MOD_MASK
|
||||
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, Column, EPG_ICON, KeyboardKey, MOD_MASK
|
||||
|
||||
|
||||
class RefsSource(Enum):
|
||||
@@ -66,10 +67,7 @@ class EpgDialog:
|
||||
self._show_tooltips = True
|
||||
self._download_xml_is_active = False
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain(TEXT_DOMAIN)
|
||||
builder.add_from_file(UI_RESOURCES_PATH + "epg_dialog.glade")
|
||||
builder.connect_signals(handlers)
|
||||
builder = get_builder(UI_RESOURCES_PATH + "epg_dialog.glade", handlers)
|
||||
|
||||
self._dialog = builder.get_object("epg_dialog_window")
|
||||
self._dialog.set_transient_for(transient)
|
||||
|
||||
@@ -12,7 +12,7 @@ from gi.repository import GLib
|
||||
|
||||
from app.commons import log, run_task, run_idle
|
||||
from app.connections import UtfFTP
|
||||
from app.ui.dialogs import show_dialog, DialogType
|
||||
from app.ui.dialogs import show_dialog, DialogType, get_builder
|
||||
from app.ui.main_helper import on_popup_menu
|
||||
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, KeyboardKey, MOD_MASK
|
||||
|
||||
@@ -68,9 +68,7 @@ class FtpClientBox(Gtk.HBox):
|
||||
"on_view_press": self.on_view_press,
|
||||
"on_view_release": self.on_view_release}
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_file(UI_RESOURCES_PATH + "ftp.glade")
|
||||
builder.connect_signals(handlers)
|
||||
builder = get_builder(UI_RESOURCES_PATH + "ftp.glade", handlers)
|
||||
|
||||
self.add(builder.get_object("main_frame"))
|
||||
self._ftp_info_label = builder.get_object("ftp_info_label")
|
||||
|
||||
@@ -6,7 +6,7 @@ from app.eparser import get_bouquets, get_services, BouquetsReader
|
||||
from app.eparser.ecommons import BqType, BqServiceType, Bouquet
|
||||
from app.eparser.neutrino.bouquets import parse_webtv, parse_bouquets as get_neutrino_bouquets
|
||||
from app.settings import SettingsType
|
||||
from app.ui.dialogs import show_dialog, DialogType, get_chooser_dialog, get_message
|
||||
from app.ui.dialogs import show_dialog, DialogType, get_chooser_dialog, get_message, get_builder
|
||||
from app.ui.main_helper import on_popup_menu
|
||||
from .uicommons import Gtk, UI_RESOURCES_PATH, KeyboardKey, Column
|
||||
|
||||
@@ -84,10 +84,7 @@ class ImportDialog:
|
||||
"on_resize": self.on_resize,
|
||||
"on_key_press": self.on_key_press}
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain("demon-editor")
|
||||
builder.add_from_file(UI_RESOURCES_PATH + "import_dialog.glade")
|
||||
builder.connect_signals(handlers)
|
||||
builder = get_builder(UI_RESOURCES_PATH + "import_dialog.glade", handlers)
|
||||
|
||||
self._bq_services = {}
|
||||
self._services = {}
|
||||
@@ -128,7 +125,7 @@ class ImportDialog:
|
||||
for bq in bqs.bouquets:
|
||||
self._main_model.append((bq.name, bq.type, True))
|
||||
self._bq_services[(bq.name, bq.type)] = bq.services
|
||||
|
||||
|
||||
if self._profile is SettingsType.ENIGMA_2:
|
||||
services = get_services(path, self._profile, 5 if self._settings.v5_support else 4)
|
||||
elif self._profile is SettingsType.NEUTRINO_MP:
|
||||
|
||||
@@ -309,6 +309,19 @@ Author: Dmitriy Yefremov
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="list_configuration_ok_button">
|
||||
<property name="label" translatable="yes">OK</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@@ -766,6 +779,7 @@ Author: Dmitriy Yefremov
|
||||
<action-widgets>
|
||||
<action-widget response="-6">cancel_config_list_button</action-widget>
|
||||
<action-widget response="-10">list_configuration_apply_button</action-widget>
|
||||
<action-widget response="-5">list_configuration_ok_button</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
<object class="GtkImage" id="yt_import_image">
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2018-2021 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
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
# Author: Dmitriy Yefremov
|
||||
#
|
||||
|
||||
|
||||
import concurrent.futures
|
||||
import os
|
||||
import re
|
||||
@@ -15,10 +43,9 @@ from app.eparser.iptv import (NEUTRINO_FAV_ID_FORMAT, StreamType, ENIGMA2_FAV_ID
|
||||
parse_m3u)
|
||||
from app.settings import SettingsType
|
||||
from app.tools.yt import YouTubeException, YouTube
|
||||
from app.ui.dialogs import Action, show_dialog, DialogType, get_dialogs_string, get_message
|
||||
from app.ui.dialogs import Action, show_dialog, DialogType, get_message, get_builder
|
||||
from app.ui.main_helper import get_base_model, get_iptv_url, on_popup_menu, get_picon_pixbuf
|
||||
from app.ui.uicommons import (Gtk, Gdk, TEXT_DOMAIN, UI_RESOURCES_PATH, IPTV_ICON, Column, IS_GNOME_SESSION,
|
||||
KeyboardKey, get_yt_icon)
|
||||
from app.ui.uicommons import (Gtk, Gdk, UI_RESOURCES_PATH, IPTV_ICON, Column, KeyboardKey, get_yt_icon)
|
||||
|
||||
_DIGIT_ENTRY_NAME = "digit-entry"
|
||||
_ENIGMA2_REFERENCE = "{}:0:{}:{:X}:{:X}:{:X}:{:X}:0:0:0"
|
||||
@@ -67,11 +94,8 @@ class IptvDialog:
|
||||
self._yt_links = None
|
||||
self._yt_dl = None
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain(TEXT_DOMAIN)
|
||||
builder.add_objects_from_string(get_dialogs_string(_UI_PATH).format(use_header=IS_GNOME_SESSION),
|
||||
("iptv_dialog", "stream_type_liststore", "yt_quality_liststore"))
|
||||
builder.connect_signals(handlers)
|
||||
builder = get_builder(_UI_PATH, handlers, use_str=True,
|
||||
objects=("iptv_dialog", "stream_type_liststore", "yt_quality_liststore"))
|
||||
|
||||
self._dialog = builder.get_object("iptv_dialog")
|
||||
self._dialog.set_transient_for(transient)
|
||||
@@ -323,10 +347,8 @@ class SearchUnavailableDialog:
|
||||
def __init__(self, transient, model, fav_bouquet, iptv_rows, s_type):
|
||||
handlers = {"on_response": self.on_response}
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain(TEXT_DOMAIN)
|
||||
builder.add_objects_from_file(UI_RESOURCES_PATH + "iptv.glade", ("search_unavailable_streams_dialog",))
|
||||
builder.connect_signals(handlers)
|
||||
builder = get_builder(UI_RESOURCES_PATH + "iptv.glade", handlers,
|
||||
objects=("search_unavailable_streams_dialog",))
|
||||
|
||||
self._dialog = builder.get_object("search_unavailable_streams_dialog")
|
||||
self._dialog.set_transient_for(transient)
|
||||
@@ -421,11 +443,8 @@ class IptvListDialog:
|
||||
|
||||
self._s_type = s_type
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain(TEXT_DOMAIN)
|
||||
builder.add_objects_from_string(get_dialogs_string(_UI_PATH).format(use_header=IS_GNOME_SESSION),
|
||||
("iptv_list_configuration_dialog", "stream_type_liststore"))
|
||||
builder.connect_signals(handlers)
|
||||
builder = get_builder(_UI_PATH, handlers, use_str=True,
|
||||
objects=("iptv_list_configuration_dialog", "stream_type_liststore"))
|
||||
|
||||
self._dialog = builder.get_object("iptv_list_configuration_dialog")
|
||||
self._dialog.set_transient_for(transient)
|
||||
@@ -446,6 +465,8 @@ class IptvListDialog:
|
||||
self._list_nid_entry = builder.get_object("list_nid_entry")
|
||||
self._list_namespace_entry = builder.get_object("list_namespace_entry")
|
||||
self._apply_button = builder.get_object("list_configuration_apply_button")
|
||||
self._cancel_button = builder.get_object("cancel_config_list_button")
|
||||
self._ok_button = builder.get_object("list_configuration_ok_button")
|
||||
# Style
|
||||
style_provider = Gtk.CssProvider()
|
||||
style_provider.load_from_path(UI_RESOURCES_PATH + "style.css")
|
||||
@@ -607,6 +628,8 @@ class M3uImportDialog(IptvListDialog):
|
||||
self._dialog.set_title(get_message("Playlist import"))
|
||||
self._dialog.connect("delete-event", self.on_close)
|
||||
self._apply_button.set_label(get_message("Import"))
|
||||
self._ok_button.bind_property("visible", self._apply_button, "visible", 4)
|
||||
self._ok_button.bind_property("visible", self._cancel_button, "visible", 4)
|
||||
# Progress
|
||||
self._progress_bar = Gtk.ProgressBar(visible=False, valign="center")
|
||||
self._spinner = Gtk.Spinner(active=False)
|
||||
@@ -688,6 +711,7 @@ class M3uImportDialog(IptvListDialog):
|
||||
|
||||
self.download_picons(picons)
|
||||
else:
|
||||
GLib.idle_add(self._ok_button.set_visible, True)
|
||||
GLib.idle_add(self._info_bar.set_visible, True, priority=GLib.PRIORITY_LOW)
|
||||
|
||||
self._app.append_imported_services(services)
|
||||
@@ -771,7 +795,9 @@ class M3uImportDialog(IptvListDialog):
|
||||
if s:
|
||||
model.set_value(r.iter, Column.FAV_PICON, picons.get(s.picon_id, None))
|
||||
yield True
|
||||
|
||||
self._info_bar.set_visible(True)
|
||||
self._ok_button.set_visible(True)
|
||||
yield True
|
||||
|
||||
def on_response(self, dialog, response):
|
||||
@@ -813,13 +839,10 @@ class YtListImportDialog:
|
||||
self._settings = settings
|
||||
self._yt = None
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain(TEXT_DOMAIN)
|
||||
builder.add_objects_from_string(get_dialogs_string(_UI_PATH).format(use_header=IS_GNOME_SESSION),
|
||||
("yt_import_dialog_window", "yt_liststore", "yt_quality_liststore",
|
||||
"yt_popup_menu", "remove_selection_image", "yt_receive_image",
|
||||
"yt_import_image"))
|
||||
builder.connect_signals(handlers)
|
||||
builder = get_builder(_UI_PATH, handlers, use_str=True,
|
||||
objects=("yt_import_dialog_window", "yt_liststore", "yt_quality_liststore",
|
||||
"yt_popup_menu", "remove_selection_image", "yt_receive_image",
|
||||
"yt_import_image"))
|
||||
|
||||
self._dialog = builder.get_object("yt_import_dialog_window")
|
||||
self._dialog.set_transient_for(transient)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
app/ui/lang/zh_CN/LC_MESSAGES/demon-editor.mo
Normal file
BIN
app/ui/lang/zh_CN/LC_MESSAGES/demon-editor.mo
Normal file
Binary file not shown.
@@ -1,3 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2018-2021 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
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
# Author: Dmitriy Yefremov
|
||||
#
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
from contextlib import suppress
|
||||
@@ -11,7 +39,7 @@ from gi.repository import GLib, Gio
|
||||
from app.commons import run_idle, log, run_task, run_with_delay, init_logger
|
||||
from app.connections import (HttpAPI, download_data, DownloadType, upload_data, test_http, TestException,
|
||||
HttpApiException, STC_XML_FILE)
|
||||
from app.eparser import get_blacklist, write_blacklist
|
||||
from app.eparser import get_blacklist, write_blacklist, write_bouquet
|
||||
from app.eparser import get_services, get_bouquets, write_bouquets, write_services, Bouquets, Bouquet, Service
|
||||
from app.eparser.ecommons import CAS, Flag, BouquetService
|
||||
from app.eparser.enigma.bouquets import BqServiceType
|
||||
@@ -22,7 +50,7 @@ from app.tools.media import Player, Recorder
|
||||
from app.ui.epg_dialog import EpgDialog
|
||||
from app.ui.transmitter import LinksTransmitter
|
||||
from .backup import BackupDialog, backup_data, clear_data_path
|
||||
from .dialogs import show_dialog, DialogType, get_chooser_dialog, WaitDialog, get_message
|
||||
from .dialogs import show_dialog, DialogType, get_chooser_dialog, WaitDialog, get_message, get_builder
|
||||
from .download_dialog import DownloadDialog
|
||||
from .imports import ImportDialog, import_bouquet
|
||||
from .iptv import IptvDialog, SearchUnavailableDialog, IptvListConfigurationDialog, YtListImportDialog, M3uImportDialog
|
||||
@@ -46,8 +74,8 @@ class Application(Gtk.Application):
|
||||
ALT_MODEL_NAME = "alt_list_store"
|
||||
DRAG_SEP = "::::"
|
||||
|
||||
DEL_FACTOR = 50 # Batch size to delete in one pass.
|
||||
FAV_FACTOR = DEL_FACTOR * 2
|
||||
DEL_FACTOR = 100 # Batch size to delete in one pass.
|
||||
FAV_FACTOR = DEL_FACTOR * 5
|
||||
|
||||
_TV_TYPES = ("TV", "TV (HD)", "TV (UHD)", "TV (H264)")
|
||||
|
||||
@@ -127,6 +155,7 @@ class Application(Gtk.Application):
|
||||
"on_model_changed": self.on_model_changed,
|
||||
"on_import_yt_list": self.on_import_yt_list,
|
||||
"on_import_m3u": self.on_import_m3u,
|
||||
"on_bouquet_export": self.on_bouquet_export,
|
||||
"on_export_to_m3u": self.on_export_to_m3u,
|
||||
"on_import_bouquet": self.on_import_bouquet,
|
||||
"on_import_bouquets": self.on_import_bouquets,
|
||||
@@ -187,6 +216,7 @@ class Application(Gtk.Application):
|
||||
self._alt_file = set()
|
||||
self._alt_counter = 1
|
||||
self._data_hash = 0
|
||||
self._filter_cache = {}
|
||||
# For bouquets with different names of services in bouquet and main list
|
||||
self._extra_bouquets = {}
|
||||
self._picons = {}
|
||||
@@ -218,9 +248,7 @@ class Application(Gtk.Application):
|
||||
self._NEW_COLOR = None # Color for new services in the main list
|
||||
self._EXTRA_COLOR = None # Color for services with a extra name for the bouquet
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_file(UI_RESOURCES_PATH + "main_window.glade")
|
||||
builder.connect_signals(self._handlers)
|
||||
builder = get_builder(UI_RESOURCES_PATH + "main_window.glade", self._handlers)
|
||||
self._main_window = builder.get_object("main_window")
|
||||
main_window_size = self._settings.get("window_size")
|
||||
# Setting the last size of the window if it was saved
|
||||
@@ -273,6 +301,7 @@ class Application(Gtk.Application):
|
||||
self._tv_count_label = builder.get_object("tv_count_label")
|
||||
self._radio_count_label = builder.get_object("radio_count_label")
|
||||
self._data_count_label = builder.get_object("data_count_label")
|
||||
self._services_load_spinner = builder.get_object("services_load_spinner")
|
||||
self._signal_level_bar.bind_property("visible", builder.get_object("play_current_service_button"), "visible")
|
||||
self._signal_level_bar.bind_property("visible", builder.get_object("record_button"), "visible")
|
||||
self._receiver_info_box.bind_property("visible", self._http_status_image, "visible", 4)
|
||||
@@ -303,11 +332,14 @@ class Application(Gtk.Application):
|
||||
# Filter
|
||||
self._services_model_filter = builder.get_object("services_model_filter")
|
||||
self._services_model_filter.set_visible_func(self.services_filter_function)
|
||||
self._filter_tool_button = builder.get_object("filter_tool_button")
|
||||
self._filter_entry = builder.get_object("filter_entry")
|
||||
self._filter_box = builder.get_object("filter_box")
|
||||
self._filter_types_model = builder.get_object("filter_types_list_store")
|
||||
self._filter_sat_pos_model = builder.get_object("filter_sat_pos_list_store")
|
||||
self._filter_only_free_button = builder.get_object("filter_only_free_button")
|
||||
self._services_load_spinner.bind_property("active", self._filter_tool_button, "sensitive", 4)
|
||||
self._services_load_spinner.bind_property("active", self._filter_box, "sensitive", 4)
|
||||
# Player
|
||||
self._player_box = builder.get_object("player_box")
|
||||
self._player_event_box = builder.get_object("player_event_box")
|
||||
@@ -481,6 +513,9 @@ class Application(Gtk.Application):
|
||||
# Save
|
||||
self._app_info_box.bind_property("visible", self.set_action("on_data_save", self.on_data_save, False),
|
||||
"enabled", 4)
|
||||
self._app_info_box.bind_property("visible", self.set_action("on_data_save_as", self.on_data_save_as, False),
|
||||
"enabled", 4)
|
||||
|
||||
# Control
|
||||
remote_action = Gio.SimpleAction.new_stateful("on_remote", None, GLib.Variant.new_boolean(False))
|
||||
remote_action.connect("change-state", self.on_control)
|
||||
@@ -697,6 +732,11 @@ class Application(Gtk.Application):
|
||||
if not self._main_window.is_maximized():
|
||||
self._settings.add("window_size", self._main_window.get_size())
|
||||
|
||||
if self._services_load_spinner.get_property("active"):
|
||||
msg = "{}\n\n\t{}".format(get_message("Data loading in progress!"), get_message("Are you sure?"))
|
||||
if show_dialog(DialogType.QUESTION, self._main_window, msg) == Gtk.ResponseType.CANCEL:
|
||||
return True
|
||||
|
||||
if self._recorder:
|
||||
if self._recorder.is_record():
|
||||
msg = "{}\n\n\t{}".format(get_message("Recording in progress!"), get_message("Are you sure?"))
|
||||
@@ -834,6 +874,10 @@ class Application(Gtk.Application):
|
||||
|
||||
returns deleted rows list!
|
||||
"""
|
||||
if self._services_load_spinner.get_property("active"):
|
||||
show_dialog(DialogType.ERROR, self._main_window, get_message("Data loading in progress!"))
|
||||
return
|
||||
|
||||
selection = view.get_selection()
|
||||
model, paths = selection.get_selected_rows()
|
||||
model_name = get_base_model(model).get_name()
|
||||
@@ -872,6 +916,7 @@ class Application(Gtk.Application):
|
||||
yield True
|
||||
self.update_fav_num_column(model)
|
||||
|
||||
self.on_model_changed(self._fav_model)
|
||||
self._wait_dialog.hide()
|
||||
yield True
|
||||
|
||||
@@ -898,6 +943,7 @@ class Application(Gtk.Application):
|
||||
for f_itr in filter(lambda r: r[Column.FAV_ID] in srv_ids_to_delete, self._fav_model):
|
||||
self._fav_model.remove(f_itr.iter)
|
||||
|
||||
self.on_model_changed(self._services_model)
|
||||
self.update_fav_num_column(self._fav_model)
|
||||
self.update_sat_positions()
|
||||
self._wait_dialog.hide()
|
||||
@@ -921,6 +967,7 @@ class Application(Gtk.Application):
|
||||
|
||||
self._bq_selected = ""
|
||||
self._bq_name_label.set_text(self._bq_selected)
|
||||
self.on_model_changed(model)
|
||||
self._wait_dialog.hide()
|
||||
yield True
|
||||
|
||||
@@ -1018,6 +1065,8 @@ class Application(Gtk.Application):
|
||||
if not is_marker:
|
||||
num += 1
|
||||
row[Column.FAV_NUM] = 0 if is_marker else num
|
||||
|
||||
self.on_model_changed(model)
|
||||
yield True
|
||||
|
||||
def update_bouquet_list(self):
|
||||
@@ -1542,6 +1591,9 @@ class Application(Gtk.Application):
|
||||
|
||||
def open_data(self, data_path=None, callback=None):
|
||||
""" Opening data and fill views. """
|
||||
if self._ftp_button.get_active():
|
||||
return
|
||||
|
||||
if data_path and os.path.isfile(data_path):
|
||||
self.open_compressed_data(data_path)
|
||||
else:
|
||||
@@ -1592,6 +1644,7 @@ class Application(Gtk.Application):
|
||||
def update_data(self, data_path, callback=None):
|
||||
self._profile_combo_box.set_sensitive(False)
|
||||
self._alt_revealer.set_visible(False)
|
||||
self._filter_tool_button.set_active(False)
|
||||
self._wait_dialog.show()
|
||||
|
||||
yield from self.clear_current_data()
|
||||
@@ -1644,8 +1697,6 @@ class Application(Gtk.Application):
|
||||
else:
|
||||
self.append_blacklist(black_list)
|
||||
yield from self.append_data(bouquets, services)
|
||||
finally:
|
||||
self._wait_dialog.hide()
|
||||
self._profile_combo_box.set_sensitive(True)
|
||||
if callback:
|
||||
callback()
|
||||
@@ -1657,6 +1708,8 @@ class Application(Gtk.Application):
|
||||
if self._filter_box.get_visible():
|
||||
self.on_filter_changed()
|
||||
yield True
|
||||
finally:
|
||||
self._wait_dialog.hide()
|
||||
|
||||
def append_data(self, bouquets, services):
|
||||
if self._app_info_box.get_visible():
|
||||
@@ -1748,7 +1801,9 @@ class Application(Gtk.Application):
|
||||
# Adding channels to dict with fav_id as keys.
|
||||
self._services[srv.fav_id] = srv
|
||||
self.update_services_counts(len(self._services.values()))
|
||||
factor = self.DEL_FACTOR * 2
|
||||
self._wait_dialog.hide()
|
||||
self._services_load_spinner.start()
|
||||
factor = self.DEL_FACTOR
|
||||
|
||||
for index, srv in enumerate(services):
|
||||
tooltip, background = None, None
|
||||
@@ -1763,11 +1818,13 @@ class Application(Gtk.Application):
|
||||
self._services_model.append(s)
|
||||
if index % factor == 0:
|
||||
yield True
|
||||
|
||||
self._services_load_spinner.stop()
|
||||
yield True
|
||||
|
||||
def clear_current_data(self):
|
||||
""" Clearing current data from lists """
|
||||
if len(self._services_model) > self.DEL_FACTOR * 100:
|
||||
if len(self._services_model) > self.DEL_FACTOR * 50:
|
||||
self._wait_dialog.set_text("Deleting data...")
|
||||
|
||||
self._bouquets_model.clear()
|
||||
@@ -1813,12 +1870,32 @@ class Application(Gtk.Application):
|
||||
gen = self.save_data()
|
||||
GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW)
|
||||
|
||||
def save_data(self, callback=None):
|
||||
def on_data_save_as(self, action=None, value=None):
|
||||
if len(self._bouquets_model) == 0:
|
||||
self.show_error_dialog("No data to save!")
|
||||
return
|
||||
|
||||
response = show_dialog(DialogType.CHOOSER, self._main_window, settings=self._settings,
|
||||
buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_SAVE, Gtk.ResponseType.OK),
|
||||
create_dir=True)
|
||||
if response in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT):
|
||||
return
|
||||
|
||||
if os.listdir(response):
|
||||
msg = "{}\n\n\t\t{}".format(get_message("The selected folder already contains files!"),
|
||||
get_message("Are you sure?"))
|
||||
if show_dialog(DialogType.QUESTION, self._main_window, msg) != Gtk.ResponseType.OK:
|
||||
return
|
||||
|
||||
gen = self.save_data(lambda: show_dialog(DialogType.INFO, self._main_window, "Done!"), response)
|
||||
GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW)
|
||||
|
||||
def save_data(self, callback=None, ext_path=None):
|
||||
profile = self._s_type
|
||||
path = self._settings.data_local_path
|
||||
path = ext_path or self._settings.data_local_path
|
||||
backup_path = self._settings.backup_local_path
|
||||
# Backup data or clearing data path
|
||||
backup_data(path, backup_path) if self._settings.backup_before_save else clear_data_path(path)
|
||||
backup_data(path, backup_path) if not ext_path and self._settings.backup_before_save else clear_data_path(path)
|
||||
yield True
|
||||
|
||||
bouquets = []
|
||||
@@ -1829,19 +1906,7 @@ class Application(Gtk.Application):
|
||||
bqs = []
|
||||
num_of_children = model.iter_n_children(itr)
|
||||
for num in range(num_of_children):
|
||||
bq_itr = model.iter_nth_child(itr, num)
|
||||
bq_name, locked, hidden, bq_type = model.get(bq_itr, Column.BQ_NAME, Column.BQ_LOCKED,
|
||||
Column.BQ_HIDDEN, Column.BQ_TYPE)
|
||||
bq_id = "{}:{}".format(bq_name, bq_type)
|
||||
favs = self._bouquets[bq_id]
|
||||
ex_s = self._extra_bouquets.get(bq_id, None)
|
||||
bq_s = list(filter(None, [self._services.get(f_id, None) for f_id in favs]))
|
||||
|
||||
if profile is SettingsType.ENIGMA_2:
|
||||
bq_s = self.get_enigma_bq_services(bq_s, ex_s)
|
||||
|
||||
bq = Bouquet(bq_name, bq_type, bq_s, locked, hidden, self._bq_file.get(bq_id, None))
|
||||
bqs.append(bq)
|
||||
bqs.append(self.get_bouquet(model.iter_nth_child(itr, num), model))
|
||||
if len(b_path) == 1:
|
||||
bouquets.append(Bouquets(*model.get(itr, Column.BQ_NAME, Column.BQ_TYPE), bqs if bqs else []))
|
||||
|
||||
@@ -1864,6 +1929,20 @@ class Application(Gtk.Application):
|
||||
if callback:
|
||||
callback()
|
||||
|
||||
def get_bouquet(self, itr, model):
|
||||
""" Constructs and returns Bouquet class instance. """
|
||||
bq_name, locked, hidden, bq_type = model.get(itr, Column.BQ_NAME, Column.BQ_LOCKED, Column.BQ_HIDDEN,
|
||||
Column.BQ_TYPE)
|
||||
bq_id = "{}:{}".format(bq_name, bq_type)
|
||||
favs = self._bouquets[bq_id]
|
||||
ex_s = self._extra_bouquets.get(bq_id, None)
|
||||
bq_s = list(filter(None, [self._services.get(f_id, None) for f_id in favs]))
|
||||
|
||||
if self._s_type is SettingsType.ENIGMA_2:
|
||||
bq_s = self.get_enigma_bq_services(bq_s, ex_s)
|
||||
|
||||
return Bouquet(bq_name, bq_type, bq_s, locked, hidden, self._bq_file.get(bq_id, None))
|
||||
|
||||
def get_enigma_bq_services(self, services, ext_services):
|
||||
""" Preparing a list of services for the Enigma2 bouquet. """
|
||||
s_list = []
|
||||
@@ -1998,7 +2077,8 @@ class Application(Gtk.Application):
|
||||
alt_servs = srv.transponder
|
||||
if alt_servs:
|
||||
alt_srv = self._services.get(alt_servs[0].data, None)
|
||||
picon = self._picons.get(alt_srv.picon_id, None) if srv else None
|
||||
if alt_srv:
|
||||
picon = self._picons.get(alt_srv.picon_id, None) if srv else None
|
||||
|
||||
self._fav_model.append((0 if is_marker else num, srv.coded, ex_srv_name if ex_srv_name else srv.service,
|
||||
srv.locked, srv.hide, srv_type, srv.pos, srv.fav_id,
|
||||
@@ -2006,6 +2086,7 @@ class Application(Gtk.Application):
|
||||
|
||||
yield True
|
||||
self._fav_view.set_model(self._fav_model)
|
||||
self.on_model_changed(self._fav_model)
|
||||
self._bouquets_view.set_sensitive(True)
|
||||
self._bouquets_view.grab_focus()
|
||||
yield True
|
||||
@@ -2164,7 +2245,7 @@ class Application(Gtk.Application):
|
||||
|
||||
def on_view_focus(self, view, focus_event=None):
|
||||
model_name, model = get_model_data(view)
|
||||
not_empty = len(model) > 0 # if > 0 model has items
|
||||
not_empty = len(model) > 0 if model else False
|
||||
is_service = model_name == self.SERVICE_MODEL_NAME
|
||||
|
||||
if model_name == self.BQ_MODEL_NAME:
|
||||
@@ -2220,8 +2301,7 @@ class Application(Gtk.Application):
|
||||
value = None if value else LOCKED_ICON if flag is Flag.LOCK else HIDE_ICON
|
||||
model.set_value(itr, 1 if flag is Flag.LOCK else 2, value)
|
||||
|
||||
@run_idle
|
||||
def on_model_changed(self, model, path, itr=None):
|
||||
def on_model_changed(self, model, path=None, itr=None):
|
||||
model_name = model.get_name()
|
||||
|
||||
if model_name == self.FAV_MODEL_NAME:
|
||||
@@ -2340,7 +2420,7 @@ class Application(Gtk.Application):
|
||||
bq = self._bouquets.get(self._bq_selected)
|
||||
EpgDialog(self._main_window, self._settings, self._services, bq, self._fav_model, self._current_bq_name).show()
|
||||
|
||||
# ***************** Import ********************#
|
||||
# ***************** Import ******************** #
|
||||
|
||||
def on_import_yt_list(self, action, value=None):
|
||||
""" Import playlist from YouTube """
|
||||
@@ -2372,30 +2452,6 @@ class Application(Gtk.Application):
|
||||
gen = self.update_bouquet_services(self._fav_model, None, self._bq_selected)
|
||||
GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW)
|
||||
|
||||
@run_idle
|
||||
def on_export_to_m3u(self, action, value=None):
|
||||
i_types = (BqServiceType.IPTV.value, BqServiceType.MARKER.value)
|
||||
bq_services = [BouquetService(r[Column.FAV_SERVICE],
|
||||
BqServiceType(r[Column.FAV_TYPE]),
|
||||
r[Column.FAV_ID],
|
||||
r[Column.FAV_NUM]) for r in self._fav_model if r[Column.FAV_TYPE] in i_types]
|
||||
|
||||
if not any(s.type is BqServiceType.IPTV for s in bq_services):
|
||||
self.show_error_dialog("This list does not contains IPTV streams!")
|
||||
return
|
||||
|
||||
response = show_dialog(DialogType.CHOOSER, self._main_window, settings=self._settings)
|
||||
if response in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT):
|
||||
return
|
||||
|
||||
try:
|
||||
bq = Bouquet(self._current_bq_name, None, bq_services, None, None)
|
||||
export_to_m3u(response, bq, self._s_type)
|
||||
except Exception as e:
|
||||
self.show_error_dialog(str(e))
|
||||
else:
|
||||
show_dialog(DialogType.INFO, self._main_window, "Done!")
|
||||
|
||||
def on_import_data(self, path):
|
||||
msg = "Combine with the current data?"
|
||||
if len(self._services_model) > 0 and show_dialog(DialogType.QUESTION, self._main_window,
|
||||
@@ -2439,6 +2495,7 @@ class Application(Gtk.Application):
|
||||
|
||||
dialog = ImportDialog(self._main_window, path, self._settings, self._services.keys(), append)
|
||||
dialog.import_data() if force else dialog.show()
|
||||
self.update_picons()
|
||||
|
||||
def append_imported_data(self, bouquets, services, callback=None):
|
||||
try:
|
||||
@@ -2476,6 +2533,61 @@ class Application(Gtk.Application):
|
||||
yield True
|
||||
self._wait_dialog.hide()
|
||||
|
||||
# ***************** Export ******************** #
|
||||
|
||||
def on_bouquet_export(self, item=None):
|
||||
""" Exports single bouquet to file. """
|
||||
bq_selected = self.check_bouquet_selection()
|
||||
if not bq_selected:
|
||||
return
|
||||
|
||||
model, paths = self._bouquets_view.get_selection().get_selected_rows()
|
||||
if len(paths) > 1:
|
||||
self.show_error_dialog("Please, select only one bouquet!")
|
||||
return
|
||||
|
||||
response = show_dialog(DialogType.CHOOSER, self._main_window, settings=self._settings,
|
||||
buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
|
||||
if response in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT):
|
||||
return
|
||||
|
||||
try:
|
||||
itr = model.get_iter(paths)
|
||||
bq = self.get_bouquet(itr, model)
|
||||
if self._s_type is SettingsType.NEUTRINO_MP:
|
||||
bq = Bouquets(*model.get(itr, Column.BQ_NAME, Column.BQ_TYPE), [bq])
|
||||
response += bq.name
|
||||
write_bouquet(response, bq, self._s_type)
|
||||
except OSError as e:
|
||||
self.show_error_dialog(str(e))
|
||||
else:
|
||||
show_dialog(DialogType.INFO, self._main_window, "Done!")
|
||||
|
||||
@run_idle
|
||||
def on_export_to_m3u(self, action, value=None):
|
||||
i_types = (BqServiceType.IPTV.value, BqServiceType.MARKER.value)
|
||||
bq_services = [BouquetService(r[Column.FAV_SERVICE],
|
||||
BqServiceType(r[Column.FAV_TYPE]),
|
||||
r[Column.FAV_ID],
|
||||
r[Column.FAV_NUM]) for r in self._fav_model if r[Column.FAV_TYPE] in i_types]
|
||||
|
||||
if not any(s.type is BqServiceType.IPTV for s in bq_services):
|
||||
self.show_error_dialog("This list does not contains IPTV streams!")
|
||||
return
|
||||
|
||||
response = show_dialog(DialogType.CHOOSER, self._main_window, settings=self._settings,
|
||||
buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
|
||||
if response in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT):
|
||||
return
|
||||
|
||||
try:
|
||||
bq = Bouquet(self._current_bq_name, None, bq_services, None, None)
|
||||
export_to_m3u(response, bq, self._s_type)
|
||||
except Exception as e:
|
||||
self.show_error_dialog(str(e))
|
||||
else:
|
||||
show_dialog(DialogType.INFO, self._main_window, "Done!")
|
||||
|
||||
# ***************** Backup ******************** #
|
||||
|
||||
def on_backup_tool_show(self, action, value=None):
|
||||
@@ -2673,6 +2785,7 @@ class Application(Gtk.Application):
|
||||
def update_state_on_full_screen(self, visible):
|
||||
self._main_data_box.set_visible(visible)
|
||||
self._player_tool_bar.set_visible(visible)
|
||||
self._control_box.set_visible(visible)
|
||||
self._status_bar_box.set_visible(visible and not self._app_info_box.get_visible())
|
||||
|
||||
@run_idle
|
||||
@@ -2802,7 +2915,7 @@ class Application(Gtk.Application):
|
||||
GLib.idle_add(self._player_box.set_visible, True)
|
||||
GLib.idle_add(self._app_info_box.set_visible, False)
|
||||
|
||||
self._http_api.send(HttpAPI.Request.STREAM_CURRENT, None, self.watch)
|
||||
self._http_api.send(HttpAPI.Request.STREAM_CURRENT, "", self.watch)
|
||||
|
||||
def watch(self, data):
|
||||
url = self.get_url_from_m3u(data)
|
||||
@@ -2990,7 +3103,7 @@ class Application(Gtk.Application):
|
||||
# ***************** Filter and search ********************* #
|
||||
|
||||
def on_filter_toggled(self, action, value):
|
||||
if self._app_info_box.get_visible():
|
||||
if self._app_info_box.get_visible() or self._services_load_spinner.get_property("active"):
|
||||
return True
|
||||
|
||||
action.set_state(value)
|
||||
@@ -3052,25 +3165,36 @@ class Application(Gtk.Application):
|
||||
|
||||
@run_with_delay(2)
|
||||
def on_filter_changed(self, item=None):
|
||||
self._services_load_spinner.start()
|
||||
model = self._services_view.get_model()
|
||||
self._services_view.set_model(None)
|
||||
self.update_filter_cache()
|
||||
self.update_filter_state(model)
|
||||
|
||||
@run_idle
|
||||
def update_filter_state(self, model):
|
||||
self._services_model_filter.refilter()
|
||||
self._services_view.set_model(model)
|
||||
GLib.idle_add(self._services_load_spinner.stop)
|
||||
|
||||
def update_filter_cache(self):
|
||||
self._filter_cache.clear()
|
||||
if not self._filter_box.is_visible():
|
||||
return
|
||||
|
||||
txt = self._filter_entry.get_text().upper()
|
||||
for r in self._services_model:
|
||||
free = not r[Column.SRV_CODED] if self._filter_only_free_button.get_active() else True
|
||||
self._filter_cache[r[Column.SRV_FAV_ID]] = all((r[Column.SRV_TYPE] in self._service_types,
|
||||
r[Column.SRV_POS] in self._sat_positions, free,
|
||||
txt in "".join((r[Column.SRV_SERVICE],
|
||||
r[Column.SRV_PACKAGE],
|
||||
r[Column.SRV_TYPE],
|
||||
r[Column.SRV_SSID],
|
||||
r[Column.SRV_POS])).upper()))
|
||||
|
||||
def services_filter_function(self, model, itr, data):
|
||||
if not self._filter_box.is_visible():
|
||||
return True
|
||||
else:
|
||||
r_txt = str(model.get(itr, Column.SRV_SERVICE, Column.SRV_PACKAGE, Column.SRV_TYPE, Column.SRV_SSID,
|
||||
Column.SRV_FREQ, Column.SRV_RATE, Column.SRV_POL, Column.SRV_FEC, Column.SRV_SYSTEM,
|
||||
Column.SRV_POS)).upper()
|
||||
txt = self._filter_entry.get_text().upper() in r_txt
|
||||
free = not model.get(itr, Column.SRV_CODED)[0] if self._filter_only_free_button.get_active() else True
|
||||
srv_type, pos = model.get(itr, Column.SRV_TYPE, Column.SRV_POS)
|
||||
|
||||
return all((srv_type in self._service_types,
|
||||
pos in self._sat_positions,
|
||||
txt, free))
|
||||
return self._filter_cache.get(model.get_value(itr, Column.SRV_FAV_ID), True)
|
||||
|
||||
def on_filter_type_toggled(self, toggle, path):
|
||||
self.update_filter_toogle_model(self._filter_types_model, toggle, path, self._service_types)
|
||||
@@ -3543,6 +3667,10 @@ class Application(Gtk.Application):
|
||||
def current_services(self):
|
||||
return self._services
|
||||
|
||||
@property
|
||||
def current_bouquets(self):
|
||||
return self._bouquets
|
||||
|
||||
@property
|
||||
def picons_buffer(self):
|
||||
""" Returns a copy and clears the current buffer. """
|
||||
|
||||
@@ -625,7 +625,7 @@ def get_base_paths(paths, model):
|
||||
def get_model_data(view):
|
||||
""" Returns model name and base model from the given view """
|
||||
model = get_base_model(view.get_model())
|
||||
model_name = model.get_name()
|
||||
model_name = model.get_name() if model else ""
|
||||
return model_name, model
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.2
|
||||
<!-- Generated with glade 3.22.1
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
@@ -96,6 +96,14 @@ Author: Dmitriy Yefremov
|
||||
<signal name="activate" handler="on_import_bouquet" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="bouquet_export_popup_item">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Save as</property>
|
||||
<signal name="activate" handler="on_bouquet_export" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="bouquets_popup_separator">
|
||||
<property name="visible">True</property>
|
||||
@@ -181,7 +189,6 @@ Author: Dmitriy Yefremov
|
||||
<!-- column-name type -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<signal name="row-deleted" handler="on_model_changed" swapped="no"/>
|
||||
<signal name="row-inserted" handler="on_model_changed" swapped="no"/>
|
||||
</object>
|
||||
<object class="GtkImage" id="control_image">
|
||||
@@ -214,8 +221,6 @@ Author: Dmitriy Yefremov
|
||||
<!-- column-name background -->
|
||||
<column type="GdkRGBA"/>
|
||||
</columns>
|
||||
<signal name="row-deleted" handler="on_model_changed" swapped="no"/>
|
||||
<signal name="row-inserted" handler="on_model_changed" swapped="no"/>
|
||||
</object>
|
||||
<object class="GtkMenu" id="fav_popup_menu">
|
||||
<property name="visible">True</property>
|
||||
@@ -810,7 +815,6 @@ Author: Dmitriy Yefremov
|
||||
<!-- column-name background -->
|
||||
<column type="GdkRGBA"/>
|
||||
</columns>
|
||||
<signal name="row-deleted" handler="on_model_changed" swapped="no"/>
|
||||
</object>
|
||||
<object class="GtkTreeModelFilter" id="services_model_filter">
|
||||
<property name="child_model">services_list_store</property>
|
||||
@@ -2497,6 +2501,22 @@ Author: Dmitriy Yefremov
|
||||
<property name="position">9</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinner" id="services_load_spinner">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Loading data...</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin_right">10</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">10</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@@ -3286,7 +3306,7 @@ Author: Dmitriy Yefremov
|
||||
<object class="GtkLabel" id="app_ver_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">1.0.7 Beta</property>
|
||||
<property name="label">1.0.10 Beta</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
|
||||
@@ -28,9 +28,10 @@ Author: Dmitriy Yefremov
|
||||
-->
|
||||
<interface domain="demon-editor">
|
||||
<requires lib="gtk+" version="3.16"/>
|
||||
<!-- interface-css-provider-path style.css -->
|
||||
<!-- interface-license-type mit -->
|
||||
<!-- interface-name DemonEditor -->
|
||||
<!-- interface-copyright 2018-2020 Dmitriy Yefremov -->
|
||||
<!-- interface-copyright 2018-2021 Dmitriy Yefremov -->
|
||||
<!-- interface-authors Dmitriy Yefremov -->
|
||||
<object class="GtkImage" id="cancel_image">
|
||||
<property name="visible">True</property>
|
||||
@@ -54,12 +55,6 @@ Author: Dmitriy Yefremov
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">emblem-important-symbolic</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="load_providers">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">network-server-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<object class="GtkListStore" id="picons_dest_list_store">
|
||||
<columns>
|
||||
<!-- column-name picon -->
|
||||
@@ -515,7 +510,7 @@ Author: Dmitriy Yefremov
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">True</property>
|
||||
<property name="shrink">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -669,7 +664,7 @@ Author: Dmitriy Yefremov
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">True</property>
|
||||
<property name="shrink">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
@@ -832,13 +827,12 @@ Author: Dmitriy Yefremov
|
||||
<property name="margin_right">5</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="margin_bottom">5</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="wide_handle">True</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="satellites_box">
|
||||
<property name="width_request">180</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">2</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
@@ -846,10 +840,12 @@ Author: Dmitriy Yefremov
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">5</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="satellite_label">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="label" translatable="yes">Satellite</property>
|
||||
</object>
|
||||
<packing>
|
||||
@@ -862,6 +858,7 @@ Author: Dmitriy Yefremov
|
||||
<object class="GtkLabel" id="loading_data_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="label" translatable="yes">Loading data...</property>
|
||||
</object>
|
||||
<packing>
|
||||
@@ -874,6 +871,7 @@ Author: Dmitriy Yefremov
|
||||
<object class="GtkSpinner" id="loading_data_spinner">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="active">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
@@ -882,6 +880,86 @@ Author: Dmitriy Yefremov
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="center">
|
||||
<object class="GtkBox" id="download_source_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="download_source_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Source:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="download_source_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="active">0</property>
|
||||
<items>
|
||||
<item id="piconcz" translatable="yes">Picon.cz</item>
|
||||
<item id="lyngsat" translatable="yes">LyngSat</item>
|
||||
</items>
|
||||
<signal name="changed" handler="on_download_source_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="satellite_filter_grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="column_spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="satellite_filter_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Filter</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="satellite_filter_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="active">True</property>
|
||||
<signal name="state-set" handler="on_satellite_filter_toggled" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@@ -891,6 +969,7 @@ Author: Dmitriy Yefremov
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="satellites_scrolled_window">
|
||||
<property name="height_request">55</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
@@ -954,22 +1033,70 @@ Author: Dmitriy Yefremov
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">False</property>
|
||||
<property name="shrink">True</property>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="proveders_pox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">2</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Satellite url:</property>
|
||||
<property name="margin_left">5</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="provider_header_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="ellipsize">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="bouquet_filter_grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="bouquet_filter_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="bouquet_filter_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Load only for selected bouquet</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@@ -977,25 +1104,8 @@ Author: Dmitriy Yefremov
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="url_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="primary_icon_name">network-workgroup-symbolic</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="placeholder_text" translatable="yes">https://www.lyngsat.com/*satellite*.html</property>
|
||||
<property name="input_purpose">url</property>
|
||||
<signal name="changed" handler="on_url_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="providers_scrolled_window">
|
||||
<property name="height_request">150</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="margin_bottom">2</property>
|
||||
@@ -1006,7 +1116,9 @@ Author: Dmitriy Yefremov
|
||||
<property name="can_focus">True</property>
|
||||
<property name="model">providers_list_store</property>
|
||||
<property name="search_column">1</property>
|
||||
<property name="tooltip_column">0</property>
|
||||
<signal name="button-press-event" handler="on_popup_menu" object="providers_popup_menu" swapped="no"/>
|
||||
<signal name="query-tooltip" handler="on_providers_view_query_tooltip" swapped="no"/>
|
||||
<signal name="select-all" handler="on_select_all" swapped="no"/>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection"/>
|
||||
@@ -1014,9 +1126,10 @@ Author: Dmitriy Yefremov
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="provider_column">
|
||||
<property name="spacing">15</property>
|
||||
<property name="title" translatable="yes">Providers</property>
|
||||
<property name="title" translatable="yes">Name</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="alignment">0.5</property>
|
||||
<property name="sort_column_id">1</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererPixbuf" id="logo_cellrendererpixbuf"/>
|
||||
<attributes>
|
||||
@@ -1100,6 +1213,7 @@ Author: Dmitriy Yefremov
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="selected_column">
|
||||
<property name="title" translatable="yes">Selected</property>
|
||||
<property name="sort_column_id">7</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererToggle" id="cellrenderer_toggle">
|
||||
<signal name="toggled" handler="on_selected_toggled" swapped="no"/>
|
||||
@@ -1119,66 +1233,6 @@ Author: Dmitriy Yefremov
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">2</property>
|
||||
<property name="margin_bottom">2</property>
|
||||
<property name="column_spacing">2</property>
|
||||
<property name="column_homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="ip_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="primary_icon_name">network-transmit-receive-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="picons_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="ip_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Receiver IP:</property>
|
||||
<property name="xalign">0.05000000074505806</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="res_picons_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Receiver picons path:</property>
|
||||
<property name="xalign">0.05000000074505806</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="picons_dir_label">
|
||||
<property name="visible">True</property>
|
||||
@@ -1209,7 +1263,7 @@ Author: Dmitriy Yefremov
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">True</property>
|
||||
<property name="shrink">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
@@ -1225,7 +1279,7 @@ Author: Dmitriy Yefremov
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1668,25 +1722,6 @@ Author: Dmitriy Yefremov
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="load_providers_button">
|
||||
<property name="label" translatable="yes">Load providers</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Load providers</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="image">load_providers</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<signal name="clicked" handler="on_load_providers" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="receive_button">
|
||||
<property name="label" translatable="yes">Receive picons</property>
|
||||
|
||||
@@ -1,7 +1,35 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2018-2021 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
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
# Author: Dmitriy Yefremov
|
||||
#
|
||||
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import tempfile
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
from urllib.parse import urlparse, unquote
|
||||
|
||||
@@ -10,20 +38,24 @@ from gi.repository import GLib, GdkPixbuf, Gio
|
||||
from app.commons import run_idle, run_task, run_with_delay
|
||||
from app.connections import upload_data, DownloadType, download_data, remove_picons
|
||||
from app.settings import SettingsType, Settings
|
||||
from app.tools.picons import PiconsParser, parse_providers, Provider, convert_to, download_picon
|
||||
from app.tools.picons import (PiconsParser, parse_providers, Provider, convert_to, download_picon, PiconsCzDownloader,
|
||||
PiconsError)
|
||||
from app.tools.satellites import SatellitesParser, SatelliteSource
|
||||
from .dialogs import show_dialog, DialogType, get_message
|
||||
from .dialogs import show_dialog, DialogType, get_message, get_builder
|
||||
from .main_helper import update_entry_data, append_text_to_tview, scroll_to, on_popup_menu, get_base_model, set_picon, \
|
||||
get_picon_pixbuf
|
||||
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, TV_ICON, Column, GTK_PATH, KeyboardKey
|
||||
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, TV_ICON, Column, KeyboardKey
|
||||
|
||||
|
||||
class PiconsDialog:
|
||||
class DownloadSource(Enum):
|
||||
LYNG_SAT = "lyngsat"
|
||||
PICON_CZ = "piconcz"
|
||||
|
||||
def __init__(self, transient, settings, picon_ids, sat_positions, app):
|
||||
self._picon_ids = picon_ids
|
||||
self._sat_positions = sat_positions
|
||||
self._app = app
|
||||
self._TMP_DIR = tempfile.gettempdir() + "/"
|
||||
self._BASE_URL = "www.lyngsat.com/packages/"
|
||||
self._PATTERN = re.compile(r"^https://www\.lyngsat\.com/[\w-]+\.html$")
|
||||
self._POS_PATTERN = re.compile(r"^\d+\.\d+[EW]?$")
|
||||
@@ -33,9 +65,14 @@ class PiconsDialog:
|
||||
self._filter_binding = None
|
||||
self._services = None
|
||||
self._current_picon_info = None
|
||||
self._filter_cache = {}
|
||||
# Downloader
|
||||
self._sats = None
|
||||
self._sat_names = None
|
||||
self._download_src = self.DownloadSource.PICON_CZ
|
||||
self._picon_cz_downloader = None
|
||||
|
||||
handlers = {"on_receive": self.on_receive,
|
||||
"on_load_providers": self.on_load_providers,
|
||||
"on_cancel": self.on_cancel,
|
||||
"on_close": self.on_close,
|
||||
"on_send": self.on_send,
|
||||
@@ -64,7 +101,10 @@ class PiconsDialog:
|
||||
"on_selective_remove": self.on_selective_remove,
|
||||
"on_local_remove": self.on_local_remove,
|
||||
"on_picons_dest_view_realize": self.on_picons_dest_view_realize,
|
||||
"on_download_source_changed": self.on_download_source_changed,
|
||||
"on_satellites_view_realize": self.on_satellites_view_realize,
|
||||
"on_satellite_filter_toggled": self.on_satellite_filter_toggled,
|
||||
"on_providers_view_query_tooltip": self.on_providers_view_query_tooltip,
|
||||
"on_satellite_selection": self.on_satellite_selection,
|
||||
"on_select_all": self.on_select_all,
|
||||
"on_unselect_all": self.on_unselect_all,
|
||||
@@ -76,9 +116,7 @@ class PiconsDialog:
|
||||
"on_tree_view_key_press": self.on_tree_view_key_press,
|
||||
"on_popup_menu": on_popup_menu}
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_file(UI_RESOURCES_PATH + "picons_manager.glade")
|
||||
builder.connect_signals(handlers)
|
||||
builder = get_builder(UI_RESOURCES_PATH + "picons_manager.glade", handlers)
|
||||
|
||||
self._dialog = builder.get_object("picons_dialog")
|
||||
self._dialog.set_transient_for(transient)
|
||||
@@ -100,15 +138,12 @@ class PiconsDialog:
|
||||
self._src_filter_button = builder.get_object("src_filter_button")
|
||||
self._dst_filter_button = builder.get_object("dst_filter_button")
|
||||
self._picons_filter_entry = builder.get_object("picons_filter_entry")
|
||||
self._ip_entry = builder.get_object("ip_entry")
|
||||
self._picons_entry = builder.get_object("picons_entry")
|
||||
self._url_entry = builder.get_object("url_entry")
|
||||
self._picons_dir_entry = builder.get_object("picons_dir_entry")
|
||||
self._message_label = builder.get_object("info_bar_message_label")
|
||||
self._info_toggle_button = builder.get_object("info_toggle_button")
|
||||
self._picon_info_image = builder.get_object("picon_info_image")
|
||||
self._picon_info_label = builder.get_object("picon_info_label")
|
||||
self._load_providers_button = builder.get_object("load_providers_button")
|
||||
self._download_source_button = builder.get_object("download_source_button")
|
||||
self._receive_button = builder.get_object("receive_button")
|
||||
self._convert_button = builder.get_object("convert_button")
|
||||
self._enigma2_path_button = builder.get_object("enigma2_path_button")
|
||||
@@ -122,12 +157,19 @@ class PiconsDialog:
|
||||
self._resize_no_radio_button = builder.get_object("resize_no_radio_button")
|
||||
self._resize_220_132_radio_button = builder.get_object("resize_220_132_radio_button")
|
||||
self._resize_100_60_radio_button = builder.get_object("resize_100_60_radio_button")
|
||||
self._satellite_label = builder.get_object("satellite_label")
|
||||
self._explorer_action_box = builder.get_object("explorer_action_box")
|
||||
self._satellite_label = builder.get_object("satellite_label")
|
||||
self._provider_header_label = builder.get_object("provider_header_label")
|
||||
self._satellite_filter_switch = builder.get_object("satellite_filter_switch")
|
||||
self._bouquet_filter_switch = builder.get_object("bouquet_filter_switch")
|
||||
self._bouquet_filter_grid = builder.get_object("bouquet_filter_grid")
|
||||
self._header_download_box = builder.get_object("header_download_box")
|
||||
self._satellite_label.bind_property("visible", builder.get_object("loading_data_label"), "visible", 4)
|
||||
self._satellite_label.bind_property("visible", builder.get_object("loading_data_spinner"), "visible", 4)
|
||||
self._satellite_label.bind_property("visible", self._download_source_button, "sensitive")
|
||||
self._satellite_label.bind_property("visible", self._satellites_view, "sensitive")
|
||||
self._download_source_button.bind_property("visible", self._receive_button, "visible")
|
||||
self._cancel_button.bind_property("visible", builder.get_object("receive_button"), "visible", 4)
|
||||
self._cancel_button.bind_property("visible", self._load_providers_button, "visible", 4)
|
||||
self._convert_button.bind_property("visible", self._explorer_action_box, "visible", 4)
|
||||
downloader_action_box = builder.get_object("downloader_action_box")
|
||||
self._explorer_action_box.bind_property("visible", downloader_action_box, "visible", 4)
|
||||
@@ -143,15 +185,9 @@ class PiconsDialog:
|
||||
self._info_toggle_button.bind_property("active", explorer_info_bar, "visible")
|
||||
# Init drag-and-drop
|
||||
self.init_drag_and_drop()
|
||||
# Style
|
||||
self._style_provider = Gtk.CssProvider()
|
||||
self._style_provider.load_from_path(UI_RESOURCES_PATH + "style.css")
|
||||
self._url_entry.get_style_context().add_provider_for_screen(Gdk.Screen.get_default(), self._style_provider,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_USER)
|
||||
# Settings
|
||||
self._settings = settings
|
||||
self._s_type = settings.setting_type
|
||||
self._ip_entry.set_text(self._settings.host)
|
||||
self._picons_entry.set_text(self._settings.picons_path)
|
||||
self._picons_dir_entry.set_text(self._settings.picons_local_path)
|
||||
|
||||
window_size = self._settings.get("picons_downloader_window_size")
|
||||
@@ -467,72 +503,168 @@ class PiconsDialog:
|
||||
|
||||
# ******************** Downloader ************************* #
|
||||
|
||||
def on_download_source_changed(self, button):
|
||||
self._download_src = self.DownloadSource(button.get_active_id())
|
||||
self.set_providers_header()
|
||||
self._bouquet_filter_grid.set_sensitive(self._download_src is self.DownloadSource.PICON_CZ)
|
||||
GLib.idle_add(self._providers_view.get_model().clear)
|
||||
self.init_satellites(self._satellites_view)
|
||||
|
||||
def on_satellites_view_realize(self, view):
|
||||
self.set_providers_header()
|
||||
self.get_satellites(view)
|
||||
|
||||
def on_satellite_filter_toggled(self, button, state):
|
||||
self.init_satellites(self._satellites_view)
|
||||
|
||||
def on_providers_view_query_tooltip(self, view, x, y, keyboard_mode, tooltip):
|
||||
if self._download_src is self.DownloadSource.LYNG_SAT:
|
||||
return False
|
||||
|
||||
dest = view.get_dest_row_at_pos(x, y)
|
||||
if not dest:
|
||||
return False
|
||||
|
||||
path, pos = dest
|
||||
model = view.get_model()
|
||||
itr = model.get_iter(path)
|
||||
logo_url = model.get_value(itr, 5)
|
||||
if logo_url:
|
||||
pix_data = self._picon_cz_downloader.get_logo_data(logo_url)
|
||||
if pix_data:
|
||||
pix = self.get_pixbuf(pix_data)
|
||||
model.set_value(itr, 0, pix if pix else TV_ICON)
|
||||
size = self._settings.tooltip_logo_size
|
||||
tooltip.set_icon(self.get_pixbuf(pix_data, size, size))
|
||||
else:
|
||||
self.update_logo_data(itr, model, logo_url)
|
||||
tooltip.set_text(model.get_value(itr, 1))
|
||||
view.set_tooltip_row(tooltip, path)
|
||||
return True
|
||||
|
||||
@run_task
|
||||
def update_logo_data(self, itr, model, url):
|
||||
pix_data = self._picon_cz_downloader.get_provider_logo(url)
|
||||
if pix_data:
|
||||
pix = self.get_pixbuf(pix_data)
|
||||
GLib.idle_add(model.set_value, itr, 0, pix if pix else TV_ICON)
|
||||
|
||||
@run_idle
|
||||
def set_providers_header(self):
|
||||
msg = "{} [{}]"
|
||||
tooltip = ""
|
||||
if self._download_src is self.DownloadSource.PICON_CZ:
|
||||
tooltip = "https://picon.cz (by Chocholoušek)"
|
||||
msg = msg.format(get_message("Package"), tooltip)
|
||||
elif self._download_src is self.DownloadSource.LYNG_SAT:
|
||||
tooltip = "https://www.lyngsat.com"
|
||||
msg = msg.format(get_message("Providers"), tooltip)
|
||||
else:
|
||||
msg = ""
|
||||
|
||||
self._provider_header_label.set_text(msg)
|
||||
self._provider_header_label.set_tooltip_text(tooltip)
|
||||
|
||||
@run_task
|
||||
def get_satellites(self, view):
|
||||
sats = SatellitesParser().get_satellites_list(SatelliteSource.LYNGSAT)
|
||||
if not sats:
|
||||
self._sats = SatellitesParser().get_satellites_list(SatelliteSource.LYNGSAT)
|
||||
if not self._sats:
|
||||
self.show_info_message("Getting satellites list error!", Gtk.MessageType.ERROR)
|
||||
|
||||
self._sat_names = {s[1]: s[0] for s in self._sats} # position -> satellite name
|
||||
self._picon_cz_downloader = PiconsCzDownloader(self._picon_ids, self.append_output)
|
||||
self.init_satellites(view)
|
||||
|
||||
@run_task
|
||||
def init_satellites(self, view):
|
||||
sats = self._sats
|
||||
if self._download_src is self.DownloadSource.PICON_CZ:
|
||||
if not self._picon_cz_downloader:
|
||||
return
|
||||
try:
|
||||
self._picon_cz_downloader.init()
|
||||
except PiconsError as e:
|
||||
self.show_info_message(str(e), Gtk.MessageType.ERROR)
|
||||
else:
|
||||
providers = self._picon_cz_downloader.providers
|
||||
sats = ((self._sat_names.get(p, p), p, None, p, False) for p in providers)
|
||||
gen = self.append_satellites(view.get_model(), sats)
|
||||
GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW)
|
||||
|
||||
def append_satellites(self, model, sats):
|
||||
is_filter = self._satellite_filter_switch.get_active()
|
||||
if model:
|
||||
model.clear()
|
||||
|
||||
try:
|
||||
for sat in sats:
|
||||
for sat in sorted(sats):
|
||||
pos = sat[1]
|
||||
name = "{} ({})".format(sat[0], pos)
|
||||
|
||||
if not self._terminate and model:
|
||||
if pos in self._sat_positions:
|
||||
yield model.append((name, sat[3], pos))
|
||||
if is_filter and pos not in self._sat_positions:
|
||||
continue
|
||||
if not model:
|
||||
return
|
||||
yield model.append((name, sat[3], pos))
|
||||
finally:
|
||||
self._satellite_label.show()
|
||||
|
||||
def on_satellite_selection(self, view, path, column):
|
||||
model = view.get_model()
|
||||
self._url_entry.set_text(model.get(model.get_iter(path), 1)[0])
|
||||
|
||||
def on_load_providers(self, item):
|
||||
self.on_info_bar_close()
|
||||
model = self._providers_view.get_model()
|
||||
model.clear()
|
||||
self.get_providers(model)
|
||||
self._satellite_label.set_visible(False)
|
||||
self.get_providers(view.get_model()[path][1], model)
|
||||
|
||||
@run_task
|
||||
def get_providers(self, model):
|
||||
providers = parse_providers(self._url_entry.get_text())
|
||||
if providers:
|
||||
self.append_providers(providers, model)
|
||||
def get_providers(self, url, model):
|
||||
if self._download_src is self.DownloadSource.LYNG_SAT:
|
||||
providers = parse_providers(url)
|
||||
elif self._download_src is self.DownloadSource.PICON_CZ:
|
||||
providers = self._picon_cz_downloader.get_sat_providers(url)
|
||||
else:
|
||||
return
|
||||
|
||||
self.append_providers(providers or [], model)
|
||||
|
||||
@run_idle
|
||||
def append_providers(self, providers, model):
|
||||
for p in providers:
|
||||
model.append((self.get_pixbuf(p[0]) if p[0] else TV_ICON, *p[1:]))
|
||||
self.update_receive_button_state()
|
||||
if self._download_src is self.DownloadSource.LYNG_SAT:
|
||||
for p in providers:
|
||||
model.append(p._replace(logo=self.get_pixbuf(p.logo) if p.logo else TV_ICON))
|
||||
elif self._download_src is self.DownloadSource.PICON_CZ:
|
||||
for p in providers:
|
||||
logo_data = self._picon_cz_downloader.get_logo_data(p.ssid)
|
||||
model.append(p._replace(logo=self.get_pixbuf(logo_data) if logo_data else TV_ICON))
|
||||
|
||||
def get_pixbuf(self, img_data):
|
||||
self.update_receive_button_state()
|
||||
GLib.idle_add(self._satellite_label.set_visible, True)
|
||||
|
||||
def get_pixbuf(self, img_data, w=48, h=32):
|
||||
if img_data:
|
||||
f = Gio.MemoryInputStream.new_from_data(img_data)
|
||||
return GdkPixbuf.Pixbuf.new_from_stream_at_scale(f, 48, 32, True, None)
|
||||
return GdkPixbuf.Pixbuf.new_from_stream_at_scale(f, w, h, True, None)
|
||||
|
||||
def on_receive(self, item):
|
||||
self._cancel_button.show()
|
||||
self.start_download()
|
||||
|
||||
@run_task
|
||||
def start_download(self):
|
||||
if self._is_downloading:
|
||||
self.show_dialog("The task is already running!", DialogType.ERROR)
|
||||
return
|
||||
|
||||
providers = self.get_selected_providers()
|
||||
|
||||
if self._download_src is self.DownloadSource.PICON_CZ and len(providers) > 1:
|
||||
self.show_dialog("Please, select only one item!", DialogType.ERROR)
|
||||
return
|
||||
|
||||
self._cancel_button.show()
|
||||
self.start_download(providers)
|
||||
|
||||
@run_task
|
||||
def start_download(self, providers):
|
||||
self._is_downloading = True
|
||||
GLib.idle_add(self._expander.set_expanded, True)
|
||||
|
||||
providers = self.get_selected_providers()
|
||||
for prv in providers:
|
||||
if not self._POS_PATTERN.match(prv[2]):
|
||||
if self._download_src is self.DownloadSource.LYNG_SAT and not self._POS_PATTERN.match(prv[2]):
|
||||
self.show_info_message(
|
||||
get_message("Specify the correct position value for the provider!"), Gtk.MessageType.ERROR)
|
||||
scroll_to(prv.path, self._providers_view)
|
||||
@@ -541,45 +673,81 @@ class PiconsDialog:
|
||||
try:
|
||||
picons_path = self._picons_dir_entry.get_text()
|
||||
os.makedirs(os.path.dirname(picons_path), exist_ok=True)
|
||||
picons = []
|
||||
|
||||
self.show_info_message(get_message("Please, wait..."), Gtk.MessageType.INFO)
|
||||
providers = (Provider(*p) for p in providers)
|
||||
|
||||
import concurrent.futures
|
||||
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
|
||||
# Getting links to picons.
|
||||
futures = {executor.submit(self.process_provider, Provider(*p), picons_path): p for p in providers}
|
||||
for future in concurrent.futures.as_completed(futures):
|
||||
if not self._is_downloading:
|
||||
executor.shutdown()
|
||||
return
|
||||
|
||||
pic = future.result()
|
||||
if pic:
|
||||
picons.extend(pic)
|
||||
|
||||
# Getting picon images.
|
||||
futures = {executor.submit(download_picon, *pic, self.append_output): pic for pic in picons}
|
||||
done, not_done = concurrent.futures.wait(futures, timeout=0)
|
||||
while self._is_downloading and not_done:
|
||||
done, not_done = concurrent.futures.wait(not_done, timeout=5)
|
||||
|
||||
for future in not_done:
|
||||
future.cancel()
|
||||
concurrent.futures.wait(not_done)
|
||||
if self._download_src is self.DownloadSource.LYNG_SAT:
|
||||
self.get_picons_for_lyngsat(picons_path, providers)
|
||||
elif self._download_src is self.DownloadSource.PICON_CZ:
|
||||
self.get_picons_for_picon_cz(picons_path, providers)
|
||||
|
||||
if not self._is_downloading:
|
||||
return
|
||||
|
||||
if not self._resize_no_radio_button.get_active():
|
||||
self.resize(picons_path)
|
||||
else:
|
||||
self.show_info_message(get_message("Done!"), Gtk.MessageType.INFO)
|
||||
finally:
|
||||
GLib.idle_add(self._cancel_button.hide)
|
||||
self._is_downloading = False
|
||||
|
||||
def get_picons_for_lyngsat(self, path, providers):
|
||||
import concurrent.futures
|
||||
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
|
||||
picons = []
|
||||
# Getting links to picons.
|
||||
futures = {executor.submit(self.process_provider, p, path): p for p in providers}
|
||||
for future in concurrent.futures.as_completed(futures):
|
||||
if not self._is_downloading:
|
||||
executor.shutdown()
|
||||
return
|
||||
|
||||
pic = future.result()
|
||||
if pic:
|
||||
picons.extend(pic)
|
||||
# Getting picon images.
|
||||
futures = {executor.submit(download_picon, *pic, self.append_output): pic for pic in picons}
|
||||
done, not_done = concurrent.futures.wait(futures, timeout=0)
|
||||
while self._is_downloading and not_done:
|
||||
done, not_done = concurrent.futures.wait(not_done, timeout=5)
|
||||
|
||||
for future in not_done:
|
||||
future.cancel()
|
||||
concurrent.futures.wait(not_done)
|
||||
self.show_info_message(get_message("Done!"), Gtk.MessageType.INFO)
|
||||
|
||||
def get_picons_for_picon_cz(self, path, providers):
|
||||
p_ids = None
|
||||
if self._bouquet_filter_switch.get_active():
|
||||
p_ids = self.get_bouquet_picon_ids()
|
||||
if not p_ids:
|
||||
return
|
||||
|
||||
try:
|
||||
# We download it sequentially.
|
||||
for p in providers:
|
||||
self._picon_cz_downloader.download(p, path, p_ids)
|
||||
except PiconsError as e:
|
||||
self.append_output("Error: {}\n".format(str(e)))
|
||||
self.show_info_message(str(e), Gtk.MessageType.ERROR)
|
||||
else:
|
||||
self.show_info_message(get_message("Done!"), Gtk.MessageType.INFO)
|
||||
|
||||
def get_bouquet_picon_ids(self):
|
||||
""" Returns picon ids for selected bouquet or None. """
|
||||
bq_selected = self._app.check_bouquet_selection()
|
||||
if not bq_selected:
|
||||
return
|
||||
|
||||
model, paths = self._app.bouquets_view.get_selection().get_selected_rows()
|
||||
if len(paths) > 1:
|
||||
self.show_dialog("Please, select only one bouquet!", DialogType.ERROR)
|
||||
return
|
||||
|
||||
fav_bouquet = self._app.current_bouquets[bq_selected]
|
||||
services = self._app.current_services
|
||||
return {services.get(fav_id).picon_id for fav_id in fav_bouquet}
|
||||
|
||||
def process_provider(self, prv, picons_path):
|
||||
self.append_output("Getting links to picons for: {}.\n".format(prv.name))
|
||||
return PiconsParser.parse(prv, picons_path, self._picon_ids, self.get_picons_format())
|
||||
@@ -626,7 +794,6 @@ class PiconsDialog:
|
||||
self._terminate = True
|
||||
self._is_downloading = False
|
||||
self.save_window_size(window)
|
||||
self.clean_data()
|
||||
self._app.update_picons()
|
||||
GLib.idle_add(self._dialog.destroy)
|
||||
|
||||
@@ -635,12 +802,6 @@ class PiconsDialog:
|
||||
height = size.height - self._text_view.get_allocated_height() - self._info_bar.get_allocated_height()
|
||||
self._settings.add("picons_downloader_window_size", (size.width, height))
|
||||
|
||||
@run_task
|
||||
def clean_data(self):
|
||||
path = self._TMP_DIR + "www.lyngsat.com"
|
||||
if os.path.exists(path):
|
||||
shutil.rmtree(path)
|
||||
|
||||
@run_task
|
||||
def run_func(self, func, update=False):
|
||||
try:
|
||||
@@ -705,8 +866,13 @@ class PiconsDialog:
|
||||
self._filter_binding.unbind()
|
||||
self._app.filter_entry.set_text("")
|
||||
|
||||
@run_with_delay(1)
|
||||
@run_with_delay(0.5)
|
||||
def on_picons_filter_changed(self, entry):
|
||||
txt = entry.get_text().upper()
|
||||
self._filter_cache.clear()
|
||||
for s in self._app.current_services.values():
|
||||
self._filter_cache[s.picon_id] = txt in s.service.upper()
|
||||
|
||||
GLib.idle_add(self._picons_src_filter_model.refilter, priority=GLib.PRIORITY_LOW)
|
||||
GLib.idle_add(self._picons_dst_filter_model.refilter, priority=GLib.PRIORITY_LOW)
|
||||
|
||||
@@ -726,8 +892,7 @@ class PiconsDialog:
|
||||
return True
|
||||
|
||||
txt = self._picons_filter_entry.get_text().upper()
|
||||
return txt in t.upper() or t in (
|
||||
map(lambda s: s.picon_id, filter(lambda s: txt in s.service.upper(), self._app.current_services.values())))
|
||||
return txt in t.upper() or self._filter_cache.get(t, False)
|
||||
|
||||
def on_picon_activated(self, view):
|
||||
if self._info_toggle_button.get_active():
|
||||
@@ -784,7 +949,7 @@ class PiconsDialog:
|
||||
def on_url_changed(self, entry):
|
||||
suit = self._PATTERN.search(entry.get_text())
|
||||
entry.set_name("GtkEntry" if suit else "digit-entry")
|
||||
self._load_providers_button.set_sensitive(suit if suit else False)
|
||||
self._download_source_button.set_sensitive(suit if suit else False)
|
||||
|
||||
def on_position_edited(self, render, path, value):
|
||||
model = self._providers_view.get_model()
|
||||
@@ -794,6 +959,7 @@ class PiconsDialog:
|
||||
def on_visible_page(self, stack: Gtk.Stack, param):
|
||||
name = stack.get_visible_child_name()
|
||||
self._convert_button.set_visible(name == "converter")
|
||||
self._download_source_button.set_visible(name == "downloader")
|
||||
is_explorer = name == "explorer"
|
||||
self._explorer_action_box.set_visible(is_explorer)
|
||||
if is_explorer:
|
||||
|
||||
@@ -9,10 +9,10 @@ from app.commons import run_idle, run_task, log
|
||||
from app.eparser import get_satellites, write_satellites, Satellite, Transponder
|
||||
from app.eparser.ecommons import PLS_MODE, get_key_by_value
|
||||
from app.tools.satellites import SatellitesParser, SatelliteSource, ServicesParser
|
||||
from .dialogs import show_dialog, DialogType, get_dialogs_string, get_chooser_dialog, get_message
|
||||
from .dialogs import show_dialog, DialogType, get_chooser_dialog, get_message, get_builder
|
||||
from .main_helper import move_items, scroll_to, append_text_to_tview, get_base_model, on_popup_menu
|
||||
from .search import SearchProvider
|
||||
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, TEXT_DOMAIN, MOVE_KEYS, KeyboardKey, IS_GNOME_SESSION, MOD_MASK
|
||||
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, MOVE_KEYS, KeyboardKey, MOD_MASK
|
||||
|
||||
_UI_PATH = UI_RESOURCES_PATH + "satellites_dialog.glade"
|
||||
|
||||
@@ -44,13 +44,10 @@ class SatellitesDialog:
|
||||
"on_resize": self.on_resize,
|
||||
"on_quit": self.on_quit}
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain(TEXT_DOMAIN)
|
||||
builder.add_objects_from_string(get_dialogs_string(_UI_PATH),
|
||||
("satellites_editor_window", "satellites_tree_store", "popup_menu",
|
||||
"left_header_menu", "popup_menu_add_image", "popup_menu_add_image_2",
|
||||
"sat_editor_save_image", "sat_editor_update_image"))
|
||||
builder.connect_signals(handlers)
|
||||
builder = get_builder(_UI_PATH, handlers, use_str=True,
|
||||
objects=("satellites_editor_window", "satellites_tree_store", "popup_menu",
|
||||
"left_header_menu", "popup_menu_add_image", "popup_menu_add_image_2",
|
||||
"sat_editor_save_image", "sat_editor_update_image"))
|
||||
|
||||
self._window = builder.get_object("satellites_editor_window")
|
||||
self._window.set_transient_for(transient)
|
||||
@@ -316,13 +313,8 @@ class TransponderDialog:
|
||||
def __init__(self, transient, transponder: Transponder = None):
|
||||
|
||||
handlers = {"on_entry_changed": self.on_entry_changed}
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain(TEXT_DOMAIN)
|
||||
builder.add_objects_from_string(get_dialogs_string(_UI_PATH).format(use_header=IS_GNOME_SESSION),
|
||||
("transponder_dialog", "pol_store", "fec_store", "mod_store", "system_store",
|
||||
"pls_mode_store"))
|
||||
builder.connect_signals(handlers)
|
||||
objects = ("transponder_dialog", "pol_store", "fec_store", "mod_store", "system_store", "pls_mode_store")
|
||||
builder = get_builder(_UI_PATH, handlers, use_str=True, objects=objects)
|
||||
|
||||
self._dialog = builder.get_object("transponder_dialog")
|
||||
self._dialog.set_transient_for(transient)
|
||||
@@ -401,10 +393,7 @@ class SatelliteDialog:
|
||||
""" Shows dialog for adding or edit satellite """
|
||||
|
||||
def __init__(self, transient, satellite: Satellite = None):
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain(TEXT_DOMAIN)
|
||||
builder.add_objects_from_string(get_dialogs_string(_UI_PATH).format(use_header=IS_GNOME_SESSION),
|
||||
("satellite_dialog", "side_store", "pos_adjustment"))
|
||||
builder = get_builder(_UI_PATH, use_str=True, objects=("satellite_dialog", "side_store", "pos_adjustment"))
|
||||
|
||||
self._dialog = builder.get_object("satellite_dialog")
|
||||
self._dialog.set_transient_for(transient)
|
||||
@@ -466,16 +455,13 @@ class UpdateDialog:
|
||||
self._parser = None
|
||||
self._size_name = "{}_window_size".format("_".join(re.findall("[A-Z][^A-Z]*", self.__class__.__name__))).lower()
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain(TEXT_DOMAIN)
|
||||
builder.add_objects_from_file(UI_RESOURCES_PATH + "satellites_dialog.glade",
|
||||
("satellites_update_window", "update_source_store", "update_sat_list_store",
|
||||
builder = get_builder(UI_RESOURCES_PATH + "satellites_dialog.glade", handlers,
|
||||
objects=("satellites_update_window", "update_source_store", "update_sat_list_store",
|
||||
"update_sat_list_model_filter", "update_sat_list_model_sort", "side_store",
|
||||
"pos_adjustment", "pos_adjustment2", "satellites_update_popup_menu",
|
||||
"remove_selection_image", "sat_update_cancel_image", "sat_receive_image",
|
||||
"sat_update_filter_image", "sat_update_search_image", "sat_update_image",
|
||||
"update_transponder_store", "update_service_store"))
|
||||
builder.connect_signals(handlers)
|
||||
|
||||
self._window = builder.get_object("satellites_update_window")
|
||||
self._window.set_transient_for(transient)
|
||||
|
||||
@@ -359,7 +359,7 @@ Author: Dmitriy Yefremov
|
||||
<property name="margin_right">5</property>
|
||||
<property name="margin_bottom">5</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="srv_grid">
|
||||
<property name="visible">True</property>
|
||||
@@ -821,10 +821,14 @@ Author: Dmitriy Yefremov
|
||||
<object class="GtkBox" id="flags_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="flags_grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin_left">5</property>
|
||||
<property name="margin_right">10</property>
|
||||
<property name="column_spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="flags_label">
|
||||
@@ -897,6 +901,47 @@ Author: Dmitriy Yefremov
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="extra_flags_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="extra_pids_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Extra:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="extra_pids_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="width_chars">20</property>
|
||||
<property name="max_width_chars">20</property>
|
||||
<property name="primary_icon_name">document-edit-symbolic</property>
|
||||
<property name="placeholder_text">c:000000,etc.</property>
|
||||
<signal name="changed" handler="on_extra_pids_entry_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="caids_grid">
|
||||
<property name="visible">True</property>
|
||||
@@ -907,8 +952,8 @@ Author: Dmitriy Yefremov
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text">C:0000,C:a1b2,etc.</property>
|
||||
<property name="width_chars">15</property>
|
||||
<property name="max_width_chars">26</property>
|
||||
<property name="width_chars">20</property>
|
||||
<property name="max_width_chars">20</property>
|
||||
<property name="primary_icon_name">document-edit-symbolic</property>
|
||||
<property name="placeholder_text" translatable="yes">C:0000,C:a1b2,etc.</property>
|
||||
<signal name="changed" handler="on_cas_entry_changed" swapped="no"/>
|
||||
@@ -934,7 +979,7 @@ Author: Dmitriy Yefremov
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2018-2021 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
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
# Author: Dmitriy Yefremov
|
||||
#
|
||||
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
@@ -8,9 +36,9 @@ from app.eparser.ecommons import (MODULATION, Inversion, ROLL_OFF, Pilot, Flag,
|
||||
TrType, SystemCable, T_SYSTEM, BANDWIDTH, TRANSMISSION_MODE, GUARD_INTERVAL, T_FEC,
|
||||
HIERARCHY, A_MODULATION)
|
||||
from app.settings import SettingsType
|
||||
from .dialogs import show_dialog, DialogType, Action, get_dialogs_string
|
||||
from .dialogs import show_dialog, DialogType, Action, get_builder
|
||||
from .main_helper import get_base_model
|
||||
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, HIDE_ICON, TEXT_DOMAIN, CODED_ICON, Column, IS_GNOME_SESSION
|
||||
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, HIDE_ICON, CODED_ICON, Column
|
||||
|
||||
_UI_PATH = UI_RESOURCES_PATH + "service_details_dialog.glade"
|
||||
|
||||
@@ -42,14 +70,12 @@ class ServiceDetailsDialog:
|
||||
"on_tr_edit_toggled": self.on_tr_edit_toggled,
|
||||
"update_reference": self.update_reference,
|
||||
"on_cas_entry_changed": self.on_cas_entry_changed,
|
||||
"on_extra_pids_entry_changed": self.on_extra_pids_entry_changed,
|
||||
"on_digit_entry_changed": self.on_digit_entry_changed,
|
||||
"on_non_empty_entry_changed": self.on_non_empty_entry_changed,
|
||||
"on_cancel": lambda item: self._dialog.destroy()}
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain(TEXT_DOMAIN)
|
||||
builder.add_from_string(get_dialogs_string(_UI_PATH).format(use_header=IS_GNOME_SESSION))
|
||||
builder.connect_signals(handlers)
|
||||
builder = get_builder(_UI_PATH, handlers, use_str=True)
|
||||
self._builder = builder
|
||||
|
||||
self._dialog = builder.get_object("service_details_dialog")
|
||||
@@ -72,6 +98,7 @@ class ServiceDetailsDialog:
|
||||
self._DIGIT_PATTERN = re.compile("\\D")
|
||||
self._NON_EMPTY_PATTERN = re.compile("(?:^[\\s]*$|\\D)")
|
||||
self._CAID_PATTERN = re.compile("(?:^[\\s]*$)|(C:[0-9a-fA-F]{1,4})(,C:[0-9a-fA-F]{1,4})*")
|
||||
self._PIDS_PATTERN = re.compile("(?:^[\\s]*$)|(c:[0-9]{2}[0-9a-fA-F]{4})(,c:[0-9]{2}[0-9a-fA-F]{4})*")
|
||||
# Buttons
|
||||
self._apply_button = builder.get_object("apply_button")
|
||||
self._create_button = builder.get_object("create_button")
|
||||
@@ -107,6 +134,7 @@ class ServiceDetailsDialog:
|
||||
self._stream_id_entry = self._digit_elements.get("stream_id_entry")
|
||||
self._tr_flag_entry = self._digit_elements.get("tr_flag_entry")
|
||||
self._namespace_entry = self._non_empty_elements.get("namespace_entry")
|
||||
self._extra_pids_entry = builder.get_object("extra_pids_entry")
|
||||
# Service elements
|
||||
self._name_entry = builder.get_object("name_entry")
|
||||
self._package_entry = builder.get_object("package_entry")
|
||||
@@ -247,6 +275,7 @@ class ServiceDetailsDialog:
|
||||
def init_enigma2_pids(self, flags):
|
||||
pids = list(filter(lambda x: x.startswith("c:"), flags))
|
||||
if pids:
|
||||
extra_pids = []
|
||||
for pid in pids:
|
||||
if pid.startswith(Pids.VIDEO.value):
|
||||
self._video_pid_entry.set_text(str(int(pid[4:], 16)))
|
||||
@@ -259,15 +288,19 @@ class ServiceDetailsDialog:
|
||||
elif pid.startswith(Pids.AC3.value):
|
||||
self._ac3_pid_entry.set_text(str(int(pid[4:], 16)))
|
||||
elif pid.startswith(Pids.VIDEO_TYPE.value):
|
||||
pass
|
||||
extra_pids.append(pid)
|
||||
elif pid.startswith(Pids.AUDIO_CHANNEL.value):
|
||||
pass
|
||||
extra_pids.append(pid)
|
||||
elif pid.startswith(Pids.BIT_STREAM_DELAY.value):
|
||||
self._bitstream_entry.set_text(str(int(pid[4:], 16)))
|
||||
elif pid.startswith(Pids.PCM_DELAY.value):
|
||||
self._pcm_entry.set_text(str(int(pid[4:], 16)))
|
||||
elif pid.startswith(Pids.SUBTITLE.value):
|
||||
pass
|
||||
extra_pids.append(pid)
|
||||
else:
|
||||
extra_pids.append(pid)
|
||||
|
||||
self._extra_pids_entry.set_text(",".join(extra_pids))
|
||||
|
||||
def init_enigma2_transponder_data(self, srv):
|
||||
""" Transponder data initialisation """
|
||||
@@ -537,6 +570,9 @@ class ServiceDetailsDialog:
|
||||
pcm_pid = self._pcm_entry.get_text()
|
||||
if pcm_pid:
|
||||
flags.append("{}{:04x}".format(Pids.PCM_DELAY.value, int(pcm_pid)))
|
||||
extra_pids = self._extra_pids_entry.get_text()
|
||||
if extra_pids:
|
||||
flags.append(extra_pids)
|
||||
# flags
|
||||
f_flags = Flag.KEEP.value if self._keep_check_button.get_active() else 0
|
||||
f_flags = f_flags + Flag.HIDE.value if self._hide_check_button.get_active() else f_flags
|
||||
@@ -696,6 +732,9 @@ class ServiceDetailsDialog:
|
||||
def on_cas_entry_changed(self, entry):
|
||||
entry.set_name("GtkEntry" if self._CAID_PATTERN.fullmatch(entry.get_text()) else self._DIGIT_ENTRY_NAME)
|
||||
|
||||
def on_extra_pids_entry_changed(self, entry):
|
||||
entry.set_name("GtkEntry" if self._PIDS_PATTERN.fullmatch(entry.get_text()) else self._DIGIT_ENTRY_NAME)
|
||||
|
||||
def get_value_from_combobox_id(self, box: Gtk.ComboBox, dc: dict):
|
||||
cb_id = box.get_active_id()
|
||||
return get_key_by_value(dc, cb_id)
|
||||
@@ -728,6 +767,8 @@ class ServiceDetailsDialog:
|
||||
return False
|
||||
if self._cas_entry.get_name() == self._DIGIT_ENTRY_NAME:
|
||||
return False
|
||||
if self._extra_pids_entry.get_name() == self._DIGIT_ENTRY_NAME:
|
||||
return False
|
||||
return True
|
||||
|
||||
def update_reference(self, entry, event=None):
|
||||
@@ -875,10 +916,7 @@ class ServiceDetailsDialog:
|
||||
|
||||
class TransponderServicesDialog:
|
||||
def __init__(self, transient, services_view, transponder, tr_iters):
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain(TEXT_DOMAIN)
|
||||
builder.add_objects_from_string(get_dialogs_string(_UI_PATH).format(use_header=IS_GNOME_SESSION),
|
||||
("tr_services_dialog", "transponder_services_liststore"))
|
||||
builder = get_builder(_UI_PATH, use_str=True, objects=("tr_services_dialog", "transponder_services_liststore"))
|
||||
self._dialog = builder.get_object("tr_services_dialog")
|
||||
self._dialog.set_transient_for(transient)
|
||||
self._srv_model = builder.get_object("transponder_services_liststore")
|
||||
|
||||
@@ -1577,7 +1577,7 @@ Author: Dmitriy Yefremov
|
||||
<object class="GtkImage" id="edit_preset_switch_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-edit</property>
|
||||
<property name="icon_name">document-edit-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@@ -2115,6 +2115,7 @@ Author: Dmitriy Yefremov
|
||||
<item id="tr_TR" translatable="yes">Türkçe</item>
|
||||
<item id="be_BY" translatable="yes">Беларуская</item>
|
||||
<item id="ru_RU" translatable="yes">Русский</item>
|
||||
<item id="zh_CN" translatable="yes">漢語</item>
|
||||
</items>
|
||||
<signal name="changed" handler="on_lang_changed" swapped="no"/>
|
||||
</object>
|
||||
|
||||
@@ -4,7 +4,7 @@ import re
|
||||
from app.commons import run_task, run_idle, log
|
||||
from app.connections import test_telnet, test_ftp, TestException, test_http, HttpApiException
|
||||
from app.settings import SettingsType, Settings, PlayStreamsMode
|
||||
from app.ui.dialogs import show_dialog, DialogType, get_message, get_chooser_dialog
|
||||
from app.ui.dialogs import show_dialog, DialogType, get_message, get_chooser_dialog, get_builder
|
||||
from .main_helper import update_entry_data, scroll_to, get_picon_pixbuf
|
||||
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, FavClickMode, DEFAULT_ICON, APP_FONT
|
||||
|
||||
@@ -64,9 +64,7 @@ class SettingsDialog:
|
||||
self._profiles = self._settings.profiles
|
||||
self._s_type = self._settings.setting_type
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_file(UI_RESOURCES_PATH + "settings_dialog.glade")
|
||||
builder.connect_signals(handlers)
|
||||
builder = get_builder(UI_RESOURCES_PATH + "settings_dialog.glade", handlers)
|
||||
|
||||
self._dialog = builder.get_object("settings_dialog")
|
||||
self._dialog.set_transient_for(transient)
|
||||
|
||||
@@ -62,4 +62,11 @@
|
||||
border-radius: 0;
|
||||
border-left-width: 0;
|
||||
border-right-width: 1px;
|
||||
}
|
||||
}
|
||||
|
||||
.stack-switcher > button {
|
||||
padding-left: 0.5em;
|
||||
padding-right: 0.5em;
|
||||
min-width: 5em;
|
||||
min-height: 1.5em;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,10 @@ import gi
|
||||
from gi.repository import GLib
|
||||
|
||||
from app.commons import log
|
||||
from app.settings import IS_DARWIN
|
||||
from app.connections import HttpAPI
|
||||
from app.settings import IS_DARWIN
|
||||
from app.tools.yt import YouTube
|
||||
from app.ui.dialogs import get_builder
|
||||
from app.ui.iptv import get_yt_icon
|
||||
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH
|
||||
|
||||
@@ -35,9 +36,7 @@ class LinksTransmitter:
|
||||
self._app_window = app_window
|
||||
self._is_status_icon = True
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_file(UI_RESOURCES_PATH + "transmitter.glade")
|
||||
builder.connect_signals(handlers)
|
||||
builder = get_builder(UI_RESOURCES_PATH + "transmitter.glade", handlers)
|
||||
|
||||
self._main_window = builder.get_object("main_window")
|
||||
self._url_entry = builder.get_object("url_entry")
|
||||
|
||||
@@ -1,7 +1,35 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2018-2021 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
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
# Author: Dmitriy Yefremov
|
||||
#
|
||||
|
||||
|
||||
import os
|
||||
from enum import Enum, IntEnum
|
||||
from functools import lru_cache
|
||||
from app.settings import Settings, SettingsException, IS_DARWIN
|
||||
from app.settings import Settings, SettingsException, IS_DARWIN, GTK_PATH
|
||||
|
||||
import gi
|
||||
|
||||
@@ -14,7 +42,6 @@ MOD_MASK = Gdk.ModifierType.MOD2_MASK if IS_DARWIN else Gdk.ModifierType.CONTROL
|
||||
# Path to *.glade files
|
||||
UI_RESOURCES_PATH = "app/ui/" if os.path.exists("app/ui/") else "ui/"
|
||||
LANG_PATH = UI_RESOURCES_PATH + "lang"
|
||||
GTK_PATH = os.environ.get("GTK_PATH", None)
|
||||
NOTIFY_IS_INIT = False
|
||||
IS_GNOME_SESSION = int(bool(os.environ.get("GNOME_DESKTOP_SESSION_ID")))
|
||||
# Translation.
|
||||
|
||||
@@ -1228,3 +1228,21 @@ msgstr "Памер пiконаў у спісах:"
|
||||
|
||||
msgid "Logo size in tooltips:"
|
||||
msgstr "Памер лагатыпа ва ўсплыўных падказках:"
|
||||
|
||||
msgid "Save as"
|
||||
msgstr "Захаваць як"
|
||||
|
||||
msgid "Mark duplicates"
|
||||
msgstr "Адзначыць дублікаты"
|
||||
|
||||
msgid "Load only for selected bouquet"
|
||||
msgstr "Загрузіць толькі для абранага букета"
|
||||
|
||||
msgid "The task is canceled!"
|
||||
msgstr "Заданне скасавана!"
|
||||
|
||||
msgid "Data loading in progress!"
|
||||
msgstr "Выконваецца загрузка дадзеных!"
|
||||
|
||||
msgid "Recordings"
|
||||
msgstr "Запісы"
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
#
|
||||
# Charly, 2019.
|
||||
# Dmitriy Yefremov, 2020-2021.
|
||||
# Thomas Schmidt, 2021
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Last-Translator: Thomas Schmidt\n"
|
||||
"Last-Translator: Dmitriy Yefremov\n"
|
||||
"Language: de\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
@@ -1241,3 +1242,21 @@ msgstr "Picons Größe in den Listen:"
|
||||
|
||||
msgid "Logo size in tooltips:"
|
||||
msgstr "Logo-Größe in Tooltips:"
|
||||
|
||||
msgid "Save as"
|
||||
msgstr "Speichern als"
|
||||
|
||||
msgid "Mark duplicates"
|
||||
msgstr "Duplikate markieren"
|
||||
|
||||
msgid "Load only for selected bouquet"
|
||||
msgstr "Nur für ausgewähltes Bouquet laden"
|
||||
|
||||
msgid "The task is canceled!"
|
||||
msgstr "Der Task wird abgebrochen!"
|
||||
|
||||
msgid "Data loading in progress!"
|
||||
msgstr "Daten werden geladen!"
|
||||
|
||||
msgid "Recordings"
|
||||
msgstr "Aufnahmen"
|
||||
|
||||
@@ -1225,3 +1225,21 @@ msgstr "Размер пиконов в списках:"
|
||||
|
||||
msgid "Logo size in tooltips:"
|
||||
msgstr "Размер логотипа во всплывающих подсказках:"
|
||||
|
||||
msgid "Save as"
|
||||
msgstr "Сохранить как"
|
||||
|
||||
msgid "Mark duplicates"
|
||||
msgstr "Отметить дубликаты"
|
||||
|
||||
msgid "Load only for selected bouquet"
|
||||
msgstr "Загрузить только для выбранного букета"
|
||||
|
||||
msgid "The task is canceled!"
|
||||
msgstr "Задание отменено!"
|
||||
|
||||
msgid "Data loading in progress!"
|
||||
msgstr "Выполняется загрузка данных!"
|
||||
|
||||
msgid "Recordings"
|
||||
msgstr "Записи"
|
||||
|
||||
@@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: DemonEditor\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-04-16 15:59+0300\n"
|
||||
"PO-Revision-Date: 2021-02-22 23:53+0300\n"
|
||||
"PO-Revision-Date: 2021-06-13 14:54+0300\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
@@ -1023,7 +1023,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Kaydedilmemiş değişiklikler var.\n"
|
||||
"\n"
|
||||
"\tŞimdi kaydedilsin mi?"
|
||||
"\t Şimdi kaydedilsin mi?"
|
||||
|
||||
msgid ""
|
||||
"Are you sure you want to change the order\n"
|
||||
@@ -1245,3 +1245,27 @@ msgstr "Picon'lar indirin"
|
||||
|
||||
msgid "Errors:"
|
||||
msgstr "Hatalar:"
|
||||
|
||||
msgid "Use to play streams:"
|
||||
msgstr "Akışları oynatmak için kullanın:"
|
||||
|
||||
msgid "Font in the lists:"
|
||||
msgstr "Listelerdeki yazı tipi:"
|
||||
|
||||
msgid "Picons size in the lists:"
|
||||
msgstr "Listelerdeki Piconların boyutu:"
|
||||
|
||||
msgid "Logo size in tooltips:"
|
||||
msgstr "Araç ipuçlarındaki logo boyutu:"
|
||||
|
||||
msgid "Save as"
|
||||
msgstr "Farklı kaydet"
|
||||
|
||||
msgid "Mark duplicates"
|
||||
msgstr "Yinelenenleri işaretle"
|
||||
|
||||
msgid "Load only for selected bouquet"
|
||||
msgstr "Yalnızca seçilen buket için yükle"
|
||||
|
||||
msgid "The task is canceled!"
|
||||
msgstr "Görev iptal edildi!"
|
||||
|
||||
1246
po/zh_CN/demon-editor.po
Normal file
1246
po/zh_CN/demon-editor.po
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user