Kodi Community Forum
Installing Netflix Add-on [input-stream] on QNAP - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Tips, tricks, and step by step guides (https://forum.kodi.tv/forumdisplay.php?fid=110)
+--- Thread: Installing Netflix Add-on [input-stream] on QNAP (/showthread.php?tid=357043)



Installing Netflix Add-on [input-stream] on QNAP - StorageFan - 2020-09-12

To help other people struggling with the installation of the Netflix plugin for KODI 18 on their QNAP, here is the set of instructions how to get there.

I start with the assumption that you managed to install HD Station on your QNAP and then install KODI 18 by adding the QNAP Club repository in your App Center. I also assume that you're capable of logging into your QNAP as admin using telnet or ssh.

This breakthrough was only possible, because @thomas.rehberg gave me the crucial hint that HD Station is a chroot subsystem based on Ubutun 18.04 residing within QTS.
Since QNAP is updating their Firmware very frequently (with all the advantages and disadvantages), this manual is only guaranteed to work for QTS 4.4.3 running HD Station 4.0.10 and KODI 18.5.0.0.
Chances are good that it might work with older or newer releases, but for example KODI 19 is a completely different animal since it is based on Python3 (while KODI 18 still runs ons Python 2.7).

The following instructions also assume that the HD Station’s chroot is based in the same folder as it is the case on my QNAP (which was the standard path after installing HD Station through the App Center):

/share/CACHEDEV1_DATA/.qpkg/HD_Station

It might be in a different folder in your case (I am running a TBS-453DX with a single 1TB SSD from WD RED SA500). During my googling sessions I’ve seen instructions and logfiles based on the premise of the HD Station folder being located for example here: /share/MD0_DATA/.qpkg/HD_Station

So maybe check first, if you can cd or ls your way into the folder
/share/CACHEDEV1_DATA/.qpkg/HD_Station
and if that fails, try to find out where your HD Station is located instead in your QTS. The command
getcfg SHARE_DEF defVolMP -f /etc/config/def_share.info
should help with that.

Now come the steps to install the Crypto package to your HD Station that took me quite some time to figure out:
Log into QNAP command line interface (via ssh or telnet) as admin and then execute the following commands:
chroot /share/CACHEDEV1_DATA/.qpkg/HD_Station

Now you’re located in the HD Station sub-environment as root, which is basically an Ubutunu 18.04 within QNAP’s QTS and gives you access to the usual commands and package managers like apt, pip etc. and now you can easily execute what CastagnaIT has suggested (which you cannot when just logging into your QNAP as admin, because there isn't even a package manager available). In case you’re not very familiar with Linux (like I am), here are the baby steps

apt update (to update the dependencies and repositories in your system)
apt upgrade (you can - and probably should! - skip that command, because it updates everything in your local Ubuntu 18.04 environment, which takes some time. Since I was already frustrated and didn’t care much anymore, I did it nonetheless and couldn’t see any bad consequences (or any difference to be honest except a newer version of the Chrome browser) later when using HD station. I uninstalled HD Station some time later and re-installed it and skipped the apt upgrade and everything worked fine as well. So run this command at your own risk and if in doubt, just skip it.

apt install build-essential
apt install python-dev
apt install python-pip
apt install python-setuptools

often a message like "python-dev is already the newest version" will be the result. Which is fine, because most packages are probably already included and up to date on your HD Station.

Since first using the officially recommended command
pip install --user pycryptodomex

resulted the Crypto package to be installed in the wrong folder /root/.local/lib/python2.7/site-packages/Cryptodome  and thus could not be found by the plugin expecting the content to be in /usr/lib/python2.7/dist-packages/Cryptodome
it made it necessary to hack a little by adding a symbolic link and downloading a Padding.py file like described in these posts on github.

But thanks to the helpful comments of CastagnaIT, the author of the Netflix plugin, I was able to correct that mistake and instead install a fitting cryptolibrary in the right location making things easier and cleaner.

Since his first suggestion
apt install python-pycryptodomex

did not work for me, because the package seems to be not known on my QNAP QTS HD-Station Ubuntu subsystem

I used his alternative suggestion
apt install python-pycryptodome

and that worked like a charm. The alternative Crypto library got installed in the right location:
/usr/lib/python2.7/dist-packages/Cryptodome

and there was also a Padding.py to be found in the subfolder /Util

Voilá! You should now be able to use your Netflix plugin without error messages (and without messing around with symbolic links or manually downloaded Padding.py files).

Anyhow, after starting KODI again, the Netflix plugin behaved for the first time like it did after installing it on my Anroid TV and on my Linux station.

I did not have any troubles logging into Netflix using my email address and password. So I did not need the new alternative login method.

After accessing the first video on Netflix, KODI asked me “Would you like to enable inputstream.adaptive?”. After accepting to enable it, KODI also asked me to install something called “Widevine”, which after accepting that, happened fortunately fully automatically.
And as a result everything works now.

The only thing that is annoying: Netflix treats the KODI plugin like the Netflix App on Android TV. As a result streaming content from other countries by using a VPN to obtain a US based IP address is blocked with a specific error message.
So while you can use a VPN connection to watch Netflix on your Kindle or Laptop, QNAP does not seem to be a solution. At least not for VPNs that have been already identified as VPN IPs by the Netflix service servers. So either switch to a different provider (which would then probably also work directly on your Smart TV) or switch to a regular Windows based Laptop.

And no, running Windows 7 or Windows 10 in a virtual machine on your QNAP is not a working solution. At least not on a TBS-453DX with a Celeron J4115 processor and similar NAS systems. Because the virtualization layer eats up too much of the processor power to provide a smooth video playback. You may be lucky on a stronger QNAP NAS.


RE: Installing Netflix Add-on [input-stream] on QNAP - thomas.rehberg - 2020-09-20

Very good, Storagefan, to share your experience. I struggled very much to get the Netflix plugin work reliably, however I may give it another try. I definitely did NOT install pycryptomex into the right directory, as I have had to work with the symbolic link... ...and now scratching my head if not this was the reason of my a/v desync problems.
Anyway, nice to see it is running well at you end :-)


RE: Installing Netflix Add-on [input-stream] on QNAP - thomas.rehberg - 2020-12-05

and I can confirm that this did the trick, as now my setup works stable since I applied the procedure NOT to us the symlinks but install the missing libraries using 

apt install python-pycryptodome 

That's it for a QNAP device!