M melon/player/__init__.py => melon/player/__init__.py +1 -0
@@ 71,6 71,7 @@ class PlayerScreen(Adw.NavigationPage):
if not self.player is None:
self.player.connect_ended(None)
self.player.connect_update(None)
+ self.player.stop()
def on_player_end(self):
if self.position is None or self.duration is None:
M melon/widgets/player.py => melon/widgets/player.py +13 -4
@@ 23,6 23,7 @@ class VideoPlayer(Gtk.Overlay):
self.position = None
self.duration = None
self.paused = True
+ self.stopped = True
self.update_callback=None
self.ended_callback=None
@@ 126,8 127,6 @@ class VideoPlayer(Gtk.Overlay):
self.picture.add_controller(self.click_ctr)
self.click_ctr.connect("pressed", self._onclick)
- self._start_loop()
-
def connect_update(self, callback=None):
self.update_callback = callback
def connect_ended(self, callback=None):
@@ 182,6 181,9 @@ class VideoPlayer(Gtk.Overlay):
self.select_stream(stream)
def _start_loop(self):
+ if not self.stopped:
+ return
+ self.stopped = False
# run once every second
GLib.timeout_add(1000, self._loop)
def _loop(self):
@@ 225,8 227,9 @@ class VideoPlayer(Gtk.Overlay):
elif not dur is None:
self.set_duration(dur)
- # stop the loop if paused?
- return True
+ # returns false if the video was stopped
+ # which will stop the loop
+ return not self.stopped
def set_position_and_duration(self, pos, dur):
self.position = pos
@@ 267,6 270,7 @@ class VideoPlayer(Gtk.Overlay):
def play(self):
self.paused = False
+ self._start_loop()
self.source.set_state(Gst.State.PLAYING)
# show pause button
# because if playing the onclick action is to pause
@@ 277,6 281,11 @@ class VideoPlayer(Gtk.Overlay):
# show play button
# because if paused the onclick action is to start playing
self.playpause_display.update("", "media-playback-start-symbolic", tooltip=_("Play"))
+ def stop(self):
+ self.paused = True
+ self.stopped = True
+ self.source.set_state(Gst.State.NULL)
+ self.playpause_display.update("", "media-playback-start-symbolic", tooltip=_("Play"))
def _toggle_playpause(self, _):
if self.paused:
M po/de.po => po/de.po +9 -8
@@ 7,7 7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Melon 0.1.2\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2024-03-15 09:36+0100\n"
+"POT-Creation-Date: 2024-03-15 10:02+0100\n"
"PO-Revision-Date: 2024-03-01 11:23+0000\n"
"Last-Translator: Anonymous <noreply@weblate.org>\n"
"Language-Team: German <https://translate.codeberg.org/projects/melon/melon-"
@@ 82,7 82,7 @@ msgstr ""
#: ../melon/browse/server.py:101 ../melon/browse/server.py:127
#: ../melon/home/history.py:23 ../melon/home/new.py:29
#: ../melon/home/playlists.py:21 ../melon/home/subs.py:20
-#: ../melon/importer.py:61 ../melon/player/__init__.py:101
+#: ../melon/importer.py:61 ../melon/player/__init__.py:102
#: ../melon/player/playlist.py:158 ../melon/player/playlist.py:165
#: ../melon/playlist/__init__.py:50
msgid "*crickets chirping*"
@@ 349,11 349,11 @@ msgstr "Beschreibung"
msgid "Add this video to a playlist"
msgstr "Füge dieses Video einer Wiedergabeliste hinzu"
-#: ../melon/player/__init__.py:103
+#: ../melon/player/__init__.py:104
msgid "Video could not be loaded"
msgstr ""
-#: ../melon/player/__init__.py:140 ../melon/player/__init__.py:174
+#: ../melon/player/__init__.py:141 ../melon/player/__init__.py:175
#: ../melon/player/playlist.py:51
msgid "Loading..."
msgstr ""
@@ 747,19 747,20 @@ msgstr ""
"Deaktivierte Dienste werden beim Durchsuchen und auf dem Startbildschirm "
"nicht angezeigt"
-#: ../melon/widgets/player.py:34
+#: ../melon/widgets/player.py:35
msgid "No streams available"
msgstr ""
-#: ../melon/widgets/player.py:80 ../melon/widgets/player.py:279
+#: ../melon/widgets/player.py:81 ../melon/widgets/player.py:283
+#: ../melon/widgets/player.py:288
msgid "Play"
msgstr ""
-#: ../melon/widgets/player.py:101
+#: ../melon/widgets/player.py:102
msgid "Video quality"
msgstr "Auflösung"
-#: ../melon/widgets/player.py:273
+#: ../melon/widgets/player.py:277
msgid "Pause"
msgstr ""
M po/fa.po => po/fa.po +9 -8
@@ 7,7 7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Melon 0.1.2\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2024-03-15 09:36+0100\n"
+"POT-Creation-Date: 2024-03-15 10:02+0100\n"
"PO-Revision-Date: 2024-03-05 05:13+0000\n"
"Last-Translator: sohrabbehdani <behdanisohrab@gmail.com>\n"
"Language-Team: Persian <https://translate.codeberg.org/projects/melon/melon-"
@@ 77,7 77,7 @@ msgstr ""
#: ../melon/browse/server.py:101 ../melon/browse/server.py:127
#: ../melon/home/history.py:23 ../melon/home/new.py:29
#: ../melon/home/playlists.py:21 ../melon/home/subs.py:20
-#: ../melon/importer.py:61 ../melon/player/__init__.py:101
+#: ../melon/importer.py:61 ../melon/player/__init__.py:102
#: ../melon/player/playlist.py:158 ../melon/player/playlist.py:165
#: ../melon/playlist/__init__.py:50
msgid "*crickets chirping*"
@@ 337,11 337,11 @@ msgstr ""
msgid "Add this video to a playlist"
msgstr "افزودن این ویدئو به لیستپخش"
-#: ../melon/player/__init__.py:103
+#: ../melon/player/__init__.py:104
msgid "Video could not be loaded"
msgstr ""
-#: ../melon/player/__init__.py:140 ../melon/player/__init__.py:174
+#: ../melon/player/__init__.py:141 ../melon/player/__init__.py:175
#: ../melon/player/playlist.py:51
msgid "Loading..."
msgstr ""
@@ 711,19 711,20 @@ msgid ""
"Disabled servers won't show up in the browser or on the local/home screen"
msgstr ""
-#: ../melon/widgets/player.py:34
+#: ../melon/widgets/player.py:35
msgid "No streams available"
msgstr ""
-#: ../melon/widgets/player.py:80 ../melon/widgets/player.py:279
+#: ../melon/widgets/player.py:81 ../melon/widgets/player.py:283
+#: ../melon/widgets/player.py:288
msgid "Play"
msgstr ""
-#: ../melon/widgets/player.py:101
+#: ../melon/widgets/player.py:102
msgid "Video quality"
msgstr ""
-#: ../melon/widgets/player.py:273
+#: ../melon/widgets/player.py:277
msgid "Pause"
msgstr ""
M po/melon.pot => po/melon.pot +9 -8
@@ 8,7 8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Melon 0.1.3\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2024-03-15 09:36+0100\n"
+"POT-Creation-Date: 2024-03-15 10:02+0100\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"
@@ 76,7 76,7 @@ msgstr ""
#: ../melon/browse/server.py:101 ../melon/browse/server.py:127
#: ../melon/home/history.py:23 ../melon/home/new.py:29
#: ../melon/home/playlists.py:21 ../melon/home/subs.py:20
-#: ../melon/importer.py:61 ../melon/player/__init__.py:101
+#: ../melon/importer.py:61 ../melon/player/__init__.py:102
#: ../melon/player/playlist.py:158 ../melon/player/playlist.py:165
#: ../melon/playlist/__init__.py:50
msgid "*crickets chirping*"
@@ 336,11 336,11 @@ msgstr ""
msgid "Add this video to a playlist"
msgstr ""
-#: ../melon/player/__init__.py:103
+#: ../melon/player/__init__.py:104
msgid "Video could not be loaded"
msgstr ""
-#: ../melon/player/__init__.py:140 ../melon/player/__init__.py:174
+#: ../melon/player/__init__.py:141 ../melon/player/__init__.py:175
#: ../melon/player/playlist.py:51
msgid "Loading..."
msgstr ""
@@ 707,19 707,20 @@ msgid ""
"Disabled servers won't show up in the browser or on the local/home screen"
msgstr ""
-#: ../melon/widgets/player.py:34
+#: ../melon/widgets/player.py:35
msgid "No streams available"
msgstr ""
-#: ../melon/widgets/player.py:80 ../melon/widgets/player.py:279
+#: ../melon/widgets/player.py:81 ../melon/widgets/player.py:283
+#: ../melon/widgets/player.py:288
msgid "Play"
msgstr ""
-#: ../melon/widgets/player.py:101
+#: ../melon/widgets/player.py:102
msgid "Video quality"
msgstr ""
-#: ../melon/widgets/player.py:273
+#: ../melon/widgets/player.py:277
msgid "Pause"
msgstr ""