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
Werkobjects orNoneif 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
Werkobjects orNoneif 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
Werkobjects orNoneif 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_werkverlagswerknummernisrcerstellung_datumtitelwerknummerwerkfassungsnummersonstige_titelinterpretensprachegattungbesetzungiwkfrei_vverbundene_schutzfristverteilung_arverteilung_vroriginalverlagesubverlageaenderung_datumspieldauerstatusurheber
Urheber (Author/Composer)
typeip_name_numbernamevornamenachnameidentifierrolleis_bevollmaechtigtis_eigenes_konto
Interpret (Performer)
namenachname
Besetzung (Instrumentation)
anzahl_instrumenteanzahl_spieleranzahl_stimmenbezeichnung
Verlag (Publisher)
typeip_name_numbernameis_bevollmaechtigtis_eigenes_kontoidentifier
License
GPLv3
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3881acd72a7c8bd486fd39f7a0c3e69e0fed4a18495e1ccb904703a384630aa6
|
|
| MD5 |
07641e6a2acb61e82f2316f5441917e2
|
|
| BLAKE2b-256 |
226ecf59f1635847ecbd37b0f22aadd9ac9cbb0d3a503d764f2dcee52d4b8a78
|
Provenance
The following attestation bundles were made for pygemasearch-0.1.4.tar.gz:
Publisher:
workflow.yml on DonMikone/PyGEMASearch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygemasearch-0.1.4.tar.gz -
Subject digest:
3881acd72a7c8bd486fd39f7a0c3e69e0fed4a18495e1ccb904703a384630aa6 - Sigstore transparency entry: 206092721
- Sigstore integration time:
-
Permalink:
DonMikone/PyGEMASearch@c6b2b892b8dbfdd2b2f7b3a9f20100b6ef62a600 -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/DonMikone
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@c6b2b892b8dbfdd2b2f7b3a9f20100b6ef62a600 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1986b2b4d391f299ad0e2c893c2409eae7e6f5db197e63c10938562a3ba094c6
|
|
| MD5 |
2019c6534a610f9f482df2334a585bb4
|
|
| BLAKE2b-256 |
af111e9cddda69dd2ccf32cb6729905078822384543d735578937ca541dd7bd1
|
Provenance
The following attestation bundles were made for pygemasearch-0.1.4-py3-none-any.whl:
Publisher:
workflow.yml on DonMikone/PyGEMASearch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygemasearch-0.1.4-py3-none-any.whl -
Subject digest:
1986b2b4d391f299ad0e2c893c2409eae7e6f5db197e63c10938562a3ba094c6 - Sigstore transparency entry: 206092724
- Sigstore integration time:
-
Permalink:
DonMikone/PyGEMASearch@c6b2b892b8dbfdd2b2f7b3a9f20100b6ef62a600 -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/DonMikone
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@c6b2b892b8dbfdd2b2f7b3a9f20100b6ef62a600 -
Trigger Event:
release
-
Statement type: