Problems writing Amazon VOD Site Configuration

I’ve been trying over the last couple of days to create a site configuration for Amazon’s video-on-demand service in order to play prime videos. I keep running into an annoying issue however, where the media server just crashes once it visits an Amazon page logged in or a page that allows one to login (I managed to get logged in by using the mobile website).



This problem can be illustrated by using a strm file with the following in it (Note it isn’t actually a link to a video file, its just a login page):



<br />
plex://localhost/video/:/webkit?url=http://www.amazon.com/gp/flex/sign-out.html<br />





Here is a basic site config that allows one to try to load that strm file and shows it crash; note this will not do anything to actually login or play, it is just a bare minimum to show the crash. I've played around with the regular expressions quite a bit (though I must admit I don't know what I am doing...) and none of that helps.


<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<site  site="http://www.amazon.com"<br />
       plugin="http://ecx.images-amazon.com/images/G/.*\.swf"<br />
       initialState="playing"<br />
       version="1.0"><br />
 <!-- PLAYING --><br />
 <state name="playing"><br />
  <event><br />
   <condition><br />
    <frameLoaded /><br />
   </condition><br />
   <action><br />
    <click x="15" y="304" /><br />
    <goto state="paused" /><br />
   </action><br />
  </event><br />
 </state><br />
 <!-- PAUSED --><br />
 <state name="paused"><br />
  <event><br />
   <condition><br />
    <command name="play" /><br />
   </condition><br />
   <action><br />
    <click x="15" y="304" /><br />
    <goto state="playing" /><br />
   </action><br />
  </event><br />
 </state><br />
</site><br />




Now what happens in both the beta server 0.9.6.0 and the stable branch logs when run:


<br />
 Saturday, April 7, 2012 6:34:48 AM America/Chicago <br />
Apr 07, 2012 06:34:51 [0xb0510000] DEBUG - Request: GET /library/metadata/795 [127.0.0.1] (1 live)<br />
Apr 07, 2012 06:34:51 [0xb0510000] DEBUG - Last refresh (2012-04-06 17:10:46) appears to be older than directory change time (2012-04-07 06:31:50), refreshing local media agent.<br />
Apr 07, 2012 06:34:51 [0xb0510000] DEBUG - Refreshing GUID: 'com.plexapp.agents.thetvdb://79656/2/2?lang=de'<br />
Apr 07, 2012 06:34:51 [0xb09a2000] DEBUG - Request: GET /system/agents/update?mediaType=4&force=1&parentGUID=com%2Eplexapp%2Eagents%2Ethetvdb:%2F%2F79656%2F2%3Flang%3Dde&guid=com%2Eplexapp%2Eagents%2Ethetvdb:%2F%2F79656%2F2%2F2%3Flang%3Dde&id=795&agent=com.plexapp.agents.localmedia&async=0 [127.0.0.1] (2 live)<br />
Apr 07, 2012 06:34:51 [0xb09a2000] DEBUG -  * mediaType => 4<br />
Apr 07, 2012 06:34:51 [0xb09a2000] DEBUG -  * force => 1<br />
Apr 07, 2012 06:34:51 [0xb09a2000] DEBUG -  * parentGUID => com.plexapp.agents.thetvdb://79656/2?lang=de<br />
Apr 07, 2012 06:34:51 [0xb09a2000] DEBUG -  * guid => com.plexapp.agents.thetvdb://79656/2/2?lang=de<br />
Apr 07, 2012 06:34:51 [0xb09a2000] DEBUG -  * id => 795<br />
Apr 07, 2012 06:34:51 [0xb09a2000] DEBUG -  * agent => com.plexapp.agents.localmedia<br />
Apr 07, 2012 06:34:51 [0xb09a2000] DEBUG -  * async => 0<br />
Apr 07, 2012 06:34:51 [0xb09a2000] DEBUG - [com.plexapp.system] Sending command over HTTP (GET): /system/agents/update?mediaType=4&force=1&parentGUID=com%2Eplexapp%2Eagents%2Ethetvdb:%2F%2F79656%2F2%3Flang%3Dde&guid=com%2Eplexapp%2Eagents%2Ethetvdb:%2F%2F79656%2F2%2F2%3Flang%3Dde&id=795&agent=com.plexapp.agents.localmedia&async=0<br />
Apr 07, 2012 06:34:51 [0xb079a000] DEBUG - Request: GET /:/plugins [127.0.0.1] (3 live)<br />
Apr 07, 2012 06:34:51 [0xb079a000] DEBUG - It took 0.000192 sec to serialize a list with 24 elements.<br />
Apr 07, 2012 06:34:51 [0xb0b28000] DEBUG - Request: GET /:/plugins [127.0.0.1] (3 live)<br />
Apr 07, 2012 06:34:51 [0xb0b28000] DEBUG - It took 0.000197 sec to serialize a list with 24 elements.<br />
Apr 07, 2012 06:34:51 [0xb0b28000] DEBUG - Request: GET /library/metadata/795/tree [127.0.0.1] (3 live)<br />
Apr 07, 2012 06:34:51 [0xb0b28000] DEBUG - It took 0.000094 sec to serialize a list with 1 elements.<br />
Apr 07, 2012 06:34:51 [0xb0b28000] DEBUG - Request: GET /:/metadata/notify?guid=com.plexapp.agents.thetvdb%3A%2F%2F79656%2F2%2F2%3Flang%3Dde&path=TV+Shows%2F0%2F92cf0734cbfb1d8e6c8ec92e71d2edfb82ef55d.bundle&force=1&queueSize=0&id=795&success=1&async=0 [127.0.0.1] (3 live)<br />
Apr 07, 2012 06:34:51 [0xb0b28000] DEBUG -  * guid => com.plexapp.agents.thetvdb://79656/2/2?lang=de<br />
Apr 07, 2012 06:34:51 [0xb0b28000] DEBUG -  * path => TV Shows/0/92cf0734cbfb1d8e6c8ec92e71d2edfb82ef55d.bundle<br />
Apr 07, 2012 06:34:51 [0xb0b28000] DEBUG -  * force => 1<br />
Apr 07, 2012 06:34:51 [0xb0b28000] DEBUG -  * queueSize => 0<br />
Apr 07, 2012 06:34:51 [0xb0b28000] DEBUG -  * id => 795<br />
Apr 07, 2012 06:34:51 [0xb0b28000] DEBUG -  * success => 1<br />
Apr 07, 2012 06:34:51 [0xb0b28000] DEBUG -  * async => 0<br />
Apr 07, 2012 06:34:51 [0xb0b28000] DEBUG - Notification of new metadata for com.plexapp.agents.thetvdb://79656/2/2?lang=de [id=795] (success=1) for 1 items.<br />
Apr 07, 2012 06:34:51 [0xb0b28000] WARN - Unable to load episode file [seasons/2/episodes/2.xml]<br />
Apr 07, 2012 06:34:51 [0xb0b28000] DEBUG - Item 795 (Bowling) Scanning metadata graphic elements in XML file seasons/2/episodes/2.xml<br />
Apr 07, 2012 06:34:51 [0xb079a000] DEBUG - Request: GET /system/agents/media/get?guid=com%2Eplexapp%2Eagents%2Ethetvdb:%2F%2F79656%2F2%2F2%3Flang%3Dde&mediaType=4&url=metadata:%2F%2Fseasons%2F2%2Fepisodes%2F2%2Fthumbs%2Fcom%2Eplexapp%2Eagents%2Ethetvdb_4c954145909f31a0ed7bfb194afe0409a2514453 [127.0.0.1] (4 live)<br />
Apr 07, 2012 06:34:51 [0xb079a000] DEBUG -  * guid => com.plexapp.agents.thetvdb://79656/2/2?lang=de<br />
Apr 07, 2012 06:34:51 [0xb079a000] DEBUG -  * mediaType => 4<br />
Apr 07, 2012 06:34:51 [0xb079a000] DEBUG -  * url => metadata://seasons/2/episodes/2/thumbs/com.plexapp.agents.thetvdb_4c954145909f31a0ed7bfb194afe0409a2514453<br />
Apr 07, 2012 06:34:51 [0xb079a000] DEBUG - [com.plexapp.system] Sending command over HTTP (GET): /system/agents/media/get?guid=com%2Eplexapp%2Eagents%2Ethetvdb:%2F%2F79656%2F2%2F2%3Flang%3Dde&mediaType=4&url=metadata:%2F%2Fseasons%2F2%2Fepisodes%2F2%2Fthumbs%2Fcom%2Eplexapp%2Eagents%2Ethetvdb_4c954145909f31a0ed7bfb194afe0409a2514453<br />
Apr 07, 2012 06:34:52 [0xb079a000] DEBUG - HTTP request to: http://127.0.0.1:49192/system/agents/media/get?guid=com%2Eplexapp%2Eagents%2Ethetvdb:%2F%2F79656%2F2%2F2%3Flang%3Dde&mediaType=4&url=metadata:%2F%2Fseasons%2F2%2Fepisodes%2F2%2Fthumbs%2Fcom%2Eplexapp%2Eagents%2Ethetvdb_4c954145909f31a0ed7bfb194afe0409a2514453<br />
Apr 07, 2012 06:34:52 [0xb079a000] DEBUG - [com.plexapp.system] HTTP reply status 200, with 23773 bytes of content.<br />
Apr 07, 2012 06:34:52 [0xb0081000] DEBUG - HTTP request to: http://127.0.0.1:32400/system/agents/media/get?guid=com%2Eplexapp%2Eagents%2Ethetvdb:%2F%2F79656%2F2%2F2%3Flang%3Dde&mediaType=4&url=metadata:%2F%2Fseasons%2F2%2Fepisodes%2F2%2Fthumbs%2Fcom%2Eplexapp%2Eagents%2Ethetvdb_4c954145909f31a0ed7bfb194afe0409a2514453<br />
Apr 07, 2012 06:34:52 [0xb0b28000] DEBUG - Brought media local (metadata://seasons/2/episodes/2/thumbs/com.plexapp.agents.thetvdb_4c954145909f31a0ed7bfb194afe0409a2514453) in 0.0s.<br />
Apr 07, 2012 06:34:52 [0xb0b28000] DEBUG - Loading information from media bundle for part ID 765 from /Users/kahrendt/Library/Application Support/Plex Media Server/Media/localhost/7/929cbe6ce4fa7fe816b15d88d2ff5dcb1ea0f8947.bundle/Contents<br />
Apr 07, 2012 06:34:52 [0xb0b28000] DEBUG - There was a change for metadata item 795 (Bowling), saving.<br />
Apr 07, 2012 06:34:52 [0xb0b28000] DEBUG - Updating metadata item (Bowling) with ID 795<br />
Apr 07, 2012 06:34:52 [0xb0b28000] DEBUG - Moving old thumb cache file (original size) over to /Users/kahrendt/Library/Caches/PlexMediaServer/PhotoTranscoder/b2/b21c4394d067e3fcc7d742922a9bfc6e7ad688f8.jpg<br />
Apr 07, 2012 06:34:52 [0xb0b28000] DEBUG - Moving old thumb cache file (512x512) over to /Users/kahrendt/Library/Caches/PlexMediaServer/PhotoTranscoder/3f/3f77fa5551a9e00a15205a758eacf0a3b81fc412.jpg<br />
Apr 07, 2012 06:34:52 [0xb0b28000] DEBUG - Loaded metadata for Bowling (ID 795) in 21.633000 ms<br />
Apr 07, 2012 06:34:52 [0xb0b28000] DEBUG - Done with metadata update for 795<br />
Apr 07, 2012 06:34:52 [0xb09a2000] DEBUG - HTTP request to: http://127.0.0.1:49192/system/agents/update?mediaType=4&force=1&parentGUID=com%2Eplexapp%2Eagents%2Ethetvdb:%2F%2F79656%2F2%3Flang%3Dde&guid=com%2Eplexapp%2Eagents%2Ethetvdb:%2F%2F79656%2F2%2F2%3Flang%3Dde&id=795&agent=com.plexapp.agents.localmedia&async=0<br />
Apr 07, 2012 06:34:52 [0xb09a2000] DEBUG - [com.plexapp.system] HTTP reply status 200, with 161 bytes of content.<br />
Apr 07, 2012 06:34:52 [0xb0510000] DEBUG - HTTP request to: http://127.0.0.1:32400/system/agents/update?mediaType=4&force=1&parentGUID=com%2Eplexapp%2Eagents%2Ethetvdb:%2F%2F79656%2F2%3Flang%3Dde&guid=com%2Eplexapp%2Eagents%2Ethetvdb:%2F%2F79656%2F2%2F2%3Flang%3Dde&id=795&agent=com.plexapp.agents.localmedia&async=0<br />
Apr 07, 2012 06:34:52 [0xb0510000] DEBUG - It took 0.000700 sec to serialize a list with 1 elements.<br />
Apr 07, 2012 06:34:52 [0xb0510000] DEBUG - Request: GET /library/parts/765/file [127.0.0.1] (1 live)<br />
Apr 07, 2012 06:34:52 [0xb048e000] DEBUG - Request: GET /video/:/webkit?url=http://www.amazon.com/gp/flex/sign-out.html [127.0.0.1] (1 live)<br />
Apr 07, 2012 06:34:52 [0xb048e000] DEBUG -  * url => http://www.amazon.com/gp/flex/sign-out.html<br />
Apr 07, 2012 06:34:52 [0xb048e000] DEBUG - WebKit: [amazon.com/gp/flex/sign-out.html]<br />
Apr 07, 2012 06:34:52 [0xb048e000] DEBUG - WebKit: Resetting to state playing.<br />
Apr 07, 2012 06:34:52 [0xb048e000] DEBUG - Using /Users/kahrendt/Library/Application Support/Plex Media Server/Site Configurations/amazonvod.xml with score of 10021.<br />
Apr 07, 2012 06:34:52 [0xb048e000] DEBUG - WebKit: Sending line: HELLO<br />
Apr 07, 2012 06:34:53 [0xa01ee540] DEBUG - WebKit: Received title [Sign In].<br />




And with that, and no helpful error messages, the media server just stops running once it finishes visiting that page. Note this happens when you visit any page (using the visit command in the site config or just opening an initial link from an strm file) on amazon that allows you to login (except the mobile site), or once you are logged in any page at all (again excluding the mobile site).

I've put a crash log on my dropbox as well, though to my untrained eye it doesn't appear too helpful: dropbox.com/sh/wpj0plu67mxl7s7/edsLDRVL9Y/Plex%20Media%20Server_2012-04-07-063510_Media-Center.crash



I have tried everything I can think of, but have had no luck. Any suggestions? Is there a way to actually debug the webkit side of things further? My guess is these various pages on amazon have some kind of script that causes the webkit engine to crash, but I haven't had any luck trying to hunt that down.

S

I’m sorry, but I don’t understand why you are specifying a webkit URL that is not a video. There is a normal format for sites which require authentication first which results in a number of states needed for the Site Configuration. An example of these are as follows:

The reason I gave the sign-out page was because it constantly crashes the media server just like a normal video would without having to jump through the hoops of logging in (and having an account…), plus the click action hasn’t consistently been working for me, so I was having trouble causing it to replicate consistently. I have found a bit of a work around though, you can use the mini-player window and that will load, so I have successfully gotten some videos to play. However, in a very similar way, whenever you use the javascript controls to pause and play, the media server crashes like I described in my first post without any errors. So I’ll post the site config that I have now that lets you login, and a strm file that should load video. Then try pressing pause and hopefully the crash is replicated. If you don’t have an amazon prime account you won’t be able to get that far, so use the strm file in my first post to get the media server to crash by visiting an amazon page.



Site config: (make sure to put in your own password and email to log in)


<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<site site="www.amazon.com"<br />
	    plugin="http://ecx.images-amazon.com/images/G/.*\.swf"<br />
			initialState="loginPage"<br />
			windowWidth="1024"<br />
			windowHeight="800"<br />
			identifier="com.plexapp.plugins.amazonvod"<br />
			version="1.0"><br />
<br />
    <crop x="0" y="0" width="1024" height="800" /><br />
<br />
    <state name="loginPage"><br />
        <event><br />
            <condition><br />
                <frameLoaded /><br />
            </condition><br />
            <br />
            <action><br />
                <visit url="https://www.amazon.com/gp/aw/ya" /><br />
                <br />
                <goto state="login" /><br />
            </action><br />
        </event><br />
    </state><br />
    <br />
    <state name="login"><br />
        <event><br />
            <condition><br />
                <title matches="^Amazon:Sign In$" /><br />
            </condition><br />
            <br />
            <action><br />
                <pause time="200" /><br />
                <run script="document.getElementsByName('email')[0].value='*****'" /><br />
                <run script="document.getElementsByName('password')[0].value='****'" /><br />
                <run script="document.forms[0].submit()"  /><br />
<br />
                <pause time="1000" /><br />
                <br />
                <goto state="reloadVideo" /><br />
<br />
            </action><br />
        </event><br />
        <br />
        <event><br />
            <condition><br />
                <title matches="^Amazon:Your Account$" /><br />
            </condition><br />
            <action><br />
                <goto state="reloadVideo" /><br />
            </action><br />
        </event><br />
    </state><br />
<br />
    <state name="reloadVideo"><br />
        <event><br />
            <condition><br />
                <javascript script="true ? 1 : 0" matches="1" /><br />
            </condition><br />
            <br />
            <action>            <br />
                <visit url="${url}" /><br />
                <br />
<br />
                <goto state="playing" /><br />
            </action><br />
        </event><br />
    <br />
    </state><br />
<br />
   <br />
 <state name="playing"><br />
  <event><br />
   <condition><br />
    <command name="pause" /><br />
   </condition><br />
   <action><br />
    <javascript script="document.getElementById('streaming').avodPause()" /><br />
    <goto state="paused" /><br />
   </action><br />
  </event><br />
  </state><br />
<br />
 <state name="paused"><br />
  <event><br />
   <condition><br />
    <command name="play" /><br />
   </condition><br />
   <action><br />
    <javascript script="document.getElementById('streaming').avodPlay()" /><br />
    <goto state="playing" /><br />
   </action><br />
  </event><br />
 </state><br />
<br />
</site><br />
<br />





And here is a strm file that should crash it once paused:


plex://localhost/video/:/webkit?url=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fvideo%2Fstreaming%2Fmini-mode.html%3Fasin%3DB007MX4O0A

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