Skip to main content

Music Metadata - Territories

Build Status Coverage Status GitHub PyPI

A simple library for dealing with territory hierarchies used in music metadata, currently primarily focused on CISAC TIS.

Conversion between TIS and DDEX territories will follow in the next release.

Code

It has only two classes:

  • Territory - the territory, e.g. World, Europe, Croatia
  • TerritoryList - this class makes including and excluding territories simpler, it also splits territories down when needed

World excluding USA results in a minimal list of included territories:

from music_metadata.territories.territory import Territory
from music_metadata.territories.territory_list import TerritoryList

world = Territory.get('2136')
usa = Territory.get('US')

l = TerritoryList()
l.include(world)
l.exclude(usa)

for t in sorted(l, key=lambda x: x.name):
    print(f'{t.tis_n:0>4}', t.name)

Result:

2100 AFRICA
2106 ASIA
0124 CANADA
2113 CENTRAL AMERICA
2120 EUROPE
0484 MEXICO
2130 OCEANIA
2132 SOUTH AMERICA
2134 WEST INDIES

It is simple to list all the countries as well:

for t in sorted(l.countries, key=lambda x: x.name):
    print(f'{t.tis_a:0>4}', t.name)

Result:

AF AFGHANISTAN
AL ALBANIA
DZ ALGERIA
AD ANDORRA
AO ANGOLA
AG ANTIGUA AND BARBUDA
AR ARGENTINA
AM ARMENIA
AU AUSTRALIA
AT AUSTRIA
...

One can check if a country is finally included in the list:

usa in l
False

You may test it online, no coding skills required: https://music-metadata.herokuapp.com/territories/

The code for it is here: https://github.com/musicmetadata/web-wrapper

Metadata

Release files for music-metadata-territories 19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for music-metadata-territories 19
File Size Uploaded Provenance
music_metadata_territories-19.tar.gz 21.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for music-metadata-territories 19
File Interpreter ABI Platform
music_metadata_territories-19-py3-none-any.whl Python 3 none any Details

Total release size: 43.9 kB

Release files / music_metadata_territories-19.tar.gz

Download URL music_metadata_territories-19.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6c03dd752978de339e26d594cdbb048dcedc796c79b8d89aa0e5ba8010490283
BLAKE2b-256 checksum
How to use checksums
137649fbf4ffc6ae3c596d48b4b4e03acaf844e99cf03fa7b5fa604e01f622d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

Release files / music_metadata_territories-19-py3-none-any.whl

Download URL music_metadata_territories-19-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b2ffa8f9090e0efc9e3dd22b6c8141bed99b3741e5d420e6ea895a3a1ece57a
BLAKE2b-256 checksum
How to use checksums
d74ac40202fc0b1d4af332e2354b2aa7de147adaac411ad7a9a9878e0e8c6a27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

Security for music-metadata-territories 19

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page