Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 17 Sep 2019, 08:55
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Multilingual Spoken Startup Welcome Plus Internet Alarm
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [4 Posts]  
Author Message
ETP


Joined: 19 Oct 2010
Posts: 1164
Location: UK

PostPosted: Tue 05 Feb 2019, 12:29    Post subject:  Multilingual Spoken Startup Welcome Plus Internet Alarm
Subject description: Original Pet - February 2019 --- New Pet May 2019
 

Multilingual Spoken Startup Welcome Plus Internet Connection alarm

This .pet (startup_welcome_alert-mk1) provides a verbal multilingual welcome plus an alarm should a working internet connection not have been established.

The spoken welcome varies according to the time of day & the script also verifies that a working Internet connection exists.
If it does not, an alarm will sound instead of the welcome.
Both the greeting and the alarm are supplemented by on-screen messages in English.

Only a single mp3 audio file is included in the .pet for the alarm, everything else including translation is handled by TTS.
This pet is suitable for use with recent WoofCE Pups and has been tested with 666philb's Bionicpup64 7.9.8 CE RC & 8.0

Installation:

1. Use ppm to install xdotool & mpv if not currently present.

2. Use ppm to install translate-shell_0.9.6.6-1 plus it's dependencies.

3. Install the attached pet, then reboot ensuring that you save the session.The pet will activate following a further reboot & save.

Final thoughts & additional info:

A. Whilst Google Translate is used as the default translation engine other engines may be specified:-
    root# trans -S
    aspell
    * google
    deepl
    bing
    spell
    hunspell
    apertium
    yandex
    root#

B. The language code used for speech is extracted automatically from your settings variable($LANG). See shot below for a complete list in English of codes.

C. No browsers are involved in this process.

D. The text to be spoken can easily be changed. In addition once you have translate-shell installed you can issue spoken messages from either
the command line or from within any script, perhaps to warn of impending meltdown or lack of free memory.
A simple example CLI command follows which will be translated from English text and spoken in French.

Code:
trans -b -p en: :fr "Good day Wee Hamish","Internet access is confirmed. Would you like to play the square game?"


E. In conclusion loads of fun plus multiple potential uses. (trans -h for help)
startup_welcome_alert-mk1.pet
Description 
pet

 Download 
Filename  startup_welcome_alert-mk1.pet 
Filesize  161.87 KB 
Downloaded  138 Time(s) 
lang-codes.png
 Description   
 Filesize   237.17 KB
 Viewed   461 Time(s)

lang-codes.png

Main_script _in_pet.png
 Description   
 Filesize   74.29 KB
 Viewed   462 Time(s)

Main_script _in_pet.png


_________________
Regards ETP

Kennels

Last edited by ETP on Mon 20 May 2019, 03:07; edited 4 times in total
Back to top
View user's profile Send private message 
foxpup


Joined: 29 Jul 2016
Posts: 937
Location: europa near northsea

PostPosted: Tue 05 Feb 2019, 16:39    Post subject:  

hello ETP

I've tried it on dPup Stretch from radky and it works.
I find it very nice. It's a good idea. And you are very resourceful.
Thanks! 'll keep it in my toolbox.

I will try out the translation/localisation now.

Edit:
I changed my locale to nl_be. Then on restarting X I got a welcome in dutch, which is right (dutch=nederlands=nl).
Just did not expect it on restarting X as well.
Back to top
View user's profile Send private message 
ETP


Joined: 19 Oct 2010
Posts: 1164
Location: UK

PostPosted: Wed 06 Feb 2019, 11:18    Post subject: Multilingual Spoken Startup Welcome Plus Internet Alarm  

Hi foxpup,

Thanks for testing and your confirmation that it works in dPup Stretch from radky.
It is intended that it triggers when X is restarted.

_________________
Regards ETP

Kennels
Back to top
View user's profile Send private message 
ETP


Joined: 19 Oct 2010
Posts: 1164
Location: UK

PostPosted: Sun 19 May 2019, 15:05    Post subject: Multilingual Spoken Startup Welcome Plus Internet Alarm
Subject description: New pet May 2019
 

New pet May 2019

The attached startup_welcome_alert-mk2.pet improves on the mk1 version with a couple of extra optional features.

In the original pet the text to be spoken in your native language was as follows:

"Good morning/afternoon/evening, Internet access is confirmed."

In this new version you may also be greeted by a name of your choice and the weekday may also be announced.
Example:

"Good afternoon Steve. Today is Sunday, Internet access is confirmed."

The revised commented main script is reproduced below. In the example above I have simply replaced Root with Steve

If you wish to move to this new version first use PPM to uninstall the mk1 version.

Code:
#!/bin/sh
# This is /root/noob/startup_welcome_alarm.sh    ETP February 2019
# Modified May 2019 to include 2 additional variables (cognomen and day). Either or both lines (6 & 7) may be commented out if not required.
# Please substitute your own desired handle for Root  e.g. Fred (The displayed messages have not been changed.)
#
cognomen=Root;echo $cognomen
day="Today is `date +%A`,";echo $day
check=`date +%H`
echo $check
if [ $check -ge 05 -a $check -le 11 ]

then
        tod="Good morning $cognomen."

elif [ $check -ge 12 -a $check -le 17 ]

then
        tod="Good afternoon $cognomen."
else
        tod="Good evening $cognomen."
fi
player=mpv
alarmclip=/usr/share/audio/no_internet.mp3
#lang=fr # Uncomment for testing only & comment out the following line.
lang=`echo $LANG | cut -d_ -f1`
echo $lang
#
#
sleep 18 # May be reduced from default of 18 seconds to 15 or less if using an SSD or fast HD.  Also if using a static IP rather than DHCP.
echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1
if [ $? -eq 0 ]; then
        trans -b -p -player mpv en: :$lang "$tod $day Internet access is confirmed." &
        xdotool mousemove --polar 0 0 mousemove_relative 0  40
        yaf-splash -close never -fontsize large -bg yellow -fg black -timeout 12 -text "   Internet access is confirmed.   "
else
        yaf-splash -close never -fontsize large -bg red -fg white -timeout 10 -text "---   WARNING: No Internet Connection   ---" &
        $player $alarmclip
fi
startup_welcome_alert-mk2.pet
Description 
pet

 Download 
Filename  startup_welcome_alert-mk2.pet 
Filesize  161.82 KB 
Downloaded  75 Time(s) 

_________________
Regards ETP

Kennels
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [4 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0549s ][ Queries: 12 (0.0222s) ][ GZIP on ]