jaseg / python-mpv

Python interface to the awesome mpv media player
https://git.jaseg.de/python-mpv.git
Other
543 stars 68 forks source link

HOW TO run a playlist via python-mpv #142

Closed Himan10 closed 3 years ago

Himan10 commented 3 years ago

Hello there, Recently I started using this library and got impressed with its functionality and features provided. So I needed it for a project and some task of the project are related to :

  1. Running a single song -> This one seems easy to me, and clearly understood by your mentioned docs.

  2. Running a playlist -> This one made me little confused, as I have N number of songs in a list object and IDK how to run a playlist and each time give the control to the user so they can do other task as well. For example : while the playlist is running then user can make commands like "pause", "stop". I couldn't find anyway to run N number of songs sequentially. What I did : (running the script via interactive shell)

  3. Search for songs via os.walk() and format it via regex so "my december" == "{pwd}/My_December(Linkin Park)"

  4. while len(searched_songs):

    player.playlist_append(searched_songs.pop(0))

Here IDK how to make this playlist run. Either I need a loop or might be something else. Any help would be appreciated, Thank you.