From bcd5018ee6842a13b07b168c6bc01c5d28c87406 Mon Sep 17 00:00:00 2001 From: Victor Sordoillet Date: Mon, 30 Sep 2024 16:55:37 +0200 Subject: Add missing music industry ISRC country codes Closes https://github.com/arthurdejong/python-stdnum/pull/455 Closes https://github.com/arthurdejong/python-stdnum/issues/454 --- stdnum/isrc.py | 20 ++++++++++++++++++-- tests/test_isrc.doctest | 4 ++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/stdnum/isrc.py b/stdnum/isrc.py index 7a2592c..5fc4e01 100644 --- a/stdnum/isrc.py +++ b/stdnum/isrc.py @@ -50,11 +50,27 @@ _isrc_re = re.compile( # These special codes are allowed for ISRC +# Source: https://isrc.ifpi.org/downloads/Valid_Characters.pdf _country_codes = set(_iso_3116_1_country_codes + [ - 'QM', # US new registrants due to US codes became exhausted + 'BC', # Pro-música Brazil - Brasil + 'BK', # Pro-música Brazil - Brasil + 'BP', # Pro-música Brazil - Brasil + 'BX', # Pro-música Brazil - Brasil + 'CB', # Connect - Canada 'CP', # reserved for further overflow 'DG', # reserved for further overflow - 'ZZ', # International ISRC Agency codes + 'FX', # SCPP - France + 'GX', # PPL UK - United Kingdom + 'KS', # KMCA - South Korea + 'QM', # US new registrants due to US codes became exhausted + 'QN', # International ISRC Agency codes - Worldwide + 'QT', # RIAA - US + 'QZ', # RIAA - US + 'UK', # PPL UK - United Kingdom + 'XK', # International ISRC Agency codes - Kosovo + 'YU', # International ISRC Agency codes - Former Yugoslavia before 2006 + 'ZB', # RISA - South Africa + 'ZZ', # International ISRC Agency codes - Worldwide ]) diff --git a/tests/test_isrc.doctest b/tests/test_isrc.doctest index bebe0c4..7911078 100644 --- a/tests/test_isrc.doctest +++ b/tests/test_isrc.doctest @@ -34,6 +34,10 @@ These are normal variations that should just work. 'USSKG1912345' >>> isrc.validate('us-skg1912345') 'USSKG1912345' +>>> isrc.validate('GX26J2400002') +'GX26J2400002' +>>> isrc.validate('FXR592300639') +'FXR592300639' Tests for mangling and incorrect country codes. -- cgit v1.2.3