Skip to main content

A Python package to search for songs in the GEMA database.

Project description

PyGEMASearch

PyGEMASearch is a Python package for searching songs in the GEMA database using the public API.

Installation

pip install git+https://github.com/DonMikone/PyGEMASearch.git

Usage

from gemasearch import GemaMusicSearch

gema_search = GemaMusicSearch()
result = gema_search.search("Bohemian Rhapsody")
print(result)

GemaMusicSearch API Documentation

Overview

GemaMusicSearch provides an interface to search for musical works in the GEMA database.

Usage

Initialize the Search

from gemasearch import GemaMusicSearch

gema_search = GemaMusicSearch()

Search for a Work by Title

results = gema_search.search("Bohemian Rhapsody")
for werk in results:
    print(werk.titel)

search Function

def search(self, search_string: str, page: int = 0, page_size: int = 50, fuzzy_search=True):
  • search_string (str): The title or name of any or multiple composers/authors of the work to search for.
  • page (int): The page number of the results (default is 0).
  • page_size (int): Number of results per page (default is 50).
  • fuzzy_search (bool): Whether to perform a fuzzy search (True) or an exact match (False).
  • Returns: A list of Werk objects or None if an error occurs.

Notes

  • Use fuzzy search for better results when searching by title.

Search for a Work by Werknummer

results = gema_search.search_werknummer("17680241-007")
for werk in results:
    print(werk.titel)

search_werknummer Function

def search_werknummer(self, number_string: str, page: int = 0, page_size: int = 50):
  • number_string (str): The Werknummer to search for.
  • page (int): The page number of the results (default is 0).
  • page_size (int): Number of results per page (default is 50).
  • Returns: A list of Werk objects or None if an error occurs.

Search for a Work by ISRC

results = gema_search.search_isrc("DEUM72301260")
for werk in results:
    print(werk.titel)

search_isrc Function

def search_isrc(self, isrc: str, page: int = 0, page_size: int = 50):
  • isrc (str): The ISRC code to search for.
  • page (int): The page number of the results (default is 0).
  • page_size (int): Number of results per page (default is 50).
  • Returns: A list of Werk objects or None if an error occurs.

Example: Fetching Authors and ISRC of a Track

results = gema_search.search("Bohemian Rhapsody")
for werk in results:
    print(f"Title: {werk.titel}")
    print("Authors:")
    for urheber in werk.urheber:
        print(f"  - {urheber.vorname} {urheber.nachname} ({urheber.rolle})")
    print(f"ISRC: {werk.isrc}")

Example Usage of the Wrapper Classes

This section provides an overview of how to use the wrapper classes to iterate over results, fetch the names of the authors/composers, and e.g. retrieve the ISRC code of a track.

Example Data

Assuming we have a list of Werk objects, we can perform various operations on them.

Iterating Over Results and Fetching Author/Composer Names

werke = gema_search.search("Bohemian Rhapsody")  # Example data instances

# Iterate over works and print their titles and authors
for werk in werke:
    print(f"Title: {werk.titel}")
    print("Authors/Composers:")
    for urheber in werk.urheber:
        print(f"  - {urheber.vorname} {urheber.nachname} ({urheber.rolle})")
    print()

Retrieving the ISRC Code of a Track

# Fetch ISRC codes of a specific work
werk = werke[0]  # Example: selecting the first work
if werk.isrc:
    print(f"ISRC Codes for '{werk.titel}': {', '.join(werk.isrc)}")
else:
    print(f"No ISRC codes available for '{werk.titel}'.")

List of Properties for Each Class

Werk

  • is_eigenes_werk
  • verlagswerknummern
  • isrc
  • erstellung_datum
  • titel
  • werknummer
  • werkfassungsnummer
  • sonstige_titel
  • interpreten
  • sprache
  • gattung
  • besetzung
  • iwk
  • frei_v
  • verbundene_schutzfrist
  • verteilung_ar
  • verteilung_vr
  • originalverlage
  • subverlage
  • aenderung_datum
  • spieldauer
  • status
  • urheber

Urheber (Author/Composer)

  • type
  • ip_name_number
  • name
  • vorname
  • nachname
  • identifier
  • rolle
  • is_bevollmaechtigt
  • is_eigenes_konto

Interpret (Performer)

  • name
  • nachname

Besetzung (Instrumentation)

  • anzahl_instrumente
  • anzahl_spieler
  • anzahl_stimmen
  • bezeichnung

Verlag (Publisher)

  • type
  • ip_name_number
  • name
  • is_bevollmaechtigt
  • is_eigenes_konto
  • identifier

License

GPLv3

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

pygemasearch-0.1.4.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

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

pygemasearch-0.1.4-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file pygemasearch-0.1.4.tar.gz.

File metadata

  • Download URL: pygemasearch-0.1.4.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pygemasearch-0.1.4.tar.gz
Algorithm Hash digest
SHA256 3881acd72a7c8bd486fd39f7a0c3e69e0fed4a18495e1ccb904703a384630aa6
MD5 07641e6a2acb61e82f2316f5441917e2
BLAKE2b-256 226ecf59f1635847ecbd37b0f22aadd9ac9cbb0d3a503d764f2dcee52d4b8a78

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygemasearch-0.1.4.tar.gz:

Publisher: workflow.yml on DonMikone/PyGEMASearch

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

File details

Details for the file pygemasearch-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: pygemasearch-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pygemasearch-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1986b2b4d391f299ad0e2c893c2409eae7e6f5db197e63c10938562a3ba094c6
MD5 2019c6534a610f9f482df2334a585bb4
BLAKE2b-256 af111e9cddda69dd2ccf32cb6729905078822384543d735578937ca541dd7bd1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygemasearch-0.1.4-py3-none-any.whl:

Publisher: workflow.yml on DonMikone/PyGEMASearch

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