mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Close VLC window after video playback ends. Close #399
This commit is contained in:
parent
fbe93ea4be
commit
dfdbe3c5f4
@ -2,6 +2,7 @@
|
||||
|
||||
## changes in this version
|
||||
|
||||
* TWBlue now closes the VLC player window automatically when a video reaches its end. ([#399](https://github.com/manuelcortez/TWBlue/issues/399))
|
||||
* After a lot of time, TWBlue now uses a new default Soundpack, called FreakyBlue. This soundpack will be set by default in all new sessions created in the application. Thanks to [Andre Louis](https://twitter.com/FreakyFwoof) for the pack. ([#247](https://github.com/manuelcortez/TWBlue/issues/247))
|
||||
* When reading a tweet, if the tweet contains more than 2 consecutive mentions, TWBlue will announce how many more users the tweet includes, as opposed to read every user in the conversation. You still can display the tweet to read all users.
|
||||
* In the tweet displayer, It is possible to copy a link to the current tweet or person by pressing a button called "copy link to clipboard".
|
||||
|
@ -114,6 +114,8 @@ class URLStream(object):
|
||||
# LibVLC controls.
|
||||
self.instance = vlc.Instance()
|
||||
self.player = self.instance.media_player_new()
|
||||
self.event_manager = self.player.event_manager()
|
||||
self.event_manager.event_attach(vlc.EventType.MediaPlayerEndReached, self.end_callback)
|
||||
|
||||
def prepare(self, url):
|
||||
""" Takes an URL and prepares it to be streamed. This function will try to unshorten the passed URL and, if needed, to transform it into a valid URL."""
|
||||
@ -158,3 +160,9 @@ class URLStream(object):
|
||||
def stop_audio(self):
|
||||
output.speak(_(u"Stopped."), True)
|
||||
self.player.stop()
|
||||
|
||||
def end_callback(self, event, *args, **kwargs):
|
||||
call_threaded(self.player.stop)
|
||||
|
||||
def __del__(self):
|
||||
self.event_manager.event_detach(vlc.EventType.MediaPlayerEndReached)
|
Loading…
Reference in New Issue
Block a user