• AI Created A Simple Countdown Timer For Me

    From Dr. Noah Bodie@noah@bodie.not to alt.os.linux.ubuntu,alt.os.linux.mint on Thu May 8 11:11:32 2025
    From Newsgroup: alt.os.linux.ubuntu

    AI created a countdown timer that has a memo feature. The way it works
    is you create a timer.sh file and when you click it you get a pop-up
    window that asks you to enter the number of minutes to wait before
    playing a whistle sound (your own .mp3 file) and a short note relating
    to what the timer is reminding you of, like "turn off stove"

    ---

    #!/bin/bash

    # Use zenity form to get both minutes and memo in one dialog form_output=$(zenity --forms --title="Set Timer" \
    --text="Enter timer details:" \
    --add-entry="Minutes to wait" \
    --add-entry="Memo")

    # If the user cancelled the form
    if [[ $? -ne 0 ]]; then
    exit 1
    fi

    # Split the form output into variables
    minutes=$(echo "$form_output" | cut -d'|' -f1)
    memo=$(echo "$form_output" | cut -d'|' -f2)

    # Validate minutes input
    if [[ -z "$minutes" || ! "$minutes" =~ ^[0-9]+$ ]]; then
    zenity --error --text="Invalid input. Please enter a number of
    minutes."
    exit 1
    fi

    # Wait for the specified number of minutes
    sleep $(( minutes * 60 ))

    # Play the MP3 in the background
    mpg123 /home/~/Desktop/Sound/Steam.Whistle.mp3 &
    MP3_PID=$!

    # Show final alert with memo and STOP button
    zenity --info \
    --title="Alarm" \
    --ok-label="STOP" \
    --text="Time's up!\n\n$memo"

    # Stop the audio
    kill $MP3_PID 2>/dev/null
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Mike Easter@MikeE@ster.invalid to alt.os.linux.ubuntu,alt.os.linux.mint on Thu May 8 09:05:31 2025
    From Newsgroup: alt.os.linux.ubuntu

    Dr. Noah Bodie wrote:
    AI created a countdown timer that has a memo feature.

    But the 'trick' for AI is 'how to ask/instruct it. So what was your input?
    --
    Mike Easter
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From vallor@vallor@cultnix.org to alt.os.linux.ubuntu,alt.os.linux.mint on Fri May 9 05:04:03 2025
    From Newsgroup: alt.os.linux.ubuntu

    On Thu, 08 May 2025 11:11:32 -0300, "Dr. Noah Bodie" <noah@bodie.not>
    wrote in <vvie2m$1roae$1@dont-email.me>:

    AI created a countdown timer that has a memo feature. The way it works
    is you create a timer.sh file and when you click it you get a pop-up
    window that asks you to enter the number of minutes to wait before
    playing a whistle sound (your own .mp3 file) and a short note relating
    to what the timer is reminding you of, like "turn off stove"

    ---

    #!/bin/bash

    # Use zenity form to get both minutes and memo in one dialog form_output=$(zenity --forms --title="Set Timer" \
    --text="Enter timer details:" \
    --add-entry="Minutes to wait" \
    --add-entry="Memo")

    # If the user cancelled the form
    if [[ $? -ne 0 ]]; then
    exit 1
    fi

    # Split the form output into variables
    minutes=$(echo "$form_output" | cut -d'|' -f1)
    memo=$(echo "$form_output" | cut -d'|' -f2)

    # Validate minutes input
    if [[ -z "$minutes" || ! "$minutes" =~ ^[0-9]+$ ]]; then
    zenity --error --text="Invalid input. Please enter a number of minutes."
    exit 1
    fi

    # Wait for the specified number of minutes
    sleep $(( minutes * 60 ))

    # Play the MP3 in the background
    mpg123 /home/~/Desktop/Sound/Steam.Whistle.mp3 &
    MP3_PID=$!

    # Show final alert with memo and STOP button
    zenity --info \
    --title="Alarm" \
    --ok-label="STOP" \
    --text="Time's up!\n\n$memo"

    # Stop the audio
    kill $MP3_PID 2>/dev/null

    Very cool!

    I have a countdown timer script for use with (older version of) xdaliclock, suitable for streaming video on (say) twitch.

    If there's interest, I'll post it.
    --
    -v System76 Thelio Mega v1.1 x86_64 NVIDIA RTX 3090 Ti
    OS: Linux 6.14.5 Release: Mint 22.1 Mem: 258G
    "A friend: someone who likes you even after they know you."
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Lawrence D'Oliveiro@ldo@nz.invalid to alt.os.linux.ubuntu,alt.os.linux.mint on Fri May 9 07:56:18 2025
    From Newsgroup: alt.os.linux.ubuntu

    On Thu, 08 May 2025 11:11:32 -0300, Dr. Noah Bodie wrote:

    # Split the form output into variables
    minutes=$(echo "$form_output" | cut -d'|' -f1)
    memo=$(echo "$form_output" | cut -d'|' -f2)

    Could have some fun by entering text with “|” characters in it ...
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From yossarian@alt.os.linux.ubuntu,alt.os.linux.mint on Sun May 11 18:09:10 2025
    From Newsgroup: alt.os.linux.ubuntu

    On Thu, 08 May 2025 11:11:32 -0300
    "Dr. Noah Bodie" <noah@bodie.not> wrote:

    # Play the MP3 in the background
    mpg123 /home/~/Desktop/Sound/Steam.Whistle.mp3 &
    MP3_PID=$!

    There is error. It's not mpg123, must be mpg321. Not installed by
    default. :)
    --
    Running Linux Mint 22.1 (Xia) using Kernel=6.11.0-25-generic on x86_64 , Cinnamon, lightdm, x11
    AMD Ryzen 7 5700G with Radeon Graphics (16) @ 5.288GHz

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Lawrence D'Oliveiro@ldo@nz.invalid to alt.os.linux.ubuntu,alt.os.linux.mint on Sun May 11 23:44:51 2025
    From Newsgroup: alt.os.linux.ubuntu

    On Sun, 11 May 2025 18:09:10 +0200, yossarian < wrote:

    There is error. It's not mpg123, must be mpg321. Not installed by
    default. :)

    <https://packages.debian.org/bookworm/mpg123> <https://packages.debian.org/bookworm/mpg321>

    Neither is, I think.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From yossarian@alt.os.linux.ubuntu,alt.os.linux.mint on Mon May 12 07:55:31 2025
    From Newsgroup: alt.os.linux.ubuntu

    On Sun, 11 May 2025 23:44:51 -0000 (UTC)
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:

    On Sun, 11 May 2025 18:09:10 +0200, yossarian < wrote:

    There is error. It's not mpg123, must be mpg321. Not installed by
    default. :)

    <https://packages.debian.org/bookworm/mpg123> <https://packages.debian.org/bookworm/mpg321>

    Neither is, I think.

    Terminal output for me was like this.

    ~$ mpg123
    Command 'mpg123' not found, but can be installed with:
    sudo apt install mpg321

    So I presumed there is no mpg123 :), and it's working.
    --
    Running Linux Mint 22.1 (Xia) using Kernel=6.11.0-25-generic on x86_64 , Cinnamon, lightdm, x11
    AMD Ryzen 7 5700G with Radeon Graphics (16) @ 5.288GHz

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Dr. Noah Bodie@noah@bodie.not to alt.os.linux.ubuntu,alt.os.linux.mint on Wed May 14 17:18:10 2025
    From Newsgroup: alt.os.linux.ubuntu

    On 2025-05-11 01:09 PM, yossarian < wrote:
    On Thu, 08 May 2025 11:11:32 -0300
    "Dr. Noah Bodie" <noah@bodie.not> wrote:

    # Play the MP3 in the background
    mpg123 /home/~/Desktop/Sound/Steam.Whistle.mp3 &
    MP3_PID=$!

    There is error. It's not mpg123, must be mpg321. Not installed by
    default. :)

    https://www.mpg123.de
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Mike Easter@MikeE@ster.invalid to alt.os.linux.ubuntu,alt.os.linux.mint on Wed May 14 13:40:09 2025
    From Newsgroup: alt.os.linux.ubuntu

    Dr. Noah Bodie wrote:
    yossarian < wrote:
    "Dr. Noah Bodie" wrote:

    # Play the MP3 in the background
    mpg123 /home/~/Desktop/Sound/Steam.Whistle.mp3 &
    MP3_PID=$!

    There is error. It's not mpg123, must be mpg321. Not installed by
    default. :)

    https://www.mpg123.de

    Ha. Not only are there both mpg123 & mpg321, but there is also mpyg321
    which is a python wrapper for both/either.

    https://pypi.org/project/mpyg321/
    --
    Mike Easter
    --- Synchronet 3.21a-Linux NewsLink 1.2