Exemple #1
0
 public PlayMediaCmd(RemotedWindowsMediaPlayer remotePlayer, IWMPPlaylist playlist, ArrayList indexes, bool appendToQueue)
 {
     initPlayer(remotePlayer);
     m_indexes = indexes;
     m_playlist = playlist;
     m_appendToQueue = appendToQueue;
 }
        private void setPlayer()
        {
            playlistMain = player.newPlaylist("Main playlist", "");
            playlistMain.appendItem(player.newMedia("bgMusic.mp3"));

            player.currentMedia = playlistMain.get_Item(0);

            player.controls.play();
            player.settings.setMode("loop", true);

            playlistTeams = player.newPlaylist("Team playlist", "");
            

            playlistTeams.appendItem(player.newMedia("liverpoolSong.mp3"));
            playlistTeams.appendItem(player.newMedia("chelseaSong.mp3"));
            playlistTeams.appendItem(player.newMedia("manchesterCitySong.mp3"));
            playlistTeams.appendItem(player.newMedia("arsenalSong.mp3"));
            playlistTeams.appendItem(player.newMedia("evertonSong.mp3"));
            playlistTeams.appendItem(player.newMedia("tottenhamHotspurSong.mp3"));
            playlistTeams.appendItem(player.newMedia("manchesterUnitedSong.mp3"));
            playlistTeams.appendItem(player.newMedia("lsouthamptonSong.mp3"));
            playlistTeams.appendItem(player.newMedia("newcastleUnitedSong.mp3"));
            playlistTeams.appendItem(player.newMedia("stokeCitySong.mp3"));
            playlistTeams.appendItem(player.newMedia("westHamUnitedSong.mp3"));
            playlistTeams.appendItem(player.newMedia("astonVillaSong.mp3"));
            playlistTeams.appendItem(player.newMedia("swanseaCitySong.mp3"));
            playlistTeams.appendItem(player.newMedia("hullCitySong.mp3"));
            playlistTeams.appendItem(player.newMedia("norwichCitySong.mp3"));
            playlistTeams.appendItem(player.newMedia("crystalPalaceSong.mp3"));
            playlistTeams.appendItem(player.newMedia("westBromwichSong.mp3"));
            playlistTeams.appendItem(player.newMedia("cardiffCitySong.mp3"));
            playlistTeams.appendItem(player.newMedia("sunderlandSong.mp3"));
            playlistTeams.appendItem(player.newMedia("fulhamSong.mp3"));
            
        }
 public NowPlayingList(IWMPPlaylist original)
 {
     for (int j = 0; j < original.count; j++)
     {
         IWMPMedia item = original.get_Item(j);
         if (item != null)
         {
             now_playing.Add(new MediaItem(item));
         }
     }
 }
Exemple #4
0
        private void axWindowsMediaPlayer1_Enter(object sender, EventArgs e)
        {
            axWindowsMediaPlayer1.PlayStateChange += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(wplayer_PlayStateChange);

            playList = axWindowsMediaPlayer1.playlistCollection.newPlaylist("ExpectoPatronumVideos");
            preMovie = axWindowsMediaPlayer1.newMedia(PRE_MOVIE);
            playList.appendItem(preMovie);
            loopMovie = axWindowsMediaPlayer1.newMedia(LOOP_MOVIE);
            //playList.appendItem(loopMovie);
            postMovie = axWindowsMediaPlayer1.newMedia(POST_MOVIE);

            axWindowsMediaPlayer1.currentPlaylist = playList;
        }
Exemple #5
0
        /// <summary>
        /// Used to log the DVD attributes.
        /// DVD organization can vary.
        /// Usually, when you open the DVD for playback, you'll see data for titles,
        /// when you play a title, you'll see chapters.
        /// Title 0 is special - it's the table of contents.
        /// Usually, you can click the Top Menu button to go back to the root title.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Player_OpenPlaylistSwitch(object sender, AxWMPLib._WMPOCXEvents_OpenPlaylistSwitchEvent e)
        {
            UseWaitCursor = true;
            listView1.Items.Clear();

            // Set the button states for the Top Menu and Title Menu buttons.
            SetDVDButtonStates();

            // Get the title playlist.
            IWMPPlaylist pTitle         = (IWMPPlaylist)e.pItem;
            IWMPMedia    TitleOrChapter = null;

            // Get the chapter as IWMPMedia.
            TitleOrChapter = pTitle.get_Item(1);

            //Get the attribute count from the chapter and loop through the attributes.
            int iAttCount = TitleOrChapter.attributeCount;

            for (int j = 0; j < iAttCount; j++)
            {
                ListViewItem item = new ListViewItem("DVD Title/Ch");
                String       name = TitleOrChapter.getAttributeName(j);
                item.SubItems.Add(name);
                item.SubItems.Add(TitleOrChapter.getItemInfo(name));

                // Tell the user about DVD navigation options.
                if ("chapterNum" == name)
                {
                    lblStatus.Text = "DVD Chapter Attributes. To view title attributes, change titles.";
                }
                else if ("titleNum" == name)
                {
                    lblStatus.Text = "DVD Title Attributes. To view chapter attributes, change chapters.";
                }

                bool bRO = TitleOrChapter.isReadOnlyItem(name);

                item.SubItems.Add(bRO.ToString());
                listView1.Items.Add(item);
            }

            ListViewItem item2 = new ListViewItem("");

            listView1.Items.Add(item2);

            UseWaitCursor = false;
        }
Exemple #6
0
        /// <summary>
        /// Adds the downloaded item to a playlist in Windows Media Player.
        /// </summary>
        /// <remarks>The title of the playlist is the name of the feed in RSS Bandit.</remarks>
        /// <param name="podcast"></param>
        private void AddPodcastToWMP(DownloadItem podcast)
        {
            try
            {
                if (!IsWMPFile(Path.GetExtension(podcast.File.LocalName)))
                {
                    return;
                }

                string     playlistName = Preferences.SinglePlaylistName;
                FeedSource source       = guiMain.FeedSourceOf(podcast.OwnerFeedId);

                if (!Preferences.SinglePodcastPlaylist && source != null)
                {
                    playlistName = source.GetFeeds()[podcast.OwnerFeedId].title;
                }

                WindowsMediaPlayer wmp = new WindowsMediaPlayer();

                //get a handle to the playlist if it exists or create it if it doesn't
                IWMPPlaylist      podcastPlaylist = null;
                IWMPPlaylistArray playlists       = wmp.playlistCollection.getAll();

                for (int i = 0; i < playlists.count; i++)
                {
                    IWMPPlaylist pl = playlists.Item(i);

                    if (pl.name.Equals(playlistName))
                    {
                        podcastPlaylist = pl;
                    }
                }

                if (podcastPlaylist == null)
                {
                    podcastPlaylist = wmp.playlistCollection.newPlaylist(playlistName);
                }

                IWMPMedia wm = wmp.newMedia(Path.Combine(podcast.TargetFolder, podcast.File.LocalName));
                podcastPlaylist.appendItem(wm);
            }
            catch (Exception e)
            {
                _log.Error("The following error occured in AddPodcastToWMP(): ", e);
            }
        }
        private void axWindowsMediaPlayer1_Enter(object sender, EventArgs e)
        {
            axWindowsMediaPlayer1.PlayStateChange += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(wplayer_PlayStateChange);
            //axWindowsMediaPlayer1.URL = @"C:\Users\CLARISSA RAMOS\Documents\GitHub\wiiwandz\HarryParty\media\videos\arania_exumai_pre.mp4";
            //axWindowsMediaPlayer1.settings.autoStart = false;
            //axWindowsMediaPlayer1.Ctlcontrols.play();
            playList = axWindowsMediaPlayer1.playlistCollection.newPlaylist("ExpectoPatronumVideos");
            preMovie = axWindowsMediaPlayer1.newMedia(PRE_MOVIE);
            playList.appendItem(preMovie);
            loopMovie = axWindowsMediaPlayer1.newMedia(LOOP_MOVIE);
            //playList.appendItem(loopMovie);
            postMovie = axWindowsMediaPlayer1.newMedia(POST_MOVIE);

            axWindowsMediaPlayer1.currentPlaylist = playList;
            //WMPLib.IWMPMedia3 preFile = (WMPLib.IWMPMedia3)axWindowsMediaPlayer1.mediaCollection.getAll().get_Item(0);
            //axWindowsMediaPlayer1.currentMedia = preFile;
        }
Exemple #8
0
        public void addPlaylist()
        {
            Playlist = player.playlistCollection.getAll().Item(0);
            int jmlhMusic = Playlist.count;

            media = new IWMPMedia[jmlhMusic];


            for (int i = 0; i < jmlhMusic; i++)
            {
                media[i] = Playlist.get_Item(i);
                Music_List.Items.Add(media[i].name);
            }

            player.currentPlaylist = Playlist;
            play();
        }
Exemple #9
0
        private void axWindowsMediaPlayer1_Enter(object sender, EventArgs e)
        {
            axWindowsMediaPlayer1.PlayStateChange += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(wplayer_PlayStateChange);
            //axWindowsMediaPlayer1.URL = @"C:\Users\CLARISSA RAMOS\Documents\GitHub\wiiwandz\HarryParty\media\videos\arania_exumai_pre.mp4";
            //axWindowsMediaPlayer1.settings.autoStart = false;
            //axWindowsMediaPlayer1.Ctlcontrols.play();
            playList = axWindowsMediaPlayer1.playlistCollection.newPlaylist("ExpectoPatronumVideos");
            preMovie = axWindowsMediaPlayer1.newMedia(@"C:\Users\CLARISSA RAMOS\Documents\GitHub\wiiwandz\HarryParty\media\videos\expecto_patronum_pre.mp4");
            playList.appendItem(preMovie);
            loopMovie = axWindowsMediaPlayer1.newMedia(@"C:\Users\CLARISSA RAMOS\Documents\GitHub\wiiwandz\HarryParty\media\videos\expecto_patronum_loop.mp4");
            //playList.appendItem(loopMovie);
            postMovie = axWindowsMediaPlayer1.newMedia(@"C:\Users\CLARISSA RAMOS\Documents\GitHub\wiiwandz\HarryParty\media\videos\expecto_patronum_post.mp4");

            axWindowsMediaPlayer1.currentPlaylist = playList;
            //WMPLib.IWMPMedia3 preFile = (WMPLib.IWMPMedia3)axWindowsMediaPlayer1.mediaCollection.getAll().get_Item(0);
            //axWindowsMediaPlayer1.currentMedia = preFile;
        }
 private void Form1_Load(object sender, EventArgs e)
 {
     this.serverMusicList.View = View.Details;
     this.serverMusicList.Columns.Add("Music Name", 150, HorizontalAlignment.Left);
     this.serverMusicList.Columns.Add("Artist", 60, HorizontalAlignment.Center);
     this.serverMusicList.Columns.Add("Play Time", 100, HorizontalAlignment.Center);
     this.serverMusicList.Columns.Add("Bit Rate", 100, HorizontalAlignment.Left);
     this.playMusicList.View = View.Details;
     this.playMusicList.Columns.Add("Music Name", 150, HorizontalAlignment.Left);
     this.playMusicList.Columns.Add("Artist", 60, HorizontalAlignment.Center);
     this.playMusicList.Columns.Add("Play Time", 100, HorizontalAlignment.Center);
     this.playMusicList.Columns.Add("Bit Rate", 100, HorizontalAlignment.Left);
     WMP                 = new WindowsMediaPlayer();
     PlayList            = WMP.newPlaylist("MusicPlayer", "");
     WMP.currentPlaylist = PlayList;
     MediaSaver          = Array.CreateInstance(typeof(IWMPMedia), 128);
 }
Exemple #11
0
        static void Play(string path)
        {
            if (Retry++ > 20)
            {
                Exit();
            }

            var          playList = Player.playlistCollection.getByName(path);
            IWMPPlaylist list     = null;

            if (playList != null && playList.count > 0)
            {
                list = playList.Item(new Random().Next(playList.count));
            }
            if (list == null || list.count <= 0)
            {
                list = Player.mediaCollection.getByAuthor(path);
            }
            if (list == null || list.count <= 0)
            {
                list = Player.mediaCollection.getByGenre(path);
            }
            if (list == null || list.count <= 0)
            {
                list = Player.mediaCollection.getByAlbum(path);
            }
            if (list != null && list.count > 0)
            {
                PlaySong(null, list.Item[new Random().Next(list.count)]);
            }
            else
            {
                if (Directory.Exists(path))
                {
                    PlayRandomFromFolder(path);
                }
                else
                {
                    var ext = Path.GetExtension(path);
                    if (SongExtensions.Contains(ext) && File.Exists(path))
                    {
                        PlaySong(path);
                    }
                }
            }
        }
Exemple #12
0
        public NowPlaying(RemotedWindowsMediaPlayer remotePlayer)
        {
            IWMPPlaylist playlist = remotePlayer.getNowPlaying();

            if (playlist != null && playlist.count > 0)
            {
                result_count = playlist.count;
                for (int j = 0; j < playlist.count; j++)
                {
                    IWMPMedia item = playlist.get_Item(j);
                    if (item != null)
                    {
                        now_playing.Add(new PlaylistTrack(j, item));
                    }
                }
            }
        }
        private void SetCurrentPlaylistSongUrl(IWMPPlaylist playlist)
        {
            var urls = new List <string>();

            for (int i = 0; i < playlist.count; i++)
            {
                urls.Add(playlist.Item[i].sourceURL);
            }
            if (PlaylistsUrl.ContainsKey(playlist.name))
            {
                PlaylistsUrl[playlist.name] = urls;
            }
            else
            {
                PlaylistsUrl.Add(playlist.name, urls);
            }
            currentPlaylistSongUrl = PlaylistsUrl[playlist.name];
        }
        /// <summary>
        /// Contructor de MusicMedia
        /// </summary>
        /// <param name="playList">Le pasamos por parametros la PlayList que queremos transformar a MusicMedia</param>
        /// <param name="isMediaCollection">Le definimos si se trata de una MediaColleccion o de una PlayList</param>
        public MusicMedia(IWMPPlaylist playList, bool isMediaCollection)
        {
            authors = new List <string>();
            genres  = new List <string>();
            albums  = new List <string>();
            titles  = new List <string>();

            if (isMediaCollection)
            {
                //lanzar hilo
                Thread thread = new Thread(new ParameterizedThreadStart(LoadMediaCollection));
                thread.Start(playList);
            }
            else
            {
                LoadPlayListCollection(playList);
            }
        }
Exemple #15
0
        public int addPlaylists(IWMPPlaylistCollection playlistCollection, IWMPPlaylistArray list)
        {
            ArrayList items = new ArrayList();

            for (int j = 0; j < list.count; j++)
            {
                bool         containsAudio = false;
                IWMPPlaylist playlist      = list.Item(j);
                string       name          = playlist.name;

                if (!name.Equals("All Music") && !name.Contains("TV") && !name.Contains("Video") && !name.Contains("Pictures"))
                {
                    for (int k = 0; k < playlist.count; k++)
                    {
                        try
                        {
                            if (playlist.get_Item(k).getItemInfo("MediaType").Equals("audio") && !playlistCollection.isDeleted(playlist))
                            {
                                containsAudio = true;
                            }
                        }
                        catch (Exception)
                        {
                            //Ignore playlists with invalid items
                        }
                    }
                }

                if (containsAudio)
                {
                    Playlist playlistData = new Playlist(name, stats_only);
                    if (!items.Contains(playlistData))
                    {
                        items.Add(playlistData);
                    }
                }
            }
            items.TrimToSize();
            if (!stats_only)
            {
                playlists = items;
            }
            return(items.Count);
        }
Exemple #16
0
        public void AddFiles(string[] fileNames)
        {
            playlist = null;
            playlist = axWindowsMediaPlayer1.playlistCollection.newPlaylist("SotNetMediaList");

            string fileName = "";

            foreach (string file in fileNames)
            {
                fileName = file;

                lstVideos.Items.Add(fileName);
                lstVideos.Items[linea].SubItems.Add(fileName);

                playlist.appendItem(axWindowsMediaPlayer1.newMedia(fileName));

                linea++;
            }
        }
Exemple #17
0
        /*
         *  When the form loads
         */
        private void Form1_Load(object sender, EventArgs e)
        {
            // Make the player invisible, add a playlist to it
            wplayer                 = new WindowsMediaPlayer();
            wplayer.uiMode          = "invisible";
            playlist                = wplayer.playlistCollection.newPlaylist("gu2ba6ed4f32s1t");
            wplayer.currentPlaylist = playlist;

            // Default volume
            wplayer.settings.volume = 75;
            volume_bar.Value        = wplayer.settings.volume;

            // If arguments are more than 1, play the media
            if (Environment.GetCommandLineArgs().Length > 1)
            {
                foreach (string file in Environment.GetCommandLineArgs())
                {
                    // If it is the exec name, skip adding
                    if (file == Environment.GetCommandLineArgs()[0])
                    {
                        continue;
                    }

                    Add_To_Playlist(file);
                }

                progress_bar.Value = 0;
                wplayer.controls.currentPosition = 0;
                wplayer.controls.play();
                play_pause.Text = pause;
            }

            // Timer for setting value in progress_bar
            timer_1          = new Timer();
            timer_1.Tick    += new EventHandler(update_progress);
            timer_1.Interval = 5;
            timer_1.Enabled  = true;

            timer_2          = new Timer();
            timer_1.Tick    += new EventHandler(keep_time_track);
            timer_2.Interval = 10;
            timer_2.Enabled  = true;
        }
Exemple #18
0
        public AlbumCollection GetAlbums()
        {
            throw new NotImplementedException();
            IWMPMediaCollection media     = wmp.mediaCollection;
            IWMPPlaylist        playlist  = media.getAll();
            List <Album>        albumlist = new List <Album>();

            for (int i = 0; i < playlist.count; i++)
            {
                IWMPMedia temp = playlist[i];
                if (temp.getItemInfo("MediaType") == "audio")
                {
                    string albumname = temp.getItemInfo("Album");
                }
            }
            AlbumCollection albums = new AlbumCollection(albumlist);

            return(albums);
        }
Exemple #19
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string FileDownPath = null;   //한 곡 경로

            if (comboBox1.SelectedItem.Equals("한곡 재생"))
            {
                if (playList.SelectedIndices.Count == 0)
                {   //곡선택이 안되어 있을 때
                    MessageBox.Show("반복 할 음악을 선택하세요");
                    comboBox1.SelectedIndex = 0;
                    return;
                }

                newPlayList = WMP.newPlaylist("MusicPlayer", "");
                int index;
                index        = playList.FocusedItem.Index;
                oneSongIndex = index;
                string musicName = playList.Items[index].SubItems[0].Text;

                DirectoryInfo d = new DirectoryInfo(downPath);         //디렉토리 경로

                FileInfo[] fArray = d.GetFiles();                      //디렉토리 해당 mp3 파일 배열
                folder = shell.NameSpace(downPath);                    //디렉토리 해당 파일 속성 가져오기

                foreach (FileInfo fInfo in fArray)                     //파일 정보 ListView에 저장
                {
                    FolderItem mp3file = folder.ParseName(fInfo.Name); //파일 이름
                    if (folder.GetDetailsOf(mp3file, 21).ToString() == musicName)
                    {
                        FileDownPath = fInfo.FullName;
                    }
                }
                IWMPMedia Media;
                Media = WMP.newMedia(@FileDownPath); //새로운 음악파일 객체 생성
                newPlayList.appendItem(Media);       //플레이리스트에 추가
                randomCheck = 1;                     //구별할 수 있도록 1저장
            }
            else
            {
                randomCheck = 0;    //설정 안할 때
            }
        }
Exemple #20
0
        public int addTracks(IWMPPlaylist playlist)
        {
            ArrayList items = new ArrayList();

            for (int j = 0; j < playlist.count; j++)
            {
                IWMPMedia item = playlist.get_Item(j);
                if (item != null)
                {
                    items.Add(new PlaylistTrack(j, item));
                }
            }
            items.TrimToSize();
            result_count = items.Count;
            if (!m_stats_only)
            {
                tracks = items;
            }
            return(result_count);
        }
Exemple #21
0
        private void radioVideo_CheckedChanged(object sender, System.EventArgs e)
        {
            try
            {
                // Show the wait cursor in case this is a lengthy operation.
                Cursor.Current = Cursors.WaitCursor;

                mediaPlaylist = Player.mediaCollection.getByAttribute("MediaType", "video");
                Fill_listBox1();

                // Restore the default cursor.
                Cursor.Current = Cursors.Default;
            }
            catch (COMException comExc)
            {
                int    hr      = comExc.ErrorCode;
                String Message = String.Format("There was an error.\nHRESULT = {1}\n{2}", hr.ToString(), comExc.Message);
                MessageBox.Show(Message, "COM Exception");
            }
        }
Exemple #22
0
        static void TestMetaDataEditor2()
        {
            WindowsMediaPlayer wmpPlayer = new WindowsMediaPlayer();
            IWMPPlaylist       playlist  = wmpPlayer.mediaCollection.getByAttribute("MediaType", "audio");
            IWMPMedia          media     = playlist.get_Item(100);

            Console.WriteLine(media.name);
            Console.WriteLine(media.getItemInfo("WM/Genre"));
            Console.WriteLine("-");

            using (MetaDataEditor mde = new MetaDataEditor(media.sourceURL)) {
                //mde.SetFieldValue("WM/Lyrics", "MORE LIKE THIS things");
                //mde.SetFieldValue("WM/Genre", "80's rock");
                Console.WriteLine(mde.GetFieldValue("WM/Year"));
                Console.WriteLine(mde.GetFieldValue("WM/Lyrics"));
                Console.WriteLine(mde.GetFieldValue("WM/Genre"));
                Console.WriteLine(mde.GetFieldValue("WM/Publisher"));
                Console.WriteLine(mde.GetFieldValue("unknown"));
            }
        }
Exemple #23
0
        private void button5_Click(object sender, EventArgs e)
        {
            //scos iteme din playlistul vechi

            pl = wplayer.newPlaylist("pl", "");
            wplayer.currentPlaylist = pl;

            foreach (song s in playlist)
            {
                //creat nou obiect "media"
                IWMPMedia sng = wplayer.newMedia(s.path);
                //adaugat la playlistul curent :D
                wplayer.currentPlaylist.appendItem(sng);
            }
            shouldChangeIndex = true;
            wplayer.controls.play();
            //listBox1.SelectedIndex = 0;
            button7.Enabled = false;
            button8.Enabled = false;
        }
Exemple #24
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd1 = new OpenFileDialog();

            ofd1.Multiselect      = true;
            ofd1.Title            = "Select a Audio File";
            ofd1.InitialDirectory = @"C:\Users\victor\Desktop\";
            ofd1.Filter           = "Audio Files (*.MP3;*.WAV;*.M4A,*.FLAC,*.WMA,*.AAC)|*.MP3;*.WAV;*.M4A,*.FLAC,*.WMA,*.AAC|" + "All files (*.*)|*.*";
            ofd1.CheckFileExists  = true;
            ofd1.CheckPathExists  = true;
            ofd1.FilterIndex      = 2;
            ofd1.RestoreDirectory = true;
            ofd1.ReadOnlyChecked  = true;
            ofd1.ShowReadOnly     = true;

            DialogResult dr = ofd1.ShowDialog();

            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                pathFiles.AddRange(ofd1.FileNames);
                DataTable dt = new DataTable();
                dt.Columns.Add("Músicas", typeof(string));
                var values = ofd1.SafeFileNames.Select(x => new { Value = x }).ToList();

                IWMPMedia    currMedia    = player.currentMedia;
                IWMPPlaylist playlist     = player.playlistCollection.newPlaylist("MusicPlayer");
                var          playListName = playlist.name;

                foreach (var val in values.Select((x, i) => new { Index = i, Value = x }))
                {
                    var fileUrl = pathFiles.Where(p => p.Contains(val.Value.Value)).FirstOrDefault();
                    currMedia = player.newMedia(fileUrl);
                    playlist.appendItem(currMedia);
                    dt.Rows.Add(val.Value.Value);
                }
                player.currentPlaylist = playlist;
                dgvNext.DataSource     = dt;
                btnPlay.Text           = "=";
                playState = false;
            }
        }
Exemple #25
0
        /// <summary>
        /// Function for creating playlist and playing it.
        /// </summary>
        private void startPlay()
        {
            mediaPlayer.currentPlaylist.clear();
            ListViewItem it;
            String       filePath;
            IWMPMedia    videoFile;
            IWMPPlaylist myPlaylist = mediaPlayer.playlistCollection.newPlaylist("playlist");

            Debug.WriteLine(mediaPlayer.openState);
            mediaPlayer.settings.setMode("loop", true);


            for (int i = 1; i <= numOfFiles; i++)
            {
                it        = listOfFiles.FindItemWithText("" + i);
                filePath  = it.Text;
                videoFile = mediaPlayer.newMedia(filePath);
                myPlaylist.appendItem(videoFile);
            }
            mediaPlayer.currentPlaylist = myPlaylist;
        }
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            isPaused = false;
            ListViewItem item   = listView1.SelectedItems[0];
            PlayListItem plItem = new PlayListItem(item.SubItems[0].Text,
                                                   item.SubItems[2].Text,
                                                   TimeSpan.Parse(item.SubItems[1].Text));

            if (plItem == null)
            {
                return;
            }

            try
            {
                if (xWMP.Ctlcontrols.currentItem.sourceURL.Equals(item.SubItems[2].Text))
                {
                    xWMP.Ctlcontrols.stop();
                    xWMP.Ctlcontrols.play();
                }
                else
                {
                    IWMPPlaylist playlist = xWMP.playlistCollection.getByName(CurrentPlayList).Item(0);
                    IWMPMedia    media    = xWMP.newMedia(item.SubItems[2].Text);
                    while (!xWMP.Ctlcontrols.currentItem.sourceURL.Equals(item.SubItems[2].Text))
                    {
                        xWMP.Ctlcontrols.next();
                    }
                    xWMP.Ctlcontrols.play();
                }

                adjustTimeBar();
                tickAction();
                myTimer.Start();
            }
            catch (Exception)
            {
                MessageBox.Show("File not found! Delete song and add it from its new location!");
            }
        }
Exemple #27
0
        // saves playlist
        private void SavePlaylistToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SavePlaylistForm saveForm = new SavePlaylistForm
            {
                StartPosition = FormStartPosition.CenterParent
            }; // launches save form

            saveForm.ShowDialog();

            if (saveForm.DialogResult == DialogResult.OK)
            {
                // saves current playlist
                playlist           = MediaPlayer.currentPlaylist;
                playlist.name      = saveForm.PlaylistName;
                playListLabel.Text = saveForm.PlaylistName;              // get playlist name
                MediaPlayer.playlistCollection.importPlaylist(playlist); // adds playlist to library

                //refresh library
                libraryListBox.Items.Clear();
                MediaPlayerHelper.SetupLibrary(libraryListBox, MediaPlayer);
            }
        }
Exemple #28
0
        //Switches playlists (for a shuffled and unshuffled playlist)
        private void SwitchPlaylist(IWMPPlaylist newPlaylist)
        {
            int index = 0;

            for (int i = 0; i < newPlaylist.count; i++)
            {
                if (player.currentMedia.name.Equals(newPlaylist.Item[i].name))
                {
                    index = i;
                    //CurrentSongNameLbl.Text = "found";
                    break;
                }
            }

            double currentTime = player.controls.currentPosition;

            player.controls.stop();
            player.currentPlaylist = newPlaylist;
            player.currentMedia    = player.currentPlaylist.Item[index];
            player.controls.play();
            player.controls.currentPosition = currentTime;
        }
Exemple #29
0
        public string FileNameForWMPItem(string itemTrackingID)
        {
            WindowsMediaPlayer WMPlayer = new WindowsMediaPlayer();
            IWMPPlaylist       pl       = WMPlayer.mediaCollection.getByAttribute("TrackingID", itemTrackingID);

            if (pl.count == 0)
            {
                Functions.WriteLineToLogFile("Warning - no item found in library with ID " + itemTrackingID);
                return(null);
            }

            if (pl.count != 1)
            {
                Functions.WriteLineToLogFile("Warning - more than one item found in library with ID " + itemTrackingID);
            }

            IWMPMedia mItem = pl.get_Item(0);


            WMPlayer.close();
            return(mItem.sourceURL);
        }
Exemple #30
0
        public void transferPlayCounts(string track, string album, string artist, int playCount)
        {
            translate(ref artist, ref album);
            IWMPPlaylist list = collection.getByAttribute("WM/AlbumTitle", album);

            for (int i = 0; i < list.count; ++i)
            {
                if (
                    (track.ToLower() == list.getItemInfo("Title").ToLower())
                    &&
                    (artist.ToLower() == list.getItemInfo("WM/AlbumArtist").ToLower())
                    &&
                    (artist.ToLower() == list.getItemInfo("WM/AlbumTitle").ToLower())
                    )
                {
                    list.setItemInfo("UserPlayCount", playCount.ToString());
                    return;
                }
            }
            Console.WriteLine("Not found: {0} {1} {2}", track, album, artist);
            skipOrRename(artist, album, track, playCount);
        }
Exemple #31
0
        private void pathBtn_Click(object sender, EventArgs e)
        {
            folderBrowserDialog1.ShowDialog();
            string path = folderBrowserDialog1.SelectedPath;

            pathText.Text    = path;
            pathText.Enabled = false;

            musicList.Items.Clear();

            wmp = new WindowsMediaPlayer();
            IWMPMedia mp3File;

            playList = wmp.newPlaylist("MusicPlayer", "");

            DirectoryInfo di = new DirectoryInfo(path);

            fi = di.GetFiles("*.mp3");
            foreach (var item in fi)
            {
                mp3File = wmp.newMedia(@"" + path + "\\" + item.Name);
                string[] file_info = new string[4];
                double   duration;
                string   bitrates;
                file_info[0] = mp3File.getItemInfo("Title");
                file_info[1] = mp3File.getItemInfo("Author");
                duration     = mp3File.duration;
                file_info[2] = ((int)duration / 60) + "분" + ((int)duration % 60) + "초";
                bitrates     = mp3File.getItemInfo("Bitrate");
                file_info[3] = bitrates.Remove(3, 3) + "kbps";

                ListViewItem list_item = new ListViewItem(file_info);
                musicList.Items.Add(list_item);

                playList.appendItem(mp3File);

                isPathSelected = true;
            }
        }
Exemple #32
0
        public frmMenu()
        {
            InitializeComponent();
          

            bmBackground = new PPPBitmap(new Bitmap("CombatGameBackground.gif"), "CombatGameBackground.gif");
            
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
           // this.pbNewGame.Image = imgNewGameSelected;
            wplayer = new WindowsMediaPlayer();
            playlistMenu = wplayer.playlistCollection.newPlaylist("Playlist Menu");
            playlistFight = wplayer.playlistCollection.newPlaylist("Playlist Fight");
            playlistMenu.appendItem(wplayer.newMedia("Eye Of The Tiger Instrumental.mp3"));
            playlistFight.appendItem(wplayer.newMedia("Hardest Gangsta beat ever.mp3"));
            wplayer.currentPlaylist = playlistMenu;
            wplayer.settings.setMode("loop", true);
            wplayer.controls.play();

            pickAForm = 0;
            Invalidate();
            
           
        }
Exemple #33
0
        //CONSTRUCTOR
        public PlayList(List <string> filenames, string Name = "newPlayList")
        {
            //Adds song Name and song Address to songs
            foreach (string songName in filenames)
            {
                songs.Add(songName, @"Playlist\" + songName);
            }
            songAddresses = songs.Values;
            songNames     = songs.Keys;
            PlayListSongs.Add(songNames.ToList());

            //initialises new playlist
            currentPlayList = wmpPlayLists.newPlaylist(Name);
            PlaylistNames.AddLast(Name);

            //initialises new media objects using songAddress and adds them to the playlist
            foreach (string songAddress in songAddresses)
            {
                media = player.newMedia(songAddress);
                currentPlayList.appendItem(media);
            }
            PlayLists.Add(this);

            //Updating all data to the Datastore, i.e., PlayListNames.json & PlayListSongs.json
            JsonSerializerOptions options = new JsonSerializerOptions
            {
                WriteIndented = true
            };

            string playListNamesSerial = JsonSerializer.Serialize(PlaylistNames, options);

            File.WriteAllText(@"PlayListNames.json", playListNamesSerial);

            string songNamesSerial = JsonSerializer.Serialize(PlayListSongs, options);

            File.WriteAllText(@"PlayListSongs.json", songNamesSerial);
        }
Exemple #34
0
        private void btnFolder_Click(object sender, EventArgs e)
        {
            IWMPMedia media;

            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                folder           = folderBrowserDialog1.SelectedPath;
                playlist         = player.newPlaylist("Playlist", folder);
                lbMusicName.Text = folder;
                // читаем папку в строку
                String[] files = Directory.GetFiles(folder, "*.mp3*", SearchOption.AllDirectories);
                if (files.Length != 0)
                {
                    songList.Items.Clear();
                    songList.ResetText();
                    foreach (string file in files)
                    {
                        media = player.newMedia(file);
                        songList.Items.Add(media.name);
                        playlist.appendItem(media);
                    }
                    songList.SelectedIndex = 0;
                    player.currentPlaylist = playlist;
                    player.Ctlcontrols.stop();
                    btnStart.Enabled = true;
                    songList.Enabled = true;
                }
                else
                {
                    MessageBox.Show("Не найдено ни одного файла mp3");
                }
            }
            else
            {
                MessageBox.Show("Путь не выбран!");
            }
        }
        private void LoadPlayList(string playlistName)
        {
            IWMPPlaylist pl = xWMP.playlistCollection.newPlaylist(playlistName);

            CurrentPlayList = playlistName;

            List <PlayListItem> playlistItems = manager.LoadPlaylist(CurrentPlayList);

            listView1.Items.Clear();

            TotalDuration = new TimeSpan(0, 0, 0);

            foreach (PlayListItem item in playlistItems)
            {
                addItemToListView(item.Name, item.Duration.ToString(), item.Path);
                IWMPMedia media = xWMP.newMedia(item.Path);
                pl.appendItem(media);
                TotalDuration         += item.Duration;
                lbl_totalDuration.Text = TotalDuration.ToString();
            }

            xWMP.currentPlaylist = pl;
            xWMP.Ctlcontrols.stop();
        }
Exemple #36
0
        private void ShowXML()
        {
            // Find out the name of the album selected, get the xml from windows media.com and
            //   drop it into the Rich Text Edit.
            string strAlbumName = albumListbox.SelectedItem as string;

            if (strAlbumName != null && strAlbumName.Length > 0)
            {
                IWMPPlaylist playlist = wmpplayer.mediaCollection.getByAlbum(strAlbumName);
                if (playlist != null && playlist.count > 0)
                {
                    IWMPMedia mediaItem = playlist.get_Item(0);
                    string    strTOC    = mediaItem.getItemInfo("TOC");
                    string    strURL    = "http://www.windowsmedia.com/redir/QueryToc.asp?cd="
                                          + strTOC
                                          + "&version=8.0.0.4452";

                    HttpWebRequest  req        = WebRequest.Create(strURL) as HttpWebRequest;
                    HttpWebResponse resp       = req.GetResponse()  as HttpWebResponse;
                    Stream          respStream = resp.GetResponseStream();
                    richTextBox1.LoadFile(respStream, RichTextBoxStreamType.PlainText);
                }
            }
        }
Exemple #37
0
 public void addItems(IWMPPlaylist playlist)
 {
     for (int j = 0; j < playlist.count; j++)
     {
         IWMPMedia item = playlist.get_Item(j);
         if (item != null)
         {
             items.Add(new PlaylistItem(j, item));
         }
     }
 }
Exemple #38
0
        void request()
        {
            string uriString =
                       string.Format("https://api.vk.com/method/{0}?oid={1}&access_token={2}",
                      "audio.get", MY_ID, ACCESS_TOKEN);
            WebRequest _webRequest = WebRequest.Create(uriString);
            WebResponse _webResponce = _webRequest.GetResponse();
            Stream _stream = _webResponce.GetResponseStream();
            StreamReader _streamReader = new StreamReader(_stream);
            string responseFromServer = _streamReader.ReadToEnd();
            _streamReader.Close();
            _webResponce.Close();
            responseFromServer = HttpUtility.HtmlDecode(responseFromServer);
            JToken _jtoken = JToken.Parse(responseFromServer);
            AudioList = _jtoken["response"].Children().Skip(1).Select(c => c.ToObject<Audio>()).ToList();
            this.Invoke((MethodInvoker)delegate
            {
                Playlist = axWindowsMediaPlayer1.playlistCollection.newPlaylist("vkPLayList");
                for (int i = 0; i < AudioList.Count; i++)
                {
                    
                    Media = axWindowsMediaPlayer1.newMedia(AudioList[i].url);
                    Playlist.appendItem(Media);
                    listView1.Items.Add(AudioList[i].artist + " " + AudioList[i].title);
                }
                axWindowsMediaPlayer1.currentPlaylist = Playlist;
                axWindowsMediaPlayer1.Ctlcontrols.stop();

            });
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            imgCerrar.Visible = false;
            mute.Visible = false;
            habilitarDragDrop();
            obtenerValoresAleatorios(); // Relleno el arrays de valores de los atributos con números aleatorios.
            deshabilitarHabilidades(); // Para que no se puedan marcar si no hay personaje seleccionado.
            lblHabilidadesPorSelec.Text = Constantes.HAB_POR_SELEC + habPorSelect;
            resetFlechasAtributos();
            // Oculto todos los elementos para emular un menú de carga.
            ocultarPaginaNewPersonaje();
            panelVistaPersonaje.Visible = false;
            menuSeleccion.Visible = false;
            ocultarModoEdicion();
            album.importarPjs();
            actualizarFlechasDesplazamiento();
            if (!album.vacio()) {
                imgAlbum.BackgroundImage = Properties.Resources.album;
                imgAlbum.Enabled = true;
            } else
                imgAlbum.Enabled = false;

            this.Cursor = new Cursor(cursor); // Cambio el cursor.
            playlist = reproductor.playlistCollection.newPlaylist("myplaylist"); // Creo la lista.
            media = reproductor.newMedia(System.IO.Path.GetFullPath(@"songGOT.mp3")); // Agrego canción a media.
            playlist.appendItem(media); // agrego canción a la lista.
            media = reproductor.newMedia(System.IO.Path.GetFullPath(@"songMGS2.mp3"));
            playlist.appendItem(media);
            media = reproductor.newMedia(System.IO.Path.GetFullPath(@"songLR.mp3"));
            playlist.appendItem(media);
            media = reproductor.newMedia(System.IO.Path.GetFullPath(@"songAR1.mp3"));
            playlist.appendItem(media);
            reproductor.currentPlaylist = playlist; // asigno la lista al reproductor.
            reproductor.settings.setMode("loop", true); // para que vuelva a empezar cuando acabe.
            reproductor.controls.play(); // Doy al play!
        }
Exemple #40
0
 private OpResult add_to_playlist(OpResult or, bool contains_query, IWMPPlaylist queried, string playlist_name)
 {
     if (contains_query)
     {
         IWMPPlaylistCollection playlistCollection = (IWMPPlaylistCollection)Player.playlistCollection;
         IWMPPlaylistArray current_playlists = playlistCollection.getByName(playlist_name);
         if (current_playlists.count > 0)
         {
             IWMPPlaylist previous_playlist = current_playlists.Item(0);
             for (int j = 0; j < queried.count; j++)
             {
                 previous_playlist.appendItem(queried.get_Item(j));
             }
             or.ContentText = "Playlist " + playlist_name + " updated.";
         }
         else
         {
             queried.name = playlist_name;
             playlistCollection.importPlaylist(queried);
             or.ContentText = "Playlist " + playlist_name + " added.";
         }
         or.StatusCode = OpStatusCode.Success;
     }
     else
     {
         or.StatusCode = OpStatusCode.BadRequest;
         or.StatusText = "Playlists can only be created using a query for a specific items.";
     }
     return or;
 }
Exemple #41
0
 public Album(string name, IWMPPlaylist playlist, bool stats_only)
 {
     m_stats_only = stats_only;
     album = name;
     if (playlist != null)
     {
         int count = 0;
         if (playlist.count > 1) count = 2;
         else count = 1;
         for (int j = 0; j < count; j++)
         {
             IWMPMedia item = playlist.get_Item(j);
             if (item != null)
             {
                 album_artist = item.getItemInfo("WM/AlbumArtist");
                 year = item.getItemInfo("WM/OriginalReleaseYear");
                 if (year.Equals("") || year.Length < 4) year = item.getItemInfo("WM/Year");
                 if (!genre.Contains(item.getItemInfo("WM/Genre"))) genre.Add(item.getItemInfo("WM/Genre"));
             }
         }
     }
 }
Exemple #42
0
 public int addSongs(IWMPPlaylist playlist)
 {
     int result_count = 0;
     for (int j = 0; j < playlist.count; j++)
     {
         IWMPMedia item = playlist.get_Item(j);
         if (item != null)
         {
             if (!m_stats_only) songs.Add(new Song(item));
             else result_count++;
         }
     }
     return result_count;
 }
 public bool get_isIdentical(IWMPPlaylist pIWMPPlaylist)
 {
     throw new NotImplementedException();
 }
 public static void Randomise(IWMPPlaylist list,Queue<Track> queue)
 {
     queue.Clear();
     var random = new Random();
     var tracks = new List<Track>();
     for(var i=0;i<list.count;i++)
     {
         var t = CreateTrack(list.get_Item(i));
         if (t != null) tracks.Add(t);
     }
     while (tracks.Count > 0)
     {
         var index = random.Next(tracks.Count);
         queue.Enqueue(tracks[index]);
         tracks.RemoveAt(index);
     }
 }
        public static Track GetRandomTrack(Random random,IWMPPlaylist list)
        {
            Track track;
            var attempts = 0;

            while (true)
            {
                track = CreateTrack(list.get_Item(random.Next(list.count)));
                if (track != null) break;
                if (attempts++ > 100) break;
            }

            return track;
        }
        private void radioVideo_CheckedChanged(object sender, System.EventArgs e)
        {
            try
            {
                // Show the wait cursor in case this is a lengthy operation.
                Cursor.Current = Cursors.WaitCursor;

                mediaPlaylist = Player.mediaCollection.getByAttribute("MediaType", "video");
                Fill_listBox1();

                // Restore the default cursor.
                Cursor.Current = Cursors.Default;
            }
            catch(COMException comExc)
            {
                int hr = comExc.ErrorCode;
                String Message = String.Format("There was an error.\nHRESULT = {1}\n{2}", hr.ToString(), comExc.Message);
                MessageBox.Show(Message, "COM Exception");
            }
        }
 public Library(IWMPPlaylist playlist)
 {
     _baseplaylist = playlist;
     Tracks = new TrackCollection();
     Total = playlist.count;
 }
 public Player(IEnumerable<FileInfo> Playlist)
 {
     _player = new WindowsMediaPlayer();
     playlist = _player.playlistCollection.newPlaylist("myplaylist");
     foreach (var file in Playlist)
     {
         var media = _player.newMedia(file.FullName);
         playlist.appendItem(media);
     }
     _player.currentPlaylist = playlist;
     _player.controls.stop();
     _player.PlayStateChange += _player_PlayStateChange;
 }