Author Topic: Scrape, unexpected error  (Read 1650 times)

0 Members and 1 Guest are viewing this topic.

OklahomaGreyBeard

  • Contributor
  • ***
  • Posts: 54
  • Karma: 3
    • View Profile
Scrape, unexpected error
« on: May 22, 2015, 12:06:14 PM »
I'm trying a program (sleep on lan) on my plex server that will let me hibernate or sleep the server from a remote computer via http. I setup a macro to scrape the url and it pauses VC for a couple of minutes then throws an error and continues with the macro.  Putting the same url in chrome or ie on the VC machine works fine.

The url is http://92.168.11.205:7770/hibernate which is the ip of the plex server and the port the sleep on lan program is running. using /sleep gives the same thing.

here's the info from the log after the error.

Code: [Select]
5/22/2015 9:52:35 AM 373 Action:  Scrape - http://192.168.11.205:7770/hibernate
5/22/2015 9:52:35 AM 373 [action] Scrape:http://192.168.11.205:7770/hibernate

5/22/2015 9:54:15 AM 386 [error] Scrape: unexpected error

5/22/2015 9:54:15 AM 387 unexpected error in action: Scrape
System.NullReferenceException: Object reference not set to an instance of an object.
   at eval_᜖.eval_ᜂ(String[] A_0)
   at eval_d.eval_ᜃ(macroElement A_0, List`1 A_1, Int32 A_2)
   at eval_d.eval_ᜂ(macroElement A_0, List`1 A_1, Int32 A_2)

running in chrome the response from the loaded url is:

Request accepted for execution: hibernate

More info: http://www.ireksoftware.com/SleepOnLan

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Scrape, unexpected error
« Reply #1 on: May 22, 2015, 02:22:51 PM »
When you use Chrome, does it respond instantly or does it take a bit of time to get a successful response?
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Scrape, unexpected error
« Reply #2 on: May 22, 2015, 03:14:51 PM »
I'm trying a program (sleep on lan) on my plex server that will let me hibernate or sleep the server from a remote computer via http. I setup a macro to scrape the url and it pauses VC for a couple of minutes then throws an error and continues with the macro.  Putting the same url in chrome or ie on the VC machine works fine.

Does the machine go to sleep/hibernate?

It seems like the "server" is not returning a response to the http request, or is not returning it in a normal way.  Have you tried doing something similar with EventGhost, or is the plex server not running on Windows?

OklahomaGreyBeard

  • Contributor
  • ***
  • Posts: 54
  • Karma: 3
    • View Profile
Re: Scrape, unexpected error
« Reply #3 on: May 23, 2015, 11:02:44 PM »
Using Chrome, the reply page in instantaneous, and the server immediately starts shutting down. It does not shut down from the scrape command, but I did switch to using eventghost and it works like a charm. I do wonder about the error though.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Scrape, unexpected error
« Reply #4 on: May 24, 2015, 07:55:56 AM »
I installed the Windows version of this program and tested it here. I get the same error but there is no delay. The machine goes to sleep and the next action executes immediately. Basically, it works fine. I don't know if your Plex machine is running Windows.  I also only tested with suspend,  not hibernate.

I'll do some more investigation.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Scrape, unexpected error
« Reply #5 on: May 28, 2015, 05:24:41 PM »
There are a lot of things about this that confuse me.  I've tried everything I can think of and I always get an error when trying to scrape this app.  I am receiving an error telling me that the server committed a protocol violation, but of course not which one.  What is also strange is that although I am not able to read the response back from the app it still goes to sleep immediately and the action completes immediately but shows an error.  I don't know what is different about your setup that it freezes VC and does not get the server to sleep.

In any case here is an alternative method that might work for you.  You only need tiny bit of python and it will probably not care about the protocol violation so it may work fine.

Paste this into your tree and edit the IP address and hopefully it will work.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.6-->
<command id="786" name="sleep on lan python" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>PY.ExecString</cmdType>
    <params>
      <param>import urllib; urllib.urlopen('http://192.168.0.107:7760/suspend')</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>