Example #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;
        }
Example #2
0
        private void cmdMusicDirectory_Click(object sender, C1.Win.C1Command.ClickEventArgs e)
        {
            try
            {
                //Browse to music directory and show mp3s created by RaagaHacker
                using(frmMusicDirBrowser browser = new frmMusicDirBrowser())
                {
                    browser.ShowDialog();
                }

            }
            catch(Exception _e)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "Raaga.com navigational problem ";
                frm.ErrorMessage = _e.Message;
                frm.StrackTrace = _e.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
        }
Example #3
0
 private void c1CommandControl1_Click(object sender, C1.Win.C1Command.ClickEventArgs e)
 {
     try
     {
         NavigateToUrl(URLs.RAAGA_HOME);
     }
     catch(Exception _e)
     {
         frmException frm = new frmException();
         frm.ExceptionDialogTitle = "Internet Navigational Error";
         frm.ErrorMessage = _e.Message;
         frm.StrackTrace = _e.StackTrace;
         if(frm.ShowDialog() == DialogResult.OK)
         {
             frm.Dispose();
             frm = null;
             Application.Exit();
         }
     }
 }
Example #4
0
 private void picVolumeControl_Click(object sender, System.EventArgs e)
 {
     try
     {
         System.Diagnostics.Process.Start("sndvol32.exe");
     }
     catch(Exception _e)
     {
         if (Globals.GetInstance().SuppressError == false)
         {
             frmException frm = new frmException();
             frm.ExceptionDialogTitle = "Raaga Jukebox Configuration Problem ";
             frm.ErrorMessage = _e.Message;
             frm.StrackTrace = _e.StackTrace;
             if (frm.ShowDialog() == DialogResult.OK)
             {
                 frm.Dispose();
                 frm = null;
             }
         }
     }
 }
Example #5
0
        private void UpdateAudioLevelUI(object state)
        {
            object[] values = (object[])state;

            byte[] data = (byte[])values[0];
            int size = (int)values[1];

            long    i = 0;
            long    iVal4 = bufferSize/4, iVal2 = bufferSize/2;
            long    iLeftAudioValue = 0, iRightAudioValue = 0;
            long    iLeftAudioValueSquared = 0, iRightAudioValueSquared = 0;
            double  dblRMSLeft = 0.0f,  dblRMSRight = 0.0f;
            double  dbldbLeft = 0.0f, dbldbRight = 0.0f;
            try
            {
                while (i < (size - 2))
                {
                    //Get the left channel data

                    //We are calculating RMS value. buffrSise/2 is the sample mean
                    iLeftAudioValue = data[i] - iVal4;
                    iLeftAudioValueSquared += iLeftAudioValue * iLeftAudioValue;

                    //Get the right channel data for same sample
                    i++;

                    //We are calculating RMS value. buffrSise/2 is the sample mean
                    iRightAudioValue = data[i] - iVal4;
                    iRightAudioValueSquared += iRightAudioValue * iRightAudioValue;

                    //Get the next sample
                    i++;
                }

                //RMS values
                dblRMSLeft = ((double)(iLeftAudioValueSquared / iVal2) *
                              (double)(iLeftAudioValueSquared / iVal2));
                dblRMSRight = ((double)(iRightAudioValueSquared / iVal2) *
                                (double)(iRightAudioValueSquared / iVal2));

                //Get the values in db
                dbldbLeft = 20 * (Math.Log(dblRMSLeft) / Math.Log(10.0f));
                dbldbRight = 20 * (Math.Log(dblRMSRight) / Math.Log(10.0f));

                if (m_wndParent != null)
                {
                    m_wndParent.SetChannelValue((int)dbldbLeft, (int)dbldbRight);
                }

            }
            catch (Exception _e)
            {
                //Handle it
                if (Globals.GetInstance().SuppressError == false)
                {
                    frmException frm = new frmException();
                    frm.ExceptionDialogTitle = "UpdateAudioLevelUI: Recording problem ";
                    frm.ErrorMessage = _e.Message;
                    frm.StrackTrace = _e.StackTrace;
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        frm.Dispose();
                        frm = null;
                    }
                }
            }
        }
Example #6
0
        private void ctlRaagaBrowser_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
        {
            try
            {
                //Either movie/playlist
                if (((e.uRL.ToString().IndexOf("movie") >= 0) && (e.uRL.ToString().IndexOf("movies") == -1) &&
                    (e.uRL.ToString().IndexOf("fastclick") == -1)) ||
                    (e.uRL.ToString().IndexOf("viewPL") >= 0))
                {
                    currentURL = e.uRL.ToString().Trim();

                    //Load CD image for the movie
                    if ((e.uRL.ToString().IndexOf("movie") >= 0) && (e.uRL.ToString().IndexOf("movies") == -1))
                    {
                        //We are at the movie's song-list page , not in movie list page
                        //
                        //Determine the CD image for the movie. CD images used to correspond to
                        //a HTML image element with src value http://images.raaga.com/Catalog/CD/.../*.jpg
                        //
                        //Parse the page for such a image

                        //Get a AgilityPack HTML document
                        HtmlAgilityPack.HtmlDocument agilityDoc = new HtmlAgilityPack.HtmlDocument();

                        //Load the current HTML into it
                        agilityDoc.LoadUrl(e.uRL.ToString());

                        //Get the image src url, stream it to a image
                        try
                        {
                            //Get the image node
                            HtmlAgilityPack.HtmlNode nodeMovie =
                                agilityDoc.DocumentNode.SelectNodes("//img[contains(@src,'http://images.raaga.com/Catalog/CD')]")[0];

                            //Get the image(movie/album pic)
                            picMovie.Image =
                            Image.FromStream(new System.Net.WebClient().OpenRead(nodeMovie.Attributes["src"].Value));

                            //Get the (movie/album) name
                            lblMovieName.Text = nodeMovie.Attributes["alt"].Value;

                        }
                        catch
                        {
                            picMovie.Image.Dispose();
                            picMovie.Image = null;
                            lblMovieName.Text = "";
                        }
                        finally
                        {
                            agilityDoc = null;
                            System.GC.Collect(0);
                        }

                    }

                    IHTMLDocument2 doc = ((IHTMLDocument2)this.ctlRaagaBrowser.Document);
                    if (doc != null)
                    {
                        //
                        //Get the forms : Raaga songs listed in a form named "raaga"
                        IHTMLFormElement2 oSongForm = null;
                        oSongForm = ((IHTMLFormElement2)doc.forms.item("raaga",0));
                        if (oSongForm != null)
                        {
                            //
                            //If the form called "raaga" is present execute following
                            //script
                            doc.parentWindow.execScript(Signatures.SongListJS,"JavaScript");
                            m_SongsNo = doc.title == "" ? 0 : int.Parse(doc.title);
                            lblSongs.Text = "1/" + m_SongsNo.ToString();
                            lblSongs.Refresh();

                            //
                            //Also attach a IDispatch handler to receive
                            //javascript events in a IE-COM way
                            doc.onclick = this;

                            songPage = true;

                        }

                    }
                }

            }
            catch(Exception _e)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "Song list setection problem ";
                frm.ErrorMessage = _e.Message;
                frm.StrackTrace = _e.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
        }
Example #7
0
        private void ctlRaagaBrowser_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
        {
            try
            {
                //Either movie/playlist
                if (((e.uRL.ToString().IndexOf("movie") >= 0) && (e.uRL.ToString().IndexOf("movies") == -1)) ||
                    (e.uRL.ToString().IndexOf("viewPL") >= 0))
                {
                    IHTMLDocument2 doc = ((IHTMLDocument2)this.ctlRaagaBrowser.Document);
                    if (doc != null)
                    {
                        //
                        //Get the forms : Raaga songs listed in a form named "raaga"
                        IHTMLFormElement2 oSongForm = null;
                        oSongForm = ((IHTMLFormElement2)doc.forms.item("raaga",0));
                        if (oSongForm != null)
                        {
                            //
                            //If the form called "raaga" is present execute following
                            //script
                            doc.parentWindow.execScript(Signatures.SongListJS,"JavaScript");
                            m_SongsNo = doc.title == "" ? 0 : int.Parse(doc.title);
                            lblSongs.Text = "1/" + m_SongsNo.ToString();
                            lblSongs.Refresh();

                            //
                            //Also attach a IDispatch handler to receive
                            //javascript events in a IE-COM way
                            doc.onclick = this;
                        }

                    }
                }

            }
            catch(Exception _e)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "Song list setection problem ";
                frm.ErrorMessage = _e.Message;
                frm.StrackTrace = _e.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
        }
Example #8
0
        private void cmdSettings_Click(object sender, C1.Win.C1Command.ClickEventArgs e)
        {
            try
            {
                frmSettings objSettings = new frmSettings();
                if (objSettings.ShowDialog() == DialogResult.OK)
                {

                }
            }
            catch(Exception _e)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "Raaga.com navigational problem ";
                frm.ErrorMessage = _e.Message;
                frm.StrackTrace = _e.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
        }
Example #9
0
 private void ctlRaagaJukebox_NewWindow2(object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow2Event e)
 {
     try
     {
         //No popup here
         e.cancel = true;
     }
     catch(Exception _e)
     {
         frmException frm = new frmException();
         frm.ExceptionDialogTitle = "Raaga.com navigational problem ";
         frm.ErrorMessage = _e.Message;
         frm.StrackTrace = _e.StackTrace;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             frm.Dispose();
             frm = null;
         }
     }
 }
Example #10
0
        private void ctlRaagaJukebox_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
        {
            try
            {
                if (e.uRL.ToString().IndexOf("playerV31/index.asp") >= 0)
                {
                    Uri PlayerUrl = new Uri(e.uRL.ToString());
                    if (PlayerUrl.Query.IndexOf("bhcp") >= 0)
                    {
                        //
                        //Go to the next track
                        //Simulate javascript::Next() API possibly exposed by
                        //the player
                        IHTMLDocument2 docPlayer = ((IHTMLDocument2)ctlRaagaJukebox.Document);

                        if (docPlayer != null)
                        {
                            this.Size = new Size(482,292);
                            this.Size = new Size(480,290);

                            //
                            //Get the first frame window
                            object oIndex = 0;
                            IHTMLWindow2 framePlayer =
                                (IHTMLWindow2)docPlayer.parentWindow.frames.item(ref oIndex);
                            if ((framePlayer != null) && (m_bToggle == true))
                            {
            #if DEBUG && TRACE_DUMP
                                using (RaagaHacker.Debug.frmDump dump = new RaagaHacker.Debug.frmDump())
                                {
                                    dump.Dump = framePlayer.document.body.parentElement.outerHTML;
                                    dump.ShowDialog();
                                }
            #endif

                                //register the above function as a RealOne control's ontitlechange
                                //listner
            //                                string sJSTitleChange = @" if (raaga_ply != null)
            //                                                            {
            //                                                                raaga_ply.attachEvent('OnTitleChange',OnTitleChange);
            //                                                            }
            //                                                            function OnTitleChange(ClipTitle)
            //                                                            {
            //                                                                document.title = ClipTitle;
            //                                                            }";
            //                                framePlayer.execScript(sJSTitleChange, "JavaScript");

                                //
                                //First audio clip is potentially a dirty add clip.
                                //So ignore it
                                //framePlayer.execScript("if (raaga_ply != null) {raaga_ply.DoNextEntry();}", "JavaScript");

                            }

                        }
                    }

                }
                else
                {
                    if ((e.uRL.ToString().IndexOf("ads1.asp") >= 0) ||
                        (e.uRL.ToString().ToLower().IndexOf("raagaads.asp") >= 0))
                    {
                        IHTMLDocument2 docPlayer = ((IHTMLDocument2)ctlRaagaJukebox.Document);

                        if (docPlayer != null)
                        {
                            this.Size = new Size(482,292);
                            this.Size = new Size(480,290);

                            //
                            //Get the first frame window
                            object oIndex = 0;
                            IHTMLWindow2 framePlayer =
                                (IHTMLWindow2)docPlayer.parentWindow.frames.item(ref oIndex);
                            if (framePlayer != null)
                            {
                                if (m_bToggle == true)
                                {
                                    //Save the frame-player
                                    m_wndPlayer = framePlayer;

            #if DEBUG && TRACE_DUMP
                                    using (RaagaHacker.Debug.frmDump dump = new RaagaHacker.Debug.frmDump())
                                    {
                                        dump.Dump = framePlayer.document.body.parentElement.outerHTML;
                                        dump.ShowDialog();
                                    }
            #endif

                                    //
                                    //First audio clip is potentially a dirty add clip.
                                    //So ignore it

                                    //register the above function as a RealOne control's ontitlechange
                                    //listner
                                    string sJSTitleChange = @"if (raaga_ply != null)
                                                            {
                                                                raaga_ply.attachEvent('OnTitleChange',OnTitleChange);
                                                            }
                                                            function OnTitleChange(ClipTitle)
                                                            {
                                                                document.title = ClipTitle;
                                                            }";
                                    framePlayer.execScript(sJSTitleChange, "JavaScript");

                                    //
                                    //The DoNextEntry() API is asynchronous - means it returns
                                    //immediately. So the call to get the current clip title
                                    //proved futile.
                                    m_bToggle = false;

                                    framePlayer.execScript("if (raaga_ply != null) {raaga_ply.DoNextEntry();}", "JavaScript");

                                }
                                else
                                {
                                    if (m_bGotSongInfo == false)
                                    {

                                    }
                                }

                            }

                        }
                    }
                    else
                    {
                        if (e.uRL.ToString().IndexOf(URLs.RAAGA_ADD_TO_PLAYLIST) >= 0)
                        {
                            this.ShowDialog();
                        }

                    }
                }
            }
            catch(Exception _e)
            {
                if (Globals.GetInstance().SuppressError == false)
                {
                    frmException frm = new frmException();
                    frm.ExceptionDialogTitle = "Raaga Jukebox Manipulation Problem ";
                    frm.ErrorMessage = _e.Message;
                    frm.StrackTrace = _e.StackTrace;
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        frm.Dispose();
                        frm = null;
                    }
                }
            }
        }
Example #11
0
        /// <summary>
        /// Gets the session ID set by the 'MyRaaga' pages
        /// </summary>
        /// <returns></returns>
        public RaagaCookies GetRaagaSessionIDCookie()
        {
            m_SessionID = "";
            try
            {
                NavigateToUrl(URLs.RAAGA_LOGIN_REFERER);

                //Wait until loading completes
                while(ctlRaagaJukebox.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
                {
                    Application.DoEvents();
                    Cursor = Cursors.WaitCursor;
                }

                if (ctlRaagaJukebox.ReadyState == SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
                {
                    Cursor = Cursors.Arrow;
                    try
                    {
                        //Get the ASP session ID(may be ASP 3.0)
                        //
                        //Get the cookie collection
                        IHTMLDocument2 doc = (IHTMLDocument2)ctlRaagaJukebox.Document;
                        string sCookie = doc.cookie;
                        if (sCookie.Trim() != "")
                        {
                            if (sCookie.IndexOf(";") >= 0)
                            {
                                string[] arr = sCookie.Split(new char[]{';'});
                                string sCookieName = "", sCookieValue = "";
                                foreach(string cookie in arr)
                                {
                                    sCookieName = cookie.Substring(0,cookie.IndexOf("="));
                                    sCookieValue = cookie.Substring(cookie.IndexOf("=") + 1);
                                    if (sCookieName.IndexOf(Signatures.RaagaASPSession) >= 0)
                                    {
                                        m_Cookies.SessionID = sCookieValue.Trim();
                                        m_Cookies.SessionIDKey = sCookieName.Trim();
                                    }
                                    if (sCookieName.Trim() == Signatures.RaagaUIDOffline)
                                    {
                                        m_Cookies.UID = sCookieValue.Trim();
                                    }
                                    if (sCookieName.Trim() == Signatures.RaagaUID)
                                    {
                                        m_Cookies.UID1 = sCookieValue.Trim();
                                    }
                                }

                            }
                            else
                            {
                                //One cookie - and that got to be ASP SESSION ID
                                m_SessionID = sCookie;
                            }
                        }

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

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

            return m_Cookies;
        }
Example #12
0
        private void DataArrived(IntPtr data, int size)
        {
            try
            {
                if (m_RecBuffer == null || m_RecBuffer.Length < size)
                    m_RecBuffer = new byte[size];

                System.Runtime.InteropServices.Marshal.Copy(data, m_RecBuffer, 0, size);

                if (m_Writer != null)
                {
                    m_Writer.Write(m_RecBuffer,0,m_RecBuffer.Length);
                }

            }
            catch(Exception _e)
            {
                Stop();

                //Handle it
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "Raaga.com navigational problem ";
                frm.ErrorMessage = _e.Message;
                frm.StrackTrace = _e.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
        }
Example #13
0
        private void ctlRaagaJukebox_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
        {
            try
            {
                if (e.uRL.ToString().IndexOf("playerV31/index.asp") >= 0)
                {
                    Uri PlayerUrl = new Uri(e.uRL.ToString());
                    if (PlayerUrl.Query.IndexOf("bhcp") >= 0)
                    {
                        //
                        //Go to the next track
                        //Simulate javascript::Next() API possibly exposed by
                        //the player
                        IHTMLDocument2 docPlayer = ((IHTMLDocument2)ctlRaagaJukebox.Document);

                        if (docPlayer != null)
                        {
                            this.Size = new Size(482,292);
                            this.Size = new Size(480,290);

                            //
                            //Get the first frame window
                            object oIndex = 0;
                            IHTMLWindow2 framePlayer =
                                (IHTMLWindow2)docPlayer.parentWindow.frames.item(ref oIndex);
                            if ((framePlayer != null) && (m_bToggle == true))
                            {
                                //
                                //First audio clip is potentially a dirty add clip.
                                //So ignore it
                                framePlayer.execScript("raaga_ply.DoNextEntry()","JavaScript");

                            }

                        }
                    }

                }
                else
                {
                    if ((e.uRL.ToString().IndexOf("ads1.asp") >= 0) ||
                        (e.uRL.ToString().ToLower().IndexOf("raagaads.asp") >= 0))
                    {
                        IHTMLDocument2 docPlayer = ((IHTMLDocument2)ctlRaagaJukebox.Document);

                        if (docPlayer != null)
                        {
                            this.Size = new Size(482,292);
                            this.Size = new Size(480,290);

                            //
                            //Get the first frame window
                            object oIndex = 0;
                            IHTMLWindow2 framePlayer =
                                (IHTMLWindow2)docPlayer.parentWindow.frames.item(ref oIndex);
                            if (framePlayer != null)
                            {
                                if (m_bToggle == true)
                                {
                                    //Save the frame-player
                                    m_wndPlayer = framePlayer;

                                    //
                                    //First audio clip is potentially a dirty add clip.
                                    //So ignore it

                                    framePlayer.execScript("raaga_ply.DoNextEntry()","JavaScript");

                                    string sJSTitleChange = "";

                                    //register the above function as a RealOne control's ontitlechange
                                    //listner
                                    sJSTitleChange += " raaga_ply.attachEvent('OnTitleChange',OnTitleChange);\n";
                                    sJSTitleChange += "function OnTitleChange(ClipTitle)\n";
                                    sJSTitleChange += "{\ndocument.title = ClipTitle;\n}\n";
                                    framePlayer.execScript(sJSTitleChange,"JavaScript");

                                    //
                                    //The DoNextEntry() API is asynchronous - means it returns
                                    //immediately. So the call to get the current clip title
                                    //proved futile.
                                    m_bToggle = false;
                                }
                                else
                                {
                                    if (m_bGotSongInfo == false)
                                    {

                                    }
                                }

                            }

                        }
                    }
                    else
                    {

                    }
                }
            }
            catch(Exception _e)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "Raaga.com navigational problem ";
                frm.ErrorMessage = _e.Message;
                frm.StrackTrace = _e.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
        }
Example #14
0
        private void cmdMyRaagaLogin_Click(object sender, C1.Win.C1Command.ClickEventArgs e)
        {
            try
            {
                //NavigateToUrl(URLs.RAAGA_LOGIN_REFERER);
                frmNewWindowJukeBox frm = new frmNewWindowJukeBox();
                frm.Visible = false;
                //m_SessionID = frm.GetRaagaSessionIDCookie();
                m_Cookies = frm.GetRaagaSessionIDCookie();
                frm.Dispose();
                frm = null;

                NavigateToUrl(Application.StartupPath + @"\HTMLPages\myraaga_Login.html");
            }
            catch(Exception _e)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "Raaga.com navigational problem ";
                frm.ErrorMessage = _e.Message;
                frm.StrackTrace = _e.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
        }
Example #15
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;
                    }
                }
            }
        }
Example #16
0
 //*********************
 //Raaga Home
 //*********************
 private void cmdRaagaHome_Click(object sender, C1.Win.C1Command.ClickEventArgs e)
 {
     try
     {
         NavigateToUrl(URLs.RAAGA_HINDI_MOVIES);
     }
     catch(Exception _e)
     {
         frmException frm = new frmException();
         frm.ExceptionDialogTitle = "Raaga.com navigational problem ";
         frm.ErrorMessage = _e.Message;
         frm.StrackTrace = _e.StackTrace;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             frm.Dispose();
             frm = null;
         }
     }
 }
Example #17
0
        private void DataArrived(IntPtr data, int size)
        {
            try
            {
                if (m_RecBuffer == null || m_RecBuffer.Length < size)
                    m_RecBuffer = new byte[size];

                System.Runtime.InteropServices.Marshal.Copy(data, m_RecBuffer, 0, size);

                if (m_Writer != null)
                {
                    m_Writer.Write(m_RecBuffer,0,m_RecBuffer.Length);
                    m_lCumulativeBytesCount += m_Writer.BytesWritten;
                }

                //If invoked syncronously, the thread-block will jeoperdize the waveIn
                //recording. So following invocation should be prohibited...
                //
                //UpdateAudioLevelUI(m_RecBuffer, size);
                //
                //Either use explicit Thread.Start() stuff or Delegate.Invoke(ThreadPool) etc.
                object[] values = new object[]{m_RecBuffer,size};
                System.Threading.ThreadPool.QueueUserWorkItem(
                    new System.Threading.WaitCallback(UpdateAudioLevelUI),values);

            }
            catch(Exception _e)
            {
                Stop();

                //Handle it
                if (Globals.GetInstance().SuppressError == false)
                {
                    frmException frm = new frmException();
                    frm.ExceptionDialogTitle = "DataArrived: Recording problem ";
                    frm.ErrorMessage = _e.Message;
                    frm.StrackTrace = _e.StackTrace;
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        frm.Dispose();
                        frm = null;
                    }
                }
            }
        }
Example #18
0
        private void ctlRaagaBrowser_BeforeNavigate2(object sender, AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2Event e)
        {
            //
            //Does songs listed in this page(Either movie / Playlist...)
            try
            {

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

            #region Old Code
            /*
            try
            {
                //

                //Someone has clicked a "submit" button in the page
                if ((e.uRL.ToString().IndexOf("secnew/authenNew.asp") >= 0) &&
                    (m_Cookies.SessionID != ""))
                {
                    //Get the Key1=Value1&Key2=Value2 like posted data string
                    string sPostedData =
                        System.Text.ASCIIEncoding.UTF8.GetString((Byte[])e.postData);

                    MessageBox.Show("Headers :" + e.headers.ToString());
                    MessageBox.Show("Cookies :" + ((IHTMLDocument2)ctlRaagaBrowser.Document).cookie);

                    //Split the posted string by "&"
                    if (sPostedData.Length > 0)
                    {
                        string[] arrPostedData = sPostedData.Split(new char[]{'&'});

                        string sLogIn =
                            arrPostedData[0].Substring(arrPostedData[0].IndexOf("=") + 1);
                        string sPassword =
                            arrPostedData[1].Substring(arrPostedData[1].IndexOf("=") + 1);

                        if ((sLogIn.Trim() != "") && (sPassword.Trim() != ""))
                        {

                            //Post the HTTP data by ourselves
                            //
                            //Use .NET smart client classes like WebRequest or WebResponse
                            //for the obvious solution
                            string sHTMLResponse =
                                Common.Utility.PostToURLAndGetResponse(
                                URLs.RAAGA_HOME + "/secnew/authenNew.asp",
                                sPostedData,
                                m_Cookies);

                            //
                            //Parse...Parse...Parse
                            //
                            //While looking for signature I found 'tHead' class
                            //in the playlists.Simple. Look fo.r <form></form> and if
                            //it has a 'tHead' in it it's playlist row
                            int iFormStartTag = -1;
                            int	iFormEndTag = -1;
                            int	iIndex = 0;
                            string sInnerFormHTML = "";
                            string sPlayListHTML = "";
                            do
                            {
                                iFormStartTag = sHTMLResponse.IndexOf(
                                    Signatures.HTMLFormTag,
                                    iIndex);

                                if (iFormStartTag >= 0)
                                {
                                    iFormEndTag = sHTMLResponse.IndexOf(
                                        Signatures.HTMLFormEndTag,
                                        iFormStartTag);
                                }

                                if ((iFormStartTag > 0) && (iFormEndTag > 0))
                                {
                                    sInnerFormHTML =
                                        sHTMLResponse.Substring(
                                        iFormStartTag,
                                        iFormEndTag - iFormStartTag);

                                    if (sInnerFormHTML.Length > 0)
                                    {
                                        //If it's the <form> block we're looking for
                                        if (sInnerFormHTML.IndexOf(
                                            Signatures.RaagaPlayList) > 0)
                                        {
                                            //Yes!!!
                                            sPlayListHTML += sInnerFormHTML;
                                            iIndex = iFormEndTag + 3;
                                        }
                                    }

                                }

                            }
                            while((iFormEndTag != -1) &&
                                (iFormEndTag != sHTMLResponse.Length));

                            //Create a tempfile and dump the HTML to it
                            FileStream fs = new FileStream(
                                Application.StartupPath + @"/HTMLPages/playlist_LIST.htm",
                                FileMode.OpenOrCreate,
                                FileAccess.ReadWrite,
                                FileShare.ReadWrite);

                            StreamReader sr = new StreamReader(fs);

                            string sNewFileContent =
                                sr.ReadToEnd().Replace(
                                "[RaagaPlayListForms]",
                                sPlayListHTML.Trim());
                            sr.Close();

                            //Write back to the HTML
                            StreamWriter sw = new StreamWriter(fs);
                            sw.Write(sNewFileContent);
                            sw.Close();

                            fs.Close();

                            //Don't let the iexplorer to post the values,We'll aqapost it later
                            e.cancel = true;

                            NavigateToUrl(
                                Application.StartupPath + @"/HTMLPages/playlist_LIST.htm");
                        }

                    }

                }
                else if (e.uRL.ToString() == URLs.RAAGA_LOGIN_REFERER)
                {
                    e.cancel = true;

                    //MessageBox.Show("Headers :" + ((IHTMLDocument2)ctlRaagaBrowser.Document).h
                    MessageBox.Show("Cookies :" + ((IHTMLDocument2)ctlRaagaBrowser.Document).cookie);

                    //Get the ASP session ID(may be ASP 3.0)
                    //
                    //Get the cookie collection
                    /*
                    IHTMLDocument2 doc = (IHTMLDocument2)ctlRaagaBrowser.Document;
                    string sCookie = doc.cookie;
                    if (sCookie.Trim() != "")
                    {
                        if (sCookie.IndexOf(";") >= 0)
                        {
                            //More than one cookie
                            m_SessionID = "";

                        }
                        else
                        {
                            //One cookie - and that got to be ASP SESSION ID
                            m_SessionID = sCookie;
                        }
                    }

                }
                else
                {
                    e.cancel = false;

                }
            }
            catch(Exception _e)
            {
                e.cancel = true;

                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "Raaga.com navigational problem ";
                frm.ErrorMessage = _e.Message;
                frm.StrackTrace = _e.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
            */
            #endregion
        }
Example #19
0
        private void Start(string FileName)
        {
            Stop();
            try
            {
                //Start WaveIn recorder
                m_Recorder =
                    new WaveLib.WaveInRecorder
                        (Globals.GetInstance().DefaultWaveInDevice, //previously : -1
                        m_Format,
                        bufferSize,
                        3,
                        new WaveLib.BufferDoneEventHandler(DataArrived));

                //Start capturing the music to a WAV stream
                Stream WaveFile =
                    new FileStream(FileName,
                                   FileMode.Create,
                                   FileAccess.Write);
                m_Writer =
                    new WaveWriter(WaveFile, m_Format);

            }
            catch(Exception _e)
            {
                Stop();

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

            }
        }
Example #20
0
        private void ctlRaagaBrowser_NewWindow2(object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow2Event e)
        {
            try
            {
                m_wndChild = new frmNewWindowJukeBox(this);
                e.ppDisp = m_wndChild.RaagaJukebox.Application;
                m_wndChild.RaagaJukebox.RegisterAsBrowser = true;
                m_wndChild.Hide();
                //frm.Show();

            }
            catch(Exception _e)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "Raaga.com navigational problem ";
                frm.ErrorMessage = _e.Message;
                frm.StrackTrace = _e.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
        }
Example #21
0
        private void c1Command2_Click(object sender, C1.Win.C1Command.ClickEventArgs e)
        {
            using (RaagaHacker.Playlists.frmPlaylists playlists = new RaagaHacker.Playlists.frmPlaylists())
            {
                if (playlists.ShowDialog() == DialogResult.OK)
                {
                    //Play selected button is clicked
                    try
                    {
                        //
                        //Now we need to move any arbitrary movie-songs page
                        NavigateToUrl(URLs.RAAGA_DUMMY_SONG_PAGE);

                        IHTMLDocument2 doc = ((IHTMLDocument2)this.ctlRaagaBrowser.Document);

                        if (doc != null)
                        {
                            //Wait until document gets loaded.
                            //
                            //For some bizzare reason following code is not working...
                            //
                            //while (doc.url.Trim().Equals(URLs.RAAGA_DUMMY_SONG_PAGE) == false)
                            //;
                            //Add a sleep
                            System.Threading.Thread.Sleep(5000);

                            //Nullify the image control
                            if (picMovie.Image != null)
                            {
                                picMovie.Image.Dispose();
                                picMovie.Image = null;
                                lblMovieName.Text = "";
                            }

                            if (playlists.SongIDs.Trim() != "")
                            {
                                //Make sure to set the number of songs to be played.
                                //Based on this, the "hidden" jukebox will dispose its resources
                                //or take other "...done" jobs.
                                if (playlists.SongIDs.IndexOf(",") == -1)
                                {
                                    this.m_SongsNo = 1;
                                }
                                else
                                {
                                    this.m_SongsNo = playlists.SongIDs.Split(",".ToCharArray()).Length;
                                }

                                //Start the "RaagaJukebox" with the song ids passed
                                doc.parentWindow.execScript(
                                        Signatures.playSelected.Replace("<<selection>>", playlists.SongIDs),
                                        "JavaScript");
                            }
                        }
                    }
                    catch (COMException _ce)
                    {
                        frmException frm = new frmException();
                        frm.ExceptionDialogTitle = "Playlist Recording Problem ";
                        frm.ErrorMessage = Marshal.GetExceptionForHR(_ce.ErrorCode).Message;
                        frm.StrackTrace = _ce.StackTrace;
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            frm.Dispose();
                            frm = null;
                        }
                    }
                    catch (Exception _e)
                    {
                        frmException frm = new frmException();
                        frm.ExceptionDialogTitle = "Playlist Recording Problem ";
                        frm.ErrorMessage = _e.Message;
                        frm.StrackTrace = _e.StackTrace;
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            frm.Dispose();
                            frm = null;
                        }
                    }

                }
            }
        }