I run Kodi via Libreelec on a Raspberry Pi 4 as my media centre connected to my TV. Recently I have been a bit fed up with the problems with the Youtube addon. This isn’t the fault of the addon creators but with Youtube itself changing the way stuff works, presumably to the api the addon utilizes. Besides that Youtube is morally abhorrent with the way it treats content creators and it’s users. As there is a Kodi addon available, I decided to give LBRY a shot.
According to lbry.com,
“LBRY is a new protocol that allows anyone to build apps that interact with digital content on the LBRY network. Apps built using the protocol allow creators to upload their work to the LBRY network of hosts (like BitTorrent), to set a price per stream or download (like iTunes) or give it away for free (like YouTube without ads). The work you publish could be videos, audio files, documents, or any other type of file.”lbry.com
The default installation of the Kodi LBRY addon expects the client be running locally but there is support to add a remote api server which is good as I don’t want to have the overhead of running the client locally or have to deal with storage issues. All my media is supplied to my media centre remotely from a VM on my SmartOS server so I also decided to run the lbry client on a VM.
There is lots of information available on the web on how to create the VM so I will forego that lesson. The LBRY client requires python 3.7 but newer SmartOS images will have that preinstalled.
There are a few dependencies to be met beforehand.
# First get your VM updated # pkgin up && pkgin -y ug # Install the build tools, GNU make and git pkgin -y in build-essential git gmake # Install the python pip module # pkgin -y in py37-pip # Install the python sqlite3 module # pkgin -y in py37-sqlite3
Next follow the instructions below which are shamelessly copied from the
INSTALL.md on the lbry-sdk github site.
# Clone the repository # git clone https://github.com/lbryio/lbry-sdk.git cd lbry-sdk # Create a Python virtual environment for lbry-sdk # python3.7 -m venv lbry-venv # Activating lbry-sdk virtual environment # source lbry-venv/bin/activate # Make sure you're on Python 3.7+ (as the default Python in # virtual environment) # python --version # Install packages # make install
From within the python venv the executable lbrynet will be in your
(lbry-venv) [root@lbrytest ~/lbry-sdk]# which lbrynet /root/lbry-sdk/lbry-venv/bin/lbrynet
The documentation says that it can be started by running:
# Start the lbrynet client # lbrynet start
It then fails with:
2021-03-21 17:32:02,603 ERROR lbry.extras.daemon.daemon:505: Failed to start lbrynet Traceback (most recent call last): File "/root/lbry-sdk/lbry/extras/daemon/daemon.py", line 498, in start await self.initialize() File "/root/lbry-sdk/lbry/extras/daemon/daemon.py", line 511, in initialize self.ensure_data_dir() File "/root/lbry-sdk/lbry/extras/daemon/daemon.py", line 444, in ensure_data_dir os.makedirs(self.conf.data_dir) File "/opt/local/lib/python3.7/os.py", line 221, in makedirs mkdir(name, mode) FileNotFoundError: [Errno 2] No such file or directory: ''
After a little digging in the code, it turns out that this error is down to the operating system detection in
lbry/conf.py . Illumos based operating systems identify as SunOS, so the trick is to cheat and add the line:
elif 'sunos' in sys.platform.lower(): get_directories = get_linux_directories
elif 'linux' in sys.platform.lower(): get_directories = get_linux_directories
lbrynet start the daemon should start up properly this time and create the necessary directory structure and related files in
~/.local/share/lbry The above would probably work for the BSDs too by altering
sunos to whatever those systems identify as.
The defaults run
lbrynet on the IP address of the localhost. To access content from a remote location we need to create a
daemon_settings.yml file in
~/.local/share/lbry/lbrynet/daemon_settings.yml with something like the following that suits your system.
api: 192.168.0.240:5279 streaming_server: 192.168.0.240:5280
All that is left is to restart your daemon with the following and you should then be able to access content with the LBRY addon from Kodi by setting the API Server to
lbrynet stop lbrynet start
All that’s left to do is run
lbrynet as a service. To create the service I use
manifold then import the xml with svccfg(1m). Remember to use the full path to
lbrynet because you won’t be running it from within the venv.