Skip to main content

Muzlib is a Python script that allows you to create your own music library.

Project description

Muzlib

Muzlib is a Python script that allows you to create your own music library. Music is downloaded from YouTube, and music tags are constructed using data from YouTube, Lrclib, NetEase.

Instalation

Arch Linux [AUR]

You can install python-muzlib from AUR using your favorite AUR helper, for example:

yay -S python-muzlib

From PyPI

Ensure that you have installed FFmpeg.

python -m venv .venv
source .venv/bin/activate
pip install muzlib

Usage

You can simply download discography of artist (YouTube API by default). Examople of usage

This script creates a simple database (.muzlib/db.json) to track downloaded tracks, allowing you to update an artist's discography without re-downloading existing tracks.

Available clases

There is only one (for now ) classe that can be used:

  1. muzlib(library_path: str, skip_downloaded=False): library class that uses YouTube Music metadata (100% accuracy, but sometimes poor quality metadata)

Available methods

Downloading artist's discography

Muzlib.download_artist_discography(artist_name: str, download_top_result=False)

  • artist_name: Name of artist as a string.
  • download_top_result: If set to True, choose the first matching artist automatically. By default (False), it will prompt you to confirm if the match is correct.

Downloading album

Muzlib.download_album_by_name(search_term: str, download_top_result=False)

  • search_term: The search query as a string. It is recommended to use the format: "artist1, artist2 - album_name".
  • download_top_result: If set to True, downloads the first matching result automatically. By default (False), it will prompt you to confirm if the match is correct.

Download track

Muzlib.download_track_by_name(search_term: str, download_top_result=False)

  • search_term: The search query as a string. It is recommended to use the format: "artist1, artist2 - track_name".
  • download_top_result: If set to True, downloads the first matching result automatically. By default (False), it will prompt you to confirm if the match is correct.

Backup library

Muzlib.backup_library() -> str

This function creates backup of library (even with user-changed tags). Creates file .muzlib/muzlib_backup_***.json and returns path to it.

Restore library

This function downloads track and set metadata from bacup file.

Muzlib.backup_library(backup_filepath: str)

  • backup_filepath: path of the file created by Muzlib.backup_library().

Example of use

You can use Muzlib/`` class in source code this way

import muzlib
ml = muzlib.Muzlib("Music")
ml.download_track_by_name("Ludwig Göransson - Can You Hear The Music")
ml.download_track_by_name("Ludwig Göransson - Destroyer Of Worlds", download_top_result=True)
# ml.download_artist_discography("Ludwig Göransson") 
backup_path = ml.backup_library()

ml2 = muzlib.Muzlib("Music2")
ml2.restore_library(backup_path)

After running this code, the Music and Music2 folders will be identical, each containing two tracks by Ludwig Göransson.

Troubleshooting

[!WARNING] If you encounter issues with yt-dlp, you can replace default cookies at assets/cookies.txt as described at this guide.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

muzlib-0.3.2.tar.gz (26.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

muzlib-0.3.2-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

Details for the file muzlib-0.3.2.tar.gz.

File metadata

  • Download URL: muzlib-0.3.2.tar.gz
  • Upload date:
  • Size: 26.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for muzlib-0.3.2.tar.gz
Algorithm Hash digest
SHA256 83a342c895b1d7b5ab95db14f38a4c60a49e1f3a1bdd23a01f9f14af04ed3dc8
MD5 d0c450792350319023c5198478df2ab2
BLAKE2b-256 6c1912c3fe97a77b2c66cf5d76b3e0a4ab24c4370f59ab40f49c7e8a12bb75e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for muzlib-0.3.2.tar.gz:

Publisher: python-publish.yml on ezvezdov/muzlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file muzlib-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: muzlib-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 28.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for muzlib-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 698cbdd8685e86e8a8a143b026db4a0c9e570cb66b82d125393c4108f4f100a1
MD5 1ece1948ab040fda219e398dcbe9881b
BLAKE2b-256 c36e211ba747eb70f24135b8017540f1d187d0bfa81169fec0120c3d9d77ea37

See more details on using hashes here.

Provenance

The following attestation bundles were made for muzlib-0.3.2-py3-none-any.whl:

Publisher: python-publish.yml on ezvezdov/muzlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page