4
// This program is free software; you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation; either version 3 of the License, or
7
// (at your option) any later version.
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
14
// You should have received a copy of the GNU General Public License
15
// along with this program; if not, write to the Free Software
16
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
using System.Threading;
21
using System.Collections.Generic;
25
namespace Do.Addins.Banshee {
27
public class BansheePlayAction : AbstractAction {
29
public override string Name {
30
get { return "Play"; }
32
public override string Description {
33
get { return "Play an item in Banshee."; }
35
public override string Icon {
36
get { return "music-player-banshee"; }
39
public override Type[] SupportedItemTypes {
41
return new Type[] { typeof (MusicItem), };
45
public override bool SupportsModifierItemForItems (IItem[] items, IItem modItem)
50
public override IItem[] Perform (IItem[] items, IItem[] modItems)
52
new Thread ((ThreadStart) delegate {
53
BansheeDBus b = new BansheeDBus();
54
List<string> filenames = new List<string>();
55
foreach (IItem item in items) {
56
foreach (SongMusicItem song in Banshee.LoadSongsFor (item as MusicItem))
57
filenames.Add(song.File);
59
b.Enqueue(filenames.ToArray());