File tree Expand file tree Collapse file tree 4 files changed +43
-0
lines changed Expand file tree Collapse file tree 4 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -63,3 +63,8 @@ Depends: xapp-thumbnailers-common
6363Description: OpenRaster thumbnailer
6464 Produces thumbnails for OpenRaster (.ora) files.
6565
66+ Package: xapp-aiff-thumbnailer
67+ Architecture: all
68+ Depends: xapp-thumbnailers-common, python3-mutagen
69+ Description: AIFF thumbnailer
70+ Produces thumbnails for aiff files.
Original file line number Diff line number Diff line change 1+ usr/bin/xapp-aiff-thumbnailer
2+ usr/share/thumbnailers/xapp-aiff-thumbnailer.thumbnailer
Original file line number Diff line number Diff line change 1+ #!/usr/bin/python3
2+ import sys
3+ from pathlib import Path
4+ from typing import cast
5+
6+ from mutagen .aiff import AIFF
7+ from XappThumbnailers import Thumbnailer
8+
9+ thumbnailer = Thumbnailer ()
10+
11+
12+ def extract_cover_aiff_file (filepath : Path ) -> bytes | None :
13+ if not filepath .is_file () or not filepath .suffix == ".aiff" :
14+ return None
15+ aiff_file : AIFF = AIFF (str (filepath ))
16+ if aiff_file .tags is None :
17+ return None
18+ try :
19+ return cast (bytes , aiff_file .tags .getall ("APIC" )[0 ].data )
20+ except :
21+ pass
22+ finally :
23+ return None
24+
25+
26+ try :
27+ cover_data : bytes | None = extract_cover_aiff_file (filepath = Path (thumbnailer .args .input ))
28+ if cover_data is not None :
29+ thumbnailer .save_bytes (data = cover_data )
30+ sys .exit (0 )
31+ except :
32+ sys .exit (1 )
Original file line number Diff line number Diff line change 1+ [Thumbnailer Entry]
2+ TryExec=xapp-aiff-thumbnailer
3+ Exec=xapp-aiff-thumbnailer -i %i -o %o -s %s
4+ MimeType=audio/x-aiff
You can’t perform that action at this time.
0 commit comments