Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Sordoillet <victor@groover.co>2024-09-30 16:55:37 +0200
committerArthur de Jong <arthur@arthurdejong.org>2024-10-13 13:11:12 +0200
commitbcd5018ee6842a13b07b168c6bc01c5d28c87406 (patch)
tree07562c8b835dc1ffb2ec4a4100747e745d27b13e
parent020f1df5a4e51685227d6301b0d8ff25a7a7bc2b (diff)
Add missing music industry ISRC country codesHEADmaster
Closes https://github.com/arthurdejong/python-stdnum/pull/455 Closes https://github.com/arthurdejong/python-stdnum/issues/454
-rw-r--r--stdnum/isrc.py20
-rw-r--r--tests/test_isrc.doctest4
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.