Plugins: brasero.py

File brasero.py, 1.2 kB (added by fulvio.dimarco@studio.unibo.it, 1 year ago)

plugin to burn cds with brasero

Line 
1 # Copyright 2007 Fulvio Di Marco
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 version 2 as
5 # published by the Free Software Foundation
6 #
7 # $Id$
8
9 import os
10 import util
11 from qltk import ErrorMessage
12 from plugins.songsmenu import SongsMenuPlugin
13
14 class Brasero(SongsMenuPlugin):
15     PLUGIN_ID = 'Burn CD with Brasero'
16     PLUGIN_NAME = _('Burn CD with Brasero')
17     PLUGIN_DESC = 'Burn CDs with Brasero.'
18     PLUGIN_ICON = 'gtk-cdrom'
19     PLUGIN_VERSION = '0.1'
20
21     def plugin_songs(self, songs):
22         if not util.iscommand("brasero"):
23             ErrorMessage(
24                 None, "Brasero not found",
25                 "The Brasero burning tool was not found. "
26                 "You can get Brasero at http://perso.orange.fr/bonfire/index.htm.").run()
27         else:
28             files = [song['~filename'] for song in songs]
29             try: util.spawn
30             except:
31                 if len(files) == 1: filelist = "%r" % files(0)
32                 else: filelist = ("%r " * len(files)) % list(reversed(files))
33                 os.system('brasero - %s &' % filelist)
34             else:
35                 util.spawn(["brasero", "-a"] + list(reversed(files)))