Skip to main content

Music Metedata - Territory-related tools

Project description

Music Metadata - Territories

Build Status Coverage Status GitHub PyPI

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

It loads the territories and hierarchies from CSV files, made from Excel files downloaded from CISAC documents.

One of the most importaint features is that it turns any combination of includes and excludes into a include-only list.

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, e.g. World excluding Croatia results in a minimal list of included territories, and not all the countries:
from music_metadata.territories import *

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for music-metadata-territories, version 19rc2
Filename, size File type Python version Upload date Hashes
Filename, size music_metadata_territories-19rc2-py3-none-any.whl (22.7 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size music_metadata_territories-19rc2.tar.gz (19.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page