Project-Siesta

A simple but very useful Telegram Bot for Moosic - GitHub

FEATURES

  • Download Tidal, Qobuz at every available quality
  • Supports upload to : Rclone, Local Storage, Telegram
  • Faster downloads - Multi-threaded downloads
  • Support Index links (Alist Tested)
  • More? Deploy the bot and check it out 😉

SETUP

Docker Builds are recommended :)

For the very worst case scenario (you not understanding how to deploy), you can ask ChatGPT (very much appreciated)

1) Using Manual - Docker Builds

Requirements

  • Git installed (optional)
  • Of course Docker installed (how would ya do docker method without docker 🤷‍)

Steps

  • Git clone (or download) the repo
  • Fill out the required variables in sample.env
  • Build the image using the Docker build command
    sudo docker build . -t project-siesta
    
  • Now run the created Docker image
    sudo docker run -d --env-file sample.env --name siesta project-siesta
    
  • At this point your bot will be running (if everything correct)
2) Using Automated - Docker Builds (Fast)

Premade Docker Images are available at Dockerhub repo weebzbots/project-siesta
These images are made using GitHub Actions

  • Supported architectures
    • arm64
    • amd64
  • Build Tags
    • latest - Latest stable releases from main branch
    • beta - Latest beta releases from beta branch (early feature testing)
    • <commit-hash> - You can use specific commit hash for specific versions

Requirements

  • Of course Docker installed (how would ya do docker method without docker 🤷‍)

Steps

  • Pull the Docker image
    sudo docker pull weebzcloud/project-siesta
    
  • Somewhere in your server, create a .env file with required variables (refer here)
  • Run the image
    sudo docker run -d --env-file .env --name siesta project-siesta
    
  • At this point your bot will be running (if everything correct)

Requirements

  • Python>=3.10 (3.12 recommended)
  • Git installed (optional)
  • Rclone (optional)

Steps

  • Git clone (or download) the repo
  • Create virtual environment and run
    virtualenv -p python3 VENV
    . ./VENV/bin/activate
    
  • Edit and fill out the essentials environment variables in sample.env (refer here)
  • Rename sample.env to .env
  • Finally run
    pip install -r requirements.txt
    python -m bot
    

VARIABLES INFO

Essential Variables

These variables are must for the bot to start

The working will be restricted much if you only fill these info.
ie. you also need some of the optional variables for the features accordingly)

  • TG_BOT_TOKEN
    • Telegram Bot token
    • Get it from BotFather
    • str
  • APP_ID
    • Your Telegram APP ID
    • Get it from my.telegram.org
    • Create an APP if you don't have any in your Telegram account
    • int
  • API_HASH
    • Your Telegram APP HASH
    • Get it from my.telegram.org
    • Create an APP if you don't have any in your Telegram account
    • str
  • DATABASE_URL
    • Postgres database URL
    • For this you can use any of the Postgres Provides (even selfhost it)
    • Online providers : aiven.io, neon.tech
    • str
  • BOT_USERNAME
    • Your Telegram Bot username (with or without @)
    • You would have given a bot username when creating a bot in BotFather
    • str
  • ADMINS
    • List of Admin users for the Bot (seperated by comma) (str)
    • You can get your ID from MissRose - use the command /id
    • Eg : 721910681,106817219
    • str
Optional Variables

Basic

  • DOWNLOAD_BASE_DIR
    • Downloads folder for the bot (folder is inside the working directory of bot)
    • Mostly you don't need to change this value
    • str
  • LOCAL_STORAGE
    • Folder (full path needed) where you want to store the downloaded file.
    • This is usefull when you want to store the files in the server itself (no uploading)
    • Anyways you need to enable this option in bot settings for this to work
    • str
  • RCLONE_CONFIG
    • Rclone config as text or URL to file
    • You can ignore this if you add config file manually to root of repo
    • Also not needed if you don't need Rclone
    • str
  • RCLONE_DEST
    • Rclone destination as <remote-name>:<folder-in-remote>
    • This value must be filled if you are using Rclone
    • str
  • INDEX_LINK
    • If index link needed for Rclone uploads (tested with alist)
    • No trailing slashes /
    • Eg : https://weebz.eu.org
    • str
  • MAX_WORKERS
    • Multithreading limit (kind of more speed)
    • Don't increase it like a monkey
    • More the value - More the stress on CPU
    • Keep it at 5 for optimum speed
    • int
  • TRACK_NAME_FORMAT
    • Naming format for tracks (check metadata section for tags supported)
    • Do not add extension value here (it is automatically added)
    • Eg : {title} - {artist}
    • str
  • PLAYLIST_NAME_FORMAT
    • Similar to TRACK_NAME_FORMAT but for Playlists
    • Note: all tags might not be available
    • str

Qobuz
For authorization, you only need any one of the (email, pass) pair or (user, token) pair
Use any one of the pair only

  • QOBUZ_EMAIL
    • Email ID for logging into Qobuz
    • str
  • QOBUZ_PASSWORD
    • Password for logging into Qobuz
    • str
  • QOBUZ_USER
    • User ID for Qobuz
    • int
  • QOBUZ_TOKEN
    • User token for Qobuz
    • str

Tidal

  • ENABLE_TIDAL
    • To enable the Tidal module - True/False
    • Set it to True for enabling Tidal Module
    • bool
  • TIDAL_MOBILE
    • To enable Tidal Mobile sessions - True/False
    • bool
  • TIDAL_MOBILE_TOKEN
    • HiRes Mobile token for Tidal
    • You need this for downloading MAX quality tracks from Tidal
    • Get your own token - guide
    • Or use public ones (sauce? don't ask me)
    • str
  • TIDAL_ATMOS_MOBILE_TOKEN
    • Atmos Mobile token for Tidal
    • Needed for downloading ATMOS AC4 Codec
    • Get your own token - guide
    • str
  • TIDAL_TV_TOKEN
    • TV/Auto Token for Tidal
    • Needed for Web-Login
    • Also needed for ATMOS-EAC3-JOC
    • Get your own token - guide
    • Also needs Secret (below)
    • str
  • TIDAL_TV_SECRET
    • TV/Auto Secret for Tidal
    • The secret should be matching for the above token (must)
    • Get your own secret - guide
    • str
  • TIDAL_CONVERT_M4A
    • Convert the MAX quality tracks to FLAC
    • Normally MAX quality tracks comes in M4A
    • So we convert this using FFMPEG

TV/Auto Token and Secret can be found here

BOT SETTINGS

You can change some of the settings in Bot itself.

  • Open the bot settings panel using /settings

The panel contains 3 options

  • Core Settings
  • Providers Settings
  • Telegram Settings
Core Settings

These settings are related with how the bot downloads and uploads.
Now each of the options are explained :

  • Upload : Where to store the downloaded file. There are 3 options
    • Telegram : Upload the files to telegram (concurrent uploads are disabled for telegram to overcome FloodWait)
    • Rclone : Upload to the remote specified in the Rclone Config (error if no config added)
    • Local - Store the files in the local storage itself (need LOCAL_STORAGE to be added as variable)
  • Return Link : Whether to show links if uploaded using Rclone, 4 options exists
    • Index - Shows Index Link when upload finished (needs INDEX_LINK to be set)
    • Rclone - Shows sharing enabled link from the remote using Rclone (the remote needs to support link sharing)
    • Both - Enables both of the above features together
    • False - Entirely disables this feature
  • Sort Playlist
    • This is a handy feature where the playlist songs are sorted according to artist and albums.
    • That is, the track will be in /<artist}>/<album>/ folder. Normally the tracks are placed inside /<playlist>/
  • Disable Sort Link
    • For the tracks sorted in the playlist, normally bot gives link (if enabled) for each track sorted (because the tracks are at different places)
    • This feature disables the links for sorted playlist only (so chat looks clean)
  • Zip Playlist
    • Zips the entire playlist
    • For Telegram uploads the zips gets splitted if near 2gb in size
  • Playlist Batch Download
    • When enabled, the bot downloads all the tracks in the playlist concurrently (making the download much faster). But this consumes a lot of storage.
    • Suppose the playlist has 200 tracks and quality is at maximum - so the bot may consume 10-15 gb at once.
    • When this feature is disabled, the bot download and upload a single file at a time - thus saving storage
  • Artist Batch Download
    • Same as above feature, but for Artist downloads
    • Another change here is, rather than each track - each album is upload at a time (so it maybe somewhat faster when disabled also)
  • Zip Artist
    • Zip the entire artist
    • For Telegram uploads the zips gets splitted if near 2gb in size
  • Art Poster
    • Whether to show album art or cover photo for artist, album, playlist etc
    • It upload the photo in telegram with some details in the post
    • You can edit the details in here
Telegram Settings
  • Bot Public
    • Set the bot for public usage
    • That is the bot does not restrict users
  • Anti Spam : Usefull feature for avoiding people spamming multiple downloads to the bot. There are 3 options for this
    • OFF : Disables this feature
    • USER
      • Restrict each user to add a single download at a time.
      • This feature works in both personal message and groups
      • For groups - a user is restricted to a single task only, but other users can download at the same time
      • That is, the restriction applies to only a single person
    • CHAT+ : This restricts chats (groups and personal messages).
      • For Groups this restricts one user task at a time
      • But this feature enables user pm to work at the same it
      • To restrict User Personal messages while using this feature - Disable bot public and set authorised chat to your group only
  • Language
    • This changes the bot interface language for all users (may be bugged as i dont have much translations added for every language)
    • Contribute to more languages in GitHub (please)
Providers Settings

Tidal

  • Authorizations
    • Add Login : Login to bot using your Tidal account
    • Remove Login : Removes the added account (this button only shows when already an account is added)
    • Refresh Auth : Tidal has 7 day expiry for the login session. So this button can be used to refresh the session
  • Quality
    • LOW - 6kbit/s AAC
    • HIGH - 320kbit/s AAC
    • LOSELESS - 44.1/16bit FLAC
    • MAX - 48/24bit FLAC
    • Spatial - Download the spatial version of the track
      • ATMOS AC3 JOC - Its actually EAC3 Dolby (needs Tidal TV/Auto client to be added)
      • ATMOS AC4 - AC4 version of Dolby (needs Tidal Mobile Atmos client to be added)

Qobuz

  • Quality : These options are straight forward like it says (i.e., the details are specified there itself)
Edit

Pub: 01 Jan 2025 15:48 UTC

Edit: 14 Jan 2025 15:11 UTC

Views: 334