keep a running M3U playlist of music shared in a channel
Find a file
2025-11-16 17:26:46 -05:00
base-config.yaml *: adding per room toggle 2025-11-16 17:26:46 -05:00
Makefile *: adding per room toggle 2025-11-16 17:26:46 -05:00
maubot.yaml *: adding per room toggle 2025-11-16 17:26:46 -05:00
musiccollector.py *: adding per room toggle 2025-11-16 17:26:46 -05:00
musiccollector_migrations.py *: adding per room toggle 2025-11-16 17:26:46 -05:00
README.md *: adding per room toggle 2025-11-16 17:26:46 -05:00
requirements.txt remove spotdl entirely. Song.link to yt-dlp only. 2025-11-13 11:44:53 -05:00

Music Collector Maubot Plugin

A maubot plugin that collects music shared in Matrix channels and adds it to an M3U playlist.

Features

  • Detects Spotify, YouTube Music, album.link, and song.link URLs in Matrix messages
  • Resolves album.link/song.link to their source platforms using the Linktree API
  • Downloads audio using yt-dlp (handles both YouTube and Spotify through song.link API)
  • Uploads MP3 files to Nextcloud
  • Generates and updates M3U playlists per Matrix room
  • Provides shareable links for both individual tracks and playlists

Installation

  1. Install the required dependencies:

    pip install maubot yt-dlp aiohttp pyyaml
    
  2. Configure the plugin with your Nextcloud credentials in base-config.yaml

  3. Build and deploy the plugin to your maubot instance

Configuration

The plugin requires the following configuration in base-config.yaml:

# Nextcloud credentials
nextcloud_url: "https://your-nextcloud-instance.com"
nextcloud_username: "your_username"
nextcloud_password: "your_password"
nextcloud_folder_path: "/MusicCollection"

# Playlist configuration
playlist_base_path: "/tmp/playlists"

# Optional: (spotdl has been removed, this configuration is no longer used)
# Spotify links are now resolved through the song.link API
# spotify_client_id: ""
# spotify_client_secret: ""

# Optional: List of room IDs where the plugin should be enabled
# If not specified or empty, the plugin works in all rooms
# enabled_rooms:
#   - "!roomid1:example.com"
#   - "!roomid2:example.com"

# Optional: Command prefix for plugin commands (default: "!music")
# command_prefix: "!music"

How it works

  1. The plugin monitors Matrix room messages for music URLs
  2. When a URL is detected:
    • Spotify/Youtube links are processed directly
    • album.link/song.link URLs are resolved to their sources using the Linktree API
    • Audio is downloaded using yt-dlp (handles both YouTube and Spotify through song.link API)
    • MP3 files are uploaded to MEGA.co.nz
    • M3U playlist for the room is updated with the new track
    • Shareable links are provided for both the track and the updated playlist

Supported Sources

  • Spotify (tracks, albums, playlists)
  • YouTube Music (videos, playlists)
  • album.link URLs
  • song.link URLs

License

MIT