Skip to content

wpdevelopment11/mpv-fzf-playlist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Switch between mpv playlist entries using fzf (with EPG support in XMLTV format)

Jump between mpv playlist entries using your terminal. Use a fuzzy search to quickly find the entry you are looking for.

If you are watching IPTV, you can provide an EPG file in XMLTV format to see the title of the current TV program and the title and start time of the next one.

Tested only on Linux.

Screenshots

screenshot of a playlist with TV listings

screenshot of mpv playlist loaded into fzf

Requirements

  • Works on Linux.

    Other operating systems are untested.

  • Start your mpv instance with the --input-ipc-server option, for example:

    mpv --input-ipc-server=/tmp/mpvsocket playlist.m3u8
    
  • Make sure that you have installed:

    • fzf
    • jq
    • socat
    • If you want to use the EPG feature: xq (xq-python on Debian/Ubuntu)

Usage

Copy the mpvpl script somewhere in your PATH.

To see the current playlist and switch playlist entries, run the following:

mpvpl

If you are watching IPTV, you can pass an EPG in XMLTV format to see the current and the next TV program:

The names of channels in your playlist and in an XMLTV file must match. Otherwise, TV programs will not be listed.

mpvpl https://example.com/xmltv.xml.gz

You can press Ctrl+R to reload a playlist and programs.

The provided URL will be cached and will be downloaded again only if it has changed on the server.

Internally, an xml.gz file will be converted to json.gz to make it possible to query it using jq.

You can convert an XMLTV file with the `xml.gz` extension to `json.gz` using the following command:
gzip -cd xmltv.xml.gz  | xq -c --xml-force-list display-name '(now | strflocaltime("%Y%m%d%H%M%S %z")) as $now | .tv.channel[],null,([.tv.programme[] | select(.["@stop"] >= $now)] | sort_by(.["@channel"], .["@stop"]) | .[])' - | gzip > xmltv.json.gz

The conversion can be time-consuming and memory hungry for large files.


You can provide a path to the local XMLTV file:

mpvpl /path/to/xmltv.xml.gz
# Path to a JSON file converted using the xq command above
mpvpl /path/to/xmltv.json.gz

Watch a demo

demo.mp4

Limitations

  • Conversion from XML to JSON is needed to be able to query TV programs using jq. It may take a lot of time depending on the EPG size, but it's done only once for each URL.

About

Switch mpv playlist entries using fzf. Provide an EPG file in XMLTV format to see the current programs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages