Skip to content

YisusChrist/python-metallum

 
 

Repository files navigation

python-metallum

            Tests Passing    GitHub pull requests    License


Report Bug · Request Feature · Ask Question · Report security bug


Alt


Table of Contents

Introduction

This is a versatile yet unofficial python API for the well known Metal Archives website, also known as Encyclopaedia Metallum. It allows you to search for bands, albums and songs to get detailed information about them.

Here is a simple UML diagram of the main model classes used in the project:

UML diagram

Thanks to py2puml and PlantUML for the easy generation of the diagram!

Requirements

Here's a breakdown of the packages needed and their versions:

Note

The software has been developed and tested using Python 3.12.1. The minimum required version to run the software is Python 3.6. Although the software may work with previous versions, it is not guaranteed.

Installation

From PyPI

pip3 install python-metallum

Important

For best practices and to avoid potential conflicts with your global Python environment, it is strongly recommended to install this program within a virtual environment. Avoid using the --user option for global installations. We highly recommend using pipx for a safe and isolated installation experience. Therefore, the appropriate command to install python-metallum would be:

pipx install python-metallum

Manual installation

If you prefer to install the program manually, follow these steps:

Warning

This will install the version from the latest commit, not the latest release.

  1. Download the latest version of python-metallum from this repository:

    git clone https://github.com/YisusChrist/python-metallum
    cd python-metallum
  2. Install the package:

    poetry install

Uninstall

If you installed it from PyPI, you can use the following command:

pipx uninstall python-metallum

Usage

Artist search

import metallum

# Search bands matching term
bands = metallum.band_search('metallica')
# -> [<SearchResult: Metallica | Thrash Metal (early), Hard Rock/Heavy/Thrash Metal (later) | United States>]

bands[0].name
# -> 'Metallica'

# Fetch band page
band = bands[0].get()

# Get all albums
band.albums
# -> [<Album: No Life 'til Leather (Demo)>, <Album: Kill 'Em All (Full-length)>, ...]

# Get only full-length albums
full_length = band.albums.search(type=metallum.AlbumTypes.FULL_LENGTH)
# -> [<Album: Kill 'Em All (Full-length)>, <Album: Ride the Lightning (Full-length)>, <Album: Master of Puppets (Full-length)>, <Album: ...and Justice for All (Full-length)>, <Album: Metallica (Full-length)>, <Album: Load (Full-length)>, <Album: ReLoad (Full-length)>, <Album: Garage Inc. (Full-length)>, <Album: St. Anger (Full-length)>, <Album: Death Magnetic (Full-length)>, <Album: Hardwired... to Self-Destruct (Full-length)>]

album = full_length[2]
album.title
# -> 'Master of Puppets'

album.date
# -> datetime.datetime(1986, 3, 3, 0, 0)

# Get all tracks
album.tracks
# -> [<Track: Battery (313)>, <Track: Master of Puppets (516)>, <Track: The Thing That Should Not Be (397)>, <Track: Welcome Home (Sanitarium) (388)>, <Track: Disposable Heroes (497)>, <Track: Leper Messiah (341)>, <Track: Orion (508)>, <Track: Damage, Inc. (330)>]

Album search

import metallum

# Search albums matching term
metallum.album_search('seventh')
# -> []

# Search albums containing term
metallum.album_search('seventh', strict=False)
# -> [<SearchResult: Beherit | Seventh Blasphemy | Demo>, <SearchResult: Black Sabbath | Seventh Star | Full-length>, ...]

# Search albums by band
metallum.album_search('seventh', band='iron maiden', strict=False)
# -> [<SearchResult: Iron Maiden | Seventh Son of a Seventh Son | Full-length>]

Refer to source and doctests for detailed usage

Contributors

How do I contribute to python-metallum?

Before you participate in our delightful community, please read the code of conduct.

I'm far from being an expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!

We also need people to test out pull requests. So take a look through the open issues and help where you can.

See Contributing Guidelines for more details.

License

python-metallum is released under the MIT License.

Releases

No releases published

Packages

No packages published

Languages

  • Python 90.8%
  • Makefile 9.2%