What is Elementum?
masterlibtorrent).repository·master·Indexed 20 days ago
https://github.com/elgatito/plugin.video.elementumElementum is a high-performance torrent finding and streaming engine for Kodi. It orchestrates external Kodi add-on providers to locate BitTorrent links and streams them using a custom Go-based engine built on libtorrent. The project includes the elementum-web interface (built with React), a bjsonrpc server for bidirectional JSON-RPC communication over TCP/IP, and tools for compiling the daemon and bundling Kodi-installable ZIP files.
libtorrent).Elementum relies on external 'providers' to find media streams.
The elementum-web package is built using Create React App. To ensure a successful build, you must use Node.js 12.
To start the development server, run npm start. The application will be available at http://localhost:3000. The server supports hot reloading, meaning the page will automatically reload when you make edits, and linting errors will be displayed in the console.
npm startnpm test. This allows you to monitor tests as you make changes to the code.npm testOnce binaries are compiled, use the bundle.sh script located in the plugin.video.elementum folder to create a .zip file for Kodi installation. This script combines the Python logic with the compiled binaries.
Usage Patterns:
To bundle all collected platforms into a zip in the current folder:
./bundle.sh --binaries=/path/to/elementum/buildTo bundle a specific platform with a custom suffix and target directory:
./bundle.sh --binaries=/path/to/elementum/build --platform=android_arm64 --suffix=custom_suffix_to_add_into_zip --target=/destination/folder/To view available options:
./bundle.sh --helpNote: After installing a new zip, restart Kodi to ensure the new code is running rather than a mix of old and new files.
# Bundle all platforms
./bundle.sh --binaries=/path/to/elementum/build
# Bundle specific platform with custom suffix
./bundle.sh --binaries=/path/to/elementum/build --platform=android_arm64 --suffix=custom_suffix_to_add_into_zip --target=/destination/folder/To prepare a release of the plugin, you must bundle existing binaries, verify Python dependencies and syntax, check localizations, and then generate/upload zip files. The process requires a GitHub access token (GH_TOKEN) and a configured Go environment (GOPATH).
elementum-binaries repository and move them to resources/bin/.pip install -r requirements.txt and run flake8 for syntax checking../scripts/xgettext.sh and make to ensure localizations are intact and the project compiles.make zipfiles to create the Kodi-compatible zip files.make upload to push the zip files to a GitHub release.#!/bin/bash
set -e
TAG=$(git describe --tags)
export GH_TOKEN=your_github_access_token
export PATH=$HOME/go/bin:/usr/lib/go-1.9/bin/:$PATH
export GOPATH=$HOME/go
git checkout master
rm -rf plugin.video.elementum
# Get current binaries
wget https://github.com/elgatito/elementum-binaries/archive/master.zip && \
unzip master.zip && \
mv elementum-binaries-master/* resources/bin/ && \
rm -rf elementum-binaries-master && \
rm master.zip
sudo -S true
# Check dependencies and syntax
pip install -r requirements.txt
python -m flake8
# Check localizations and compile
./scripts/xgettext.sh
make
if [[ $TAG != *-* ]]
then
make zipfiles
make upload
fiIf you need full control over the underlying build tools (Webpack, Babel, ESLint, etc.), you can run npm run eject.
WARNING: This is a one-way operation. Once you eject, you cannot go back.
Executing this command will remove the single build dependency and copy all configuration files and transitive dependencies directly into your project directory. After ejecting, you are responsible for managing the configuration and dependencies yourself.
npm run ejectTo create a production-ready version of the application, run npm run build. This command:
The resulting production files will be located in the build folder.
npm run buildTo build the elementum daemon from source, you must work within the elementum directory. This process uses Docker images containing the necessary compilers and libtorrent-go libraries.
Pull required Docker images:
make pull-allCompile for a specific platform:
make android-arm64-sharedmake android-x86Compile for all supported platforms:
make allCompiled binary files are placed in the /build folder.
# Pull all docker images
make pull-all
# Compile for specific platform
make android-arm64-shared
make android-x86
# Compile for all platforms
make allTo ensure Elementum functions correctly within Kodi, you must enable specific service settings before installation:
Use createserver() to instantiate a bjsonrpc.server.Server object bound to a specific host and port. This server listens for incoming TCP connections. By default, it binds to 127.0.0.1 on port 10123 for security. To allow connections from any interface, use 0.0.0.0 as the host.
To define which remote functions are available to clients, pass a class to the handler_factory parameter. This class will be instantiated to handle incoming RPC requests.
import bjsonrpc
# Create a server listening on all interfaces
server = bjsonrpc.createserver("0.0.0.0")
# Start the server loop
server.serve()Use connect() to instantiate a bjsonrpc.connection.Connection object that establishes a TCP connection to a remote bjsonrpc server.
Once connected, you can invoke remote methods on the server using the conn.call attribute. By default, the handler_factory is set to bjsonrpc.handlers.NullHandler, which means no functions are executable by the server unless a custom handler is provided.
import bjsonrpc
# Connect to a remote server
conn = bjsonrpc.connect("rpc.host.net")
# Call a method available on the server side
result = conn.call.some_method_in_server_side()
print(result)