23 декабря | 2024г. | 18:10:35


АвторТема: Seekbar Mod  (Прочитано 15481 раз)

0 Пользователей и 1 Гость смотрят эту тему.

Онлайн scorpionas56

  • Друзья Джедаев
  • *****
  • Сообщений: 2497
  • Поблагодарили: 3492
  • Уважение: +12
Seekbar Mod
« Ответ #15: 15 июля | 2014г. | 19:07:08 »
0
Не стает ни одна !
Ставил два последних варианта, в плагинах не отображались,но на кнопки реагировали по-разному-значит что-то работает.

Оффлайн MegAndretH

  • Джедай Куратор
  • **
  • Сообщений: 1012
  • Поблагодарили: 1138
  • Уважение: +5
Seekbar Mod
« Ответ #16: 15 июля | 2014г. | 19:13:50 »
0
sawa wapos. При воспроизведении вызывается долгим нажатием кнопок перемотки, в плагинах не отображается.

Оффлайн Ingo

  • Джедай
  • ***
  • Сообщений: 346
  • Поблагодарили: 569
  • Уважение: 0
Seekbar Mod
« Ответ #17: 08 февраля | 2016г. | 23:59:28 »
0
Очень актуальная тема, решил поднять, Спасибо автору.
Seasondream, Mediaportal, IPTVPlayer ...

Оффлайн Ingo

  • Джедай
  • ***
  • Сообщений: 346
  • Поблагодарили: 569
  • Уважение: 0
Seekbar Mod
« Ответ #18: 12 февраля | 2016г. | 14:42:42 »
0
Тема только для Seekbar Mod , по TimeSeekBar здесь можно искать передержки?

Оффлайн Ingo

  • Джедай
  • ***
  • Сообщений: 346
  • Поблагодарили: 569
  • Уважение: 0
Seekbar Mod
« Ответ #19: 15 февраля | 2016г. | 12:33:26 »
0
Не выходит сделать управление Seasondream в Seekbar Mod (в частности перемотку FLV), помогите разобраться.
Делал по аналогии, строго не судите ...
Спойлер   :
##
## Seekbar
## by AliAbdul
## mod Dima73(2012)
from Components.ActionMap import ActionMap
from Components.config import config, ConfigInteger, ConfigNumber, ConfigSelection, ConfigSubsection, ConfigYesNo, getConfigListEntry
from Components.ConfigList import ConfigListScreen
from Components.Label import Label
from Components.Language import language
from Components.Pixmap import MovingPixmap
from enigma import eTimer
from keyids import KEYIDS
from os import environ
from Screens.Screen import Screen
from Screens.InfoBar import MoviePlayer, InfoBar
from Tools.Directories import fileExists, resolveFilename, SCOPE_LANGUAGE, SCOPE_PLUGINS
from Tools.KeyBindings import addKeyBinding
import gettext, keymapparser



##############################################

config.plugins.Seekbar = ConfigSubsection()
config.plugins.Seekbar.overwrite_left_right = ConfigYesNo(default=True)
config.plugins.Seekbar.sensibility = ConfigInteger(default=10, limits=(1, 10))

##############################################

lang = language.getLanguage()
environ["LANGUAGE"] = lang[:2]
gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANGUAGE))
gettext.textdomain("enigma2")
gettext.bindtextdomain("Seekbar", "%s%s" % (resolveFilename(SCOPE_PLUGINS), "Extensions/Seekbar/locale/"))

def _(txt):
   t = gettext.dgettext("Seekbar", txt)
   if t == txt:
      t = gettext.gettext(txt)
   return t

##############################################

class Seekbar(ConfigListScreen, Screen):
   skin = """
   <screen position="center,center" size="560,160" title="%s">
      <widget name="config" position="10,10" size="540,100" scrollbarMode="showOnDemand" />
      <widget name="cursor" position="0,125" size="8,18" pixmap="skin_default/position_arrow.png" alphatest="on" />
      <widget source="session.CurrentService" render="PositionGauge" position="145,140" size="270,10" zPosition="2" pointer="skin_default/position_pointer.png:540,0" transparent="1" foregroundColor="#20224f">
         <convert type="ServicePosition">Gauge</convert>
      </widget>
      <widget name="time" position="50,130" size="100,20" font="Regular;20" halign="left" backgroundColor="#4e5a74" transparent="1" />
      <widget source="session.CurrentService" render="Label" position="420,130" size="90,24" font="Regular;20" halign="right" backgroundColor="#4e5a74" transparent="1">
         <convert type="ServicePosition">Length</convert>
      </widget>
   </screen>""" % _("Seek")

   def __init__(self, session, instance, fwd):
      Screen.__init__(self, session)
      
      self.session = session
      self.infobarInstance = instance
      self.fwd = fwd
      if isinstance(session.current_dialog, MoviePlayer):
         self.movie = True
      else:
         self.movie = False
      try:
         if isinstance(session.current_dialog, MoviePlayer2):
            self.media = True
         else:
            self.media = False
      except:
         self.media = False
      try:
         if isinstance(session.current_dialog, DVDPlayer):
            self.dvd_pli = True
         else:
            self.dvd_pli = False
      except:
         self.dvd_pli = False
      try:
         if isinstance(session.current_dialog, DVDPlayer2):
            self.old_dvd = True
         else:
            self.old_dvd = False
      except:
         self.old_dvd = False
      try:
         if isinstance(session.current_dialog, MyTubePlayer):
            self.mytube = True
         else:
            self.mytube = False
      except:
         self.mytube = False
      try:
         if isinstance(session.current_dialog, nVODplayer):
            self.vod = True
         else:
            self.vod = False
      except:
         self.vod = False
      try:
         if isinstance(session.current_dialog, VODplayer):
            self.cSc_vod = True
         else:
            self.cSc_vod = False
      except:
         self.cSc_vod = False
      try:
            if isinstance(session.current_dialog, Player):
            self.seasondream = True
         else:
            self.seasondream = False
      except:
         self.seasondream = False
      try:
         if isinstance(session.current_dialog, InfoBar):
            self.timeshift = True
         else:
            self.timeshift = False
      except:
         self.timeshift = False
      self.percent = 0.0
      self.length = None
      service = session.nav.getCurrentService()
      if service:
         self.seek = service.seek()
         if self.seek:
            self.length = self.seek.getLength()
            position = self.seek.getPlayPosition()
            if self.length and position:
               if int(position[1]) > 0:
                  self.percent = float(position[1]) * 100.0 / float(self.length[1])
      
      self.minuteInput = ConfigNumber(default=5)
      self.positionEntry = ConfigSelection(choices=["<>"], default="<>")
      if self.fwd:
         txt = _("Jump x minutes forward:")
      else:
         txt = _("Jump x minutes back:")
      ConfigListScreen.__init__(self, [
         getConfigListEntry(txt, self.minuteInput),
         getConfigListEntry(_("Go to position:"), self.positionEntry),
         getConfigListEntry(_("Sensibility:"), config.plugins.Seekbar.sensibility),
         getConfigListEntry(_("Overwrite left and right buttons:"), config.plugins.Seekbar.overwrite_left_right)])
      
      self["cursor"] = MovingPixmap()
      self["time"] = Label()
      
      self["actions"] = ActionMap(["WizardActions"], {"back": self.exit}, -1)
      
      self.cursorTimer = eTimer()
      self.cursorTimer.callback.append(self.updateCursor)
      self.cursorTimer.start(200, False)
      
      self.onLayoutFinish.append(self.firstStart)

   def firstStart(self):
      self["config"].setCurrentIndex(1)

   def updateCursor(self):
      if self.length:
         x = 145 + int(2.7 * self.percent)
         self["cursor"].moveTo(x, 125, 1)
         self["cursor"].startMoving()
         pts = int(float(self.length[1]) / 100.0 * self.percent)
         self["time"].setText("%d:%02d" % ((pts/60/90000), ((pts/90000)%60)))

   def exit(self):
      self.cursorTimer.stop()
      ConfigListScreen.saveAll(self)
      self.close()

   def keyOK(self):
      sel = self["config"].getCurrent()[1]
      if sel == self.positionEntry:
         if self.length:
            if self.old_dvd: # seekTo() doesn't work for DVD Player
               oldPosition = self.seek.getPlayPosition()[1]
               newPosition = int(float(self.length[1]) / 100.0 * self.percent)
               if newPosition > oldPosition:
                  pts = newPosition - oldPosition
               else:
                  pts = -1*(oldPosition - newPosition)
               DVDPlayer2.doSeekRelative(self.infobarInstance, pts)
            elif self.media:
               oldPosition = self.seek.getPlayPosition()[1]
               newPosition = int(float(self.length[1]) / 100.0 * self.percent)
               if newPosition > oldPosition:
                  pts = newPosition - oldPosition
               else:
                  pts = -1 * (oldPosition - newPosition)
               MoviePlayer2.doSeekRelative(self.infobarInstance, pts)
            elif self.dvd_pli:
               oldPosition = self.seek.getPlayPosition()[1]
               newPosition = int(float(self.length[1]) / 100.0 * self.percent)
               if newPosition > oldPosition:
                  pts = newPosition - oldPosition
               else:
                  pts = -1 * (oldPosition - newPosition)
               DVDPlayer.doSeekRelative(self.infobarInstance, pts)
            elif self.mytube:
               oldPosition = self.seek.getPlayPosition()[1]
               newPosition = int(float(self.length[1]) / 100.0 * self.percent)
               if newPosition > oldPosition:
                  pts = newPosition - oldPosition
               else:
                  pts = -1 * (oldPosition - newPosition)
               MyTubePlayer.doSeekRelative(self.infobarInstance, pts)
            elif self.vod:
               oldPosition = self.seek.getPlayPosition()[1]
               newPosition = int(float(self.length[1]) / 100.0 * self.percent)
               if newPosition > oldPosition:
                  pts = newPosition - oldPosition
               else:
                  pts = -1 * (oldPosition - newPosition)
               nVODplayer.doSeekRelative(self.infobarInstance, pts)
            elif self.cSc_vod:
               oldPosition = self.seek.getPlayPosition()[1]
               newPosition = int(float(self.length[1]) / 100.0 * self.percent)
               if newPosition > oldPosition:
                  pts = newPosition - oldPosition
               else:
                  pts = -1 * (oldPosition - newPosition)
               VODplayer.doSeekRelative(self.infobarInstance, pts)
            elif self.seasondream:
               oldPosition = self.seek.getPlayPosition()[1]
               newPosition = int(float(self.length[1]) / 100.0 * self.percent)
               if newPosition > oldPosition:
                  pts = newPosition - oldPosition
               else:
                  pts = -1 * (oldPosition - newPosition)
               Player.doSeekRelative(self.infobarInstance, pts)
            elif self.movie:
               self.seek.seekTo(int(float(self.length[1]) / 100.0 * self.percent))
            elif self.timeshift:
               self.seek.seekTo(int(float(self.length[1]) / 100.0 * self.percent))
            else:
               pass
            self.exit()
      elif sel == self.minuteInput:
         pts = self.minuteInput.value * 60 * 90000
         if self.fwd == False:
            pts = -1*pts
         if self.old_dvd:
            DVDPlayer2.doSeekRelative(self.infobarInstance, pts)
         elif self.media:
            MoviePlayer2.doSeekRelative(self.infobarInstance, pts)
         elif self.dvd_pli:
            DVDPlayer.doSeekRelative(self.infobarInstance, pts)
         elif self.mytube:
            MyTubePlayer.doSeekRelative(self.infobarInstance, pts)
         elif self.vod:
            nVODplayer.doSeekRelative(self.infobarInstance, pts)
         elif self.cSc_vod:
            VODplayer.doSeekRelative(self.infobarInstance, pts)
         elif self.movie:
            MoviePlayer.doSeekRelative(self.infobarInstance, pts)
         elif self.seasondream:
            Player.doSeekRelative(self.infobarInstance, pts)
         elif self.timeshift:
            InfoBar.doSeekRelative(self.infobarInstance, pts)
         else:
            pass
         self.exit()

   def keyLeft(self):
      sel = self["config"].getCurrent()[1]
      if sel == self.positionEntry:
         self.percent -= float(config.plugins.Seekbar.sensibility.value) / 10.0
         if self.percent < 0.0:
            self.percent = 0.0
      else:
         ConfigListScreen.keyLeft(self)

   def keyRight(self):
      sel = self["config"].getCurrent()[1]
      if sel == self.positionEntry:
         self.percent += float(config.plugins.Seekbar.sensibility.value) / 10.0
         if self.percent > 100.0:
            self.percent = 100.0
      else:
         ConfigListScreen.keyRight(self)

   def keyNumberGlobal(self, number):
      sel = self["config"].getCurrent()[1]
      if sel == self.positionEntry:
         self.percent = float(number) * 10.0
      else:
         ConfigListScreen.keyNumberGlobal(self, number)

##############################################
# This hack overwrites the functions seekFwdManual and seekBackManual of the InfoBarSeek class (MoviePlayer and DVDPlayer)

def seekbar(instance, fwd=True):
   if instance and instance.session:
      instance.session.open(Seekbar, instance, fwd)

def seekbarBack(instance):
   seekbar(instance, False)

MoviePlayer.seekFwdManual = seekbar
MoviePlayer.seekBackManual = seekbarBack
InfoBar.seekFwdManual = seekbar
InfoBar.seekBackManual = seekbarBack
if fileExists("/usr/lib/enigma2/python/Screens/DVD.pyo"):
   try:
      from Screens.DVD import DVDPlayer
   except:
      pass
   else:
      DVDPlayer.seekFwdManual = seekbar
      DVDPlayer.seekBackManual = seekbarBack

dvdPlayer = "%s%s" % (resolveFilename(SCOPE_PLUGINS), "Extensions/DVDPlayer/plugin.py")
dvdPlayerKeymap = "%s%s" % (resolveFilename(SCOPE_PLUGINS), "Extensions/DVDPlayer/keymap.xml")
if fileExists(dvdPlayer) and fileExists(dvdPlayerKeymap):
   try:
      from Plugins.Extensions.DVDPlayer.plugin import DVDPlayer as DVDPlayer2
   except:
      pass
   else:
      DVDPlayer2.seekFwdManual = seekbar
      DVDPlayer2.seekBackManual = seekbarBack
mediaPlayer = '%s%s' % (resolveFilename(SCOPE_PLUGINS), 'Extensions/MediaPlayer/plugin.py')
if fileExists(mediaPlayer) or fileExists("%sc" % mediaPlayer):
   try:
      from Plugins.Extensions.MediaPlayer.plugin import MediaPlayer as MoviePlayer2
   except:
      pass
   else:
      MoviePlayer2.seekFwdManual = seekbar
      MoviePlayer2.seekBackManual = seekbarBack
mytubePlayer = '%s%s' % (resolveFilename(SCOPE_PLUGINS), 'Extensions/MyTube/plugin.py')
if fileExists(mytubePlayer) or fileExists("%sc" % mytubePlayer):
   try:
      from Plugins.Extensions.MyTube.plugin import MyTubePlayer
   except:
      pass
   else:
      MyTubePlayer.seekFwdManual = seekbar
      MyTubePlayer.seekBackManual = seekbarBack
nStreamVODPlayer = '%s%s' % (resolveFilename(SCOPE_PLUGINS), 'Extensions/nStreamVOD/plugin.pyo')
if fileExists(nStreamVODPlayer):
   try:
      from Plugins.Extensions.nStreamVOD.plugin import nVODplayer
   except:
      pass
   else:
      nVODplayer.seekFwdManual = seekbar
      nVODplayer.seekBackManual = seekbarBack
cScVODPlayer = '%s%s' % (resolveFilename(SCOPE_PLUGINS), 'Extensions/cScVOD/plugin.pyo')
if fileExists(cScVODPlayer):
   try:
      from Plugins.Extensions.cScVOD.plugin import VODplayer
   except:
      pass
   else:
      VODplayer.seekFwdManual = seekbar
      VODplayer.seekBackManual = seekbarBack
SeasondreamPlayer = '%s%s' % (resolveFilename(SCOPE_PLUGINS), 'Extensions/Seasondream/Player.pyo')
if fileExists(SeasondreamPlayer):
   try:
      from Plugins.Extensions.Seasondream.Player import Player
   except:
      pass
   else:
      Player.seekFwdManual = seekbar
      Player.seekBackManual = seekbarBack

      ##############################################
# This hack puts the functions seekFwdManual and seekBackManual to the maped keys to seekbarRight and seekbarLeft

DoBind = ActionMap.doBind
def doBind(instance):
   if not instance.bound:
      for ctx in instance.contexts:
         if ctx == "InfobarSeekActions":
            if instance.actions.has_key("seekFwdManual"):
               instance.actions["seekbarRight"] = instance.actions["seekFwdManual"]
            if instance.actions.has_key("seekBackManual"):
               instance.actions["seekbarLeft"] = instance.actions["seekBackManual"]
         DoBind(instance)

if config.plugins.Seekbar.overwrite_left_right.value:
   ActionMap.doBind = doBind

##############################################
# This hack maps the keys left and right to seekbarRight and seekbarLeft in the InfobarSeekActions-context

KeymapError = keymapparser.KeymapError
ParseKeys = keymapparser.parseKeys
def parseKeys(context, filename, actionmap, device, keys):
   if context == "InfobarSeekActions":
      if device == "generic":
         for x in keys.findall("key"):
            get_attr = x.attrib.get
            mapto = get_attr("mapto")
            id = get_attr("id")
            if id == "KEY_LEFT":
               mapto = "seekbarLeft"
            if id == "KEY_RIGHT":
               mapto = "seekbarRight"
            flags = get_attr("flags")
            flag_ascii_to_id = lambda x: {'m':1,'b':2,'r':4,'l':8}

            flags = sum(map(flag_ascii_to_id, flags))
            assert mapto, "%s: must specify mapto in context %s, id '%s'" % (filename, context, id)
            assert id, "%s: must specify id in context %s, mapto '%s'" % (filename, context, mapto)
            assert flags, "%s: must specify at least one flag in context %s, id '%s'" % (filename, context, id)
            if len(id) == 1:
               keyid = ord(id) | 0x8000
            elif id[0] == '\\':
               if id[1] == 'x':
                  keyid = int(id[2:], 0x10) | 0x8000
               elif id[1] == 'd':
                  keyid = int(id[2:]) | 0x8000
               else:
                  raise KeymapError("key id '" + str(id) + "' is neither hex nor dec")
            else:
               try:
                  keyid = KEYIDS[id]
               except:
                  raise KeymapError("key id '" + str(id) + "' is illegal")
            actionmap.bindKey(filename, device, keyid, flags, context, mapto)
            addKeyBinding(filename, keyid, context, mapto, flags)
      else:
         ParseKeys(context, filename, actionmap, device, keys)
   else:
      ParseKeys(context, filename, actionmap, device, keys)

if config.plugins.Seekbar.overwrite_left_right.value:
   keymapparser.parseKeys = parseKeys
   keymapparser.removeKeymap(config.usage.keymap.value)
   keymapparser.readKeymap(config.usage.keymap.value)

##############################################

def Plugins(**kwargs):
   return []
Еще бы упраправление на кн. "Право", "Лево"  :blush:

Онлайн scorpionas56

  • Друзья Джедаев
  • *****
  • Сообщений: 2497
  • Поблагодарили: 3492
  • Уважение: +12
Seekbar Mod
« Ответ #20: 15 февраля | 2016г. | 12:42:03 »
0
Не выходит
Рассмотри этот вариант TimeSeekBar

Теги:
 

Похожие темы

  Тема / Автор Ответов Последний ответ
0 Ответов
2709 Просмотров
Последний ответ 04 октября | 2010г. | 09:50:07
от 2boom
7 Ответов
3213 Просмотров
Последний ответ 15 декабря | 2011г. | 08:26:26
от anatoly
768 Ответов
434812 Просмотров
Последний ответ 15 декабря | 2015г. | 21:39:01
от 024730
27 Ответов
17710 Просмотров
Последний ответ 06 августа | 2015г. | 12:58:59
от Nikei
69 Ответов
46314 Просмотров
Последний ответ 12 февраля | 2013г. | 23:44:49
от 024730



X

Добро пожаловать!

Мы заметили, что у Вас установлено расширение AdBlock или ему подобное. Пожалуйста добавьте наш Клуб в белый список, внесите этим посильную лепту в его развитие. Спасибо!