How can I compare the cover art of 2 MP3 file using python: eyed3?

75 Views Asked by At

I am writing my own sync file for MP3 between my computer and MP3 player. I can catch new file, change in the name, artist, etc... but find if I have updated the cover is harder.

1

There are 1 best solutions below

0
porcumare1234 On

Use this command to get the image file.

eyeD3 --write-images=DIR mp3_file

Code for comparing the images:

import cv2
import numpy as np
original = cv2.imread("imaoriginal_golden_bridge.jpg")
duplicate = cv2.imread("images/duplicate.jpg")
# Check if 2 images are equals
if original.shape == duplicate.shape:
print("The images have same size and channels")
difference = cv2.subtract(original, duplicate)
b, g, r = cv2.split(difference)
if cv2.countNonZero(b) == 0 and cv2.countNonZero(g) == 0 and cv2.countNonZero(r)== 0:
print("The images are completely Equal")
#display images
cv2.imshow("Original", original)
cv2.imshow("Duplicate", duplicate)
cv2.waitKey(0)
cv2.destroyAllWindows()