💾 Archived View for frrobert.net › log › mpvaudiobook-2020-05-14.gmi captured on 2022-07-16 at 13:51:57. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-11-30)

-=-=-=-=-=-=-

---

Title: MPV as an Audiobook Player

Published: 2020-05-14 07:44

Author: Rev. Fr. Robert Bower

Tag:

layout: blog

---

To my dismay I can not find a terminal based audiobook reader. I can find plenty of music and even video players that are terminal based but nothing for audiobooks. I was talking to Roman, he is my black lab (think Mr. Peabody with black fur and without the glasses), about this and he suggested using one of the terminal players for music or videos. The problem is having a way to save your place in the audiobook

After much review we decided to use MPV. MPV has a switch **--save-position-on-quit** this allows you to resume playback where you left off if you quit the program and start it up later. The switch has one limitation it can only save the position for one file at a time. If you use that switch on the playback of multiple files it saves only the quit position for the last file played.

There are two switches I tried **--use-filedir-conf** which looks for file-specific configuration files in the same directory as the file being played. I tried this option first but I could not get it to be consistency applied. Sometimes it worked as intended and sometimes not. I am assuming the issue was me and not MPV. I may go back later and try to see if I can get this to work.

The second approach I tried was using the **--config-dir=<path>**. This approach is the one that worked for me.

The first thing I did was create a directory in my current MPV config directory called book1. Next, I created a subdirectory in book1 called watch_later. This is the default directory that MPV will use to store the current stopping point. The new configuration file only has one line in it **save-position-on-quit**. This file is saved in book1 with the name mpv.conf Whenever this configuration is called it will save your position in watch_later.

Next I created a bash script the started MPV using the configuration file I just created. The script starts MPV with the specified configuration file and plays a playlist I created for the book called book1.m3u

     #!/bin/sh
     mpv --config-dir='/pathto.config/.config/mpv/book1' /pathtoplaylist/book1.m3u

If you listen to more than one book at a time, just repeat this setup for book2 and then for book3 till you get to the number of books you listen to simultaneously.

When you finish a book and want to start a new book just edit the book1 playlist and remove the old book and add the files for the new book.

This configuration allows me to start and stop playing my audio book and have MPV remember which file I left off at and where in that file I left off at.

Zettelkasten ID **mpvaudiobook-2020-05-14-0744**

..