.) Fix "Not switching back after refresh"
[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                 print("[EPGRefresh] DEBUG prepare.previousService=" + str(self.previousService))
24                 return True
25
26         def play(self, service):
27                 print("[EPGRefresh.MainPictureAdapter.play]")
28                 return self.navcore.playService(service)
29
30         def stop(self):
31                 if self.previousService is not None or Screens.Standby.inStandby:
32                         self.navcore.playService(self.previousService)
33