From 4176f6e7b4a91eada4b8e48065901493dfbebc77 Mon Sep 17 00:00:00 2001 From: Madison Swain-Bowden Date: Wed, 13 Mar 2024 08:47:10 -0700 Subject: [PATCH] ccMixter: Handle spaces in URLs (#3907) --- catalog/dags/providers/provider_api_scripts/cc_mixter.py | 2 +- .../resources/cc_mixter/expected_single_record.json | 4 ++-- .../resources/cc_mixter/single_item.json | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/catalog/dags/providers/provider_api_scripts/cc_mixter.py b/catalog/dags/providers/provider_api_scripts/cc_mixter.py index 66eadd1fb3b..1f5254def95 100644 --- a/catalog/dags/providers/provider_api_scripts/cc_mixter.py +++ b/catalog/dags/providers/provider_api_scripts/cc_mixter.py @@ -193,7 +193,7 @@ def _get_audio_files( files = [ { - "url": file["download_url"], + "url": file["download_url"].replace(" ", "%20"), "filesize": file["file_rawsize"], "filetype": file["file_format_info"]["default-ext"], "sample_rate": self._get_sample_rate( diff --git a/catalog/tests/dags/providers/provider_api_scripts/resources/cc_mixter/expected_single_record.json b/catalog/tests/dags/providers/provider_api_scripts/resources/cc_mixter/expected_single_record.json index 7f396411bc6..1aabf31df0f 100644 --- a/catalog/tests/dags/providers/provider_api_scripts/resources/cc_mixter/expected_single_record.json +++ b/catalog/tests/dags/providers/provider_api_scripts/resources/cc_mixter/expected_single_record.json @@ -30,14 +30,14 @@ "VBR", "instrumental" ], - "url": "https://ccmixter.org/content/testuser/testuser_-_Test_Music.mp3", + "url": "https://ccmixter.org/content/testuser/testuser%20-%20Test_Music.mp3", "sample_rate": 44100, "filetype": "mp3", "filesize": 11150278, "duration": 346000, "alt_files": [ { - "url": "https://ccmixter.org/content/testuser/testuser_-_Test_Music.flac", + "url": "https://ccmixter.org/content/testuser/testuser%20-%20Test_Music.flac", "sample_rate": 44000, "filetype": "flac", "filesize": 111502780, diff --git a/catalog/tests/dags/providers/provider_api_scripts/resources/cc_mixter/single_item.json b/catalog/tests/dags/providers/provider_api_scripts/resources/cc_mixter/single_item.json index d21e87f9d6a..6ac828e771c 100644 --- a/catalog/tests/dags/providers/provider_api_scripts/resources/cc_mixter/single_item.json +++ b/catalog/tests/dags/providers/provider_api_scripts/resources/cc_mixter/single_item.json @@ -46,7 +46,7 @@ "file_order": 0, "file_is_remote": 0, "file_num_download": 0, - "download_url": "https://ccmixter.org/content/testuser/testuser_-_Test_Music.zip", + "download_url": "https://ccmixter.org/content/testuser/testuser - Test_Music.zip", "local_path": "/var/www/ccmixter/content/testuser/testuser_-_Test_Music.zip", "file_rawsize": 11150278 }, @@ -74,7 +74,7 @@ "file_order": 0, "file_is_remote": 0, "file_num_download": 0, - "download_url": "https://ccmixter.org/content/testuser/testuser_-_Test_Music.flac", + "download_url": "https://ccmixter.org/content/testuser/testuser - Test_Music.flac", "local_path": "/var/www/ccmixter/content/testuser/testuser_-_Test_Music.flac", "file_rawsize": 111502780 }, @@ -100,7 +100,7 @@ "file_order": 0, "file_is_remote": 0, "file_num_download": 0, - "download_url": "https://ccmixter.org/content/testuser/testuser_-_Test_Music.mp3", + "download_url": "https://ccmixter.org/content/testuser/testuser - Test_Music.mp3", "local_path": "/var/www/ccmixter/content/testuser/testuser_-_Test_Music.mp3", "file_rawsize": 11150278 }