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.