From 083c331c5cb75f5a7fd5f084484f3c5a613ca62b Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Sat, 9 Mar 2024 08:25:42 +0100 Subject: [PATCH] add video could not be loaded message to player required to not crash the app, when the video couldn't be loaded. e.g. when an invidious video could not be loaded because of short-term bans --- melon/player/__init__.py | 13 +++++++++-- po/de.po | 48 ++++++++++++++++++++++------------------ po/fa.po | 48 ++++++++++++++++++++++------------------ po/melon.pot | 48 ++++++++++++++++++++++------------------ 4 files changed, 89 insertions(+), 68 deletions(-) diff --git a/melon/player/__init__.py b/melon/player/__init__.py index 993facd..e939f16 100644 --- a/melon/player/__init__.py +++ b/melon/player/__init__.py @@ -73,12 +73,21 @@ class PlayerScreen(Adw.NavigationPage): if not self.channel is None: self.about.add(AdaptiveFeedItem(self.channel)) + def display_error(self): + text = Gtk.Label() + text.set_label(_("Video could not be loaded")) + cb = Gtk.CenterBox() + cb.set_center_widget(text) + self.scrollview.set_child(cb) + def background(self, video_id): # obtain video_information self.video = self.instance.get_video_info(video_id) + if self.video is None: + GLib.idle_add(self.display_error) + return # add video to history - add_to_history(self.video) - GLib.idle_add(notify, "history_changed") + GLib.idle_add(add_to_history, self.video) # Load the media element in a webview self.streams = self.instance.get_video_streams(self.video_id) diff --git a/po/de.po b/po/de.po index da271ec..114e0b2 100644 --- a/po/de.po +++ b/po/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Melon 0.1.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-08 16:49+0100\n" +"POT-Creation-Date: 2024-03-09 08:25+0100\n" "PO-Revision-Date: 2024-03-01 11:23+0000\n" "Last-Translator: Anonymous \n" "Language-Team: German \n" "Language-Team: Persian \n" "Language-Team: LANGUAGE \n" @@ -313,7 +313,11 @@ msgstr "" msgid "Video quality" msgstr "" -#: ../melon/player/__init__.py:101 +#: ../melon/player/__init__.py:78 +msgid "Video could not be loaded" +msgstr "" + +#: ../melon/player/__init__.py:110 msgid "Player" msgstr "" @@ -341,11 +345,11 @@ msgstr "" msgid "Change playlist information" msgstr "" -#: ../melon/playlist/__init__.py:86 ../melon/playlist/create.py:38 +#: ../melon/playlist/__init__.py:86 ../melon/playlist/create.py:37 msgid "Playlist name" msgstr "" -#: ../melon/playlist/__init__.py:89 ../melon/playlist/create.py:41 +#: ../melon/playlist/__init__.py:89 ../melon/playlist/create.py:40 msgid "Playlist description" msgstr "" @@ -381,8 +385,8 @@ msgstr "" msgid "This cannot be undone" msgstr "" -#: ../melon/playlist/__init__.py:155 ../melon/playlist/create.py:48 -#: ../melon/playlist/pick.py:86 ../melon/widgets/preferencerow.py:174 +#: ../melon/playlist/__init__.py:155 ../melon/playlist/create.py:47 +#: ../melon/playlist/pick.py:70 ../melon/widgets/preferencerow.py:174 #: ../melon/widgets/preferencerow.py:217 msgid "Cancel" msgstr "" @@ -400,42 +404,38 @@ msgstr "" msgid "Delete this playlist" msgstr "" -#: ../melon/playlist/create.py:17 ../melon/playlist/create.py:34 -msgid "New Playlist" -msgstr "" - -#: ../melon/playlist/create.py:24 ../melon/playlist/pick.py:28 +#: ../melon/playlist/create.py:23 ../melon/playlist/pick.py:28 msgid "Video" msgstr "" -#: ../melon/playlist/create.py:25 +#: ../melon/playlist/create.py:24 msgid "The following video will be added to the new playlist" msgstr "" -#: ../melon/playlist/create.py:35 +#: ../melon/playlist/create.py:33 ../melon/playlist/create.py:91 +msgid "New Playlist" +msgstr "" + +#: ../melon/playlist/create.py:34 msgid "Enter more playlist information" msgstr "" -#: ../melon/playlist/create.py:39 +#: ../melon/playlist/create.py:38 msgid "Unnamed Playlist" msgstr "" -#: ../melon/playlist/create.py:48 ../melon/playlist/pick.py:86 +#: ../melon/playlist/create.py:47 ../melon/playlist/pick.py:70 msgid "Do not create playlist" msgstr "" -#: ../melon/playlist/create.py:49 ../melon/widgets/preferencerow.py:175 +#: ../melon/playlist/create.py:48 ../melon/widgets/preferencerow.py:175 msgid "Create" msgstr "" -#: ../melon/playlist/create.py:49 +#: ../melon/playlist/create.py:48 msgid "Create playlist" msgstr "" -#: ../melon/playlist/pick.py:23 -msgid "Add to Playlist" -msgstr "" - #: ../melon/playlist/pick.py:29 msgid "The following video will be added to the playlist" msgstr "" @@ -458,6 +458,10 @@ msgstr "" msgid "Create a new playlist and add the video to it" msgstr "" +#: ../melon/playlist/pick.py:102 +msgid "Add to Playlist" +msgstr "" + #: ../melon/servers/invidious/__init__.py:27 msgid "Open source alternative front-end to YouTube" msgstr "" @@ -663,6 +667,6 @@ msgstr "" msgid "Remove item from list" msgstr "" -#: ../melon/window.py:81 +#: ../melon/window.py:76 msgid "Stream videos on the go" msgstr "" -- 2.38.5