package constants const ( // App names and IDs AppName = "mpv-manager" AppDisplayName = "MPV.Rocks Manager" AppNameMPV = "mpv" ConfigFileName = "mpv-manager.json" MPVConfigFileName = "mpv.conf" UOSCConfigFileName = "uosc.conf" ModernZConfFileName = "modernz.conf" ModernZFontFile = "modernz-icons.ttf" // UI Type identifiers for MPV overlays UITypeUOSC = "uosc" UITypeModernZ = "modernz" UITypeNone = "none" // Default UI for new installations DefaultUIType = UITypeModernZ // Config paths ConfigDirName = ".config" InstallDirName = "mpv" PortableConfigDir = "portable_config" ScriptsDir = "scripts" ScriptOptsDir = "script-opts" FontsDir = "fonts" ConfigBackupsDir = "conf_backups" MpvConfDir = ".config/mpv" InstallerConfDir = ".config/mpv-manager" // Windows installer directories InstallerDir = "mpv-manager" MPVInstallerDir = "" // zhongfly/mpv-winbuild has scripts at root level (not in subdirectory) SevenZipFileName = "7zr.exe" MPVInstallBat = "mpv-register.bat" MPVUninstallBat = "mpv-unregister.bat" // Windows shortcut icons // NOTE: zhongfly/mpv-winbuild does not include .ico files. // Shortcuts use mpv.exe as the icon source (it has an embedded icon). // These constants are kept for backward compatibility with existing installations. MPVInstallIco = "mpv-install.ico" MPVUninstallIco = "mpv-uninstall.ico" InstallerIco = "mpv-manager.ico" ShortcutInstallName = "Set MPV as Default.lnk" ShortcutUninstallName = "Remove MPV from Defaults.lnk" ShortcutMPVName = "MPV.lnk" ShortcutInstallerName = "MPV Manager.lnk" UninstallBatFileName = "uninstall.bat" // Archive extensions ExtZIP = ".zip" Ext7z = ".7z" ExtTar = ".tar" ExtTarGz = ".tar.gz" ExtTarXz = ".tar.xz" ExtGz = ".gz" ExtXz = ".xz" ExtDmg = ".dmg" ExtExe = ".exe" Ext7zip = ".7zip" // Platform install method IDs MethodMPVBinary = "mpv-binary" MethodMPVBinaryV3 = "mpv-binary-v3" MethodMPCQT = "mpc-qt" MethodMPVApp = "mpv-app" MethodMPVBrew = "mpv-brew" MethodIINA = "iina" MethodMPVFlatpak = "mpv-flatpak" MethodCelluloidFlatpak = "celluloid-flatpak" MethodMPVPackage = "mpv-package" MethodCelluloidPackage = "celluloid-package" // Component method IDs (for UOSC, ModernZ, FFmpeg updates) MethodUOSC = "uosc" MethodModernZ = "modernz" MethodFFmpeg = "ffmpeg" // Flatpak App IDs FlatpakMPV = "io.mpv.Mpv" FlatpakCelluloid = "io.github.celluloid_player.Celluloid" // GSettings schema names (different from Flatpak app IDs!) // Note: Celluloid uses hyphen in schema but underscore in Flatpak app ID GSettingsCelluloidSchema = "io.github.celluloid-player.Celluloid" // Package names PackageMPV = "mpv" PackageCelluloid = "celluloid" // File permissions DirPermission = 0755 FilePermission = 0644 ExecutablePermission = 0755 // Windows executable names WinMPVExe = "mpv.exe" WinFFMpegExe = "ffmpeg.exe" Win7zExe = "7z.exe" Win7zzExe = "7zz.exe" Win7zaExe = "7za.exe" // macOS app names MacMPVApp = "MPV.app" MacIINAApp = "IINA.app" ApplicationsDir = "/Applications" // Linux binaries LinuxMPVBinary = "mpv" // Command names Command7z = "7z" Command7zz = "7zz" Command7za = "7za" Command7zr = "7zr" CommandUnzip = "unzip" CommandTar = "tar" CommandHdiutil = "hdiutil" CommandBrew = "brew" CommandFlatpak = "flatpak" CommandSudo = "sudo" CommandApt = "apt" CommandDnf = "dnf" CommandPacman = "pacman" CommandGsettings = "gsettings" CommandMpv = "mpv" // Timestamp format for backups BackupTimestampFormat = "2006-01-02" BackupTimestampFullFormat = "2006-01-02-150405" BackupFilePrefix = "-mpv.conf.bak" BackupDirFilePrefix = "_mpv.conf" // URLs HomebrewInstallURL = "https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh" FlathubRepoURL = "https://flathub.org/repo/flathub.flatpakrepo" SevenZipURL = "https://www.7-zip.org/a/7zr.exe" RepositoryURL = "https://gitgud.io/mike/mpv-manager" // Progress bar settings ProgressBarWidth = 30 ProgressUpdateInterval = 500 // milliseconds // Command output settings OutputChanBufferSize = 100 // Placeholder values for development mode Blake3Placeholder = "blake3:HASH" // Error messages Err7zipNotFound = "7zip not found. Please install 7zip first" Err7zipNotFoundDetailed = "7zip not found. Please install 7zip (https://www.7-zip.org) and try again" ErrHomebrewNotInstalled = "homebrew is not installed" ErrFlatpakNotInstalled = "flatpak is not installed" ErrUnsupportedArchive = "unsupported archive format" ErrDMGManual = "DMG files must be opened manually" ErrEXEManual = "EXE files must be executed manually" ErrUnsupportedDistro = "unsupported distro family" // Warning messages WarnFailedToInstallUOSC = "Warning: Failed to install uOSC" WarnFailedToInstallModernZ = "Warning: Failed to install ModernZ" WarnFailedToInstallMPVConfig = "Warning: Failed to install MPV config" WarnBackupFailed = "Warning: Failed to create backup" WarnFailedToConfigureCelluloid = "Warning: Failed to configure Celluloid" // Installation messages MsgConfigNotOverwritten = "Note: Configuration was not overwritten to preserve your settings" // Linux icon constants LinuxIconsDir = ".local/share/icons" LinuxIconThemeDir = "hicolor/128x128/apps" LinuxIconFileName = "mpv-manager.png" // macOS icon constants MacOSIconFileName = "icon.icns" MacOSTempIconDir = ".config/mpv/mpv-manager" // MPV config keys ConfigKeyAudioLanguage = "alang" ConfigKeySubtitleLanguage = "slang" ConfigKeyHardwareDecoder = "hwdec" ConfigKeyVideoOutput = "vo" ConfigKeyScaleFilter = "scale" ConfigKeyDitherAlgorithm = "dither-depth-convert" ConfigKeySavePositionOnQuit = "save-position-on-quit" ConfigKeyBorder = "border" ConfigKeyProfile = "profile" // MPV screenshot config keys ConfigKeyScreenshotFormat = "screenshot-format" ConfigKeyScreenshotTagColorspace = "screenshot-tag-colorspace" ConfigKeyScreenshotHighBitDepth = "screenshot-high-bit-depth" ConfigKeyScreenshotTemplate = "screenshot-template" ConfigKeyScreenshotDirectory = "screenshot-directory" ConfigKeyScreenshotJpegQuality = "screenshot-jpeg-quality" ConfigKeyScreenshotPngCompression = "screenshot-png-compression" ConfigKeyScreenshotWebpLossless = "screenshot-webp-lossless" ConfigKeyScreenshotWebpQuality = "screenshot-webp-quality" ConfigKeyScreenshotJxlDistance = "screenshot-jxl-distance" ConfigKeyScreenshotAvifEncoder = "screenshot-avif-encoder" ConfigKeyScreenshotAvifPixfmt = "screenshot-avif-pixfmt" ConfigKeyScreenshotAvifOpts = "screenshot-avif-opts" // HTTP content types ContentTypeJSON = "application/json" ContentTypeHTML = "text/html" // HTTP methods MethodGet = "GET" MethodPost = "POST" MethodPut = "PUT" MethodDelete = "DELETE" // Log message prefixes LogPrefixAPI = "[API]" LogPrefixSSE = "[SSE]" // Modal types ModalTypeShutdown = "shutdown" ModalTypeUpdateManager = "update-manager" ModalTypeUpdateManagerSuccess = "update-manager-success" ModalTypeUninstall = "uninstall" ModalTypeRemoveFileAssociations = "remove-file-associations" ModalTypeResetConfig = "reset-config" ModalTypeRestoreConfig = "restore-config" ModalTypeApplyConfig = "apply-config" ModalTypeDeleteBackup = "delete-backup" ModalTypeClearLogs = "clear-logs" ModalTypeSelectUI = "select-ui" ModalTypeChangeUI = "change-ui" // Query parameter names QueryParamType = "type" QueryParamMethodID = "method_id" QueryParamAppName = "app_name" QueryParamAppType = "app_type" QueryParamInstallMethod = "install_method" QueryParamBackupPath = "backup_path" QueryParamVersion = "version" QueryParamInstallUOSC = "install_uosc" QueryParamAudioLanguages = "audio_languages" QueryParamSubtitleLanguages = "subtitle_languages" // Status values StatusShutdown = "shutdown" StatusSuccess = "success" // Response messages ResponseMessageShutdown = "Server shutting down..." ResponseMessageMissingModalType = "Missing modal type" ResponseMessageUnknownModalType = "Unknown modal type" ResponseMessageMethodNotAllowed = "Method not allowed" ResponseMessageMissingAppName = "Missing app_name parameter" ResponseMessageMissingBackupPath = "Missing backup_path parameter" ResponseMessageInvalidBackupPath = "Invalid backup path" ) // MethodIDToName maps method IDs to display names var MethodIDToName = map[string]string{ MethodMPVBinary: "MPV", MethodMPVBinaryV3: "MPV (AVX2 optimized)", MethodMPCQT: "MPC-QT", MethodMPVApp: "MPV", MethodMPVBrew: "MPV (CLI only)", MethodIINA: "IINA", MethodMPVFlatpak: "MPV", MethodCelluloidFlatpak: "Celluloid", MethodMPVPackage: "MPV", MethodCelluloidPackage: "Celluloid", MethodUOSC: "uOSC", MethodModernZ: "ModernZ", MethodFFmpeg: "FFmpeg", } // MethodIDToAppID maps method IDs to their corresponding Flatpak/app IDs var MethodIDToAppID = map[string]string{ MethodMPVFlatpak: FlatpakMPV, MethodCelluloidFlatpak: FlatpakCelluloid, } // MethodIcon maps method IDs to Boxicon class names for Web UI var MethodIcon = map[string]string{ MethodMPVBinary: "bx bx-play-circle", MethodMPVBinaryV3: "bx bx-play-circle", MethodMPCQT: "bx bx-film", MethodMPVApp: "bx bx-play-circle", MethodMPVBrew: "bx bx-beer", MethodIINA: "bxl bxl-apple", MethodMPVFlatpak: "bx bx-box", MethodCelluloidFlatpak: "bx bx-box", MethodMPVPackage: "bx bx-play-circle", MethodCelluloidPackage: "bx bx-film", MethodUOSC: "bx bx-palette", MethodModernZ: "bx bx-palette", MethodFFmpeg: "bx bx-video", } // MethodLogo maps method IDs to logo image filenames for Web UI var MethodLogo = map[string]string{ MethodMPVBinary: "mpv.avif", MethodMPVBinaryV3: "mpv.avif", MethodMPCQT: "mpc.avif", MethodMPVApp: "mpv.avif", MethodMPVBrew: "mpv.avif", MethodIINA: "iina.avif", MethodMPVFlatpak: "mpv.avif", MethodCelluloidFlatpak: "celluloid.avif", MethodMPVPackage: "mpv.avif", MethodCelluloidPackage: "celluloid.avif", MethodUOSC: "uosc.avif", MethodModernZ: "modernz.avif", MethodFFmpeg: "ffmpeg.avif", } // MethodType maps method IDs to display type labels for Web UI var MethodType = map[string]string{ MethodMPVBinary: "Portable", MethodMPVBinaryV3: "Portable", MethodMPCQT: "Installed App", MethodMPVApp: "Portable", MethodMPVBrew: "Package Manager", MethodIINA: "Installed App", MethodMPVFlatpak: "Flatpak", MethodCelluloidFlatpak: "Flatpak", MethodMPVPackage: "Package Manager", MethodCelluloidPackage: "Package Manager", MethodUOSC: "UI Component", MethodModernZ: "UI Component", MethodFFmpeg: "Utility", } // MethodAppType maps method IDs to application type names for Web UI // Valid types: "app" (standalone apps), "frontend" (MPV frontends), or "component" (UI components/utilities) var MethodAppType = map[string]string{ MethodMPVBinary: "app", MethodMPVBinaryV3: "app", MethodMPCQT: "app", MethodMPVApp: "app", MethodMPVBrew: "app", MethodIINA: "app", MethodMPVFlatpak: "app", MethodCelluloidFlatpak: "frontend", MethodMPVPackage: "app", MethodCelluloidPackage: "frontend", MethodUOSC: "component", MethodModernZ: "component", MethodFFmpeg: "component", } // MethodHomepage maps method IDs to project homepage URLs for Web UI var MethodHomepage = map[string]string{ MethodMPVBinary: "https://mpv.io/", MethodMPVBinaryV3: "https://mpv.io/", MethodMPCQT: "https://github.com/mpc-qt/mpc-qt", MethodMPVApp: "https://mpv.io/", MethodMPVBrew: "https://brew.sh/", MethodIINA: "https://iina.io/", MethodMPVFlatpak: "https://flathub.org/apps/details/io.mpv.Mpv", MethodCelluloidFlatpak: "https://flathub.org/apps/details/io.github.celluloid_player.Celluloid", MethodMPVPackage: "https://mpv.io/", MethodCelluloidPackage: "https://celluloid-player.github.io/", MethodUOSC: "https://github.com/tomasklaen/uosc", MethodModernZ: "https://github.com/Samillion/ModernZ", MethodFFmpeg: "https://ffmpeg.org/", } // Architecture identifiers const ( // ArchI686 is kept for error messaging; not used in build selection logic. ArchI686 = "i686" ArchX8664 = "x86-64" ArchX8664V3 = "x86-64-v3" ArchAarch64 = "aarch64" Arch386 = "386" ArchAMD64 = "amd64" ArchARM64 = "arm64" ) // OS identifiers const ( OSWindows = "windows" OSDarwin = "darwin" OSLinux = "linux" ) // Package manager families const ( PMFamilyDebian = "debian" PMFamilyRHEL = "rhel" PMFamilyArch = "arch" PMFamilySUSE = "suse" ) // Package not found error patterns for detection var PackageNotFoundPatterns = []string{ "package not found", "unable to locate package", "no match for argument", "target not found", "not installed", "no such keg", "no such formula", } // 7zip executables to try in order var SevenZipExecutables = []string{ Command7zz, Command7z, Command7za, Command7zr, } // Package manager commands structure type PackageManagerCommands struct { Install []string Update []string Upgrade []string Remove []string Makecache []string Refresh []string } // PackageManagerConfigs contains command configurations for each package manager var PackageManagerConfigs = map[string]PackageManagerCommands{ CommandApt: { Install: []string{"apt", "install", "-y"}, Update: []string{"apt", "update"}, Upgrade: []string{"apt", "upgrade", "-y"}, Remove: []string{"apt", "remove", "-y"}, Makecache: []string{"apt", "update"}, }, CommandDnf: { Install: []string{"dnf", "install", "-y"}, Update: []string{"dnf", "makecache"}, Upgrade: []string{"dnf", "upgrade", "-y"}, Remove: []string{"dnf", "remove", "-y"}, Makecache: []string{"dnf", "makecache"}, }, CommandPacman: { Install: []string{"pacman", "-S", "--noconfirm"}, Update: []string{"pacman", "-Sy"}, Upgrade: []string{"pacman", "-Sy", "--noconfirm"}, Remove: []string{"pacman", "-Rns", "--noconfirm"}, Makecache: []string{"pacman", "-Sy"}, }, } // Flatpak commands var FlatpakCommands = map[string][]string{ "install": {"flatpak", "install", "flathub", "-y"}, "update": {"flatpak", "update", "-y"}, "remove": {"flatpak", "uninstall", "-y"}, "add-remote": {"flatpak", "remote-add", "--if-not-exists", "flathub", FlathubRepoURL}, "override": {"flatpak", "override", "--user"}, } // Windows uninstall directory lists var WindowsPreserveDirs = []string{PortableConfigDir, InstallerDir} var WindowsRemoveDirs = []string{"cache", "temp", "shaders", "scripts", "script-opts", "fonts"}