]> littlesong.place Git - littlesongplace.git/commitdiff
Remove mpck, always use ffmpeg
authorChris Fulljames <christianfulljames@gmail.com>
Thu, 24 Jul 2025 11:21:50 +0000 (07:21 -0400)
committerChris Fulljames <christianfulljames@gmail.com>
Thu, 24 Jul 2025 11:21:50 +0000 (07:21 -0400)
.github/workflows/test-and-deploy.yml
README.md
src/littlesongplace/songs.py
test/test_songs.py

index 906ca44a37d1ed1e1cbb195606c496ed33c8c9f5..875565c5a6ff1a02af69cf0a57e2d403aebc7136 100644 (file)
@@ -100,11 +100,6 @@ jobs:
       with:
         python-version: "3.11"
 
-    - name: Install mpck
-      run: |
-        wget https://github.com/Sjord/checkmate/releases/download/v0.21/mpck_0.21-1_amd64.deb
-        sudo dpkg --install mpck_0.21-1_amd64.deb
-
     - name: Install Dependencies
       run: |
         python -m pip install --upgrade pip
index 0a11fc9216e76b493952384e161096e2709b3364..8ac18c7bc0d54822b1aa858fccece9f3cdbb40cb 100644 (file)
--- a/README.md
+++ b/README.md
@@ -16,7 +16,6 @@ Important Places:
 ## Dependencies
 This project has some dependencies that need to be installed manually to your system PATH:
 - [Python 3.11](https://python.org)
-- mpck from [Checkmate](https://github.com/Sjord/checkmate)
 - [ffmpeg](https://ffmpeg.org/)
 
 ## Environment Setup
index eaffdaff9bc7634f6385f84363e540046f105858..be04b466762556d0b07da656e2c0dc9e4b3f18e2 100644 (file)
@@ -476,16 +476,7 @@ def convert_song(tmp_file, request_file, yt_url):
             flash_and_log(f"Failed to import from YouTube URL: {yt_url}")
             return False
 
-    result = subprocess.run(["mpck", tmp_file.name], stdout=subprocess.PIPE)
-    res_stdout = result.stdout.decode()
-    current_app.logger.info(f"mpck result: \n {res_stdout}")
-    lines = res_stdout.split("\n")
-    lines = [l.strip().lower() for l in lines]
-    if any(l.startswith("result") and l.endswith("ok") for l in lines):
-        # Uploaded valid mp3 file
-        return True
-
-    # Not a valid mp3, try to convert with ffmpeg
+    # Try to convert with ffmpeg
     with tempfile.NamedTemporaryFile(suffix=".mp3", delete=False) as out_file:
         out_file.close()
         os.remove(out_file.name)
index 3fa526f20352c6a9ec181fc89d42a92422538d61..e0f79d4791033d22d23a0ea4638a6a39525645af 100644 (file)
@@ -110,8 +110,9 @@ def test_update_song_success(client):
     upload_song(client, b"Successfully updated &#39;song title&#39;", filename=TEST_DATA/"sample-6s.mp3", songid=1)
     response = client.get("/song/1/1")
     assert response.status_code == 200
-    with open(TEST_DATA/"sample-6s.mp3", "rb") as expected_file:
-        assert response.data == expected_file.read()
+    # File has been converted by ffmpeg, will not match byte-for-byte
+    # with open(TEST_DATA/"sample-6s.mp3", "rb") as expected_file:
+    #     assert response.data == expected_file.read()
 
 @pytest.mark.yt
 def test_update_song_from_youtube(client):
@@ -264,8 +265,11 @@ def test_delete_song_other_users_song(client):
 def test_get_song(client):
     create_user_and_song(client)
     response = client.get("/song/1/1")
-    with open(TEST_DATA/"sample-3s.mp3", "rb") as mp3file:
-        assert response.data == mp3file.read()
+    assert response.status_code == 200
+
+    # File has been converted by ffmpeg, will not match byte-for-byte
+    # with open(TEST_DATA/"sample-3s.mp3", "rb") as mp3file:
+    #     assert response.data == mp3file.read()
 
 def test_get_song_invalid_song(client):
     create_user_and_song(client)