Merge remote-tracking branch 'origin/master'
[enigma2-plugins.git] / epgrefresh / src / MainPictureAdapter.py
1 import Screens.Standby
2
3 # MessageBox
4 from Screens.MessageBox import MessageBox
5 from Tools import Notifications
6
7 # Config
8 from Components.config import config
9
10 class MainPictureAdapter:
11         def __init__(self, session):
12                 self.showNotification = config.plugins.epgrefresh.enablemessage.value
13                 self.session = session
14                 self.previousService = session.nav.getCurrentlyPlayingServiceReference()
15
16         def play(self, service):
17                 print "[EPGRefresh.MainPictureAdapter.play]"
18                 if self.showNotification:
19                         Notifications.AddNotification(MessageBox, _("EPG refresh starts scanning channels."), type=MessageBox.TYPE_INFO, timeout=4)
20                         self.showNotification = False
21                 return self.session.nav.playService(service)
22
23         def stop(self):
24                 if self.previousService is not None or Screens.Standby.inStandby:
25                         self.session.nav.playService(self.previousService)
26