home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
OnlineVideos
Help needed develpoing BrowserSiteUtil
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Ministerk" data-source="post: 1170243" data-attributes="member: 61145"><p>Some quick answers (a lot of trail and error has be put into this...)</p><p></p><p></p><p>The easy part first...</p><p>Log: Use MessageHandler from BrowserUtilConnector class to log but you also have to configure the browser player to write to log. Do this by changing <strong>OnlineVideos.WebAutomation.BrowserHost.exe.config</strong> file (found in [MP-INSTALL-PATH]l\plugins\Windows\OnlineVideos) Change the <strong>WriteDebugLog</strong> value to <strong>true. </strong>This will change every time you compile the Mediaportal1 project (or OnlineVideos.WebAutomation.BrowserHost). So edit the App.config in OnlineVideos.WebAutomation.BrowserHost instead and rebuild.</p><p></p><p>You can debug the connector by attaching to the OnlineVideos.WebAutomation.BrowserHost.exe Process. But you have to be fast... Or delaying the process by</p><p>[code]</p><p>//in BrowserDocumentComplete</p><p>Thread.Sleep(5000);</p><p>//Or maybe some thread blocking js:</p><p>InvokeScript("alert('debug please...');");</p><p>[/code]</p><p>Place your breakpoint after the thread delay.</p><p></p><p></p><p>This is a good question... I don't use this fully with the different statuses and returns.</p><p>I always use</p><p>[code]ProcessComplete.Finished = true;</p><p>ProcessComplete.Success = true;</p><p>return EventResult.Complete();[/code]</p><p>when a "phase" in the automation is done;</p><p></p><p>There're two phases in the automation Login phase and the "trying to play the video" phase</p><p></p><p>First you start the login phase in the <strong>PerformLogin</strong> method, you're in this phase until you do the above ProcessComplete.Finished and so on...</p><p>Then the Second phase starts in the <strong>PlayVideo</strong> method.</p><p></p><p>The <strong>BrowserDocumentComplete</strong> is called on every "document ready" event (when the page redirected to or browsed to by setting a new value to the <strong>Url</strong> property is ready/completely loded).</p><p></p><p>The most tricky part is to automate stuff when the site uses a lot of ajax and everything is async. When is the login process finished? How can I know where I'm in the automation process?</p><p></p><p>I have made some <strong>important methods and properties bold.</strong></p><p><strong></strong></p><p>Other methods:</p><p>Pause() - What to do OnPause...</p><p>Play() - What to do OnPlay (play button pressed while the video already is playing)</p><p>OnAction - other keyboard or remote events.</p><p></p><p>What you are trying to achieve is some kind of deterministic automation... To do this I try to do some kind of simple state machine and to do this I often define an "state enum" to keep track on where I am and what "transition" to do next.</p><p></p><p></p><p>Back to</p><p>[code]ProcessComplete.Finished = true;</p><p>ProcessComplete.Success = true;</p><p>return EventResult.Complete();[/code]</p><p></p><p>If ProcessComplete.Success = false; this could signal that something went wrong (e.g. the login) and the browser could exit with an error. [USER=139416]@Jason Pyke[/USER] could maybe describe how this should/could be used...</p><p><strong><span style="color: #ff4d4d"></span></strong></p><p><strong><span style="color: #ff4d4d">I did NOT proof read this</span></strong></p><p><strong><span style="color: #ff4d4d"></span></strong></p><p>Edit: I wrote this related post yesterday: <a href="https://forum.team-mediaportal.com/posts/1170065/" target="_blank">Swedish sites: SVT, TV4 Premium, UR, TV3, TV6, TV8, TV10, Kanal 5, 9 and 11 + Movie & Series sites</a></p><p></p><p></p><p>EDIT AGAIN:</p><p>And set a longer timeout in OnlineVideos.WebAutomation.BrowserHost.exe.config or App.config when debugging.</p></blockquote><p></p>
[QUOTE="Ministerk, post: 1170243, member: 61145"] Some quick answers (a lot of trail and error has be put into this...) The easy part first... Log: Use MessageHandler from BrowserUtilConnector class to log but you also have to configure the browser player to write to log. Do this by changing [B]OnlineVideos.WebAutomation.BrowserHost.exe.config[/B] file (found in [MP-INSTALL-PATH]l\plugins\Windows\OnlineVideos) Change the [B]WriteDebugLog[/B] value to [B]true. [/B]This will change every time you compile the Mediaportal1 project (or OnlineVideos.WebAutomation.BrowserHost). So edit the App.config in OnlineVideos.WebAutomation.BrowserHost instead and rebuild. You can debug the connector by attaching to the OnlineVideos.WebAutomation.BrowserHost.exe Process. But you have to be fast... Or delaying the process by [code] //in BrowserDocumentComplete Thread.Sleep(5000); //Or maybe some thread blocking js: InvokeScript("alert('debug please...');"); [/code] Place your breakpoint after the thread delay. This is a good question... I don't use this fully with the different statuses and returns. I always use [code]ProcessComplete.Finished = true; ProcessComplete.Success = true; return EventResult.Complete();[/code] when a "phase" in the automation is done; There're two phases in the automation Login phase and the "trying to play the video" phase First you start the login phase in the [B]PerformLogin[/B] method, you're in this phase until you do the above ProcessComplete.Finished and so on... Then the Second phase starts in the [B]PlayVideo[/B] method. The [B]BrowserDocumentComplete[/B] is called on every "document ready" event (when the page redirected to or browsed to by setting a new value to the [B]Url[/B] property is ready/completely loded). The most tricky part is to automate stuff when the site uses a lot of ajax and everything is async. When is the login process finished? How can I know where I'm in the automation process? I have made some [B]important methods and properties bold. [/B] Other methods: Pause() - What to do OnPause... Play() - What to do OnPlay (play button pressed while the video already is playing) OnAction - other keyboard or remote events. What you are trying to achieve is some kind of deterministic automation... To do this I try to do some kind of simple state machine and to do this I often define an "state enum" to keep track on where I am and what "transition" to do next. Back to [code]ProcessComplete.Finished = true; ProcessComplete.Success = true; return EventResult.Complete();[/code] If ProcessComplete.Success = false; this could signal that something went wrong (e.g. the login) and the browser could exit with an error. [USER=139416]@Jason Pyke[/USER] could maybe describe how this should/could be used... [B][COLOR=#ff4d4d] I did NOT proof read this [/COLOR][/B] Edit: I wrote this related post yesterday: [URL='https://forum.team-mediaportal.com/posts/1170065/']Swedish sites: SVT, TV4 Premium, UR, TV3, TV6, TV8, TV10, Kanal 5, 9 and 11 + Movie & Series sites[/URL] EDIT AGAIN: And set a longer timeout in OnlineVideos.WebAutomation.BrowserHost.exe.config or App.config when debugging. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
OnlineVideos
Help needed develpoing BrowserSiteUtil
Contact us
RSS
Top
Bottom