Plugins: soundconverter.py

File soundconverter.py, 1.2 kB (added by neox@mymail.ch, 2 months ago)

convert audio files with soundconverter

Line 
1 # Copyright 2008 Steffen Binder
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
8 import os, gtk, util, qltk
9 from plugins.songsmenu import SongsMenuPlugin
10
11 class SoundConverter(SongsMenuPlugin):
12     PLUGIN_ID = 'Convert Files'
13     PLUGIN_NAME = _('Convert Files')
14     PLUGIN_DESC = 'Convert Files with Soundconverter.'
15     PLUGIN_VERSION = '0.1'
16     PLUGIN_ICON = gtk.STOCK_CONVERT
17
18     def plugin_songs(self, songs):
19         if not util.iscommand("soundconverter"):
20             ErrorMessage(
21                 None, "SoundConverter not found",
22                 "The SoundConverter tool was not found. "
23                 "You can get SoundConverter at http://soundconverter.berlios.de.").run()
24         else:
25             files = [song['~filename'] for song in songs]
26             try: util.spawn
27             except:
28                 if len(files) == 1: filelist = "%r" % files(0)
29                 else: filelist = ("%r " * len(files)) % list(reversed(files))
30                 os.system('soundconverter %s &' % filelist)
31             else:
32                 util.spawn(["soundconverter", " "] + list(reversed(files)))