def playMovie(self):
     if self.service and self.enabled:
         if self.service.flags & eServiceReference.mustDescent or isinstance(
                 self.service, eServiceReferenceBludisc):
             print "Skipping video preview"
             self.__playLastService()
             return
         from MoviePlayer import playerChoice
         if playerChoice and playerChoice.isPlaying():
             print "Skipping video preview"
             return
         cpsr = self.session.nav.getCurrentlyPlayingServiceReference()
         if cpsr and cpsr == self.service:
             return
         #if not self.lastService:
         #    self.lastService = self.session.nav.getCurrentlyPlayingServiceReference()
         self.stopCurrentlyPlayingService()
         if isinstance(self.service, eServiceReferenceDvd):
             if self.service.isIsoImage():
                 if ISOInfo().getFormatISO9660(self.service) != ISOInfo.DVD:
                     print "Skipping video preview"
                     self.__playLastService()
                     return
             newref = eServiceReference(4369, 0, self.service.getPath())
             self.session.nav.playService(newref)
             subs = self.getServiceInterface("subtitle")
             if subs:
                 subs.enableSubtitles(self.dvdScreen.instance, None)
         else:
             self.session.nav.playService(self.service)
         print "play", self.service.getPath()
         self.currentlyPlayingService = self.service
         seekable = self.getSeek()
         if seekable:
             try:
                 cue = CueSheet(self.service)
                 self.cut_list = cue.getCutList()
                 length, last = self.getCuePositions()
                 stop_before_end_time = int(config.AdvancedMovieSelection.
                                            stop_before_end_time.value)
                 if stop_before_end_time > 0:
                     if (((length) -
                          (last / 90000)) / 60) < stop_before_end_time:
                         return
                 if last > 0 and config.AdvancedMovieSelection.video_preview_marker.value:
                     if self.service.getPath().endswith('ts'):
                         seekable.seekTo(last)
                     else:
                         self.minutes = long(last / 90000 / 60)
                         if isinstance(self.service, eServiceReferenceDvd):
                             self.resume_point = last
                             self.dvd_preview_timer.start(1000, True)
                             return
                         self.fwd_timer.start(1000, True)
             except Exception, e:
                 print e
 def stopCurrentlyPlayingService(self):
     if self.currentlyPlayingService:
         if isinstance(self.currentlyPlayingService, eServiceReferenceDvd):
             subs = self.getServiceInterface("subtitle")
             if subs:
                 subs.disableSubtitles(self.session.current_dialog.instance)
         self.session.nav.stopService()
         cue = CueSheet(self.currentlyPlayingService)
         cue.setCutList(self.cut_list)
         self.currentlyPlayingService = None
 def stopCurrentlyPlayingService(self):
     if self.currentlyPlayingService:
         if isinstance(self.currentlyPlayingService, eServiceReferenceDvd):
             subs = self.getServiceInterface("subtitle")
             if subs:
                 subs.disableSubtitles(self.session.current_dialog.instance)
         self.session.nav.stopService()
         cue = CueSheet(self.currentlyPlayingService)
         cue.setCutList(self.cut_list)
         self.currentlyPlayingService = None
 def playMovie(self):
     if self.service and self.enabled:
         if self.service.flags & eServiceReference.mustDescent or isinstance(self.service, eServiceReferenceBludisc):
             print "Skipping video preview"
             self.__playLastService()
             return
         from MoviePlayer import playerChoice
         if playerChoice and playerChoice.isPlaying():
             print "Skipping video preview"
             return
         cpsr = self.session.nav.getCurrentlyPlayingServiceReference()
         if cpsr and cpsr == self.service:
             return 
         #if not self.lastService:
         #    self.lastService = self.session.nav.getCurrentlyPlayingServiceReference()
         self.stopCurrentlyPlayingService()
         if isinstance(self.service, eServiceReferenceDvd):
             if self.service.isIsoImage():
                 if ISOInfo().getFormatISO9660(self.service) != ISOInfo.DVD:
                     print "Skipping video preview"
                     self.__playLastService()
                     return
             newref = eServiceReference(4369, 0, self.service.getPath())
             self.session.nav.playService(newref)
             subs = self.getServiceInterface("subtitle")
             if subs:
                 subs.enableSubtitles(self.dvdScreen.instance, None)
         else:
             self.session.nav.playService(self.service)
         print "play", self.service.getPath()
         self.currentlyPlayingService = self.service
         seekable = self.getSeek()
         if seekable:
             try:
                 cue = CueSheet(self.service)
                 self.cut_list = cue.getCutList()
                 length, last = self.getCuePositions()
                 stop_before_end_time = int(config.AdvancedMovieSelection.stop_before_end_time.value)
                 if stop_before_end_time > 0:
                     if (((length) - (last / 90000)) / 60) < stop_before_end_time:
                         return
                 if last > 0 and config.AdvancedMovieSelection.video_preview_marker.value:
                     if self.service.getPath().endswith('ts'):
                         seekable.seekTo(last)
                     else:
                         self.minutes = long(last / 90000 / 60)
                         if isinstance(self.service, eServiceReferenceDvd):
                             self.resume_point = last
                             self.dvd_preview_timer.start(1000, True)
                             return
                         self.fwd_timer.start(1000, True)
             except Exception, e:
                 print e