Skip to content

A Timewarrior-based time tracker for mpv.

License

Notifications You must be signed in to change notification settings

linguisticmind/mediaw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mediaw (Mediawarrior)

Mediawarrior is a time-tracking plugin for mpv. It talks to Timewarrior to help you track what you watch or listen to in mpv player. Language learners will appreciate Mediawarrior's ability to automatically add a language tag to a Timewarrior entry and an increased awareness of how much time you spend consuming content in your target language.

Video tutorials:

Mediawarrior v0.1.0 Related: watchtower
(useful Timewarrior-related scripts)
Mindful Technology - Mediawarrior: a time tracker for mpv Mindful Technology - watchtower: organize your favorite tasks for the watch command

Support me on Ko-fi

Changelog

0.1.2 2025-12-18

Fixed a timezone conversion issue: was setting a wrong date/time when using mediaw-start-retro.

Read more

Dependencies

Required

Required dependencies must be installed in order for Mediawarrior to work.

Name Installation Notes
Timewarrior sudo apt install timewarrior

Homepage: https://timewarrior.net/

GitHub: https://github.com/GothenburgBitFactory/timewarrior

Installation and upgrading

# Install:
cd ~/.config/mpv/scripts
git clone https://github.com/linguisticmind/mediaw.git
# Upgrade:
cd ~/.config/mpv/scripts/mediaw
git pull

Options

Options can be set either on the command line, or in a configuration file.

In both cases, this script's identifier – mediaw – will be needed.

Use --script-opts=<identifier>-<option>=<value>,... to set options on the command line.

To set options in a configuration file, create the following file: ~/.config/mpv/script-opts/<identifier>.conf. Set options in the file, one per line, in the following fashion: <option>=<value>.

More information on mpv's script-opts command line and configuration file syntax can be found here (based on the example of the built-in osc.lua script).

The table below lists the options that are available for this script.

NOTE: The default values are shown as they appear in the script's source code written in Lua. In mpv, when passing script options on the command line, or setting them in a configuration file, the words yes and no are used for Lua's true and false, and string values are not quoted.

Option Default value Description
tag 'mediaw'

Main Timewarrior tag.

language_tag true

Whether to add a language tag.

language_props_check 'current-tracks/sub/lang,slang,current-tracks/audio/lang,alang'

A comma-separated list of mpv properties to check to determine the language used for the language tag.

Properties are checked in the specified order. The first non-nil value is used.

language ''

Set the language used for the language tag manually.

If set to a non-empty string, overrides language_props_check.

Must be a valid two- or three-letter ISO 639 language code. The language tag will then be formatted according to the value of language_tag_format.

language_tag_format 'alpha_2'

Format of the language tag.

Possible values:

'alpha_2', 'iso_639_1'
Two-letter language codes.
'alpha_3', 'iso_639_2'
Three-letter language codes. Adding .b or .t to the value swithes between bibliographic and terminological codes. The default is bibliographic.
'name'
Language name in English.

osd true

Whether to show on-screen messages.

debug false

Show debug messages in the console.

dry_run false

Suppress execution of shell commands.

Keybindings

Video tutorial

Keybindings can be remapped in ~/.config/mpv/input.conf. Add a line in the following format to remap a keybinding: <key> script-binding <name>.

If you remap a keybinding, you will likely want to disable the default keybinding by adding <default key> ignore to ~/.config/mpv/input.conf. See the video tutorial linked to above for a demonstration and for information on how to see what a given key is currently mapped to in mpv.

The following keybindings are available for this script:

Key Name Description
Ctrl+t mediaw-start Start tracking.
Ctrl+Alt+t mediaw-start-retro Start tracking and retroactively correct the start time to the time when the file was open.
Ctrl+T mediaw-stop Stop tracking.
Ctrl+Alt+T mediaw-cancel Stop tracking and delete the entry.
Ctrl+SPACE mediaw-pause Pause playback and tracking. Tracking will resume when the player is unpaused.
Ctrl+Alt-SPACE mediaw-pause-on-next Pause playback and tracking when the next file in the playlist is reached.

License

GNU General Public License v3.0

About

A Timewarrior-based time tracker for mpv.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages