Is there a way I can get total listening time from command line? I want to write a script to keep track of how much time I spend listening to music on a daily basis.
First, using the following command:
you can check if Banshee is running.
If yes, you can use:
command in your bash script to get the current Banshee state (if it's playing or not).
Here is some rudimentary bash code from which you can start and improve your script:
#!/bin/bash seconds=0 while : ; do if ( pgrep banshee > /dev/null ); then if [ "$(banshee --query-current-state | cut -d' ' -f2)" = "playing" ]; then (( seconds++ )) echo "Total listening time: $seconds seconds" fi fi sleep 1 done
Here are some (not console, but with GUI) time-tracking apps:
- Package: gtimer
- Section: universe/utils
GTK-based X11 task timer
A graphical program that tracks how your time is spent. Maintains a simple list of tasks, each of which can belong to a project, and allows you to track time in each. Multiple clocks can run simultaneously, annotations can be added to a day's time, and reports can be generated in either HTML or text. If GTimer detects that you're idle, you are given the option of subtracting off the time you spent idle when you return.
Compared to other time tracking applications, GTimer is graphical without depending on a desktop environment and aims for simplicity rather than attempting to be a full-fledged project tracking and billing application.
sudo apt-get install gtimer
A Gtk+ time tracking application
Time Tracker (a.k.a. gtimelog) provides a time tracking application to allow the user to track what they work on during the day and how long they spend doing it.
sudo apt-get install gtimelog
- Package: hamster-applet
- Section: universe/gnome
Time tracking applet for GNOME
Project Hamster helps you to keep track of how much time you spend on various activities during the day. Whenever you move from one task to another, you change your current activity in the GNOME applet.
It can present graphical statistics of how long you have spent on each task, and may be useful for project management or keeping employee timesheets.
sudo apt-get install hamster-applet
To install AppIndicator for the same:
sudo apt-get install hamster-indicator