private EventResult PlayPause()
        {
            if (_currentState != State.Playing)
            {
                return(EventResult.Complete());
            }
            initJs();

            // We have to move the cursor to show the OSD
            Cursor.Position = new System.Drawing.Point(Browser.FindForm().Location.X + 200, Browser.FindForm().Location.Y + 200);
            Application.DoEvents();
            Cursor.Position = new System.Drawing.Point(Browser.FindForm().Location.X + 300, Browser.FindForm().Location.Y + 300);
            Application.DoEvents();

            if (_paused)
            {
                InvokeScript("try { play(); } catch(e) {}");
            }
            else
            {
                InvokeScript("try { pause(); } catch(e) {}");
            }

            _paused = !_paused;
            return(EventResult.Complete());
        }
Esempio n. 2
0
        public override Entities.EventResult PerformLogin(string username, string password)
        {
            Cursor.Hide();
            Application.DoEvents();
            JObject json = JObject.Parse(System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String(password)));

            _showLoading = bool.Parse(json["showLoadingSpinner"].Value <string>());

            if (_showLoading)
            {
                ShowLoading();
            }
            _disableLogging          = bool.Parse(json["disableLogging"].Value <string>());
            _enableNetflixOsd        = bool.Parse(json["enableNetflixOsd"].Value <string>());
            _profileToken            = json["profileToken"].Value <string>();
            _password                = json["password"].Value <string>();
            _username                = username;
            _currentState            = State.Login;
            ProcessComplete.Finished = false;
            ProcessComplete.Success  = false;
            unsafe
            {
                Int32 option = INTERNET_SUPPRESS_COOKIE_PERSIST;
                InternetSetOption(IntPtr.Zero, INTERNET_OPTION_SUPPRESS_BEHAVIOR, new IntPtr(&option), sizeof(Int32));
            }

            Url = @"https://www.netflix.com/Login";
            return(EventResult.Complete());
        }
        public override Entities.EventResult PerformLogin(string username, string password)
        {
            Cursor.Hide();
            Application.DoEvents();
            JObject json = JObject.Parse(System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String(password)));

            _showLoading = bool.Parse(json["showLoadingSpinner"].Value <string>());

            if (_showLoading)
            {
                ShowLoading();
            }
            _disableLogging          = bool.Parse(json["disableLogging"].Value <string>());
            _enableNetflixOsd        = bool.Parse(json["enableNetflixOsd"].Value <string>());
            _profileUrl              = json["switchUrl"].Value <string>();
            _profileIndex            = int.Parse(json["profileIndex"].Value <string>());
            _use2200Mode             = bool.Parse(json["use2200Mode"].Value <string>());
            _password                = json["password"].Value <string>();
            _username                = username;
            _currentState            = State.Login;
            ProcessComplete.Finished = false;
            ProcessComplete.Success  = false;
            if (!_disableLogging)
            {
                MessageHandler.Info("_useCompatibilityMode: {0}", _use2200Mode);
            }
            Url = @"https://www.netflix.com/Login";
            return(EventResult.Complete());
        }
Esempio n. 4
0
        public override Entities.EventResult PerformLogin(string username, string password)
        {
            _rememberLogin    = username.Contains("REMEMBERLOGIN");
            username          = username.Replace("REMEMBERLOGIN", string.Empty);
            _disableLogging   = username.Contains("DISABLELOGGING");
            username          = username.Replace("DISABLELOGGING", string.Empty);
            _showLoading      = username.Contains("SHOWLOADING");
            username          = username.Replace("SHOWLOADING", string.Empty);
            _enableNetflixOsd = username.Contains("ENABLENETFLIXOSD");
            username          = username.Replace("ENABLENETFLIXOSD", string.Empty);

            if (_showLoading)
            {
                ShowLoading();
            }
            string[] userProfile = username.Split('¥');
            _username                = userProfile[0];
            _profile                 = userProfile[1];
            _password                = password;
            _currentState            = State.Login;
            ProcessComplete.Finished = false;
            ProcessComplete.Success  = false;
            Url = @"https://www.netflix.com/Login";
            return(EventResult.Complete());
        }
        public override Entities.EventResult BrowserDocumentComplete()
        {
            if (!_connectorSettings.disableLogging)
            {
                MessageHandler.Info("Netflix. Url: {0}, State: {1}", Url, _currentState.ToString());
            }
            switch (_currentState)
            {
            case State.Login:
            {
                if (Url.ToLowerInvariant().Contains("/browse") && !_connectorSettings.enableIEDebug)
                {
                    _currentState = State.None;
                    return(EventResult.Error("ignore this"));
                }
                break;
            }

            case State.Playing:
            {
                if (_connectorSettings.showLoadingSpinner)
                {
                    HideLoading();
                }
                ProcessComplete.Finished = true;
                ProcessComplete.Success  = true;
                break;
            }
            }
            return(EventResult.Complete());
        }
Esempio n. 6
0
        public override EventResult PerformLogin(string username, string password)
        {
            Cursor.Hide();
            Application.DoEvents();
            showLoading = username.Contains("SHOWLOADING");
            username    = username.Replace("SHOWLOADING", string.Empty);
            isPremium   = username.Contains("PREMIUM");
            username    = username.Replace("PREMIUM", string.Empty);
            string[] userStrings = username.Split('¥');
            username = userStrings[0];
            string videoId = userStrings[1];

            if (showLoading)
            {
                ShowLoading();
            }
            this.username = username;
            this.password = password;
            if (!HaveCredentials)
            {
                ProcessComplete.Finished = true;
                ProcessComplete.Success  = false;
                return(EventResult.Error("No login credantials"));
            }
            Url = string.Format(loginUrl, videoId);
            ProcessComplete.Finished = false;
            ProcessComplete.Success  = false;
            return(EventResult.Complete());
        }
        public override EventResult BrowserDocumentComplete()
        {
            MessageHandler.Info("Url: {0}, login: {1}, clicked: {2}, maximized: {3}", Url, login.ToString(), clicked.ToString(), maximized.ToString());
            if (login)
            {
                if (Url == "about:blank")
                {
                    login = false;
                    ProcessComplete.Finished = true;
                    ProcessComplete.Success = true;

                }
                else if (clicked && Url != loginUrl)
                {
                    login = false;
                    ProcessComplete.Finished = true;
                    ProcessComplete.Success = true;
                }
                else
                {
                    InvokeScript("document.getElementById('login-email').value = '" + username + "';");
                    InvokeScript("document.getElementById('login-password').value = '" + password + "';");
                    InvokeScript("document.getElementById('remember-me-checkbox').checked = false;");
                    InvokeScript("setTimeout(\"document.getElementsByClassName('button-submit')[0].click()\", 2000);");
                    clicked = true;
                }
            }
            else
            {
                InvokeScript("setTimeout(\"document.getElementsByClassName('play-button')[0].click()\", 2000);");
                System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
                timer.Tick += (object sender, EventArgs e) =>
                {
                    if (_showLoading) HideLoading();
                    if (!maximized)
                    {
                        maximized = true;
                        //Workaround for keeping maximized flashplayer on top
                        Browser.FindForm().Activated += FormActivated;
                        Cursor.Position = new System.Drawing.Point(Browser.FindForm().Location.X + 20, Browser.Location.Y + 200);
                        Application.DoEvents();
                        Thread.Sleep(1000);
                        //Click only once
                        CursorHelper.DoLeftMouseClick();
                        Application.DoEvents();
                        Thread.Sleep(500);
                    }
                    System.Windows.Forms.SendKeys.Send("f");
                    timer.Stop();
                    timer.Dispose();
                };

                timer.Interval = 4500;
                timer.Start();
                ProcessComplete.Finished = true;
                ProcessComplete.Success = true;

            }
            return EventResult.Complete();
        }
 public override EventResult PlayVideo(string videoToPlay)
 {
     Url = videoToPlay;
     ProcessComplete.Finished = false;
     ProcessComplete.Success = false;
     return EventResult.Complete();
 }
Esempio n. 9
0
        public override Entities.EventResult BrowserDocumentComplete()
        {
            MessageHandler.Debug("BrowserDocumentComplete");
            switch (_currentState)
            {
            case State.Login:
                _currentState = State.ReadyToPlay;
                break;

            case State.ReadyToPlay:
                ProcessComplete.Finished = true;
                ProcessComplete.Success  = true;
                break;

            case State.Playing:
                _currentState            = State.Playing;
                ProcessComplete.Finished = true;
                ProcessComplete.Success  = true;
                string jsCode = "var preparePlayer = function(){$('#zone-top, .player-overlay, .live-info-panel, .channel-list, .orange-deco').remove();" +
                                "$('#zone-content').css('margin-top', 0).css('max-width', '100%');" +
                                "$('.playerplugin object').css('height', " + _alturaVideo + ");}; setTimeout(preparePlayer, " + _scriptDelayTime + ");";
                InvokeScript(jsCode);
                MessageHandler.Debug("Ejecuto script");
                break;
            }
            return(EventResult.Complete());
        }
        public override Entities.EventResult PerformLogin(string username, string password)
        {
            _connectorSettings = JsonConvert.DeserializeObject <ConnectorSettings>(System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String(password)));

            if (username == "GET")
            {
                Application.DoEvents();
                _currentState            = State.Login;
                ProcessComplete.Finished = false;
                ProcessComplete.Success  = false;
                Url = @"https://www.netflix.com/Login";
                RemoveEvent();
                Browser.PreviewKeyDown += Browser_PreviewKeyDown;
            }
            else
            {
                if (_connectorSettings.showLoadingSpinner)
                {
                    ShowLoading();
                }
                ProcessComplete.Finished = true;
                ProcessComplete.Success  = true;
                _currentState            = State.ReadyToPlay;
            }
            return(EventResult.Complete());
        }
Esempio n. 11
0
 /// <summary>
 /// Play the video from the start
 /// </summary>
 /// <param name="videoToPlay"></param>
 /// <returns></returns>
 public override EventResult PlayVideo(string videoToPlay)
 {
     ProcessComplete.Finished = false;
     ProcessComplete.Success  = false;
     _currentState            = State.PlayPage;
     Url = Properties.Resources.SkyGo_VideoPlayUrl(videoToPlay);
     return(EventResult.Complete());
 }
 public EventResult PlayPause()
 {
     if (maximized)
     {
         System.Windows.Forms.SendKeys.Send(" ");
     }
     return EventResult.Complete();
 }
Esempio n. 13
0
 public override Entities.EventResult PlayVideo(string videoToPlay)
 {
     ProcessComplete.Finished = false;
     ProcessComplete.Success  = false;
     Url           = videoToPlay;
     _currentState = State.Playing;
     return(EventResult.Complete());
 }
Esempio n. 14
0
 /// <summary>
 /// Play the specified video - try and keep the loading screen showing for as long as possible
 /// </summary>
 /// <param name="videoToPlay"></param>
 /// <returns></returns>
 public override EventResult PlayVideo(string videoToPlay)
 {
     ShowLoading();
     Browser.ScrollBarsEnabled = false;
     _currentState             = State.PlayPage;
     ProcessComplete.Finished  = false;
     ProcessComplete.Success   = false;
     Url = Properties.Resources.AmazonMovieUrl(videoToPlay);
     return(EventResult.Complete());
 }
Esempio n. 15
0
 /// <summary>
 /// Perform a log in to the 4OD site
 /// </summary>
 /// <param name="username"></param>
 /// <param name="password"></param>
 /// <returns></returns>
 protected override EventResult PerformActualLogin(string username, string password)
 {
     _username                = username;
     _password                = password;
     _currentState            = State.LoggingIn;
     ProcessComplete.Finished = false;
     ProcessComplete.Success  = false;
     Url = Properties.Resources._4OD_LoginUrl;
     return(EventResult.Complete());
 }
 public override EventResult PlayVideo(string videoToPlay)
 {
     string[] parts = videoToPlay.Split('|');
     bool.TryParse(parts[1], out _removeFormWatchlist);
     Url = parts[0];
     ProcessComplete.Finished = false;
     ProcessComplete.Success  = false;
     _currentState            = State.Start;
     return(EventResult.Complete());
 }
Esempio n. 17
0
        public override EventResult BrowserDocumentComplete()
        {
            Cursor.Hide();
            Application.DoEvents();
            Click();

            ProcessComplete.Finished = true;
            ProcessComplete.Success  = true;
            return(EventResult.Complete());
        }
Esempio n. 18
0
 public override Entities.EventResult PlayVideo(string videoToPlay)
 {
     if (showLoading)
     {
         ShowLoading();
     }
     Url = videoToPlay;
     ProcessComplete.Finished = false;
     ProcessComplete.Success  = false;
     return(EventResult.Complete());
 }
Esempio n. 19
0
 public override Entities.EventResult PerformLogin(string username, string password)
 {
     MessageHandler.Debug("PerformLogin");
     _currentState            = State.Login;
     _alturaVideo             = username;
     _scriptDelayTime         = password;
     ProcessComplete.Finished = false;
     ProcessComplete.Success  = false;
     Url = @"https://orangetv.orange.es";///atv/api/authenticate?appId=es.orange.pc&appVersion=1.0&deviceIdentifier=036f4b3c-599d-4773-bbe3-537ee0c4202e&username=930042856&password=temppass";
     return(EventResult.Complete());
 }
 public override EventResult PerformLogin(string username, string password)
 {
     ShowLoading();
     _password                = password;
     _username                = username;
     _currentState            = State.Login;
     Url                      = LoginUrl;
     ProcessComplete.Finished = false;
     ProcessComplete.Success  = false;
     return(EventResult.Complete());
 }
        public override EventResult BrowserDocumentComplete()
        {
            switch (_currentState)
            {
            case State.Login:
                if (Url == _redirectUrl)
                {
                    ProcessComplete.Finished = true;
                    ProcessComplete.Success  = true;
                    _currentState            = State.None;
                }
                else if (Url.ToLower().Contains("/account"))
                {
                    InvokeScript(Properties.Resources.HboNordicJs + "setTimeout(\"__login('" + _username + "','" + _password + "','" + _redirectUrl + "' )\", 1000); ");
                }
                break;

            case State.Start:
                if (Url.Contains("/watchlist"))
                {
                    InvokeScript(Properties.Resources.HboNordicJs + "setTimeout(\"__startWatch()\", 1000);");
                    if (_removeFormWatchlist)
                    {
                        InvokeScript("setTimeout(\"__removeFromWatchlist()\", 2000);");
                    }
                    _currentState = State.HideSpinner;
                }
                break;

            case State.HideSpinner:
                ProcessComplete.Finished = true;
                ProcessComplete.Success  = true;
                _currentState            = State.Playing;
                System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
                timer.Tick += (object sender, EventArgs e) =>
                {
                    HideLoading();
                    timer.Stop();
                    timer.Dispose();
                };
                timer.Interval = 1500;
                timer.Start();
                break;

            case State.Playing:
                ProcessComplete.Finished = true;
                ProcessComplete.Success  = true;
                break;

            default:
                break;
            }
            return(EventResult.Complete());
        }
Esempio n. 22
0
 /// <summary>
 /// Play button has been pressed
 /// </summary>
 /// <returns></returns>
 public override EventResult Play()
 {
     // Make sure we've paused before playing
     if (!_lastButtonPause)
     {
         return(EventResult.Complete());
     }
     _lastButtonPause = false;
     InvokeScript("C4.Video.Controller.unstall()");
     return(EventResult.Complete());
 }
        public override EventResult PlayVideo(string videoToPlay)
        {
            MessageHandler.Info("videoToPlay: {0}", videoToPlay);
            ProcessComplete.Finished = false;
            ProcessComplete.Success  = false;
            _currentState            = State.StartPlaying;
            Uri uri = new Uri(BaseUrl + videoToPlay);

            Url = uri.GetLeftPart(UriPartial.Path);
            return(EventResult.Complete());
        }
Esempio n. 24
0
 private EventResult PlayPause()
 {
     if (_currentState != State.Playing || _isPlayingOrPausing || Browser.Document == null || Browser.Document.Body == null)
     {
         return(EventResult.Complete());
     }
     _isPlayingOrPausing = true;
     SendKeyToBrowser(" ");
     _isPlayingOrPausing = false;
     return(EventResult.Complete());
 }
Esempio n. 25
0
        /// <summary>
        /// Pause button has been pressed
        /// </summary>
        /// <returns></returns>
        public override EventResult Pause()
        {
            // Try and prevent multiple stall requests as it'll kill the player
            if (_lastButtonPause)
            {
                return(EventResult.Complete());
            }
            _lastButtonPause = true;

            InvokeScript("C4.Video.Controller.stall()");
            return(EventResult.Complete());
        }
Esempio n. 26
0
 public override Entities.EventResult PerformLogin(string username, string password)
 {
     showLoading = username.Contains("SHOWLOADING");
     if (showLoading)
     {
         ShowLoading();
     }
     Url = "about:blank";
     ProcessComplete.Finished = false;
     ProcessComplete.Success  = false;
     return(EventResult.Complete());
 }
Esempio n. 27
0
 private Entities.EventResult PlayPause()
 {
     if (isPausing)
     {
         InvokeScriptAndMoveCursor("myPlay();");
     }
     else
     {
         InvokeScriptAndMoveCursor("myPause();");
     }
     isPausing = !isPausing;
     return(EventResult.Complete());
 }
        /// <summary>
        /// Find the play/pause button and click it
        /// </summary>
        /// <returns></returns>
        private EventResult DoPlayOrPause()
        {
            if (DateTime.Now < _lastPlayClick.AddMilliseconds(500))
            {
                return(EventResult.Complete());
            }

            TemporaryCursorHelper.MoveMouseTo(Browser.FindForm().Left + (Browser.FindForm().Width / 2) + 50, Browser.FindForm().Top + (Browser.FindForm().Height / 2));
            TemporaryCursorHelper.DoLeftMouseClick();
            TemporaryCursorHelper.MoveMouseTo(0, 0);
            _lastPlayClick = DateTime.Now;
            return(EventResult.Complete());
        }
Esempio n. 29
0
        /// <summary>
        /// Find the play/pause button and click it
        /// </summary>
        /// <returns></returns>
        private EventResult DoPlayOrPause()
        {
            if (_isPlayOrPausing || Browser.Document == null || Browser.Document.Body == null)
            {
                return(EventResult.Complete());
            }

            _isPlayOrPausing = true;

            SendKeyToControl(" ");

            _isPlayOrPausing = false;
            return(EventResult.Complete());
        }
 public override EventResult PerformLogin(string username, string password)
 {
     ShowLoading();
     string[] parts = username.Split('|');
     _password                = password;
     _username                = parts[0];
     _redirectUrl             = "about:blank";
     _loginUrl                = parts[1];
     Url                      = _loginUrl;
     _currentState            = State.Login;
     ProcessComplete.Finished = false;
     ProcessComplete.Success  = false;
     return(EventResult.Complete());
 }