Skip to content

Commit

Permalink
2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dream-alpha committed Nov 10, 2024
1 parent be8b0a8 commit 27fd368
Show file tree
Hide file tree
Showing 12 changed files with 562 additions and 567 deletions.
2 changes: 1 addition & 1 deletion CONTROL/control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Description: TVMagazineCockpit
Maintainer: dream-alpha
Package: enigma2-plugin-extensions-tvmagazinecockpit
Version: 1.10.5
Version: 2.0.1
Architecture: all
Depends: enigma2-plugin-skincomponents-extmultilistselection
8 changes: 4 additions & 4 deletions src/ChannelManagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
from .__init__ import _
from .MyList import MyList
from .Debug import logger
from .ChannelUtils import write_channel_list, getChannel
from .ChannelUtils import writeChannelList, getChannel
from .Constants import TVS
from .ZapUtils import Zap_Service
from .ZapUtils import zapService


class ChannelManagement(Screen):
Expand Down Expand Up @@ -139,7 +139,7 @@ def key_green(self):
bouquet_channel_list = self["list"].getList()
for list_element in bouquet_channel_list:
channel_list.append(list_element[5])
write_channel_list(self.bouquet, channel_list)
writeChannelList(self.bouquet, channel_list)
logger.debug("channel_list: %s", channel_list)
self.close(channel_list)

Expand Down Expand Up @@ -238,7 +238,7 @@ def menuCallback(self, answer):
logger.debug("addall: channel_list: %s", self.channel_list)
self.key_blue()
elif answer == "zap":
Zap_Service(curr[3])
zapService(curr[3])

def addTVChannel(self, curr):
name = curr[0]
Expand Down
21 changes: 6 additions & 15 deletions src/ChannelUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,11 @@
from six import text_type
from Tools.Directories import resolveFilename, SCOPE_CONFIG, pathExists
from .ConfigInit import plugindir
from .UnicodeUtils import convertUni2Str
from .Debug import logger


def convert_unicode_to_str(input_data):
if isinstance(input_data, dict):
return {convert_unicode_to_str(key): convert_unicode_to_str(value) for key, value in input_data.iteritems()}
if isinstance(input_data, list):
return [convert_unicode_to_str(element) for element in input_data]
if isinstance(input_data, text_type):
return input_data.encode("utf-8")
return input_data


def read_channel_list(bouquet="default"):
def readChannelList(bouquet="default"):
logger.info("bouquet: %s", bouquet)
filename = ""
channel_list = []
Expand All @@ -52,20 +43,20 @@ def read_channel_list(bouquet="default"):
logger.debug("filename: %s", filename)
if filename:
with open(filename) as data_file:
channel_list = convert_unicode_to_str(json.load(data_file))
channel_list = convertUni2Str(json.load(data_file))
logger.debug("channel_list: %s", channel_list)
return channel_list


def write_channel_list(bouquet, channel_list):
def writeChannelList(bouquet, channel_list):
logger.info("bouquet: %s", bouquet)
channel_list_filename = "tvspielfilm_channel_list_%s.json" % bouquet
path = os.path.join(resolveFilename(SCOPE_CONFIG), channel_list_filename)
with open(path, "w") as afile:
json.dump(channel_list, afile, indent=2)


def read_channel_dict():
def readChannelDict():
logger.info("...")
filename = ""
channel_dict = {}
Expand All @@ -80,7 +71,7 @@ def read_channel_dict():
logger.debug("filename: %s", filename)
if filename:
with open(filename) as data_file:
channel_dict = convert_unicode_to_str(json.load(data_file))
channel_dict = convertUni2Str(json.load(data_file))
logger.debug("channel_dict: %s", channel_dict)
return channel_dict

Expand Down
109 changes: 56 additions & 53 deletions src/Menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,32 @@
# <http://www.gnu.org/licenses/>.


from Components.config import config
from Components.UsageConfig import preferredTimerPath
from RecordTimer import RecordTimerEntry
from Screens.TimerEdit import TimerSanityConflict
from Screens.TimerEntry import TimerEntry
from Screens.ChoiceBox import ChoiceBox
from enigma import eServiceReference
from ServiceReference import ServiceReference
from Components.config import config
from .__init__ import _
from .Debug import logger
from .ConfigScreen import ConfigScreen
from .ChannelManagement import ChannelManagement
from .ConfigInit import bouquet_choices
from .About import about
from .Version import PLUGIN
from .ZapUtils import Zap_Service
from .Constants import EVENT_IDX_TIME_START, EVENT_IDX_TIME_END, EVENT_IDX_TITLE, EVENT_IDX_GENRE
from .PluginUtils import getPlugin, WHERE_MEDIATHEK_SEARCH, WHERE_TMDB_MOVIELIST
from .ServiceUtils import getService


class Menu():
def __init__(self):
logger.info("...")
self.mediathek_plugin = getPlugin(WHERE_MEDIATHEK_SEARCH)
self.tmdb_plugin = getPlugin(WHERE_TMDB_MOVIELIST)

def openMenu(self, service, event):
logger.info("service: %s", service)
logger.info("event: %s", event)
self.service = service
self.event = event
def openMenu(self, bouquet, channel_list, channel_dict):
logger.info("...")
self.bouquet = bouquet
self.channel_list = channel_list
self.channel_dict = channel_dict
alist = [
("%s" % _("Zap"), "zap"),
("%s" % _("Add Timer"), "timer"),
("%s" % _("Bouquet Selection"), "bouquetselection"),
("%s" % _("Bouquet Setup"), "channel"),
("%s" % _("Settings"), "settings"),
("%s" % _("About"), "about"),
]
if self.mediathek_plugin:
alist.append(("%s" % self.mediathek_plugin.description, "mediathek_search"))
if self.tmdb_plugin:
alist.append(("%s" % self.tmdb_plugin.description, "tmdb_search"))

self.session.openWithCallback(
self.openMenuCallback,
Expand All @@ -69,34 +59,47 @@ def openMenu(self, service, event):
def openMenuCallback(self, answer=None):
logger.info("...")
if answer:
action = answer[1]
if action == "zap":
Zap_Service(self.service)
self.close()
elif action == "timer":
serviceref = ServiceReference(eServiceReference(self.service))
begin = int(self.event[EVENT_IDX_TIME_START]) - config.recording.margin_before.value * 60
end = int(self.event[EVENT_IDX_TIME_END]) + config.recording.margin_after.value * 60
eventdata = (begin, end, self.event[EVENT_IDX_TITLE], self.event[EVENT_IDX_GENRE], None)
newEntry = RecordTimerEntry(serviceref, checkOldTimers=True, dirname=preferredTimerPath(), *eventdata)
self.session.openWithCallback(self.finishedAdd, TimerEntry, newEntry)
elif action == "mediathek_search":
self.mediathek_plugin(self.session, self.event[EVENT_IDX_TITLE])
elif action == "tmdb_search":
service = getService("", self.event[EVENT_IDX_TITLE])
self.tmdb_plugin(self.session, service)
screen = answer[1]
if screen == "channel":
self.session.openWithCallback(
self.openChannelManagementCallback,
ChannelManagement,
self.bouquet,
self.channel_list,
self.channel_dict,
)
elif screen == "settings":
self.session.openWithCallback(
self.openConfigScreenCallback,
ConfigScreen,
config.plugins.tvmagazinecockpit
)
elif screen == "bouquetselection":
alist = [(value[1], value[0]) for value in bouquet_choices]
self.session.openWithCallback(
self.openBouquetSelectionCallback,
ChoiceBox,
title="Bouquet Selection",
list=alist,
windowTitle=_("Bouquet Selection"),
allow_cancel=True,
titlebartext=_("Input")
)
elif screen == "about":
about(self.session)

def finishedAdd(self, answer):
def openConfigScreenCallback(self, _result=None):
logger.info("...")
if answer[0]:
entry = answer[1]
simulTimerList = self.session.nav.RecordTimer.record(entry)
if simulTimerList is not None:
for x in simulTimerList:
if x.setAutoincreaseEnd(entry):
self.session.nav.RecordTimer.timeChanged(x)
simulTimerList = self.session.nav.RecordTimer.record(entry)
if simulTimerList is not None:
self.session.openWithCallback(self.finishedAdd, TimerSanityConflict, simulTimerList)
else:
logger.debug("Timeredit aborted")
self.reload()

def openChannelManagementCallback(self, channel_list):
logger.info("...")
self.channel_list = channel_list
self.reload()

def openBouquetSelectionCallback(self, bouquet):
logger.info("bouquet: %s", bouquet)
if bouquet:
config.plugins.tvmagazinecockpit.bouquet.value = bouquet[1]
config.plugins.tvmagazinecockpit.bouquet.save()
self.close("programcolumns")
109 changes: 53 additions & 56 deletions src/More.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,42 @@
# <http://www.gnu.org/licenses/>.


from Screens.ChoiceBox import ChoiceBox
from Components.config import config
from Components.UsageConfig import preferredTimerPath
from RecordTimer import RecordTimerEntry
from Screens.TimerEdit import TimerSanityConflict
from Screens.TimerEntry import TimerEntry
from Screens.ChoiceBox import ChoiceBox
from enigma import eServiceReference
from ServiceReference import ServiceReference
from .__init__ import _
from .Debug import logger
from .ConfigScreen import ConfigScreen
from .ChannelManagement import ChannelManagement
from .ConfigInit import bouquet_choices
from .About import about
from .Version import PLUGIN
from .ZapUtils import zapService
from .Constants import EVENT_IDX_TIME_START, EVENT_IDX_TIME_END, EVENT_IDX_TITLE, EVENT_IDX_GENRE
from .PluginUtils import getPlugin, WHERE_MEDIATHEK_SEARCH, WHERE_TMDB_MOVIELIST
from .ServiceUtils import getService


class More():
def __init__(self):
logger.info("...")
self.mediathek_plugin = getPlugin(WHERE_MEDIATHEK_SEARCH)
self.tmdb_plugin = getPlugin(WHERE_TMDB_MOVIELIST)

def openMore(self, bouquet, channel_list, channel_dict):
logger.info("...")
self.bouquet = bouquet
self.channel_list = channel_list
self.channel_dict = channel_dict
def openMore(self, service, event):
logger.info("service: %s", service)
logger.info("event: %s", event)
self.service = service
self.event = event
alist = [
("%s" % _("Bouquet Selection"), "bouquetselection"),
("%s" % _("Bouquet Setup"), "channel"),
("%s" % _("Settings"), "settings"),
("%s" % _("About"), "about"),
("%s" % _("Zap"), "zap"),
("%s" % _("Add Timer"), "timer"),
]
if self.mediathek_plugin:
alist.append(("%s" % self.mediathek_plugin.description, "mediathek_search"))
if self.tmdb_plugin:
alist.append(("%s" % self.tmdb_plugin.description, "tmdb_search"))

self.session.openWithCallback(
self.openMoreCallback,
Expand All @@ -59,47 +69,34 @@ def openMore(self, bouquet, channel_list, channel_dict):
def openMoreCallback(self, answer=None):
logger.info("...")
if answer:
screen = answer[1]
if screen == "channel":
self.session.openWithCallback(
self.openChannelManagementCallback,
ChannelManagement,
self.bouquet,
self.channel_list,
self.channel_dict,
)
elif screen == "settings":
self.session.openWithCallback(
self.openConfigScreenCallback,
ConfigScreen,
config.plugins.tvmagazinecockpit
)
elif screen == "bouquetselection":
alist = [(value[1], value[0]) for value in bouquet_choices]
self.session.openWithCallback(
self.openBouquetSelectionCallback,
ChoiceBox,
title="Bouquet Selection",
list=alist,
windowTitle=_("Bouquet Selection"),
allow_cancel=True,
titlebartext=_("Input")
)
elif screen == "about":
about(self.session)
action = answer[1]
if action == "zap":
zapService(self.service)
self.close()
elif action == "timer":
serviceref = ServiceReference(eServiceReference(self.service))
begin = int(self.event[EVENT_IDX_TIME_START]) - config.recording.margin_before.value * 60
end = int(self.event[EVENT_IDX_TIME_END]) + config.recording.margin_after.value * 60
eventdata = (begin, end, self.event[EVENT_IDX_TITLE], self.event[EVENT_IDX_GENRE], None)
newEntry = RecordTimerEntry(serviceref, checkOldTimers=True, dirname=preferredTimerPath(), *eventdata)
self.session.openWithCallback(self.finishedAdd, TimerEntry, newEntry)
elif action == "mediathek_search":
self.mediathek_plugin(self.session, self.event[EVENT_IDX_TITLE])
elif action == "tmdb_search":
service = getService("", self.event[EVENT_IDX_TITLE])
self.tmdb_plugin(self.session, service)

def openConfigScreenCallback(self, _result=None):
def finishedAdd(self, answer):
logger.info("...")
self.reload()

def openChannelManagementCallback(self, channel_list):
logger.info("...")
self.channel_list = channel_list
self.reload()

def openBouquetSelectionCallback(self, bouquet):
logger.info("bouquet: %s", bouquet)
if bouquet:
config.plugins.tvmagazinecockpit.bouquet.value = bouquet[1]
config.plugins.tvmagazinecockpit.bouquet.save()
self.close("programcolumns")
if answer[0]:
entry = answer[1]
simulTimerList = self.session.nav.RecordTimer.record(entry)
if simulTimerList is not None:
for x in simulTimerList:
if x.setAutoincreaseEnd(entry):
self.session.nav.RecordTimer.timeChanged(x)
simulTimerList = self.session.nav.RecordTimer.record(entry)
if simulTimerList is not None:
self.session.openWithCallback(self.finishedAdd, TimerSanityConflict, simulTimerList)
else:
logger.debug("Timeredit aborted")
Loading

0 comments on commit 27fd368

Please sign in to comment.