From 3bab1ac8960e3d864681bf9633b78d3e6dc45aab Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 28 Nov 2024 14:57:36 +0100
Subject: [PATCH] Reduce reliance on mpv.py conveniences for raw libmpv command
 access.

---
 src/ytplom/misc.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/ytplom/misc.py b/src/ytplom/misc.py
index 59a9a93..b207d49 100644
--- a/src/ytplom/misc.py
+++ b/src/ytplom/misc.py
@@ -515,8 +515,8 @@ class Player:
             self._signal_update()
 
         for path in [f.full_path for f in self._files]:
-            self._mpv.playlist_append(path)
-        self._mpv.playlist_play_index(self._idx)
+            self._mpv.command('loadfile', path, 'append')
+        self._mpv.command('playlist-play-index', self._idx)
 
     @_if_mpv_available
     def _kill_mpv(self) -> None:
@@ -574,19 +574,19 @@ class Player:
         """Move player to previous item in playlist."""
         assert self._mpv is not None
         if self._mpv.playlist_pos > 0:
-            self._mpv.playlist_prev()
+            self._mpv.command('playlist-prev')
         else:
-            self._mpv.playlist_play_index(0)
+            self._mpv.command('playlist-play-index', 0)
 
     @_if_mpv_available
     def next(self) -> None:
         """Move player to next item in playlist."""
         assert self._mpv is not None
-        max_idx: int = len(self._mpv.playlist_filenames) - 1
-        if self._mpv.playlist_pos < len(self._mpv.playlist_filenames) - 1:
-            self._mpv.playlist_next()
+        max_idx = len(self._mpv.playlist) - 1
+        if self._mpv.playlist_pos < max_idx:
+            self._mpv.command('playlist-next')
         else:
-            self._mpv.playlist_play_index(max_idx)
+            self._mpv.command('playlist-play-index', max_idx)
 
     def reload(self) -> None:
         """Close MPV, re-read (and re-shuffle) filenames, then re-start MPV."""
-- 
2.30.2