QNAP QPKG for DVR Record Engine

Downloads & Instructions
Post Reply
demonrik
Posts: 1591
Joined: Mon May 04, 2015 10:03 am
Device ID: 108042A1, 10814D8E
x 38

Re: QNAP QPKG for DVR Record Engine

Post by demonrik »

avdp wrote:ok, so the latest change did return nothing (no rules) but only took 10.5826029778 seconds.
I was surprised by that!

I'll PM the dump and my modest attempt at hacking python :)
now remove the method and content lines of the array... should return something.
And you can change the timeout to whatever you want then - it's in seconds, and takes a decimal point.

Surprised it took 10s - but still better than 2mins.

avdp
Posts: 296
Joined: Thu Nov 13, 2014 4:54 pm

Re: QNAP QPKG for DVR Record Engine

Post by avdp »

still nothing... blank. Nothing but the time shows up.

demonrik
Posts: 1591
Joined: Mon May 04, 2015 10:03 am
Device ID: 108042A1, 10814D8E
x 38

Re: QNAP QPKG for DVR Record Engine

Post by demonrik »

avdp wrote:still nothing... blank. Nothing but the time shows up.
try extending the timeout

Make sure it looks like

Code: Select all

		//method 2
		$context = stream_context_create(
				array('http' => array(
					'header'=>'Connection: close\r\n',
					'timeout' => 2.0)));
		$rules_json = file_get_contents($this->recordingsURL . $auth,false,$context);		

avdp
Posts: 296
Joined: Thu Nov 13, 2014 4:54 pm

Re: QNAP QPKG for DVR Record Engine

Post by avdp »

I tried various numbers, unfortunately I had to set it to 200 for it to return data... So basically this approach is not addressing my problem.

At this point, I think it's a QNAP bug. I do have a fairly sophisticated network setup with 2 NICs trunk-ed as one interface, and also a high MTU. Perhaps I should go back to default settings and see if I still have the problem. Weird.

avdp
Posts: 296
Joined: Thu Nov 13, 2014 4:54 pm

Re: QNAP QPKG for DVR Record Engine

Post by avdp »

Very interesting... Using the following function instead of file_get_contents gets me the results back in 10 seconds.
If I set it the timeout to 1 second, then I get a "name lookup timed out" error. So there may indeed be some DNS issue after all.

Code: Select all

function http_get_contents($url)
{
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_TIMEOUT, 200);
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  if(FALSE === ($retval = curl_exec($ch))) {
    error_log(curl_error($ch));
  } else {
    return $retval;
  }
}

demonrik
Posts: 1591
Joined: Mon May 04, 2015 10:03 am
Device ID: 108042A1, 10814D8E
x 38

Re: QNAP QPKG for DVR Record Engine

Post by demonrik »

Removed - see OP for correct version and link
Last edited by demonrik on Fri Oct 01, 2021 4:23 pm, edited 1 time in total.

avdp
Posts: 296
Joined: Thu Nov 13, 2014 4:54 pm

Re: QNAP QPKG for DVR Record Engine

Post by avdp »

Fixed my DNS issue, my primary was wrong. Now the rules come back in milliseconds, but ONLY when using cURL function, the built-in file_get_contents function still takes 2 minutes.

So I am happy for now... Of course, I'd be happier if you switch to using curl in your code :)

thanks for posting a new qpkg with the latest engine so fast. Now I feel like a kid in a candy store, and want to try all the new engine/firmware functionality :)


Code: Select all

function http_get_contents($url)
{
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_TIMEOUT, 2);
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  if(FALSE === ($retval = curl_exec($ch))) {
    error_log(curl_error($ch));
  } else {
    return $retval;
  }
}


demonrik
Posts: 1591
Joined: Mon May 04, 2015 10:03 am
Device ID: 108042A1, 10814D8E
x 38

Re: QNAP QPKG for DVR Record Engine

Post by demonrik »

avdp wrote:Fixed my DNS issue, my primary was wrong. Now the rules come back in milliseconds, but ONLY when using cURL function, the built-in file_get_contents function still takes 2 minutes.

So I am happy for now... Of course, I'd be happier if you switch to using curl in your code :)

thanks for posting a new qpkg with the latest engine so fast. Now I feel like a kid in a candy store, and want to try all the new engine/firmware functionality :)


Code: Select all

function http_get_contents($url)
{
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_TIMEOUT, 2);
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  if(FALSE === ($retval = curl_exec($ch))) {
    error_log(curl_error($ch));
  } else {
    return $retval;
  }
}

I was about to consider cUrl but I didnt see any improvement on my side..
Since it works for us both, I will do another update later to move to this ;)

cetheridge30
Posts: 9
Joined: Fri Feb 12, 2016 8:07 am

Re: QNAP QPKG for DVR Record Engine

Post by cetheridge30 »

Ever since version 0.8, upon opening the app in the QNAP interface, I get a window that has the title HDHomeRunDVR, but in the middle of the window is a broken page icon:

Image

It appears that it may have to do with running SSL as I found a description from googling information about the icon:

"This is usually from mixed content, as in the resource is on http:// and the page is on https:// . There should be a shield on the location bar you can click to turn on "unsafe" or "mixed" content. It could also just be from a broken file, as in it is corrupted or 0 bytes or something."

Recordings and all still work, just can't get to it from the QNAP interface. Nothing has changed with my setup, locations are all default, and I did try uninstalling and reinstalling as well.

avdp
Posts: 296
Joined: Thu Nov 13, 2014 4:54 pm

Re: QNAP QPKG for DVR Record Engine

Post by avdp »

Do you see the tabs for "Logs" and "Rules"?
If yes, click on them and see what happens

demonrik
Posts: 1591
Joined: Mon May 04, 2015 10:03 am
Device ID: 108042A1, 10814D8E
x 38

Re: QNAP QPKG for DVR Record Engine

Post by demonrik »

cetheridge30 wrote:Ever since version 0.8, upon opening the app in the QNAP interface, I get a window that has the title HDHomeRunDVR, but in the middle of the window is a broken page icon:

Image

It appears that it may have to do with running SSL as I found a description from googling information about the icon:

"This is usually from mixed content, as in the resource is on http:// and the page is on https:// . There should be a shield on the location bar you can click to turn on "unsafe" or "mixed" content. It could also just be from a broken file, as in it is corrupted or 0 bytes or something."

Recordings and all still work, just can't get to it from the QNAP interface. Nothing has changed with my setup, locations are all default, and I did try uninstalling and reinstalling as well.
The page is served by the qnap webserver.
Check the settings under control panel-> applications-> webserver...
Make sure its enabled.
Works for both SSL and non-SSL, remote and local.

If that doesnt help.. Check that the /share/Web exists and there should be a softlink called HDHomeRunDVR here that links to /share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR/ui
For some qnaps the CACHEDEV1_DATA may be MD0_DATA or similar.

cetheridge30
Posts: 9
Joined: Fri Feb 12, 2016 8:07 am

Re: QNAP QPKG for DVR Record Engine

Post by cetheridge30 »

Not sure which one fixed it but, I went into the web server settings and clicked the restore button for the web server and restore for the php.ini and it is working now. I don't run anything else that requires the web server (that I know of) or anything that requires php... Oh well...

demonrik
Posts: 1591
Joined: Mon May 04, 2015 10:03 am
Device ID: 108042A1, 10814D8E
x 38

Re: QNAP QPKG for DVR Record Engine

Post by demonrik »

cetheridge30 wrote:Not sure which one fixed it but, I went into the web server settings and clicked the restore button for the web server and restore for the php.ini and it is working now. I don't run anything else that requires the web server (that I know of) or anything that requires php... Oh well...
Sounds like it got corrupted at some point, possibly from an update.
Glad your up and running now :)

demonrik
Posts: 1591
Joined: Mon May 04, 2015 10:03 am
Device ID: 108042A1, 10814D8E
x 38

Re: QNAP QPKG for DVR Record Engine

Post by demonrik »

Removed - see OP for correct version and link
Last edited by demonrik on Fri Oct 01, 2021 4:23 pm, edited 1 time in total.

avdp
Posts: 296
Joined: Thu Nov 13, 2014 4:54 pm

Re: QNAP QPKG for DVR Record Engine

Post by avdp »

Installed, and works great! I like that the auth key is displayed on top, very handy!

Post Reply