~ubuntu-branches/ubuntu/natty/exaile/natty

« back to all changes in this revision

Viewing changes to plugins/sound-juicer.py

  • Committer: Bazaar Package Importer
  • Author(s): Nick Ellery
  • Date: 2008-11-04 18:33:00 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20081104183300-e4t9seztl35bdb24
Tags: 0.2.14-0ubuntu1
* New upstream release (LP: #280287)
* debian/control:
  - tighten dependency on python-gtk2 to (>= 2.10)
  - added python-sexy to recommends to add a clear button to filters
  - added python-gnome2-extras to recommends for lyrics, better tray icon,
    etc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Aren Olson
2
 
#
3
 
# This program is free software; you can redistribute it and/or modify
4
 
# it under the terms of the GNU General Public License as published by
5
 
# the Free Software Foundation; either version 1, or (at your option)
6
 
# any later version.
7
 
#
8
 
# This program is distributed in the hope that it will be useful,
9
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
# GNU General Public License for more details.
12
 
#
13
 
# You should have received a copy of the GNU General Public License
14
 
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16
 
 
17
 
import time, os, gtk, subprocess, xl.media
18
 
from xl import common
19
 
from gettext import gettext as _
20
 
import xl.plugins as plugins
21
 
 
22
 
PLUGIN_NAME = _("Sound Juicer")
23
 
PLUGIN_AUTHORS = ['Aren Olson <reacocard@gmail.com>']
24
 
PLUGIN_VERSION = '0.1.3'
25
 
PLUGIN_DESCRIPTION = _(r"""Allows importing of cds with sound-juicer.""")
26
 
 
27
 
PLUGIN_ENABLED = False
28
 
w = gtk.Button()
29
 
PLUGIN_ICON = w.render_icon('gtk-cdrom', gtk.ICON_SIZE_MENU)
30
 
 
31
 
APP = None
32
 
MENU_ITEM = None
33
 
SETTINGS = None
34
 
TIPS = gtk.Tooltips()
35
 
 
36
 
def launch_sound_juicer(widget):
37
 
        args = ['sound-juicer']
38
 
        subprocess.Popen(args, stdout=-1, stderr=-1)
39
 
 
40
 
def initialize():
41
 
        """
42
 
                Adds the 'Import CD' menuitem.
43
 
        """
44
 
        global SETTINGS, APP, MENU_ITEM
45
 
 
46
 
        try:
47
 
                ret = subprocess.call(['sound-juicer', '--help'], stdout=-1, stderr=-1)
48
 
        except OSError:
49
 
                raise plugins.PluginInitException(_("Sound Juicer was not found in your $PATH. "
50
 
                        "Disabling the Sound Juicer plugin."))
51
 
                return False
52
 
 
53
 
        menu = APP.xml.get_widget('file_menu_menu')
54
 
        MENU_ITEM = gtk.ImageMenuItem(_('Import Disc'))
55
 
        MENU_ITEM.label = gtk.Label(_('Import Disc'))
56
 
        MENU_ITEM.connect('activate',launch_sound_juicer)
57
 
        image = gtk.Image()
58
 
        image.set_from_stock('gtk-cdrom', gtk.ICON_SIZE_MENU)
59
 
        MENU_ITEM.set_image(image)
60
 
        menu.append(MENU_ITEM)
61
 
        menu.reorder_child(MENU_ITEM,5)
62
 
        MENU_ITEM.show_all()
63
 
        return True
64
 
 
65
 
def destroy():
66
 
        """
67
 
                Removes the 'Import CD' menuitem.
68
 
        """
69
 
        MENU_ITEM.destroy()