| 1 |
#!/usr/bin/env python3 |
| 2 |
import os |
| 3 |
import sys |
| 4 |
|
| 5 |
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| 6 |
|
| 7 |
from DisplayCAL import ICCProfile as iccp |
| 8 |
from DisplayCAL.defaultpaths import ICCPROFILES, ICCPROFILES_HOME |
| 9 |
|
| 10 |
|
| 11 |
for p in set(ICCPROFILES_HOME + ICCPROFILES): |
| 12 |
if os.path.isdir(p): |
| 13 |
for f in os.listdir(p): |
| 14 |
try: |
| 15 |
profile = iccp.ICCProfile(os.path.join(p, f)) |
| 16 |
except Exception: |
| 17 |
pass |
| 18 |
else: |
| 19 |
if isinstance(profile.tags.desc, iccp.TextDescriptionType): |
| 20 |
if profile.tags.desc.get("Unicode") or profile.tags.desc.get( |
| 21 |
"Macintosh" |
| 22 |
): |
| 23 |
print(os.path.join(p, f)) |
| 24 |
if profile.tags.desc.get("Unicode"): |
| 25 |
print( |
| 26 |
"Unicode Language Code:", |
| 27 |
profile.tags.desc.unicodeLanguageCode, |
| 28 |
) |
| 29 |
print("Unicode Description:", profile.tags.desc.Unicode) |
| 30 |
if profile.tags.desc.get("Macintosh"): |
| 31 |
print( |
| 32 |
"Macintosh Language Code:", profile.tags.desc.macScriptCode |
| 33 |
) |
| 34 |
print("Macintosh Description:", profile.tags.desc.Macintosh) |
| 35 |
if profile.tags.desc.get("Unicode") or profile.tags.desc.get( |
| 36 |
"Macintosh" |
| 37 |
): |
| 38 |
print("") |
| 39 |
elif not isinstance(profile.tags.desc, iccp.MultiLocalizedUnicodeType): |
| 40 |
print(os.path.join(p, f)) |
| 41 |
print( |
| 42 |
f"Warning: 'desc' is invalid type ({type(profile.tags.desc)})" |
| 43 |
) |
| 44 |
print("") |