Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/dakara_player/media_player/mpv.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def play(self, what):

if what == "song":
# manage instrumental track/file
path_audio = str(self.playlist_entry_data["song"].path_audio)
path_audio = self.playlist_entry_data["song"].path_audio
if path_audio:
if path_audio == "self":
# mpv use different index for each track, so we can safely request
Expand All @@ -404,7 +404,7 @@ def play(self, what):
logger.debug("Requesting to play audio track 2")

else:
self.player.audio_files = [path_audio]
self.player.audio_files = [str(path_audio)]
logger.debug("Requesting to play audio file %s", path_audio)

# if the subtitle file cannot be discovered, do not request it
Expand Down
10 changes: 10 additions & 0 deletions tests/integration/test_media_player_mpv.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ def test_play_playlist_entry(self):
# check audio track
self.assertEqual(mpv_player.player.audio, 1)

# check there is no audio file
self.assertEqual(len(mpv_player.player.audio_files), 0)

# assert the started song callback has been called
mpv_player.callbacks["started_song"].assert_called_with(
self.playlist_entry1["id"]
Expand Down Expand Up @@ -251,6 +254,9 @@ def test_play_playlist_entry_instrumental_track(self):
# check audio track
self.assertEqual(mpv_player.player.audio, 2)

# check there is no audio file
self.assertEqual(len(mpv_player.player.audio_files), 0)

# assert the started song callback has been called
mpv_player.callbacks["started_song"].assert_called_with(
self.playlist_entry1["id"]
Expand Down Expand Up @@ -285,6 +291,10 @@ def test_play_playlist_entry_instrumental_file(self):
# check audio track
self.assertEqual(mpv_player.player.audio, 3)

# check audio file
self.assertEqual(len(mpv_player.player.audio_files), 1)
self.assertEqual(mpv_player.player.audio_files[0], str(self.audio2_path))

# assert the started song callback has been called
mpv_player.callbacks["started_song"].assert_called_with(
self.playlist_entry1["id"]
Expand Down