2017-09-11 16:44:17 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2019-09-23 12:39:19 +02:00
|
|
|
"""
|
2019-12-21 08:16:12 +01:00
|
|
|
Sound notification plugin using gstreamer
|
2019-09-23 12:39:19 +02:00
|
|
|
"""
|
2017-09-11 16:44:17 +02:00
|
|
|
import gi
|
|
|
|
gi.require_version('Gst', '1.0')
|
|
|
|
from gi.repository import Gst # noqa: E402
|
|
|
|
|
|
|
|
Gst.init(None)
|
|
|
|
_player = Gst.ElementFactory.make("playbin", "player")
|
|
|
|
|
|
|
|
|
|
|
|
def connect_plugin(sound_file):
|
2019-09-23 12:39:19 +02:00
|
|
|
"""Entry point for sound file"""
|
2017-09-11 16:44:17 +02:00
|
|
|
_player.set_state(Gst.State.NULL)
|
|
|
|
_player.set_property("uri", "file://" + sound_file)
|
|
|
|
_player.set_state(Gst.State.PLAYING)
|