Exemplo n.º 1
0
 public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems)
 {
     new Thread((ThreadStart) delegate {
         Rhythmbox.Client("--next --no-start");
     }).Start();
     return(null);
 }
Exemplo n.º 2
0
 public void Run()
 {
     Services.Application.RunOnThread(() => {
         Rhythmbox.StartIfNeccessary();
         Rhythmbox.Client(Command);
     });
 }
Exemplo n.º 3
0
        public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems)
        {
            new Thread((ThreadStart) delegate {
                Rhythmbox.StartIfNeccessary();

                foreach (Item item in items)
                {
                    string enqueue;

                    enqueue = "--no-present ";
                    foreach (SongMusicItem song in
                             Rhythmbox.LoadSongsFor(item as MusicItem))
                    {
                        enqueue += string.Format("--enqueue \"{0}\" ", song.File);
                    }
                    Rhythmbox.Client(enqueue);
                }
            }).Start();
            return(null);
        }
Exemplo n.º 4
0
        public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems)
        {
            new Thread((ThreadStart) delegate {
                Rhythmbox.StartIfNeccessary();

                Rhythmbox.Client("--pause --no-present");
                Rhythmbox.Client("--clear-queue --no-present", true);

                if (items.Count() == 1 && items.ElementAt(0) is PlaylistMusicItem)
                {
                    // Because playlists are not enqueued, but played as is, playing
                    // more than one does not make any sense. Neither does playing e.g.
                    // one playlist and two songs.
                    // Therefore, only the case where the lone item selected is a playlist is supported.

                    RhythmboxDBus.PlayPlaylist((PlaylistMusicItem)items.ElementAt(0));
                }
                else
                {
                    foreach (Item item in items)
                    {
                        if (item is MusicItem && !(item is PlaylistMusicItem))
                        {
                            string enqueue = "--no-present ";
                            foreach (SongMusicItem song in Rhythmbox.LoadSongsFor(item as MusicItem))
                            {
                                enqueue = string.Format("{0} --enqueue \"{1}\" ", enqueue, song.File);
                            }
                            Rhythmbox.Client(enqueue, true);
                        }
                    }
                }

                Rhythmbox.Client("--next --no-present");
                Rhythmbox.Client("--play --no-present");
            }).Start();
            return(null);
        }