~comcloudway/melon

8d20c31849cc6a3e7829a1c2dc94151fed76bfa2 — Jakob Meier 3 months ago 3067153
Add settings option to disable gpu acceleration for video player

FIXES: weird pink player bug (The user has to turn this option off, if
they experience this problem)
M melon/models/__init__.py => melon/models/__init__.py +6 -4
@@ 106,6 106,9 @@ app_conf_template = {
    "nsfw_only_content": False,
    # do not include apps that require login by default
    "login_required": False,
    # toggle opengl for video player
    # turn this off if the video player is broken
    "with_gl": True,
}

server_settings_template = {


@@ 505,11 508,10 @@ def set_app_setting(pref: str, value):
    execute_sql(
        conn,
        """
    UPDATE appconf
    SET value = ?
    WHERE key = ?
    INSERT OR REPLACE INTO appconf
    VALUES (?, ?)
    """,
        (value, pref),
        (pref, value),
    )
    # notify channels and playlists, because available channels might be different
    conn.close()

M melon/player/__init__.py => melon/player/__init__.py +2 -1
@@ 63,7 63,8 @@ class PlayerScreen(Adw.NavigationPage):
    def display_player(self):
        self.position = 0
        self.duration = 0
        self.player = VideoPlayer(self.streams)
        settings = get_app_settings()
        self.player = VideoPlayer(self.streams, settings["with_gl"])
        pos = get_video_playback_position(self.video.server, self.video.id)
        if not pos is None:
            self.position = pos

M melon/settings/__init__.py => melon/settings/__init__.py +8 -0
@@ 69,6 69,14 @@ global_prefs = {
        True,
        True,
    ),
    "with_gl": Preference(
        "with_gl",
        _("Use GPU acceleration for video player if available"),
        _("Disable this if the video player doesn't work"),
        PreferenceType.TOGGLE,
        True,
        True,
    ),
}



M melon/widgets/player.py => melon/widgets/player.py +4 -4
@@ 115,7 115,7 @@ class VideoPlayerBase(Gtk.Overlay):
    # inverse opacity of overlay
    brightness = 1.0

    def __init__(self, streams: list[Stream], *args, **kwargs):
    def __init__(self, streams: list[Stream], with_gl=True, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.streams = streams
        self.stream = None


@@ 145,7 145,7 @@ class VideoPlayerBase(Gtk.Overlay):
        self.source = Gst.ElementFactory.make("playbin3")

        # Use GL if available
        if paintable.props.gl_context:
        if paintable.props.gl_context and with_gl:
            glsink = Gst.ElementFactory.make("glsinkbin", "sink")
            glsink.props.sink = gtksink
            sink = glsink


@@ 632,10 632,10 @@ class VideoPlayerBase(Gtk.Overlay):


class VideoPlayer(Gtk.Stack):
    def __init__(self, streams: list[Stream], *args, **kwargs):
    def __init__(self, streams: list[Stream], with_gl=True, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.window = None
        self.player = VideoPlayerBase(streams)
        self.player = VideoPlayerBase(streams, with_gl)
        self.player.connect_toggle_fullscreen(self.toggle_fullscreen)
        self.player.connect_toggle_popout(self.toggle_popout)
        placeholder = Gtk.Label()

M po/de.po => po/de.po +17 -9
@@ 7,7 7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Melon 0.1.2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-15 07:54+0200\n"
"POT-Creation-Date: 2024-07-15 07:56+0200\n"
"PO-Revision-Date: 2024-04-20 14:18+0000\n"
"Last-Translator: hurzelchen <hurzelchen@users.noreply.translate.codeberg."
"org>\n"


@@ 90,7 90,7 @@ msgstr ""
#: ../melon/browse/server.py:115 ../melon/browse/server.py:143
#: ../melon/home/history.py:25 ../melon/home/new.py:36
#: ../melon/home/playlists.py:23 ../melon/home/subs.py:22
#: ../melon/importer.py:63 ../melon/player/__init__.py:112
#: ../melon/importer.py:63 ../melon/player/__init__.py:113
#: ../melon/player/playlist.py:164 ../melon/player/playlist.py:171
#: ../melon/playlist/__init__.py:77
msgid "*crickets chirping*"


@@ 357,11 357,11 @@ msgstr "Beschreibung"
msgid "Add this video to a playlist"
msgstr "Füge dieses Video einer Wiedergabeliste hinzu"

#: ../melon/player/__init__.py:113
#: ../melon/player/__init__.py:114
msgid "Video could not be loaded"
msgstr "Das Video konnte nicht geladen werden"

#: ../melon/player/__init__.py:151 ../melon/player/__init__.py:185
#: ../melon/player/__init__.py:152 ../melon/player/__init__.py:186
#: ../melon/player/playlist.py:57
msgid "Loading..."
msgstr ""


@@ 730,23 730,31 @@ msgid ""
"function"
msgstr "Zeige Dienste, für die du einen Account brauchst, beim Durchsuchen an"

#: ../melon/settings/__init__.py:78
#: ../melon/settings/__init__.py:74
msgid "Use GPU acceleration for video player if available"
msgstr ""

#: ../melon/settings/__init__.py:75
msgid "Disable this if the video player doesn't work"
msgstr ""

#: ../melon/settings/__init__.py:86
msgid "Settings"
msgstr "Einstellungen"

#: ../melon/settings/__init__.py:91
#: ../melon/settings/__init__.py:99
msgid "General"
msgstr "Allgemein"

#: ../melon/settings/__init__.py:92
#: ../melon/settings/__init__.py:100
msgid "Global app settings"
msgstr "Globale App Einstellungen"

#: ../melon/settings/__init__.py:116
#: ../melon/settings/__init__.py:124
msgid "Enable Server"
msgstr "Dienst aktivieren"

#: ../melon/settings/__init__.py:118
#: ../melon/settings/__init__.py:126
msgid ""
"Disabled servers won't show up in the browser or on the local/home screen"
msgstr ""

M po/fa.po => po/fa.po +17 -9
@@ 7,7 7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Melon 0.1.2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-15 07:54+0200\n"
"POT-Creation-Date: 2024-07-15 07:56+0200\n"
"PO-Revision-Date: 2024-05-30 09:18+0000\n"
"Last-Translator: sohrabbehdani <sohrabbehdani@users.noreply.translate."
"codeberg.org>\n"


@@ 96,7 96,7 @@ msgstr ""
#: ../melon/browse/server.py:115 ../melon/browse/server.py:143
#: ../melon/home/history.py:25 ../melon/home/new.py:36
#: ../melon/home/playlists.py:23 ../melon/home/subs.py:22
#: ../melon/importer.py:63 ../melon/player/__init__.py:112
#: ../melon/importer.py:63 ../melon/player/__init__.py:113
#: ../melon/player/playlist.py:164 ../melon/player/playlist.py:171
#: ../melon/playlist/__init__.py:77
#, fuzzy


@@ 358,11 358,11 @@ msgstr "توضیحات"
msgid "Add this video to a playlist"
msgstr "افزودن این ویدئو به لیست‌پخش"

#: ../melon/player/__init__.py:113
#: ../melon/player/__init__.py:114
msgid "Video could not be loaded"
msgstr ""

#: ../melon/player/__init__.py:151 ../melon/player/__init__.py:185
#: ../melon/player/__init__.py:152 ../melon/player/__init__.py:186
#: ../melon/player/playlist.py:57
msgid "Loading..."
msgstr "در حال بارکردن..."


@@ 719,23 719,31 @@ msgid ""
"function"
msgstr ""

#: ../melon/settings/__init__.py:78
#: ../melon/settings/__init__.py:74
msgid "Use GPU acceleration for video player if available"
msgstr ""

#: ../melon/settings/__init__.py:75
msgid "Disable this if the video player doesn't work"
msgstr ""

#: ../melon/settings/__init__.py:86
msgid "Settings"
msgstr "تنظیمات"

#: ../melon/settings/__init__.py:91
#: ../melon/settings/__init__.py:99
msgid "General"
msgstr "کلی"

#: ../melon/settings/__init__.py:92
#: ../melon/settings/__init__.py:100
msgid "Global app settings"
msgstr "تنظیمات کلی کاره"

#: ../melon/settings/__init__.py:116
#: ../melon/settings/__init__.py:124
msgid "Enable Server"
msgstr "فعال کردن کارساز"

#: ../melon/settings/__init__.py:118
#: ../melon/settings/__init__.py:126
msgid ""
"Disabled servers won't show up in the browser or on the local/home screen"
msgstr ""

M po/melon.pot => po/melon.pot +17 -9
@@ 8,7 8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Melon 0.2.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-15 07:54+0200\n"
"POT-Creation-Date: 2024-07-15 07:56+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"


@@ 83,7 83,7 @@ msgstr ""
#: ../melon/browse/server.py:115 ../melon/browse/server.py:143
#: ../melon/home/history.py:25 ../melon/home/new.py:36
#: ../melon/home/playlists.py:23 ../melon/home/subs.py:22
#: ../melon/importer.py:63 ../melon/player/__init__.py:112
#: ../melon/importer.py:63 ../melon/player/__init__.py:113
#: ../melon/player/playlist.py:164 ../melon/player/playlist.py:171
#: ../melon/playlist/__init__.py:77
msgid "*crickets chirping*"


@@ 343,11 343,11 @@ msgstr ""
msgid "Add this video to a playlist"
msgstr ""

#: ../melon/player/__init__.py:113
#: ../melon/player/__init__.py:114
msgid "Video could not be loaded"
msgstr ""

#: ../melon/player/__init__.py:151 ../melon/player/__init__.py:185
#: ../melon/player/__init__.py:152 ../melon/player/__init__.py:186
#: ../melon/player/playlist.py:57
msgid "Loading..."
msgstr ""


@@ 692,23 692,31 @@ msgid ""
"function"
msgstr ""

#: ../melon/settings/__init__.py:78
#: ../melon/settings/__init__.py:74
msgid "Use GPU acceleration for video player if available"
msgstr ""

#: ../melon/settings/__init__.py:75
msgid "Disable this if the video player doesn't work"
msgstr ""

#: ../melon/settings/__init__.py:86
msgid "Settings"
msgstr ""

#: ../melon/settings/__init__.py:91
#: ../melon/settings/__init__.py:99
msgid "General"
msgstr ""

#: ../melon/settings/__init__.py:92
#: ../melon/settings/__init__.py:100
msgid "Global app settings"
msgstr ""

#: ../melon/settings/__init__.py:116
#: ../melon/settings/__init__.py:124
msgid "Enable Server"
msgstr ""

#: ../melon/settings/__init__.py:118
#: ../melon/settings/__init__.py:126
msgid ""
"Disabled servers won't show up in the browser or on the local/home screen"
msgstr ""

M po/nl.po => po/nl.po +17 -9
@@ 7,7 7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Melon 0.2.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-15 07:54+0200\n"
"POT-Creation-Date: 2024-07-15 07:56+0200\n"
"PO-Revision-Date: 2024-04-23 12:18+0000\n"
"Last-Translator: Vistaus <Vistaus@users.noreply.translate.codeberg.org>\n"
"Language-Team: Dutch <https://translate.codeberg.org/projects/melon/melon-"


@@ 96,7 96,7 @@ msgstr ""
#: ../melon/browse/server.py:115 ../melon/browse/server.py:143
#: ../melon/home/history.py:25 ../melon/home/new.py:36
#: ../melon/home/playlists.py:23 ../melon/home/subs.py:22
#: ../melon/importer.py:63 ../melon/player/__init__.py:112
#: ../melon/importer.py:63 ../melon/player/__init__.py:113
#: ../melon/player/playlist.py:164 ../melon/player/playlist.py:171
#: ../melon/playlist/__init__.py:77
msgid "*crickets chirping*"


@@ 360,11 360,11 @@ msgstr "Beschrijving"
msgid "Add this video to a playlist"
msgstr "Video toevoegen aan afspeellijst"

#: ../melon/player/__init__.py:113
#: ../melon/player/__init__.py:114
msgid "Video could not be loaded"
msgstr "De video kan niet worden geladen"

#: ../melon/player/__init__.py:151 ../melon/player/__init__.py:185
#: ../melon/player/__init__.py:152 ../melon/player/__init__.py:186
#: ../melon/player/playlist.py:57
msgid "Loading..."
msgstr "Bezig met laden…"


@@ 729,23 729,31 @@ msgid ""
"function"
msgstr "Toon/Verberg servers op de verkenlijst als ze een account vereisen"

#: ../melon/settings/__init__.py:78
#: ../melon/settings/__init__.py:74
msgid "Use GPU acceleration for video player if available"
msgstr ""

#: ../melon/settings/__init__.py:75
msgid "Disable this if the video player doesn't work"
msgstr ""

#: ../melon/settings/__init__.py:86
msgid "Settings"
msgstr "Voorkeuren"

#: ../melon/settings/__init__.py:91
#: ../melon/settings/__init__.py:99
msgid "General"
msgstr "Algemeen"

#: ../melon/settings/__init__.py:92
#: ../melon/settings/__init__.py:100
msgid "Global app settings"
msgstr "Algemene voorkeuren"

#: ../melon/settings/__init__.py:116
#: ../melon/settings/__init__.py:124
msgid "Enable Server"
msgstr "Server inschakelen"

#: ../melon/settings/__init__.py:118
#: ../melon/settings/__init__.py:126
msgid ""
"Disabled servers won't show up in the browser or on the local/home screen"
msgstr ""