Page 2 of 5

Posted: Sat 26 Jun 2010, 15:08
by musher0
Now, now, kids! :roll:
You can have all the fun after your homework is done! :lol:

Posted: Sat 26 Jun 2010, 23:46
by big_bass
Hey Lobster your script is looking good with flite

I was looking for a new image hows this

a lot of work getting that alpha channel
thingy working
needs a smile I'll leave that to
whoever that wants to play a bit with it


Joe

Posted: Sun 27 Jun 2010, 03:41
by technosaurus
Now Puppified

Code: Select all

xpupsay --pup=puppy Hello
or simply

Code: Select all

xpupsay Hello

Posted: Sun 27 Jun 2010, 05:20
by Lobster
Now Puppified
Thank goodness. Those Lobsters were driving me crazy (sorry Joe)
- and I don't have too far to go . . . :wink:

Used your new pet technosaurus
working fine 8)

are there other option such as

Code: Select all

xpupsay --pup=lobster Hello
xpupsay --pup=cow Hello
Ah no - just the one puppy png link?
but have you got all the code in that one 25k pet? Impressive if so . . .

I have streamlined the code specifically for the new pet and Puppy Lucid
As far as I can tell, if flite is not included the program will still work OK

Code: Select all

#! /bin/bash

cd /
xpupsay --pup=puppy --time=2 --dream=/usr/share/doc/community48.jpg "$@" 
aplay /usr/share/audio/2barks.au "$@" &
flitet "Welcome to Puppy." | aplay & 
xpupsay --pup=puppy Welcome to Puppy."$@"
flitet "Made with Puppy magic, and the best Ubuntu bits." | aplay &
xpupsay --pup=puppy Made with Puppy magic and the best Ubuntu bits."$@"
flitet "What is new for 5.1 of Puppy Lucid?" | aplay & 
xpupsay --pup=puppy What is new for 5.1 of Puppy Lucid? "$@"
flitet "Upgraded scripts and programs." | aplay &
xpupsay --pup=puppy Upgraded scripts and programs. "$@"
flitet "New quick pet. More working packages." | aplay &
xpupsay --pup=puppy NEW quickpet. More working packages. "$@"
flitet "Latest Browsers: FireFox, Crome and Opera." | aplay &
xpupsay --pup=puppy Latest Browsers: FireFox, Chrome and Opera. "$@"
flitet "Puppy speaks. Have fun." | aplay &
xpupsay --pup=puppy Puppy speaks. Have fun. "$@"
cd /
xpupsay --pup=puppy --time=2 --dream=/usr/share/doc/community48.jpg "$@" &
aplay /usr/share/audio/2barks.au "$@" &

Posted: Sun 27 Jun 2010, 06:27
by technosaurus
there is an --image option to, but it requires full path to image
--think makes a cloud-like bubble
--dream is broken - it uses pwd as / (so it only works if you cd to /)

Here is a summary of xpupsay --help
  • -t, --time=SECONDS Number of seconds to display message for
    -r, --reading-speed=N Number of milliseconds to delay per word.
    -f, --font=FONT Set message font (Pango format).
    -d, --dream=FILE Display an image instead of text.
    --think Display a thought bubble rather than a speech bubble.
    --daemon Run xpupsay in daemon mode.
    --pup-size=SIZE Size of the pup (small, med, large).
    --image=FILE Use a different image instead of the pup.
    --monitor=N Display pup on monitor N.
    --at=X,Y Force the pup to appear at screen location (X,Y).
    --bubble-at=X,Y Change relative position of bubble.
    --config=FILE Specify alternative config file.
    --debug Keep daemon attached to terminal.

Posted: Sun 27 Jun 2010, 07:44
by vovchik
Dear Puppians,

xcowsay can also make use of a .xcowsayrc file in the users $HOME directory. Mine now contains the following:

Code: Select all

display_time=5
alt_image=/usr/share/xcowsay/felix.png
at_y=300
at_x=300
The man file contains a bit more information on what is acceptable as rc content.

Cheers,
vovchik

Posted: Sun 27 Jun 2010, 08:06
by technosaurus
removed most remaining "cow" references in source package - replaced with pup

changed --dream to use full path vs. relative path from pwd

Posted: Sun 27 Jun 2010, 09:51
by Lobster
Anyone worked out how to use multiple lines
or call a text file?

This seems to directly call c programming (printf)
and uses a virtual Richard Stallman (be afraid)
http://www.doof.me.uk/2009/10/31/an-alt ... f-xcowsay/

Posted: Sun 27 Jun 2010, 10:01
by Lobster
a lot of work getting that alpha channel
thingy working
Joe I assume you are not talking of the
alpha channel to communicate with the Lobsterian multiverse :shock:
. . . so this is something to do with masking in Gimp?

It is a fine Lobster incidentally
but I have to watch my egoic tendencies
and try not to encourage them . . .

Vorchik has used his 'felix cat icon' - heretic :wink:
Technosaurus is orthodox
. . . and I have a strange feeling that the alligator in Jemimahs pond
may start talking in Fluppy
I hope so anyway . . . :lol:

The new text messages in 205 Lucid are excellent
but I feel this has more potential
readouts, presentation, tutorials, messages, easy intros
for the non-Puppy fraternity etc.

Puppy Linux
Fun 4 Penguins

Posted: Sun 27 Jun 2010, 15:20
by JustGreg
Thank you, technosaurus, for the up date. I have change my temperature checking to use xpupsay. This is a very good way of displaying information that a user needs to see. It is nice that it closes automatically without requiring user action.

Posted: Sun 27 Jun 2010, 16:30
by big_bass
technosaurus
--dream is broken - it uses pwd as / (so it only works if you cd to /)
if that part is broken and you fixed it please make a patch against the original source code
the author would like to see that * and I would too and would add it to xcowsay
it will be very difficult to follow updated versions by changing official command line options
and using code snippets from the official website

doing something like this in the sources just to rename everything to xpupsay doesnt improve the code unless of course that part was broken

Code: Select all

grep -rl xcowsay /root/xcowsay-1.2/xcowsay-1.2/ | xargs sed -i 's/xcowsay/xpupsay/g'


life could get more complicated quickly with something like this

Code: Select all

#! /bin/pup-bash
pup-ls -1
.pup-config --pup-prefix=/pup-usr

pup-make
pup-makeinstall

pup-uname -r

pup-gcc -lpthread -o puptheworld puptheworld.c
if you have a need to repackage xcowsay with new features added thats fine
but at least we should maintain the official command line options
since they are working correctly as is

Joe

Posted: Sun 27 Jun 2010, 19:23
by big_bass
vovchik
xcowsay can also make use of a .xcowsayrc file in the users $HOME directory. Mine now contains the following:


much easier to have some way to preset a config file



Lobster
. . . and I have a strange feeling that the alligator in Jemimahs pond
may start talking in Fluppy

I dont know who the alligator may be in that story
but I used to live in Florida and fished in many remote places where alligators were present and very large but they keep away from people

the risks you take to go fishing you have to a fanatic :D

P.S Jemimah is friendly and easy to talk to so I tried out the latest Fluppy
which was the only puppy iso I had tried out since the release of puppy 4.12
as for me I have a lot of work to do building my next iso
what is most important to me is understanding how to build a distro
the simple way with packages even if it takes me along another road to set it all up
I am enjoying the walk and dont let other things distract my plan


Joe

Posted: Sun 27 Jun 2010, 20:53
by vovchik
Dear all xcowsayers,

Here is the relevant bit from the man regarding config files:
CONFIGURATION FILE

xcowsay reads a configuration file on startup. The configuration file can be stored in the XDG compliant location $XDG_CONFIG_HOME/xcowsayrc (which will default to $HOME/.config/xcowsayrc) or in your home directory at $HOME/.xcowsayrc. If the --config=FILE command line option is passed FILE will be processed after your personal configuration file.
The configuration file consists of 'option = value' pairs, one per line. The valid keys are given in the next section. For example, the following line sets display time to 10 seconds:
display_time = 10000
The character '#' begins a comment which lasts until the end of the line.
In theory, one could have, say, five different config files for different situations: warning, error, confirmation, info, WTF#@!, and call them up with appropriate text as the second argument, or one script with a case statement that would load the appropriate one. The images could be different and appropriate for each situation.

Just an idea....

With kind regards,
vovchik

Posted: Sun 27 Jun 2010, 21:00
by JustGreg
I read about xcowsayrc configuration file. So, I created the following configuration file .xpupsayrc in root and found it worked nicely.

Code: Select all

display_time=4
#alt_image=/usr/share/xpupsay/pup_small.png
at_y=200
at_x=600 
I found the alt_image entry always resulted in the pup_small.png being used and the command line entry for image being overridden. I commented it out to allow the image I want to be display. Thanks, vovchik for the information on configuration files from the man page.

Posted: Mon 28 Jun 2010, 13:15
by big_bass
there is active recent development with xcowsay
so if you wanted new features or would like to suggest a patch
it would be done by the author and maintaining documented progress of the program
such as the correct way using GIT
this is the only way linux will progress in an organized way

leave a comment on the main xcowsay page I did :D


main page
http://www.doof.me.uk/xcowsay/


GIT
http://git.nickg.me.uk/?p=xcowsay.git;a=summary


how about a funny error message

add time 20 seconds
add an exact location on the screen(right 200 and down 100 ) or x=200 and y=100

Code: Select all

#!/bin/sh

TEXT_MESG="looks like you messed up big time" 
IMG=donkey
exec xcowsay --time=20 --at=200,100 --cow=$IMG   $TEXT_MESG "$@"

Posted: Mon 28 Jun 2010, 17:55
by vovchik
Dear Puppians,

Using printf has advantages - you can display an exclamation mark, for instance, and use a newline escape sequence. Here is a little example:

Code: Select all

#!/bin/bash

# *****************************************************
# PROGRAM:	xcowtest
# PURPOSE:	test of xcowsay
# AUTHOR:		vovchik (Puppy Linux forum)		
# DEPENDS:	bash, 
# PLATFORM:	Puppy Linux (actually, any *nix)
# DATE:		28-06-2010
# *****************************************************

# cfg overrides img argument!!!
# sec overrides rc display_time=xx!!!

# *********************
# FUNCTIONS
# *********************

# --------------------
function init_vars()
# --------------------
{
	cfg="$HOME/.xcowfelix1rc"
	txt="HELP\n ME!"
	img="/usr/share/xcowsay/felix.png"
	sec=10
	fnt="DejaVu Sans Bold 15"
	snd="/root/my-documents/audio/pop.wav"
}

# --------------------
function display_message()
# --------------------
{
	play "$snd" 2> /dev/null&
	printf %b "$txt" | xcowsay --image="$img" --time=$sec --font="$fnt" 
}

# *********************
# END FUNCTIONS
# *********************

# *********************
# MAIN
# *********************

init_vars
display_message

# *********************
# END MAIN
# *********************
I am having fun.

With kind regards,
vovchik

Posted: Mon 28 Jun 2010, 21:21
by Lobster
I am having fun.
I am having prawns.
:)

took your code
modified for xpupsay
and flite
to produce this

Code: Select all

#! /bin/bash

txt1="Welcome to Puppy.\n 
A computers best friend.\n
An operating system that works!" 
   
txt2="Made with Puppy magic and the best Ubuntu bits.\n 
Puppy heart, recognition and scripting!"    

txt3="What is new for 5.1 of Puppy Lucid?\n 
Upgraded scripts and programs.\n
New quickpet. More working packages.\n
Latest Browsers: FireFox, Chrome, and Opera."  

   sec=10 
   fnt="DejaVu Sans Bold 15" 

# -------------------- 
function display_message() 
# -------------------- 
{ 
#   play "$snd" 2> /dev/null& 

cd /
xpupsay --pup=puppy --time=2 --dream=/usr/share/doc/community48.jpg "$@" 
aplay /usr/share/audio/2barks.au "$@" &

   printf %b "$txt1" | xpupsay --time=$sec --font="$fnt" "$@" | flitet "Welcome to Puppy. A computers best friend. An operating system that works!" | aplay & 
 sleep $sec
   printf %b "$txt2" | xpupsay --time=$sec --font="$fnt" "$@" | flitet "Made with Puppy magic, and the best Ubuntu bits. Puppy heart, recognition and scripting!" | aplay &
 sleep $sec
   printf %b "$txt3" | xpupsay --time=12 --font="$fnt" "$@" | flitet "What is new for 5.1 of Puppy Lucid? Upgraded scripts and programs. New quick pet. More working packages. Latest Browsers: FireFox, KerRome, and Opera." | aplay &
 sleep 14

cd /
xpupsay --pup=puppy --time=2 --dream=/usr/share/doc/community48.jpg "$@" &
aplay /usr/share/audio/2barks.au "$@" &
} 

# ********************* 
# END FUNCTIONS 
# ********************* 

# ********************* 
# MAIN 
# ********************* 

init_vars 
display_message 

# ********************* 
# END MAIN 
# *************
Incidentally whilst we are having fun
Barry is preparing a spup
that can run Windows programs
at native speed
check his blog
http://bkhome.org/blog/?viewDetailed=01680

Puppy Linux
We have Fun

Posted: Tue 29 Jun 2010, 10:23
by vovchik
Dear Puppians,

Xcowsay does UTF-8 nicely. Here is proof of the pudding (in Japanese, Chinese and Russian). I like it. :)

With kind regards,
vovchik

PS. Thanks for the Longene info, Lobster. Now, that will be fun! :)

Posted: Tue 29 Jun 2010, 16:47
by big_bass
before things get crazy with two different coding languages

heres a repair tool

a drag N drop tool to convert back to the standard code so we could share code snippets

drag your code file onto the script

Code: Select all

#! /bin/bash

# drag N drop file on this script to repair it 
# call this dnd-cowsay-repair


# rename code back to a standard official code 

#renames xpupsay back to xcowsay
#renames --pup back to --cow

# E-I-E-I-O :D

sed -i 's/xpupsay/xcowsay/g' "$@"
sed -i 's/--pup/--cow/g' "$@" 
sed -i 's/xpupdream/xcowdream/g' "$@"
sed -i 's/xpupfortune/xcowfortune/g' "$@"
sed -i 's/xpupthink/xcowthink/g' "$@" 

using Lobster's nice code snippet just as an example how it will get converted to this
BTW Lobster the coding is looking good and many great things there I just want to give it a try too

Code: Select all


#! /bin/bash

txt1="Welcome to Puppy.\n
A computers best friend.\n
An operating system that works!"
   
txt2="Made with Puppy magic and the best Ubuntu bits.\n
Puppy heart, recognition and scripting!"   

txt3="What is new for 5.1 of Puppy Lucid?\n
Upgraded scripts and programs.\n
New quickpet. More working packages.\n
Latest Browsers: FireFox, Chrome, and Opera." 

   sec=10
   fnt="DejaVu Sans Bold 15"

# --------------------
function display_message()
# --------------------
{
#   play "$snd" 2> /dev/null&

cd /
xcowsay --cow=puppy --time=2 --dream=/usr/share/doc/community48.jpg "$@"
aplay /usr/share/audio/2barks.au "$@" &

   printf %b "$txt1" | xcowsay --time=$sec --font="$fnt" "$@" | flitet "Welcome to Puppy. A computers best friend. An operating system that works!" | aplay &
 sleep $sec
   printf %b "$txt2" | xcowsay --time=$sec --font="$fnt" "$@" | flitet "Made with Puppy magic, and the best Ubuntu bits. Puppy heart, recognition and scripting!" | aplay &
 sleep $sec
   printf %b "$txt3" | xcowsay --time=12 --font="$fnt" "$@" | flitet "What is new for 5.1 of Puppy Lucid? Upgraded scripts and programs. New quick pet. More working packages. Latest Browsers: FireFox, KerRome, and Opera." | aplay &
 sleep 14

cd /
xcowsay --cow=puppy --time=2 --dream=/usr/share/doc/community48.jpg "$@" &
aplay /usr/share/audio/2barks.au "$@" &
}

# *********************
# END FUNCTIONS
# *********************

# *********************
# MAIN
# *********************

init_vars
display_message

# *********************
# END MAIN
# ************* 









Joe

Posted: Tue 29 Jun 2010, 21:22
by vovchik
Dear Joe,

I can't seem to get enough of a good thing. I modified your very nice but laconic xcow-repair script to use xcowsay, so that the user knows that he is doing. If there is no file dropped but just a mouse click, there is an appropriate message. This is fun :)

With kind regards,
vovchik

Code: Select all

#!/bin/bash

# ********************************************************
# PROGRAM:	xcow-repair
# PURPOSE:	drag-n-drop file on this script to repair
# 			it - i.e. make xpupsay standard xcowsay.
# AUTHOR:		big_bass (Joe - Puppy Linux forum)
# MODDED:		vovchik (to use xcowsay fir notification :)
# DEPENDS:	bash, aplay, xcowsay, sed
# PLATFORM:	Puppy Linux (actually, any *nix)
# DATE:		30-06-2010
# ********************************************************

# *********************
# FUNCTIONS
# *********************

# --------------------
function init_vars()
# --------------------
{
	org_file="$@"
	alt_txt="No file to process!\nDrag an xpupsay file\nonto this script\nto restore it as\nstandard xcowsay!" 
	txt="Fixing $org_file\nfor standard xcowsay!"
	sec=4
	fnt="DejaVu Sans Bold 15"
	snd="/usr/share/audio/2barks.au"
}


# --------------------
function fix_file()
# --------------------
{
		sed -i 's/xpupthink/xcowthink/g' "$@"
		sed -i 's/xpupsay/xcowsay/g' "$@"
		sed -i 's/--pup/--cow/g' "$@"
		sed -i 's/xpupdream/xcowdream/g' "$@"
		sed -i 's/xpupfortune/xcowfortune/g' "$@"
		sed -i 's/xpupthink/xcowthink/g' "$@" 
}

# --------------------
function display_message()
# --------------------
{
	aplay "$snd" 2> /dev/null&
	if [ -e "$org_file" ] ; then
		printf %b "$txt" | xcowsay --time=$sec --font="$fnt" &
        fix_file "$org_file"
	else
		printf %b "$alt_txt" | xcowsay --time=$sec --font="$fnt" &
		exit 1
	fi
}


# *********************
# END FUNCTIONS
# *********************

# *********************
# MAIN
# *********************

init_vars "$@"
display_message &
exit 0

# *********************
# END MAIN
# *********************