Functionality:
[enigma2-plugins.git] / epgrefresh / src / MainPictureAdapter.py
1 from __future__ import print_function
2
3 import Screens.Standby
4
5 # MessageBox
6 from Screens.MessageBox import MessageBox
7 from Tools import Notifications
8
9 # Config
10 from Components.config import config
11
12 from . import _, STARTNOTIFICATIONID, NOTIFICATIONDOMAIN
13
14 class MainPictureAdapter:
15         backgroundCapable = True
16         def __init__(self, session):
17                 self.navcore = session.nav
18
19         def prepare(self):
20                 if config.plugins.epgrefresh.enablemessage.value:
21                         Notifications.AddPopup(_("EPG refresh starts scanning channels."), MessageBox.TYPE_INFO, 4, STARTNOTIFICATIONID, domain = NOTIFICATIONDOMAIN)
22                 self.previousService = self.navcore.getCurrentlyPlayingServiceReference()
23                 return True
24
25         def play(self, service):
26                 print("[EPGRefresh.MainPictureAdapter.play]")
27                 return self.navcore.playService(service)
28
29         def stop(self):
30                 if self.previousService is not None:
31                         self.navcore.playService(self.previousService)
32