macOS / Tests (AppleSilicon) (push) Canceled after 0s
macOS / Tests (Intel) (push) Canceled after 0s
macOS / Build (AppleSilicon) (push) Canceled after 0s
macOS / Build (Intel) (push) Canceled after 0s
macOS / Publish the GitHub Release (push) Canceled after 0s
81 lines
2.9 KiB
Python
81 lines
2.9 KiB
Python
"""LinTunes.app's Info.plist entries, as plain data.
|
|
|
|
Kept out of the .spec so the tests can check it on Linux. The spec hands
|
|
``info_plist(version)`` to PyInstaller's BUNDLE, which adds the keys it
|
|
owns itself (executable, icon file, bundle name/identifier).
|
|
"""
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
sys.path.insert(0, str(ROOT))
|
|
from lintunes import release_info # noqa: E402 (pure Python, no Qt)
|
|
|
|
# PyQt6 6.12's macOS wheel is tagged macosx_14_0 (Sonoma); Qt itself would
|
|
# go a little lower, but the bindings decide. Raise it when PyQt6 does.
|
|
MINIMUM_MACOS = "14.0"
|
|
|
|
# Every Bonjour service the app browses for. Chromecast (pychromecast);
|
|
# AirPlay speakers through pyatv's scan of the AirPlay and RAOP protocols,
|
|
# which also reads the device-info and sleep-proxy records it finds.
|
|
BONJOUR_SERVICES = [
|
|
"_googlecast._tcp",
|
|
"_raop._tcp",
|
|
"_airplay._tcp",
|
|
"_device-info._tcp",
|
|
"_sleep-proxy._udp",
|
|
]
|
|
|
|
# Audio the app can import, so files can be dropped on the Dock icon or
|
|
# opened with "Open With". "Alternate": LinTunes never claims to be the
|
|
# default app for any of them.
|
|
AUDIO_TYPES = [
|
|
"public.mp3",
|
|
"public.mpeg-4-audio",
|
|
"com.apple.m4a-audio",
|
|
"com.apple.protected-mpeg-4-audio",
|
|
"public.aac-audio",
|
|
"org.xiph.flac",
|
|
"public.aiff-audio",
|
|
"public.aifc-audio",
|
|
"com.microsoft.waveform-audio",
|
|
"public.audio",
|
|
]
|
|
|
|
|
|
def version() -> str:
|
|
text = (ROOT / "lintunes" / "__init__.py").read_text()
|
|
return re.search(r'^__version__ = "([^"]+)"', text, re.MULTILINE)[1]
|
|
|
|
|
|
def info_plist(app_version: str | None = None) -> dict:
|
|
app_version = app_version or version()
|
|
return {
|
|
"CFBundleName": release_info.APP_NAME,
|
|
"CFBundleDisplayName": release_info.APP_NAME,
|
|
"CFBundleIdentifier": release_info.BUNDLE_ID,
|
|
"CFBundleShortVersionString": app_version,
|
|
"CFBundleVersion": app_version,
|
|
"CFBundlePackageType": "APPL",
|
|
"NSPrincipalClass": "NSApplication",
|
|
"NSHighResolutionCapable": True,
|
|
"NSRequiresAquaSystemAppearance": False, # dark mode allowed
|
|
"LSMinimumSystemVersion": MINIMUM_MACOS,
|
|
"LSApplicationCategoryType": "public.app-category.music",
|
|
"NSHumanReadableCopyright":
|
|
"LinTunes. Bundled tools: see Contents/Resources/licenses.",
|
|
# macOS 15+ asks before an app talks to the local network: casting
|
|
# and AirPlay find speakers with Bonjour, then stream to them.
|
|
"NSLocalNetworkUsageDescription":
|
|
"LinTunes looks for Chromecast and AirPlay speakers on your "
|
|
"network so it can play music on them.",
|
|
"NSBonjourServices": list(BONJOUR_SERVICES),
|
|
"CFBundleDocumentTypes": [{
|
|
"CFBundleTypeName": "Audio file",
|
|
"CFBundleTypeRole": "Viewer",
|
|
"LSHandlerRank": "Alternate",
|
|
"LSItemContentTypes": list(AUDIO_TYPES),
|
|
}],
|
|
}
|