QNAP QPKG for DVR Record Engine

Downloads & Instructions
Post Reply
Sorbo78
Posts: 1
Joined: Fri Oct 19, 2018 11:20 pm

Re: QNAP QPKG for DVR Record Engine

Post by Sorbo78 »

FYI - I had an issue where the website would not load through the admin interface or via the direct URL. This turned out to be a script error in the dvrui_hdhrjson.php file where it said it had an unexpected '.' on line 5.

The changes i made to get this working are below, once these were made this worked in both the admin interface and direct URL.

modified line 5 to:
private $myhdhrurl = ''; //DVRUI_Vars::DVRUI_apiurl . 'discover';

and then in public function DVRUI_HDHRjson() {

changed:
$hdhr_data = getJsonFromUrl($this->myhdhrurl);
to:
$hdhr_data = getJsonFromUrl(DVRUI_Vars::DVRUI_apiurl . 'discover');

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 »

Sorbo78 wrote: Mon Oct 22, 2018 6:52 pm FYI - I had an issue where the website would not load through the admin interface or via the direct URL. This turned out to be a script error in the dvrui_hdhrjson.php file where it said it had an unexpected '.' on line 5.

The changes i made to get this working are below, once these were made this worked in both the admin interface and direct URL.

modified line 5 to:
private $myhdhrurl = ''; //DVRUI_Vars::DVRUI_apiurl . 'discover';

and then in public function DVRUI_HDHRjson() {

changed:
$hdhr_data = getJsonFromUrl($this->myhdhrurl);
to:
$hdhr_data = getJsonFromUrl(DVRUI_Vars::DVRUI_apiurl . 'discover');
If I remember rightly this error is because of an older php installation.
Which PHP version is installed on your NAS?

Is an ok change to make since we only use the URL once in that script.

upfwnv03
Posts: 1
Joined: Fri Nov 09, 2018 1:55 pm

Re: QNAP QPKG for DVR Record Engine

Post by upfwnv03 »

Hello demonrik,

Question concerning version 0.9.34. When checked the md5 returned doesn't match the qpkg.md5 posted on google drive.

Thanks,
upfwnv03

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 »

upfwnv03 wrote: Fri Nov 09, 2018 2:06 pm Hello demonrik,

Question concerning version 0.9.34. When checked the md5 returned doesn't match the qpkg.md5 posted on google drive.

Thanks,
upfwnv03
confirming I can see it too.
Not sure what happened.
FWIW - the original file on my local storage md5sum is

Code: Select all

afe1cb335361ca35bfd69adcb2ff4133  HDHomeRunDVR_0.9.34.qpkg
I did a rebuild to check - and it was ok.. so not sure what happened here.
am in the middle of changing up the UI a little bit, so can't quite roll back to 0.9.34 to do a rebuild.
So will hold off until next release but will remove the md5 file for now..

numus
Posts: 541
Joined: Thu Apr 21, 2016 7:57 am

Re: QNAP QPKG for DVR Record Engine

Post by numus »

On the latest version and when I try to open the HDHomeRunDVR app on my QNAP it says refused to connect.

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 »

numus wrote: Sat Dec 08, 2018 6:15 pm On the latest version and when I try to open the HDHomeRunDVR app on my QNAP it says refused to connect.
connection refused is all about gaining access to the webserver
If using remotely - make sure you have port forwarded the webserver port of the qnap
Make sure the webserver is running and configured correctly
If using https - check the https ports

numus
Posts: 541
Joined: Thu Apr 21, 2016 7:57 am

Re: QNAP QPKG for DVR Record Engine

Post by numus »

demonrik wrote: Sun Dec 09, 2018 8:47 am
numus wrote: Sat Dec 08, 2018 6:15 pm On the latest version and when I try to open the HDHomeRunDVR app on my QNAP it says refused to connect.
connection refused is all about gaining access to the webserver
If using remotely - make sure you have port forwarded the webserver port of the qnap
Make sure the webserver is running and configured correctly
If using https - check the https ports
The direct url works. I was trying to open the app in QNAP app center and that is when I get a refused to connect.

I checked the iframe and it says

<iframe id="ext-gen361HDHomeRunDVR" class="wait" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" src="http://192.168.1.200:80/HDHomeRunDVR?wi ... "></iframe>

When I go directly to http://192.168.1.200:80/HDHomeRunDVR?wi ... 0.9.34&amp; it loads up the DVR MAnager without a problem.

darqnova
Posts: 7
Joined: Wed Jan 27, 2010 12:50 pm

Re: QNAP QPKG for DVR Record Engine

Post by darqnova »

Decided to update the record engine today to see if it works any better now a days. Was on qpkg 0.9.24 and did a manual install and it said it updated it OK to 0.9.34. However the record engine doesn't start anymore nor does it create a log file.

If I try to start manually using HDHomeRunDVR.sh I get

./HDHomeRunDVR.sh: line 27: /share/MD0_DATA/.qpkg/HDHomeRunDVR/hdhr_wrapper_arm: No such file or directory

All the files in the record directory are set to httpdusr:administors and running the diagnostics.sh doesn't show any errors, all the directories are found.

Not sure where to go from there since it is previously working alright along with HDHRDVR UI. Any help appreciated.

Thanks,

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 »

darqnova wrote: Tue Dec 25, 2018 4:32 pm Decided to update the record engine today to see if it works any better now a days. Was on qpkg 0.9.24 and did a manual install and it said it updated it OK to 0.9.34. However the record engine doesn't start anymore nor does it create a log file.

If I try to start manually using HDHomeRunDVR.sh I get

./HDHomeRunDVR.sh: line 27: /share/MD0_DATA/.qpkg/HDHomeRunDVR/hdhr_wrapper_arm: No such file or directory

All the files in the record directory are set to httpdusr:administors and running the diagnostics.sh doesn't show any errors, all the directories are found.

Not sure where to go from there since it is previously working alright along with HDHRDVR UI. Any help appreciated.

Thanks,
that's a long time between updates.. lots changed in those versions..
first off permissions is key.
To get around the fact that the record engine will run as root at boot I had to implement a workaround to wrap it for the http user so we could start/stop from the UI.
That wrapper is what you see the error about.
Can you login to the NAS as an admin and see if that file does exist?
ie..

Code: Select all

ls -l /share/MD0_DATA/.qpkg/HDHomeRunDVR
Could be that the permissions are wrong on the binary - or could be missing from the build (always possible - but since you are first to notice in months, probably not).
If the file is there - just try running it and see what it says..

darqnova
Posts: 7
Joined: Wed Jan 27, 2010 12:50 pm

Re: QNAP QPKG for DVR Record Engine

Post by darqnova »

Thanks for the quick reply.

Files are all there
-rw-rw-r-- 1 admin administ 100 Aug 26 2017 HDHomeRunDVR.conf
-rwxr-xr-x 1 admin administ 1666 Dec 25 17:23 HDHomeRunDVR.sh*
-rwxr-xr-x 1 admin administ 2543 Aug 3 18:04 diagnostics.sh*
-rwxr-xr-x 1 admin administ 1527038 Aug 17 15:32 hdhomerun_record_linux*
-rwxr-xr-x 1 admin administ 8916 Feb 5 2018 hdhr_wrapper_arm*
-rwxr-xr-x 1 admin administ 10432 Feb 5 2018 hdhr_wrapper_x86_64*
drwxr-xr-x 7 httpdusr administ 4096 Dec 25 16:50 ui/

sudo ./hdhr_wrapper_arm
sudo: unable to execute ./hdhr_wrapper_arm: No such file or directory

sudo ./hdhomerun_record_linux start
HDHomeRun RECORD started

It starts, and the firetv finds the engine. But no recordings show up and I just get protocol error when trying to tune in a live station. Then ran this
sudo ./hdhomerun_record_linux start --conf HDHomeRunDVR.conf

And all seems right, live TV and recorded programs show up and play again. Also it creates the log file. HDHomeRun DVR UI displays all the records and what not again as well.

Thanks,

jim_a
Posts: 152
Joined: Fri Jul 10, 2009 11:36 am

Automatically start the record engine?

Post by jim_a »

First, I haven’t read this entire thread so this may have already been covered.

Second, I like the package and have it installed and working on my TS-231. Thanks :)

However, when I restart the NAS the record engine must be started
manually. I don’t see any option to start the engine automatically.

I found this method of running a startup script and “installed” it.

https://forum.qnap.com/viewtopic.php?f=45&t=130345

This is my current script to start the record engine.

[/share/CACHEDEV1_DATA/.system/autorun/scripts] # cat 030-myscript

Code: Select all

#!/bin/sh
rm /tmp/mlog*
touch /tmp/mlog1
/share/CACHEDEV1_DATA/.qpkg/HDHomeRunDVR/hdhomerun_record_linux start &
touch /tmp/mlog2
exit
The script successfully starts the engine. However, I cannot view live TV or
control the record engine with the hdhrun app on my shield TV. It appears
that this is because the engine is running as “admin” and not “httpdusr”.

Is there a better way to automatically start the record engine?

darqnova
Posts: 7
Joined: Wed Jan 27, 2010 12:50 pm

Re: QNAP QPKG for DVR Record Engine

Post by darqnova »

jim_a

Looks kind of similar to the issue I am currently having. To get you going for now try starting it with the --conf option when ssh in.
hdhomerun_record_linux start --conf HDHomeRunDVR.conf

This started the record engine and everything seems to work normally for me when I ran it from the same directory as long as your conf file is in there already.

Waiting for demonrik on a real solution. But the above might get you by in the mean time at least.

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 »

darqnova wrote: Tue Dec 25, 2018 5:18 pm Thanks for the quick reply.

Files are all there
-rw-rw-r-- 1 admin administ 100 Aug 26 2017 HDHomeRunDVR.conf
-rwxr-xr-x 1 admin administ 1666 Dec 25 17:23 HDHomeRunDVR.sh*
-rwxr-xr-x 1 admin administ 2543 Aug 3 18:04 diagnostics.sh*
-rwxr-xr-x 1 admin administ 1527038 Aug 17 15:32 hdhomerun_record_linux*
-rwxr-xr-x 1 admin administ 8916 Feb 5 2018 hdhr_wrapper_arm*
-rwxr-xr-x 1 admin administ 10432 Feb 5 2018 hdhr_wrapper_x86_64*
drwxr-xr-x 7 httpdusr administ 4096 Dec 25 16:50 ui/

sudo ./hdhr_wrapper_arm
sudo: unable to execute ./hdhr_wrapper_arm: No such file or directory
Sorry late with follow up reply - internet is crap here, and had to pay attention to family for the day.

Anyway,
that's strange - you have the wrapper, but is not executing it..
even if something had changed in the linker I would still expect it to execute and say invalid format.
So either the file is corrupt in the package or something else is happening on the qnap that's changed.

I see you using sudo. I didn't think that was standard for QNAP. You install? Or did it come in a recent update?
BTW- which NAS model and firmware version?

Maybe try downloading the arm binary directly to some other path

Code: Select all

wget http://www.irish-networx.com/hdhr_wrapper/hdhr_wrapper_arm
chmod a+x hdhr_wrapper_arm
./hdhr_wrapper_arm
If it still says not found - then something is very wrong. Maybe try with full explicit path to the binary
Try logging in as an admin user and not use sudo to execute
Do you have any other security apps running which may limit the executable permissions of files?

EDIT: BTW - did you try start from the UI?
sudo ./hdhomerun_record_linux start
HDHomeRun RECORD started

It starts, and the firetv finds the engine. But no recordings show up and I just get protocol error when trying to tune in a live station. Then ran this
sudo ./hdhomerun_record_linux start --conf HDHomeRunDVR.conf

And all seems right, live TV and recorded programs show up and play again. Also it creates the log file. HDHomeRun DVR UI displays all the records and what not again as well.

Thanks,
That's how you run it.. Without the --conf the record engine will try create one with a recordpath set to current folder and obviously permissions won't allow you to record anything to it..
So when you added -cconf you get it working, but now is running as root user.
root user will allow you to use everything perfectly, but now all your recordings will be as root.. so a) you can't use the stop/start controls in the UI, and b) once we get the wrapper working again you will need to fix permissions of all the recordings again to httpdusr :)
Last edited by demonrik on Wed Dec 26, 2018 11:02 am, edited 1 time in total.

jim_a
Posts: 152
Joined: Fri Jul 10, 2009 11:36 am

Re: QNAP QPKG for DVR Record Engine

Post by jim_a »

darqnova
My issue may be related to yours.

However, I am using the qpkg gui interface to manually start and stop the recorder with no problems.

Basically , I am trying to get the record engine to start when the NAS starts without logging into the NAS.

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 »

jim_a wrote: Wed Dec 26, 2018 11:01 am darqnova
My issue may be related to yours.

However, I am using the qpkg gui interface to manually start and stop the recorder with no problems.

Basically , I am trying to get the record engine to start when the NAS starts without logging into the NAS.
Could be same issue as @darqnova
From autostart you need the arm binary.. From UI start it's not needed since is already running as right user.
you seem familiar with command console - can you do like @darqnova and check if you can run the arm wrapper binary on your system?

Post Reply