Site Configuration Questions - Preferences, URLs, & Javascript

I’m editing a site configuration file for a plugin that requires the user to login in order to access certain videos. On the Python side, everything is working correctly. On the webkit / site configuration side, i’m not having much luck. I’m having trouble getting Plex to recognize when a certain element is no longer present so that it will go to the “playing” state. I’ve tried all kinds of things, but so far have been running into a brick wall. Any help would be greatly appreciated.



My issues is that i’m stuck in a loop where plex continues to send the user back to the login state even when the new page doesn’t have the “new_pw” element. Because of this Plex gets stuck in an infinite loop. It seems like the site configuration and/or plex always sees the “new_pw” element as present even when on a page where it is not. I have double/triple verified that the page the login state visits is free of this “new_pw” element.



Here is the site config. (Cleaned up a bit for simplicity)



<site site="http://www.crunchyroll.com/swf/.*qual=720" <br />
plugin="http://www.crunchyroll.com/swf/vidplayer.swf.*"<br />
identifier="com.plexapp.plugins.CrunchyRoll"<br />
initialState="wait-for-frame-load" version="2.0"<br />
manualLock="true"<br />
windowHeight="752" <br />
windowWidth="1280"><br />
<br />
    <crop x="0" y="0" width="0" height="-32"/><br />
<br />
    <seekbar type="thumb"><br />
	<start x="82" y="-15"/> <!-- x would be 48 if next episode button weren't there. --><br />
	<end x="1020" y="-15"/><br />
	<played><br />
		<color rgb="ffffff"/><br />
	</played><br />
    </seekbar><br />
<br />
    <condition name="need-to-login"><br />
	<and><br />
            <javascript script="login = document.getElementById('new_pw') == 'none' ? 0 : 1" matches="1" /><br />
	</and><br />
    </condition><br />
		<br />
    <state name="wait-for-frame-load"><br />
        <event><br />
            <condition><br />
                <frameLoaded /><br />
            </condition><br />
            <action><br />
                <visit url="https://www.crunchyroll.com/acct/?action=status" /><br />
                <pause time="5000" /><br />
		<goto state="check-for-auth" /><br />
            </action><br />
        </event><br />
    </state><br />
<br />
    <state name="check-for-auth"><br />
        <event><br />
            <condition><br />
                <not> <condition name="need-to-login" /> </not><br />
            </condition><br />
            <action><br />
		<visit url="${url}" /><br />
		<lockPlugin/><br />
    		<goto state="playing" /><br />
            </action><br />
        </event> <br />
	<event><br />
            <condition><br />
                <condition name="need-to-login" /><br />
            </condition><br />
            <action><br />
		<goto state="login" /><br />
            </action><br />
        </event>		<br />
    </state><br />
<br />
    <state name="login"><br />
        <event><br />
            <condition><br />
                <javascript script="true ? 1 : 0" matches="1" /><br />
            </condition><br />
            <action><br />
		<run script="document.getElementById('RpcApiUser_Login').name.value='${username}';document.getElementById('RpcApiUser_Login').password.value='${password}';document.getElementById('RpcApiUser_Login').submit();" /><br />
		<pause time="1000" /><br />
		<goto state="check-for-auth-again" /><br />
            </action><br />
        </event><br />
    </state><br />
	<br />
    <state name="check-for-auth-again"><br />
	<event><br />
            <condition><br />
                <not> <condition name="need-to-login" /> </not><br />
            </condition><br />
            <action><br />
		<visit url="${url}" /><br />
		<lockPlugin/><br />
    		<goto state="playing" /><br />
            </action><br />
        </event> <br />
	<event><br />
            <condition><br />
                <condition name="need-to-login" /><br />
            </condition><br />
            <action><br />
		<goto state="end" param="Please check your username and password in the plugin's settings" /><br />
            </action><br />
        </event> <br />
    </state><br />
	<br />
    <state name="playing"><br />
	........<br />
    </state><br />
</site>



Any help would be greatly appriciated.

I’m also struggling with frame size. When the above site configuration first runs, it sets the webkit window to be 1280 x 752. (The way it should be.) However, when the site configuration wells webkit to browse to the login page, it resizes the webkit window down to 1024 x 768. And from that point forward the frame remains 1024 x 768. Even when i hard code the site configuration to bypass the auth checks so that it just goes straight to “playing” state, the frame remains 1024 x 768. Take a look at these excerpts from the Plex Media Server Log:



<br />
Jan 21, 2013 18:12:12:677 [0220] DEBUG - WK_BrowseToURL http://www.crunchyroll.com/swf/vidplayer.swf?config_url=http%3A%2F%2Fwww.crunchyroll.com%2Fxml%2F%3Freq%3DRpcApiVideoPlayer_GetStandardConfig%26media_id%3D612263%26video_format%3D0%26video_quality%3D0%26auto_play%3D1%26click_through%3D1&__qual=720<br />
Jan 21, 2013 18:12:12:678 [3484] DEBUG - Resizing WebKit window to be 1280 x 752<br />
Jan 21, 2013 18:12:12:678 [0220] DEBUG - Setting low latency option for two-way stream.<br />
Jan 21, 2013 18:12:12:679 [0220] DEBUG - Beginning read from two-way stream.<br />
Jan 21, 2013 18:12:12:679 [5328] DEBUG - WebKit: Sending line: HELLO<br />
Jan 21, 2013 18:12:12:680 [3484] DEBUG - WebKit successfully loaded http://www.crunchyroll.com/swf/vidplayer.swf?config_url=http%3A%2F%2Fwww.crunchyroll.com%2Fxml%2F%3Freq%3DRpcApiVideoPlayer_GetStandardConfig%26media_id%3D612263%26video_format%3D0%26video_quality%3D0%26auto_play%3D1%26click_through%3D1&__qual=720<br />
Jan 21, 2013 18:12:12:765 [1604] DEBUG - Request: GET / [127.0.0.1:57460] (2 live)<br />
Jan 21, 2013 18:12:12:766 [1604] DEBUG - It took 0.000000 sec to serialize a list with 9 elements.<br />
Jan 21, 2013 18:12:13:035 [3484] DEBUG - Plugin loaded (application/x-shockwave-flash, http://www.crunchyroll.com/swf/vidplayer.swf?config_url=http%3A%2F%2Fwww.crunchyroll.com%2Fxml%2F%3Freq%3DRpcApiVideoPlayer_GetStandardConfig%26media_id%3D612263%26video_format%3D0%26video_quality%3D0%26auto_play%3D1%26click_through%3D1&__qual=720, 7EF20ED0, 0, 0, 1280, 752, )<br />
Jan 21, 2013 18:12:13:387 [3484] DEBUG - WebKit: Frame was loaded, processing event.<br />
Jan 21, 2013 18:12:13:387 [3484] DEBUG - WebKit: Executing Visiting https://www.crunchyroll.com/acct/?action=status.<br />
Jan 21, 2013 18:12:13:387 [3484] DEBUG - Browsing to URL: https://www.crunchyroll.com/acct/?action=status<br />
Jan 21, 2013 18:12:13:387 [3484] DEBUG - WK_BrowseToURL https://www.crunchyroll.com/acct/?action=status<br />
Jan 21, 2013 18:12:13:387 [3484] DEBUG - WebKit: Stopping execution, waiting for state 1.<br />
Jan 21, 2013 18:12:13:387 [3484] DEBUG - WebKit: Saving pendingContext: 03CF5B08 pendingEvent: 03D1CE88 in state wait-for-frame-load.<br />
Jan 21, 2013 18:12:13:435 [3484] DEBUG - Resizing WebKit window to be 1024 x 768<br />
Jan 21, 2013 18:12:13:437 [3484] DEBUG - WebKit: Plug-in changed frame size to 1024 x 768<br />
Jan 21, 2013 18:12:13:442 [3484] DEBUG - WebKit successfully loaded https://www.crunchyroll.com/acct/?action=status<br />
Jan 21, 2013 18:12:13:480 [3484] DEBUG - WebKit: Executing Pausing 5000ms.<br />
<----A bit later after the login process----><br />
Jan 21, 2013 18:12:22:444 [3484] DEBUG - WebKit: Executing Visiting ${url}.<br />
Jan 21, 2013 18:12:22:444 [3484] DEBUG - Browsing to URL: http://www.crunchyroll.com/swf/vidplayer.swf?config_url=http%3A%2F%2Fwww.crunchyroll.com%2Fxml%2F%3Freq%3DRpcApiVideoPlayer_GetStandardConfig%26media_id%3D612263%26video_format%3D0%26video_quality%3D0%26auto_play%3D1%26click_through%3D1&__qual=720<br />
Jan 21, 2013 18:12:22:444 [3484] DEBUG - WK_BrowseToURL http://www.crunchyroll.com/swf/vidplayer.swf?config_url=http%3A%2F%2Fwww.crunchyroll.com%2Fxml%2F%3Freq%3DRpcApiVideoPlayer_GetStandardConfig%26media_id%3D612263%26video_format%3D0%26video_quality%3D0%26auto_play%3D1%26click_through%3D1&__qual=720<br />
Jan 21, 2013 18:12:22:444 [3484] DEBUG - WebKit: Stopping execution, waiting for state 1.<br />
Jan 21, 2013 18:12:22:444 [3484] DEBUG - WebKit: Saving pendingContext: 03D0F710 pendingEvent: 03D1C8E8 in state check-for-auth-again.<br />
Jan 21, 2013 18:12:22:454 [3484] DEBUG - WebKit successfully loaded http://www.crunchyroll.com/swf/vidplayer.swf?config_url=http%3A%2F%2Fwww.crunchyroll.com%2Fxml%2F%3Freq%3DRpcApiVideoPlayer_GetStandardConfig%26media_id%3D612263%26video_format%3D0%26video_quality%3D0%26auto_play%3D1%26click_through%3D1&__qual=720<br />
Jan 21, 2013 18:12:22:770 [4368] DEBUG - Request: GET / [127.0.0.1:57491] (2 live)<br />
Jan 21, 2013 18:12:22:771 [4368] DEBUG - It took 0.000000 sec to serialize a list with 9 elements.<br />
Jan 21, 2013 18:12:22:809 [3484] DEBUG - Plugin loaded (application/x-shockwave-flash, http://www.crunchyroll.com/swf/vidplayer.swf?config_url=http%3A%2F%2Fwww.crunchyroll.com%2Fxml%2F%3Freq%3DRpcApiVideoPlayer_GetStandardConfig%26media_id%3D612263%26video_format%3D0%26video_quality%3D0%26auto_play%3D1%26click_through%3D1&__qual=720, 7E92B560, 0, 0, 1024, 768, )<br />
Jan 21, 2013 18:12:23:211 [3484] DEBUG - WebKit: Frame was loaded, processing event.<br />
Jan 21, 2013 18:12:23:211 [3484] DEBUG - WebKit: Executing Performing plug-in lock.<br />
Jan 21, 2013 18:12:23:211 [3484] DEBUG - Sending 1 plug-ins.<br />
Jan 21, 2013 18:12:23:211 [3484] DEBUG - WebKit: 7E92B560 Plugin loaded [crunchyroll.com/swf/vidplayer.swf?config_url=http%3A%2F%2Fwww.crunchyroll.com%2Fxml%2F%3Freq%3DRpcApiVideoPlayer_GetStandardConfig%26media_id%3D612263%26video_format%3D0%26video_quality%3D0%26auto_play%3D1%26click_through%3D1&__qual=720] (0 0 1024 768 )<br />
Jan 21, 2013 18:12:23:211 [3484] DEBUG - WebKit: Executing Moving to state playing.<br />
Jan 21, 2013 18:12:23:263 [3484] DEBUG - WebKit: Initializing shared memory 1024 x 736<br />




As you can see, for whatever reason, after the site config tells webkit to return to ${url} it loads it up as 1024x768.

Any ideas?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.