From 4168064adee8227b193c2d9ef799cdcc8fde5aa9 Mon Sep 17 00:00:00 2001 From: jaseg Date: Sun, 7 May 2017 15:59:16 +0200 Subject: README: Add playlist example --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 44c4f4f..13177cc 100644 --- a/README.md +++ b/README.md @@ -58,3 +58,21 @@ player.wait_for_playback() del player ``` + +```python +#!/usr/bin/env python3 +import mpv + +player = mpv.MPV(ytdl=True, input_default_bindings=True, input_vo_keyboard=True) + +player.playlist_append('https://youtu.be/PHIGke6Yzh8') +player.playlist_append('https://youtu.be/Ji9qSuQapFY') +player.playlist_append('https://youtu.be/6f78_Tf4Tdk') + +player.playlist_pos = 0 + +while True: + # To modify the playlist, use player.playlist_{append,clear,move,remove}. player.playlist is read-only + print(player.playlist) + player.wait_for_playback() +``` -- cgit