Ejemplo n.º 1
0
        public static SongInfo GetClipInfo(string ClipEntryTitle)
        {
            SongInfo songInfo = new SongInfo();
            string sCoreSongInfo  = "";
            try
            {
                //
                //The clip will be in form of below
                //
                //ClipEntryTitle =
                //		3122^Tere+Bina+Zindegi+Vi^Kishore+Kumar,Lata+Mangeshkar^Aandhi^R.D+Burman^^...
                //
                if ((ClipEntryTitle.IndexOf("^") >= 0))
                {
                    sCoreSongInfo =
                        ClipEntryTitle.Substring(ClipEntryTitle.IndexOf("^") + 1);
                    if (sCoreSongInfo.Trim() != "")
                    {
                        string[] clipInfos = sCoreSongInfo.Split("^".ToCharArray());

                        songInfo.SongTitle = clipInfos[0].Trim().Replace("+"," ");
                        songInfo.Artist = clipInfos[1].Trim().Replace("+"," ");
                        songInfo.Album = clipInfos[2].Trim().Replace("+"," ");
                        songInfo.MusicComposer = clipInfos[3].Trim().Replace("+"," ");

                    }

                }
            }
            catch(Exception _e)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "Clip information parsing problem ";
                frm.ErrorMessage = _e.Message;
                frm.StrackTrace = _e.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }

            return songInfo;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This function starts the converter thread internally and returns 
        /// immediately
        /// </summary>
        /// <param name="wavFilePath">Full path of the WAV file</param>
        public void Convert(string wavFile,SongInfo songInfo)
        {
            try
            {
                //Protect the wav file path memeber
                this.WAVFilePath = wavFile;

                //Protect songinfo member
                this.SongInfo = songInfo;

                //Start conversion asynchronously
                this.converterThread.Start();

            }
            finally
            {

            }
        }
Ejemplo n.º 3
0
        public void DisplaySongInfo(SongInfo SongInformation,int CurrentIndex)
        {
            lblSongTitle.Text = (SongInformation.SongTitle == null ? "" : SongInformation.SongTitle.Trim());
            lblSongTitle.Refresh();

            lblArtist.Text = (SongInformation.Artist == null ? "" : SongInformation.Artist.Trim());
            lblArtist.Refresh();

            lblMusicComposer.Text = (SongInformation.MusicComposer == null ? "" : SongInformation.MusicComposer.Trim());
            lblMusicComposer.Refresh();

            lblAlbum.Text = (SongInformation.Album == null ? "" : SongInformation.Album.Trim());
            lblAlbum.Refresh();

            lblSongs.Text = CurrentIndex.ToString() + "/" + m_SongsNo.ToString();
            lblSongs.Refresh();
        }
Ejemplo n.º 4
0
        //Fires when document's title changes
        private void ctlRaagaJukebox_TitleChange(object sender, AxSHDocVw.DWebBrowserEvents2_TitleChangeEvent e)
        {
            try
            {
                //Add skipped !!!!
                if (m_bToggle == false)
                {
                    IHTMLWindow2 framePlayer = m_wndPlayer;

                    if (framePlayer != null)
                    {
                        //
                        //Save the previous recording
                        if (m_isRecording == true)
                        {
                            //Stop the recording
                            m_isRecording = false;
                            Stop();

                            //
                            //Do the saving...(mp3/wav etc)
                            if (m_sCurrentSongInfo != null)
                            {
                                //
                                //Do the saving...(mp3/wav etc)
                                FormatConverter converter = new FormatConverter();
                                converter.Convert(m_sCurrentMusicRecordingPath + "\\" +
                                        m_sCurrentSongInfo.SongTitle + ".wav",m_sCurrentSongInfo);

                                m_sCurrentSongInfo = null;
                            }
                        }

                        //Finished the playlist...close the window
                        if (m_CurrentSongIndex >= m_wndParent.SongsCount)
                        {
                            //Disable the Raaga player volume control
                            m_wndParent.PlayerVolume = -1;
                            Stop();
                            this.Close();
                        }
                        else
                        {
                            //Un-register the TitleChange event-hadler
                            ctlRaagaJukebox.TitleChange -=
                                new AxSHDocVw.DWebBrowserEvents2_TitleChangeEventHandler(
                                    this.ctlRaagaJukebox_TitleChange);

                            //Get the volume and update the parent UI
                            framePlayer.execScript("if (raaga_ply != null) { document.title = raaga_ply.GetVolume(); }", "JavaScript");
                            m_wndParent.PlayerVolume = int.Parse(framePlayer.document.title.Trim());

                            //
                            //No way to get javascript string to C# string
                            framePlayer.execScript(
                                "if (raaga_ply != null) { document.title = raaga_ply.GetEntryTitle(raaga_ply.GetCurrentEntry()); }",
                                "JavaScript");
                            string sClipTitle = framePlayer.document.title;

                            SongInfo si = ClipInfoParser.GetClipInfo(sClipTitle);
                            m_sCurrentSongInfo = si;

                            string s = "";
                            s += "Song :" + si.SongTitle + "\r\n";
                            s += "Artist :" + si.Artist + "\r\n";
                            s += "Composer/Director :" + si.MusicComposer + "\r\n";
                            s += "Album/Film :" + si.Album + "\r\n";
                            //MessageBox.Show(s);

                            //
                            //Register the .NET event-handler again sothat
                            //on clipchange(on-document-title change) it fires again
                            ctlRaagaJukebox.TitleChange +=
                                new AxSHDocVw.DWebBrowserEvents2_TitleChangeEventHandler(
                                this.ctlRaagaJukebox_TitleChange);

                            //
                            //Add embedded between subsequent songs have no title/album
                            m_isRecording = true;

                            if ((si != null) && (si.Album.Trim() != ""))
                            {
                                //
                                //Detect adds in between(Ad Signatures in Beta 2.)
                                string[] AdSignatures = new string[] { "xoom", "citibank", "rupee", "money", "ford" };
                                if ((si.SongTitle.ToLower().IndexOf(AdSignatures[0]) >= 0) ||
                                    (si.SongTitle.ToLower().IndexOf(AdSignatures[1]) >= 0) ||
                                    (si.SongTitle.ToLower().IndexOf(AdSignatures[2]) >= 0) ||
                                    (si.SongTitle.ToLower().IndexOf(AdSignatures[3]) >= 0) ||
                                    (si.SongTitle.ToLower().IndexOf(AdSignatures[4]) >= 0))
                                {
                                    framePlayer.execScript("if (raaga_ply != null) { raaga_ply.DoNextEntry(); }", "JavaScript");
                                    m_isRecording = false;
                                    m_sCurrentSongInfo = null;
                                }
                                else
                                {
                                    //
                                    //Show songinfo/index in main window
                                    if (m_wndParent != null)
                                    {
                                        m_wndParent.DisplaySongInfo(m_sCurrentSongInfo, m_CurrentSongIndex);
                                        m_CurrentSongIndex++;
                                    }

                                    //
                                    //Core : Record the music
                                    m_lCumulativeBytesCount = 0;
                                    string MusicFolder = "";
                                    if (Globals.GetInstance().AutomaticGenreDetection == true)
                                    {
                                        if (Directory.Exists(
                                            Globals.GetInstance().MusicDirectory + "\\" +
                                            m_sCurrentSongInfo.Album) == false)
                                        {

                                            Directory.CreateDirectory(
                                                Globals.GetInstance().MusicDirectory + "\\" +
                                                m_sCurrentSongInfo.Album);
                                        }

                                        MusicFolder =
                                            Globals.GetInstance().MusicDirectory + "\\" +
                                            m_sCurrentSongInfo.Album;

                                    }
                                    else
                                    {
                                        //Assorted is selceted
                                        if (Directory.Exists(
                                            Globals.GetInstance().MusicDirectory + "\\" +
                                            Globals.GetInstance().AssortedDirectory) == false)
                                        {
                                            Directory.CreateDirectory(
                                                Globals.GetInstance().MusicDirectory + "\\" +
                                                Globals.GetInstance().AssortedDirectory);
                                        }

                                        MusicFolder =
                                            Globals.GetInstance().MusicDirectory + "\\" +
                                            Globals.GetInstance().AssortedDirectory;

                                    }

                                    m_isRecording = true;
                                    m_sCurrentMusicRecordingPath =
                                        MusicFolder;
                                    Start(MusicFolder + "\\" +
                                        m_sCurrentSongInfo.SongTitle + ".wav");

                                }

                            }
                        }

                    }

                }

            }
            catch(Exception _e)
            {
                Stop();

                if (Globals.GetInstance().SuppressError == false)
                {
                    frmException frm = new frmException();
                    frm.ExceptionDialogTitle = "Raaga.com recording problem ";
                    frm.ErrorMessage = _e.Message;
                    frm.StrackTrace = _e.StackTrace;
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        frm.Dispose();
                        frm = null;
                    }
                }
            }
        }