From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 7eb35017 for ; Tue, 20 Aug 2019 06:37:01 +0000 (UTC) Received: (qmail 18758 invoked by alias); 20 Aug 2019 06:36:51 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24160 Received: (qmail 22735 invoked by uid 1010); 20 Aug 2019 06:36:51 -0000 X-Qmail-Scanner-Diagnostics: from 195-159-176-226.customer.powertech.no by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25545. spamassassin: 3.4.2. Clear:RC:0(195.159.176.226):SA:0(2.0/5.0):. Processed in 4.723236 secs); 20 Aug 2019 06:36:51 -0000 X-Envelope-From: gcszu-zsh-users@m.gmane.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at m.gmane.org does not designate permitted sender hosts) X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: zsh-users@zsh.org To: zsh-users@zsh.org From: Emanuel Berg Subject: audio-timer, when I sent it I was offline from news.gmane.org so I don't know if you got it, I sure don't see it Date: Tue, 20 Aug 2019 08:35:55 +0200 Message-ID: <86lfvoe438.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Mail-Copies-To: never Cancel-Lock: sha1:cFBA03XkbI4F85Oerlx35o3FRq4= Is this any good? Oh, obviously not everyone has omx-play-sound, unix-time, and the files are hard-coded but I think you get the meaning. Feel free to set it up POSIX style BTW :) #! /bin/zsh # this file: http://user.it.uu.se/~embe8573/conf/.zsh/audio-timer # https://dataswamp.org/~incal/conf/.zsh/audio-timer timer () { # arguments local init=${1:-10} # seconds local interval=${2:-40} # s local pause=${3:-0} # s local total=${4:-60} # minutes # stop time local total_secs=$(( $total * 60 )) local now=$(unix-time) local stop_time=$(( $now + $total_secs )) # sounds local interval_sound=~/bo/blum/blum.mp3 local pause_sound=~/bo/bo/bo.m4a local end_sound=~/bo/up.mp3 # report echo " init: $init s" echo "interval: $interval s" echo " pause: $pause s" echo " total: $total min" # get up your chair echo "\n(get ready...)" sleep $init local so_far=1 # go echo "\n[program begins]" echo -n "\nso far: " while (( $now < $stop_time )); do omx-play-sound $interval_sound sleep $interval # do stretch/exercise here echo -n "$so_far " so_far=$(( $so_far + 1 )) # pause if (( $pause > 0 )); then omx-play-sound $pause_sound sleep $pause fi now=$(unix-time) done # done omx-play-sound $end_sound echo "\n\ngreat work, you are done! :)" } -- underground experts united http://user.it.uu.se/~embe8573 https://dataswamp.org/~incal