#time #planner #content #consumption #saved #bank #strategic

bin+lib trimsec

Strategic (& fast) content consumption planner

13 releases

new 0.3.1 Mar 5, 2025
0.3.0 Feb 19, 2025
0.2.0 Dec 27, 2024
0.1.9 Dec 26, 2024

#1 in #saved

Download history 794/week @ 2024-12-21 74/week @ 2024-12-28 2/week @ 2025-01-04 1/week @ 2025-02-01 108/week @ 2025-02-15 20/week @ 2025-02-22 137/week @ 2025-03-01

266 downloads per month

MIT license

28KB
465 lines

trimsec

Unit Tests Release Builds

Strategic (& fast) content consumption planner.

Table of Contents

Overview

trimsec provides an easy way to accurately estimate how much time you save on watching videos when using speed multipliers. This is essentially helpful when watching recorded classes or documentaries online, in case you do not have enough time to spare based on your situation.

Since I am also a student and both coordinating between my routine, as well as manually doing the math required to estimate my overall hours for study wasn't an option I'd consider - I chose to program a tool that would automate the process for me.

If you like this tool, consider starring the repository ✨ on GitHub! It really encourages me to build more open-source tools like this. :D

Usage

The tool provides two core functionalities: calculating saved time with a speed multiplier and managing your time bank data. This guide explains how to use both features in a seamless flow.

To calculate saved time, you run the trim command as follows:

$ trimsec trim <duration> <speed>

Here, <duration> represents the length of the video you are watching (using any combination of <days>d, <hours>h, <minutes>m, and <seconds>s), and <speed> is the speed multiplier—a floating-point number that can optionally be suffixed with an x (for example, both 1.5x and 1.5 are valid). For instance, if you are watching a 1-hour video at 2x speed, execute:

$ trimsec trim 1h 2x

This command outputs the time you saved by watching the video at 2x speed. You can also combine multiple duration indicators and apply floating-point multipliers, such as:

$ trimsec trim 1h30m 1.5x

For convenience, in some cases you might use floating-point numbers for the duration itself. For example:

# Equivalent to `2h 1.5x`.
$ trimsec trim 1.5h30m 1.5x

If you wish to calculate saved time for multiple durations at once using the same speed multiplier, separate the durations with a '+' sign:

$ trimsec trim 1h30m+2h50m 1.25x

Each of these commands follows a consistent pattern for specifying durations and multipliers.

In addition to calculating saved time, every trim command interacts with a “time bank” that logs the total amount of saved time per day in a JSON file. To manage this time bank, you have several options:

  • To display the current saved time for each day, use:
$ trimsec bank show
  • To reset the time bank, run:
$ trimsec bank reset
  • And if you want to know the absolute path to the time bank file, simply execute:
$ trimsec bank path

Installation

cargo

If you have Rust and Cargo installed, you can install trimsec by running the following command:

$ cargo install trimsec

mise

To install trimsec as a tool using mise, use the following command:

$ mise use -g cargo:trimsec

Manual installation

Standalone binaries for this project are all available at the GitHub Releases page. The binaries are produced by automated GitHub Actions workflows on three distinct runners and should run on all their respective platforms.

In case, however, if you prefer building standalone binaries native to your machine, here's a few commands to help you:

# Clone the repository.
$ git clone https://github.com/hitblast/trimsec.git
$ cd trimsec

# Output: target/release/trimsec
$ cargo build --release

Either you download the binary from the mentioned page above or manually compile, you will have to move it to somewhere which can be directly pointed at using the $PATH variable. Here's an example:

$ mv target/release/trimsec ~/.local/bin/

# (Optional) This code appends the binary path to the PATH environment variable.
$ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
$ source ~/.bashrc

# Now you can run the binary from anywhere.
$ trimsec 1h20m 1.75x

Contributors

furtidev
furtidev

💻

Changelog

For release notes and changelog, please refer to the CHANGELOG.md file.

License

This project is licensed under the MIT License.

Dependencies

~3–10MB
~99K SLoC