Exemplo n.º 1
0
 public Playlist(IPlayEngine Engine, string Name, MediaChrome.MainForm d)
 {
     Songs = new List<Song>();
     this.Engine = Engine;
     this.Title = Name;
     this.MainForm = d;
     Thread ds = new Thread(RetrieveData);
     ds.Start();
 }
Exemplo n.º 2
0
 public ImportLibrary()
 {
     //
     // The InitializeComponent() call is required for Windows Forms designer support.
     //
     InitializeComponent();
     Importer = Program.MediaEngines["sp"];
     //
     // TODO: Add constructor code after the InitializeComponent() call.
     //
 }
Exemplo n.º 3
0
 public ImportLibrary(Library src)
 {
     //
     // The InitializeComponent() call is required for Windows Forms designer support.
     //
     InitializeComponent();
     Importer = null;
     //
     // TODO: Add constructor code after the InitializeComponent() call.
     //
     Host=src;
 }
Exemplo n.º 4
0
        public Playlist(IPlayEngine Engine,String ID,MainForm host)
        {
            this.Host=host;
            this.Engine=Engine;
                //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();
            this.ID=ID;
            Thread D = new Thread(RetrieveData);
            D.Start();
            timer1.Start();

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
        }
Exemplo n.º 5
0
        private void Tree(IPlayEngine Engine)
        {
            this.cListView2.Groups.Clear();
            this.cListView2.Items.Clear();
            cListView2.ShowGroups = true;

            this.cListView1.ContextMenu = contextMenu1;
            try
            {
                ListViewGroup GP = this.cListView2.Groups.Add(Engine.Namespace+"_playlists","playlists");
                GP.Header = Engine.Title + " playlists";
                foreach (Playlist i in Engine.Playlists)
                {
                    ListViewItem D = GP.Items.Add(i.Title);
                    cListView2.Items.Add(D);
                    D.SubItems.Add(Engine.Title);
                    D.Tag = (object)i;

                    D.ImageIndex = 0;
                }
                ListViewItem Plst = cListView2.Items.Add("New playlist");

                Plst.Tag = (object)"meta:new_playlist[" + Engine.Namespace + "]";
                Plst.ImageIndex = 1;
                Plst.Group = GP;

                GP.Items.Add(Plst);
            }
            catch
            {
            }
            finally
            {
            }
        }
Exemplo n.º 6
0
        void Button2Click(object sender, EventArgs e)
        {
            Importer = (IPlayEngine)Program.MediaEngines[(String)comboBox1.SelectedValue];
            button2.Enabled=false;
            button1.Enabled=false;

            Thread XCM = new Thread(ImportFiles);
            XCM.Start();
            timer1.Start();
            label3.Show();
            button3.Enabled=false;
            ready=false;
        }
Exemplo n.º 7
0
        /// <summary>
        /// When a media file is begin to play, it decides the player engine to use by the parameter a:
        /// </summary>
        /// <param name="Query"></param>
        /// 
        public static void PlayItem(String Query)
        {
            /// <summary>
            /// Stop the current player to play the media, but first
            /// be sure that there is a current instance of a class witihn the IMediaEngine
            /// </summary>
            if(currentPlayer!=null){
                currentPlayer.Stop();
                foreach(Control d in Program.Host.Playboard.Controls)
                {
                    if(d.GetType() == currentPlayer.MediaControl.GetType())
                    {
                        d.Hide();
                    }
                }
            }
            /// <summary>
            /// Get the engine namespace from the query passed
            /// </summary>
            string engine = Query.Split(':')[0];

            IPlayEngine D = null;
            if(Query.StartsWith("music:"))
            {
                Song _Song = new Song();
                Uri d = new System.Uri(Query);
                _Song.Title=d.Segments[3];
                _Song.Artist=d.Segments[1];
                _Song.Album=d.Segments[2];
                foreach(IPlayEngine Engine in Program.MediaEngines.Values)
                {
                    if((currentTrack.Path=Engine.RawFind(currentTrack))!=null)
                    {

                        break;
                    }

                }

                return;
            }
            else
            {
                /// <summary>
                /// Get the player from the list
                /// </summary>
                ///
                if(Program.MediaEngines.ContainsKey(engine))
                {
                    D = Program.MediaEngines[engine];
                }

            }
            if(D!=null)
            {

                D.MediaControl.Dock = DockStyle.Fill;
                D.MediaControl.Show();
                D.MediaControl.Enabled=true;
                /// <summary>
                /// Remove the engine specification of the Query URI
                /// </summary>
                String Path = Query.Replace(engine+":","");
                /// <summary>
                /// Send it to the media player
                /// </summary>
                D.Load((Path));
                /// <summary>
                /// Play the media
                /// </summary>
                D.Play();
                currentPlayer=D;

            }
            else
            {
                MessageBox.Show("There is no media handler for the media");
            }
        }
Exemplo n.º 8
0
 public Playlist(IPlayEngine Engine,String ID,String Name)
 {
     this.ID = ID;
     this.Title = Name;
     this.Engine = Engine;
 }
Exemplo n.º 9
0
        public static bool Song_Exists(Song _Song)
        {
            if (Querys != null)
                if (Querys.ContainsKey("service"))
                {
                    if (Program.MediaEngines.ContainsKey(Querys["service"]))
                    {
                        IPlayEngine Engine = Program.MediaEngines[Querys["service"]];
                        MainForm.Engine = Engine;
                        MainForm.watchSong = Engine.RawFind(_Song);
                        _Song.Checked = true;
                        return true;
                        /* */
                    }
                }

            /**
             * Elsewhere, iterate through installed music services
             * and check if there is a matching track to play the song on
             * */
            foreach (IPlayEngine Engine in Program.MediaEngines.Values)
            {

                Song f = Engine.RawFind(_Song);

                if (f != null)
                {
                    MainForm.Engine = Engine;
                    _Song.Checked = true;
                    MainForm.watchSong = f;
                    return true;
                }

                /*  currentTrack = f;

                  currentPlayer = Engine;
                  Engine.Load((currentTrack.Path));
                  currentTrack = _Song;
                  Engine.Play();
            */

            }
            return false;
        }
Exemplo n.º 10
0
        /// <summary>
        /// When a media file is begin to play, it decides the player engine to use by the parameter a:
        /// </summary>
        /// <param name="Query"></param>
        /// 
        public static bool PlayItem(String Query)
        {
            /*    if (ResolvingSongThread != null)
                return false;*/
            /// <summary>
            /// Stop the current player to play the media, but first
            /// be sure that there is a current instance of a class witihn the IMediaEngine
            /// </summary>
            if(currentPlayer!=null){
                currentPlayer.Stop();
                foreach(Control d in Program.Host.Playboard.Controls)
                {
                    if(d.GetType() == currentPlayer.MediaControl.GetType())
                    {
                        d.Hide();
                    }
                }
            }
            /// <summary>
            /// Get the engine namespace from the query passed
            /// </summary>
            string engine = Query.Split(':')[0];
            try
            {
                Song _Song = GetSongFromURI(Query);
                if(_Song.ID != null && _Song.ID != "" && _Song.ProposedEngine != "" && _Song.ProposedEngine != null)
                {
                    try
                    {
                        IPlayEngine Df = Program.MediaEngines[_Song.ProposedEngine];
                        MainForm.currentPlayer = Df;
                        MainForm.currentPlayer.Load(Df.Namespace+":"+_Song.ID);
                        MainForm.currentTrack = _Song;
                        return true;
                    }
                    catch
                    {

                    }

                }
            }
            catch
            {

            }

            IPlayEngine D = null;
            if(Query.StartsWith("music:")||Query.StartsWith("song:"))
            {

                Song _Song = GetSongFromURI(Query);
                Uri d = new System.Uri(Query.Replace("music:","http:").Replace("song:","http:"));
                if(_Song.ID != null && _Song.ID != "" && _Song.ProposedEngine != "" && _Song.ProposedEngine != null)
                {
                    try
                    {
                        IPlayEngine Df = Program.MediaEngines[_Song.ProposedEngine];
                        MainForm.currentPlayer = Df;
                        MainForm.currentPlayer.Load(Df.Namespace+":"+_Song.ID);
                        MainForm.currentTrack = _Song;
                        return true;
                    }
                    catch
                    {

                    }

                }
                ResolvingSongThread = new Thread(MainForm._ResolveSong);
                ResolvingSongThread.Start((object)_Song);
                /***
                 * If a default service is assigned, try the service
                 * before attempting to find it on other service
                 * */

              Querys  = UriHelper.Querystrings(d);

                return true;
            }
            else
            {
                /// <summary>
                /// Get the player from the list
                /// </summary>
                ///
                if(Program.MediaEngines.ContainsKey(engine))
                {
                    D = Program.MediaEngines[engine];
                }

            }
            if(D!=null)
            {

                D.MediaControl.Dock = DockStyle.Fill;
                D.MediaControl.Show();
                D.MediaControl.Enabled=true;
                /// <summary>
                /// Remove the engine specification of the Query URI
                /// </summary>
                String Path = Query.Replace(engine+":","");
                /// <summary>
                /// Send it to the media player
                /// </summary>
                D.Load((Path));
                /// <summary>
                /// Play the media
                /// </summary>
                D.Play();
                currentPlayer=D;

            }
            else
            {
                MessageBox.Show("There is no media handler for the media");
            }
            return true;
        }
Exemplo n.º 11
0
        static void _ResolveSong(Object dr)
        {
            resolvingSong = true;

            Song _Song = (Song)dr;

            if(Querys != null)
            if (Querys.ContainsKey("service"))
            {
                if (Program.MediaEngines.ContainsKey(Querys["service"]))
                {
                    IPlayEngine Engine = Program.MediaEngines[Querys["service"]];
                    MainForm.Engine = Engine;
                    MainForm.watchSong = Engine.RawFind(_Song);
                    resolvingSong = false;
                    return;
                   /* */
                }
            }

            /**
             * Elsewhere, iterate through installed music services
             * and check if there is a matching track to play the song on
             * */
            foreach (IPlayEngine Engine in Program.MediaEngines.Values)
            {

             Song f  = Engine.RawFind(_Song);

                if (f != null)
                {
                    MainForm.Engine = Engine;
                     resolvingSong = false;
                     MainForm.watchSong = f;
                    return;
                }

                  /*  currentTrack = f;

                    currentPlayer = Engine;
                    Engine.Load((currentTrack.Path));
                    currentTrack = _Song;
                    Engine.Play();
            */

            }
            resolvingSong = false;
            MainForm.ResolvingSongThread = null;
            ShowMessage("There was no service found for the song");
        }