McSinyx / comp

Migrated to https://git.sr.ht/~cnx/comp
https://pypi.org/project/comp/
GNU Affero General Public License v3.0
15 stars 1 forks source link

Use mpv playlist #3

Open McSinyx opened 7 years ago

McSinyx commented 7 years ago

Currently the playlist functions (go backward/forward, history, shuffle, repeat, etc.) are implemented in Python by me, which is slow and buggy (-er than mpv's, which is written in C and well tested). The mpv playlist is quite easy to use by triggering the MPV.playlist_* functions, but there are a few remaining problems:

  1. The logic:
    • Currently comp has a (stupidly) unique history handling, i.e. when you go backward, it will go back to the previously played tracks, not caring whether which mode it's in. This is weird, as in shuffle mode we'd expect to have randomly chosen track either go back or forward when there is no track really there. I mean I want history to be mode-wise. This makes implementing mpv's playlist lose the point.
    • Selective modes: this is a new (read: weird) feature made to allow user to have temporary subplaylist. I'm thinking about sth similar to visual mode, so we'll only change the mpv playlist when there is a user command to do so. Update: This will requires rewriting the playlist so we'll need to have another one for displaying.
    • Instant repeat/shuffle mode changing: currently user need to press play key (return/enter key) to get the playlist updated (as it's implement in an iterator, the mode can't be switch dynamically). This is so so inconvenience. Update: mpv has loop-file and loop-list for repeating but shuffling can only be done by playlist-shuffle function which well, shuffle the list up, so when we switch to another mode, I guess rewrite the whole list is a must.
  2. To do this, we'll need filename to parse to mpv, but youtube-dl extract flat playlist, at least with Youtube playlists return list of dicts containing IDs, not full URL. Maybe solving #2 will help. SOLVED