Skip to main content

Music Metedata - Territory-related tools

Project description

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

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

music_metadata_territories-19.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

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

music_metadata_territories-19-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file music_metadata_territories-19.tar.gz.

File metadata

  • Download URL: music_metadata_territories-19.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for music_metadata_territories-19.tar.gz
Algorithm Hash digest
SHA256 6c03dd752978de339e26d594cdbb048dcedc796c79b8d89aa0e5ba8010490283
MD5 b19f12f1803d0052409446af2c4f5e20
BLAKE2b-256 137649fbf4ffc6ae3c596d48b4b4e03acaf844e99cf03fa7b5fa604e01f622d0

See more details on using hashes here.

File details

Details for the file music_metadata_territories-19-py3-none-any.whl.

File metadata

  • Download URL: music_metadata_territories-19-py3-none-any.whl
  • Upload date:
  • Size: 22.8 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for music_metadata_territories-19-py3-none-any.whl
Algorithm Hash digest
SHA256 3b2ffa8f9090e0efc9e3dd22b6c8141bed99b3741e5d420e6ea895a3a1ece57a
MD5 b86a56b28ad6d516cecab22d929dc10f
BLAKE2b-256 d74ac40202fc0b1d4af332e2354b2aa7de147adaac411ad7a9a9878e0e8c6a27

See more details on using hashes here.

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