This script allows you to play torrents directly in mpv by leveraging the power of TorrServer. It acts as a bridge between mpv and your running TorrServer instance, enabling seamless playback of torrent content.
Key Features:
- Plays torrent files (
.torrent
). - Plays magnet links.
- Plays torrent links (HTTP/HTTPS links to
.torrent
files). - Uses your existing TorrServer setup for downloading and streaming.
- TorrServer must be installed and running. Make sure you have TorrServer set up and accessible.
- mpv media player (https://mpv.io/).
- curl (version 8.3.0 or later): This is required only for uploading local
.torrent
files to TorrServer. It is pre-installed on most systems.
- Navigate to your mpv configuration directory:
- *nix:
~/.config/mpv/scripts/
(create thescripts
directory if it doesn't exist) - Windows:
%APPDATA%/mpv/scripts/
orportable_config/scripts/
(create thescripts
directory if it doesn't exist)
- *nix:
- Download the
torrserver_hook.lua
script. Place this file in thescripts
directory.
You need to configure the endpoint used by your TorrServer instance. By default, https://localhost:8090
is assumed.
-
Create a configuration file in your mpv
script-opts
directory:- *nix:
~/.config/mpv/script-opts/torrserver_hook.conf
(create thescript-opts
directory if it doesn't exist) - Windows:
%APPDATA%/mpv/script-opts/torrserver_hook.conf
(create thescript-opts
directory if it doesn't exist)
- *nix:
-
Open the
torrserver_hook.conf
file with a text editor and set theserver
option to the address and port of your TorrServer instance. For example:# *nix: ~/.config/mpv/script-opts/torrserver_hook.conf # Windows: %APPDATA%/mpv/script-opts/torrserver_hook.conf # portable_config/script-opts/torrserver_hook.conf server=https://my-server.lan:8090
Once installed and configured, you can play torrents in mpv using the following methods:
- Playing a local
.torrent
file: Simply open the.torrent
file with mpv:mpv big-buck-bunny.torrent
- Playing a magnet link: Open the magnet link with mpv:
mpv 'magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c&dn=Big+Buck+Bunny&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fbig-buck-bunny.torrent'
- Playing a
.torrent
link (HTTP/S): Open the link with mpv:mpv https://webtorrent.io/torrents/big-buck-bunny.torrent
The license is MIT No Attribution, unless otherwise noted.