I2music : JS-Free music player, with torrent packing/indexing
Posted: Mon Mar 03, 2025 5:50 pm

Leopold wanted to find a way to have music on an eepsite without needing JS, or loading all of the audio files at once. For those of you that have used the save feature on simp.i2p, it works by using a tiny iframe as the number. This was done to avoid refreshing the whole page. You can get some limited interactivity with iframes like this, so i thought i could do the same sort of tricks for a music player without js.
It uses 4 iframes, left for track list, middle for the music/album art, top right for settings, bottom right for info. It loads the next track by using meta refresh and loading a new html page in the player iframe.
There's fully automaged audio compression/torrent creation functionality for each playlist with scraping, borrowing code from simp.i2p. You place media and image files in a directory under "/static/playlists".
If the options under "[torrent]" in the config file are enabled, running
Code: Select all
python3 updateplaylists.py
will compress all found media files (including video) for audio playback in i2p, make a torrent, and send it to your torrent client for seeding. The webapp will show a magnet link and link to download the .torrent file.
If scraping is enabled it'll show peercounts, pulling from all trackers in the "tracker_list" (also used for hashing torrents). Scraping needs to use an i2p http proxy to work.
The steps updateplaylists.py takes:
- search all playlist directories for media files and images (ignores previously converted items)
- compress all found media files to a given codec as set in "[audio_settings]", default is 64k opus as ogg for browser playback, using ffmpeg. This will accept major video formats too.
- convert any images to progressive jpeg
- hash a .torrent file for each playlist (all contents of the directory will be hashed)
- create a symlink from the playlist data folder to a torrent client watch directory (for seeding, to avoid needing 2 copies of the media files)
- copy the .torrent files to your torrent client watch directory
- creates data.json file of the tracks for the webapp to use
Input appreciated, it's in testing
Source code: http://git.simp.i2p/simp/i2music
Live test instance: http://u327ny5s3a2qy2tgeiwr3yvfhoz3lhc7 ... a.b32.i2p/