~francesco-marella/specto/blacklist-plugins

« back to all changes in this revision

Viewing changes to spectlib/tools/sound.py

  • Committer: Jean-François Fortin Tam
  • Date: 2009-12-29 21:02:37 UTC
  • mfrom: (98.3.84 specto-woutc)
  • Revision ID: nekohayo@gmail.com-20091229210237-pt7k7v2shsun2z49
Merge Wout's fixes and new features
- DBUS watches (including Pidgin, Evolution, Rhythmbox, and a bunch of others)
- Integration with Ubuntu's indicator applet
- Use GStreamer for playing sounds (fixes issue 289)
- Fix the Google Reader watch (issue 283)
- Various other enhancements

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: UTF8 -*-
 
2
 
 
3
# Specto , Unobtrusive event notifier
 
4
#
 
5
#       sound.py
 
6
#
 
7
# See the AUTHORS file for copyright ownership information
 
8
 
 
9
# This program is free software; you can redistribute it and/or
 
10
# modify it under the terms of the GNU General Public
 
11
# License as published by the Free Software Foundation; either
 
12
# version 2 of the License, or (at your option) any later version.
 
13
#
 
14
# This program is distributed in the hope that it will be useful,
 
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
17
# General Public License for more details.
 
18
#
 
19
# You should have received a copy of the GNU General Public
 
20
# License along with this program; if not, write to the
 
21
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
22
# Boston, MA 02111-1307, USA.
 
23
 
 
24
import pygst
 
25
pygst.require("0.10")
 
26
import gst
 
27
 
 
28
class Sound:
 
29
    def __init__(self):
 
30
        self.player = None
 
31
        
 
32
    def play(self, uri):
 
33
        if uri:
 
34
            self.player = gst.element_factory_make("playbin", "player")
 
35
            uri =  "file://" + uri
 
36
            self.player.set_property('uri', uri)
 
37
            self.player.set_state(gst.STATE_PLAYING)
 
 
b'\\ No newline at end of file'