Skip to content

Commit

Permalink
Add m4a artwork support
Browse files Browse the repository at this point in the history
Issue #2
  • Loading branch information
th3-z committed Mar 2, 2021
1 parent 6a6a32b commit 1fc9338
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
position=640, 480
position=5,5
col_bg=#212121
col_fg=#ffffff
alpha=0.6
Expand Down
13 changes: 11 additions & 2 deletions foobar_miniplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from PIL import Image, ImageTk, ImageColor
from mutagen import File
from mutagen.flac import FLAC
from mutagen.mp4 import MP4
import win32com.client

import sys
Expand Down Expand Up @@ -268,7 +269,7 @@ def get_art(self):
try: # MP3
file = File(self.path)
# Access APIC frame and grab bytes
art_bytes = file.tags["APIC:"].data or file.tags["covr"]
art_bytes = file.tags["APIC:"].data
# Create new PIL image from bytes
img = Image.open(io.BytesIO(art_bytes))
found_art = True
Expand All @@ -281,7 +282,15 @@ def get_art(self):
img = Image.open(io.BytesIO(file.pictures[0].data))
found_art = True
except Exception:
pass
pass

try: # MP4
file = MP4(self.path)
art_bytes = file.tags["covr"][0]
img = Image.open(io.BytesIO(art_bytes))
found_art = True
except Exception:
pass

if not found_art or prefer_external:
art_files = [
Expand Down

0 comments on commit 1fc9338

Please sign in to comment.