Esempio n. 1
0
 def extract_description():
     with YoutubeDL({"quiet": True}) as extractor:
         try:
             speak(_("يتم الآن جلب وصف الفيديو"))
             info = extractor.extract_info(self.url, download=False)
         except:
             speak(_("هناك خطأ ما أدى إلى منع جلب وصف الفيديو"))
             return
         self.description = info['description']
     wx.CallAfter(DescriptionDialog, self, self.description)
	def playVideo(self):
		number = self.searchResults.Selection
		title = self.search.get_title(number)
		url = self.search.get_url(number)
		speak(_("جاري التشغيل"))
		media = pafy.new(url)
		gui = MediaGui(self, title, url, True if self.search.get_views(number) is not None else False)
		stream = media.getbest()
		self.Hide()
		gui.Show()
		gui.player = Player(stream.url, gui.GetHandle())
	def playAudio(self):
		number = self.searchResults.Selection
		title = self.search.get_title(number)
		url = self.search.get_url(number)
		speak(_("جاري التشغيل"))
		media = pafy.new(url)
		gui = MediaGui(self, title, url)
		stream = media.getbestaudio()
		self.Hide()
		gui.Show()
		gui.player = Player(stream.url, gui.GetHandle())
Esempio n. 4
0
    def playAudio(self):
        number = self.searchResults.Selection
        if self.search.get_type(number) == "playlist":
            return
        title = self.search.get_title(number)
        url = self.search.get_url(number)
        speak(_("جاري التشغيل"))
        stream = get_audio_stream(url)
        gui = MediaGui(self, title, url, results=self.search, audio_mode=True)

        gui.Show()
        self.Hide()
        gui.player = Player(stream.url, gui.GetHandle())
Esempio n. 5
0
 def playVideo(self):
     number = self.searchResults.Selection
     if self.search.get_type(number) == "playlist":
         return
     title = self.search.get_title(number)
     url = self.search.get_url(number)
     speak(_("جاري التشغيل"))
     stream = get_video_stream(url)
     gui = MediaGui(
         self,
         title,
         url,
         True if self.search.get_views(number) is not None else False,
         results=self.search)
     gui.Show()
     self.Hide()
     gui.player = Player(stream.url, gui.GetHandle())
	def loadMore(self):
		if self.searchResults.Strings == []:
			return
		speak(_("جاري تحميل المزيد من النتائج"))
		if self.search.load_more() is None:
			speak(_("لم يتمكن البرنامج من تحميل المزيد من النتائج"))
			return
		# position = self.searchResults.Selection
		wx.CallAfter(self.searchResults.Append, self.search.get_last_titles())
		speak(_("تم تحميل المزيد من نتائج البحث"))
		wx.CallAfter(self.searchResults.SetFocus)
Esempio n. 7
0
 def set_position(self, key):
     step = int(chr(key)) / 10
     self.player.media.set_position(step)
     speak(_("الوقت المنقضي: {}").format(self.player.get_elapsed()))
Esempio n. 8
0
 def onBrowser(self, event):
     speak(_("جاري الفتح"))
     webbrowser.open(self.url)
Esempio n. 9
0
 def togleFullScreen(self):
     self.ShowFullScreen(not self.IsFullScreen())
     if self.IsFullScreen():
         speak(_("وضع ملء الشاشة مفعل"))
     else:
         speak(_("وضع ملء الشاشة متوقف"))
Esempio n. 10
0
 def decrease_volume(self):
     self.player.volume = self.player.volume - 5 if self.player.volume > 0 else 0
     self.player.media.audio_set_volume(self.player.volume)
     speak(f"{self.player.volume}%")
     config_set("volume", self.player.volume)
Esempio n. 11
0
 def increase_volume(self):
     self.player.volume = self.player.volume + 5 if self.player.volume < 350 else 350
     self.player.media.audio_set_volume(self.player.volume)
     speak(f"{self.player.volume}%")
     config_set("volume", self.player.volume)
Esempio n. 12
0
 def get_duration(self):
     speak(_("المدة: {}").format(self.player.get_duration()))
Esempio n. 13
0
    def onKeyDown(self, event):
        event.Skip()
        if event.GetKeyCode() in (wx.WXK_SPACE, wx.WXK_PAUSE, 430):
            self.playAction()
        elif event.GetKeyCode(
        ) == wx.WXK_RIGHT and not event.HasAnyModifiers():
            self.forwardAction()
        elif event.GetKeyCode() == wx.WXK_LEFT and not event.HasAnyModifiers():
            self.rewindAction()
        elif event.controlDown and event.KeyCode == wx.WXK_RIGHT:
            self.next()
        elif event.controlDown and event.KeyCode == wx.WXK_LEFT:
            self.previous()
        elif event.GetKeyCode() == wx.WXK_UP:
            self.increase_volume()
        elif event.GetKeyCode() == wx.WXK_DOWN:
            self.decrease_volume()
        elif event.GetKeyCode() == wx.WXK_HOME:
            self.beginingAction()
        elif event.KeyCode in range(49, 58):
            self.set_position(event.KeyCode)
        elif event.controlDown and event.shiftDown and event.KeyCode == ord(
                "L"):
            self.get_duration()
        elif event.controlDown and event.shiftDown and event.KeyCode == ord(
                "T"):
            if self.player is not None:
                speak(_("الوقت المنقضي: {}").format(self.player.get_elapsed()))
        elif event.KeyCode == ord("S"):

            if self.player is not None:
                self.player.media.set_rate(1.4)
                speak(_("سريع"))

        elif event.KeyCode == ord("D"):

            if self.player is not None:

                self.player.media.set_rate(1.0)

                speak(_("معتدل"))

        elif event.KeyCode == ord("F"):

            if self.player is not None:

                self.player.media.set_rate(0.6)

                speak(_("بطيء"))

        elif event.GetKeyCode() in (ord("-"), wx.WXK_NUMPAD_SUBTRACT):

            self.seek -= 1

            if self.seek < 1:

                self.seek = 1

            speak("{} {} {}".format(_("تحريك المقطع"), self.seek,
                                    _("ثانية/ثواني")))

            config_set("seek", self.seek)

        elif event.GetKeyCode() in (ord("="), wx.WXK_NUMPAD_ADD):

            self.seek += 1

            if self.seek > 10:

                self.seek = 10

            speak("{} {} {}".format(_("تحريك المقطع"), self.seek,
                                    _("ثانية/ثواني")))

            config_set("seek", self.seek)

        elif event.KeyCode == ord("R"):

            if config_get("repeatetracks"):

                config_set("repeatetracks", False)

                speak(_("التكرار متوقف"))

            else:

                config_set("repeatetracks", True)

                speak(_("التكرار مفعل"))

        elif event.KeyCode in (wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER):

            self.togleFullScreen()

        elif event.KeyCode == wx.WXK_ALT:

            if self.IsFullScreen():

                self.ShowFullScreen(False)

        elif event.GetKeyCode() == wx.WXK_ESCAPE:

            self.closeAction()
Esempio n. 14
0
 def beginingAction(self):
     self.player.media.set_position(0.0)
     speak(_("بداية المقطع"))
     if self.player.media.get_state() in (State.NothingSpecial,
                                          State.Stopped):
         self.player.media.play()
	def onCheckForUpdates(self, event):
		speak(_("جاري البحث عن التحديثات. يرجى الانتظار"))
		check_for_updates()
 def beginingAction(self):
     if self.player is None:
         return
     self.player.media.set_position(0.0)
     speak(_("بداية المقطع"))
    def onKeyDown(self, event):
        if event.GetKeyCode() == wx.WXK_SPACE:
            self.playAction()
        elif event.GetKeyCode() == wx.WXK_RIGHT:
            self.forwardAction()
        elif event.GetKeyCode() == wx.WXK_LEFT:
            self.rewindAction()
        elif event.GetKeyCode() == wx.WXK_UP:
            if self.player is None:
                event.Skip()
                return
            volume = self.player.media.audio_get_volume()
            self.player.media.audio_set_volume(volume + 5)
            speak(f"{self.player.media.audio_get_volume()} {_('بالمائة')}")
        elif event.GetKeyCode() == wx.WXK_DOWN:
            if self.player is None:
                event.Skip()
                return
            volume = self.player.media.audio_get_volume()
            self.player.media.audio_set_volume(volume - 5)
            speak(f"{self.player.media.audio_get_volume()} {_('بالمائة')}")
        elif event.GetKeyCode() == wx.WXK_HOME:
            self.beginingAction()
        elif event.controlDown and event.shiftDown and event.KeyCode == ord(
                "L"):
            if self.player is not None:
                speak(_("المدة: {}").format(self.player.get_duration()))
        elif event.controlDown and event.shiftDown and event.KeyCode == ord(
                "T"):
            if self.player is not None:
                speak(_("الوقت المنقضي: {}").format(self.player.get_elapsed()))
        elif event.KeyCode == ord("S"):

            if self.player is not None:
                self.player.media.set_rate(1.4)
                speak(_("سريع"))
        elif event.KeyCode == ord("D"):
            if self.player is not None:
                self.player.media.set_rate(1.0)
                speak(_("معتدل"))
        elif event.KeyCode == ord("F"):
            if self.player is not None:
                self.player.media.set_rate(0.6)
                speak(_("بطيء"))
        elif event.GetKeyCode() in (ord("-"), wx.WXK_NUMPAD_SUBTRACT):
            self.seek -= 1
            if self.seek < 1:
                self.seek = 1
            speak("{} {} {}".format(_("تحريك المقطع"), self.seek,
                                    _("ثانية/ثواني")))
            config_set("seek", self.seek)
        elif event.GetKeyCode() in (ord("="), wx.WXK_NUMPAD_ADD):
            self.seek += 1
            if self.seek > 10:
                self.seek = 10
            speak("{} {} {}".format(_("تحريك المقطع"), self.seek,
                                    _("ثانية/ثواني")))
            config_set("seek", self.seek)
        elif event.GetKeyCode() == wx.WXK_ESCAPE:
            self.closeAction()
        event.Skip()