From 54c7f32d53a53c4272f92cc7f2ca4d2fb610f841 Mon Sep 17 00:00:00 2001 From: DYefremov Date: Sat, 16 Dec 2017 10:29:51 +0300 Subject: [PATCH] little iptv and ui changes --- app/eparser/bouquets.py | 17 ++++++++++------- app/ui/__init__.py | 4 ++-- app/ui/main_app_window.py | 1 + app/ui/main_window.glade | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/eparser/bouquets.py b/app/eparser/bouquets.py index ec3e7771..d328f0e0 100644 --- a/app/eparser/bouquets.py +++ b/app/eparser/bouquets.py @@ -46,11 +46,13 @@ def write_bouquet(path, name, bq_type, channels): def to_bouquet_id(ch): """ Creates bouquet channel id """ - data_type = int(ch.data_id.split(":")[-2]) - if data_type == 22: - data_type = 16 - elif data_type == 25: - data_type = 19 + data_type = ch.data_id + if data_type: + data_type = int(ch.data_id.split(":")[-2]) + if data_type == 22: + data_type = 16 + elif data_type == 25: + data_type = 19 service = "{}:0:{}:{}:0:0:0:".format(1, data_type, ch.fav_id) return service @@ -62,11 +64,12 @@ def get_bouquet(path, name, bq_type): chs_list = file.read() ids = [] for ch in list(filter(lambda x: len(x) > 1, chs_list.split("#SERVICE")[1:])): # filtering [''] - if "#DESCRIPTION" in ch: # IPTV + if "#DESCRIPTION" in ch: ids.append("#SERVICE{}".format(ch)) else: ch_data = ch.strip().split(":") - ids.append("{}:{}:{}:{}".format(ch_data[3], ch_data[4], ch_data[5], ch_data[6])) + if len(ch_data) > 5: + ids.append("{}:{}:{}:{}".format(ch_data[3], ch_data[4], ch_data[5], ch_data[6])) return ids diff --git a/app/ui/__init__.py b/app/ui/__init__.py index 0d4fcfea..fd1af914 100644 --- a/app/ui/__init__.py +++ b/app/ui/__init__.py @@ -5,8 +5,8 @@ from gi.repository import Gtk, Gdk theme = Gtk.IconTheme.get_default() _IMAGE_MISSING = theme.load_icon("image-missing", 16, 0) if theme.lookup_icon("image-missing", 16, 0) else None -CODED_ICON = theme.load_icon("gtk-dialog-authentication-panel", 16, 0) if theme.lookup_icon( - "gtk-dialog-authentication-panel", 16, 0) else _IMAGE_MISSING +CODED_ICON = theme.load_icon("emblem-readonly", 16, 0) if theme.lookup_icon( + "emblem-readonly", 16, 0) else _IMAGE_MISSING LOCKED_ICON = theme.load_icon("system-lock-screen", 16, 0) if theme.lookup_icon( "system-lock-screen", 16, 0) else _IMAGE_MISSING HIDE_ICON = theme.load_icon("go-jump", 16, 0) if theme.lookup_icon("go-jump", 16, 0) else _IMAGE_MISSING diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index 232a457d..261499e4 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -460,6 +460,7 @@ class MainAppWindow: if "#DESCRIPTION" in srv: fav_id, sep, name = str(srv).partition("#DESCRIPTION") name = name.strip() if ":" not in name else name.strip()[1:] + ch_type = "IPTV" if "http" in fav_id else None aggr = [None] * 8 self.__channels[srv] = Channel(*aggr[0:3], name, *aggr[0:3], "IPTV", *aggr, srv, None) diff --git a/app/ui/main_window.glade b/app/ui/main_window.glade index de06e78e..b7fba9cf 100644 --- a/app/ui/main_window.glade +++ b/app/ui/main_window.glade @@ -1109,7 +1109,7 @@ True False 5 - gtk-dialog-authentication-panel + emblem-readonly False