#!/usr/local/bin/python3

# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: Copyright 2024-2025 kramo

import gettext
import locale
import signal
import sys
from pathlib import Path
from platform import system

pkgdatadir = "/usr/local/share/showtime"
localedir = "/usr/local/share/locale"

sys.path.insert(1, pkgdatadir)
signal.signal(signal.SIGINT, signal.SIG_DFL)

if system() == "Linux" or system() == "OpenBSD":
    locale.bindtextdomain("showtime", localedir)
    locale.textdomain("showtime")
    gettext.install("showtime", localedir)
else:
    gettext.install("showtime")

if __name__ == "__main__":
    import gi

    gi.require_version("Gtk", "4.0")

    from gi.repository import Gio, GLib, Gtk

    GLib.set_prgname("showtime")
    GLib.set_application_name(_("Video Player"))
    Gtk.Window.set_default_icon_name("org.gnome.Showtime")

    Gio.resources_register(
        Gio.Resource.load(str(Path(pkgdatadir, "showtime.gresource")))
    )

    from showtime import main

    sys.exit(main.main())
