xcowsay talking lobster? new x message display with icon

Under development: PCMCIA, wireless, etc.
Message
Author
big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#31 Post 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

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#32 Post 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
Last edited by big_bass on Sun 27 Jun 2010, 21:48, edited 1 time in total.

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#33 Post 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

JustGreg
Posts: 782
Joined: Tue 24 May 2005, 10:55
Location: Connecticut USA

#34 Post 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.
Last edited by JustGreg on Mon 28 Jun 2010, 14:30, edited 1 time in total.
Enjoy life, Just Greg
Live Well, Laugh Often, Love Much

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#35 Post 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 "$@"
Attachments
error-msg.png
(63.07 KiB) Downloaded 1776 times

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#36 Post 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

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#37 Post 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
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#38 Post 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! :)
Attachments
xcow-jpn-chn.jpg
(6.97 KiB) Downloaded 1626 times
xcow-cyr.jpg
(23.65 KiB) Downloaded 1608 times

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#39 Post 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
Last edited by big_bass on Wed 30 Jun 2010, 13:23, edited 1 time in total.

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#40 Post 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
# *********************

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#41 Post by big_bass »

Hey vovchik
I modified your very nice but laconic xcow-repair script

yes ! thank you

I am very blunt most of the time but I never say more than I mean or less
any attempt of trying to be eloquent for me is with much forced effort
I do agree with you 100% in my very short and to to the point way of writing
if it be code or a simple post I already feel I used too many words :lol:

thanks for the structured well written re write of the code snippet

P.S the pop up messages are too cool 8)

Joe

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#42 Post by vovchik »

Dear Puppians,

Now, this is COOL!!!! You can use text attributes just as gtkdialog does with markup. The syntax is described here: http://library.gnome.org/devel/pango/st ... ormat.html. It is a great little discovery. I also discovered, thanks to Lobster, that if you change the dir to /, you can use your own base image and your own dream image. This is my silly example of pretty text:

Code: Select all

printf %s '<span foreground="blue" size="x-large">Blue text</span> is <i>cool</i>!' | xcowsay 
To select your own image and dream image, simply precede your xcowsay invocation with "cd /" and then use something like this:

Code: Select all

xcowsay --image="/usr/share/xcowsay/felix3.png" --time=10 --dream="/usr/share/xcowsay/felix.png"
With kind regards,
vovchik
Attachments
xcow-dream.jpg
(14.04 KiB) Downloaded 1524 times
xcow-txt-attr.jpg
(9.54 KiB) Downloaded 1489 times

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#43 Post by Lobster »

Good work Vovchik
Joe I followed up your suggestion to contact the developer
. . . coming soon new feature . . .
Lobster to Nick Gasson:
I am the lobster from another dimension that found and suggested your program for Puppy (it has now morphed into xpupsay) I would recommend left and right sides for the image - so a Q and A type situation can be developed. Many thanks :)
Nick Gasson to Lobster:
Thanks for your suggestion. It would be fairly simple to add so I'll try to include it in the next release.
Any other features we need that may be simple to implement . . .
contact the developer here in the comments
http://www.doof.me.uk/xcowsay/
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#44 Post by vovchik »

Dear Puppians,

I have a demo here of xcowsay speaking nicely, and showing markup. You need either festival or espeak to hear sounds. flitet sounds much worse on my machine than festival. Lobster might be interested in the routine that strips off the markup language, which I have added, so that the same text variable can be used for both sound and display. The png files and script are in the archive, as is a readme.

With kind regards,
vovchik

PS. Lobster and Joe: I have left a nice note for Nick on his site. You might want to mention to him that antialiasing of the "comment" graphics would be a nice touch, as would be 32 bbp and the full alpha channel for image display. There is quite a bit of calculation for "clouds" and rounded boxes in the source, so this might not be so easy as the suggestion regarding positioning.
Attachments
xcow-red-text.jpg
(16.96 KiB) Downloaded 1534 times
felix-demo.tar.gz
(37.05 KiB) Downloaded 873 times

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#45 Post by big_bass »

Hey vovchik

I see in my minds eye a few good things comming

1.) By the not using the standard code of xcowsy using "xpupsay"
which I admit to be very annoying but it turned out to give me a good Idea about
code conversions being able to translate code from one language to another
so in a way in the end I am thankful technosaurus changed the code or I wouldnt of had a need to change it back and then code conversion I would had missed out on
so all is well that ends well

2. the pango mark format I can see that I wrote a lot of code to make html indexes generated from bash drag n drop indexers I needed while building a website

I was working on this today editing one of my scripts to generate html code
it would be possible to make a GUI to to enter the values such as

Code: Select all

<span foreground="blue" size="x-large">Blue text</span>


and ask forr background color , size ,text etc...

then have it generate the code using bash
pretty easily since only the GUI needs to be made I have the code to convert it
already only sight modifications were needed

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#46 Post by vovchik »

Dear Joe,

I was also thinking along the same lines - and thinking of this: http://murga-linux.com/puppy/viewtopic.php?t=40418, which I posted a donkey's age ago. It could be reworked and show the xcowsay bit, perhaps also with speech, so that the entire "animation" could be properly timed. The gui would require adding a seconds entry widget and a checkbox for sound or not.

With kind regards,
vovchik

PS. I have included a slightly modified version of markup here (cleaned up and structured). It is easier to make changes to this version. Try copying this into the edit window:

Code: Select all

<span color="red"><tt><i>I'M</i> <u>ON</u> A <s>ROLL</s></tt> !</span><span color="green"> OK</span><sup>2</sup>?
<b>I'M ON A ROLL</b>
<b><big>I'M ON A ROLL</big></b>
<b><big><big>I'M ON A ROLL</big></big></b>
<b><big><big><big>I'M ON A ROLL</big></big></big></b>
<b><big><big><big><big>I'M ON A ROLL</big></big></big></big></b>
<b><big><big><big><big><big>I'M ON A ROLL</big></big></big></big></big></b>
You will get the text shown in the image.
Attachments
xcow-tag-edit.jpg
(28.3 KiB) Downloaded 1392 times
mark-up.tar.gz
(1.5 KiB) Downloaded 670 times

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#47 Post by big_bass »

Hey vovchick

I was thinking about a GUI to aid in producing the code
one step before the viewer comes in

then it could be viewed like this also

save it a vovchick.html then click on it :D

Code: Select all


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html><head></head><body>
<span color="red"><tt><i>I'M</i> <u>ON</u> A <s>ROLL</s></tt> !</span><span color="green"> OK</span><sup>2</sup>?
<b>I'M ON A ROLL</b>
<b><big>I'M ON A ROLL</big></b>
<b><big><big>I'M ON A ROLL</big></big></b>
<b><big><big><big>I'M ON A ROLL</big></big></big></b>
<b><big><big><big><big>I'M ON A ROLL</big></big></big></big></b>
<b><big><big><big><big><big>I'M ON A ROLL</big></big></big></big></big></b>

</body>
</html>

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#48 Post by vovchik »

Dear Joe,

That works but great, but I think this little editor has potential here, too. Have a look at the attached. It's not quite ready because I am still trying to strip out trailing newlines in the edit window and in the string that gets passed to xcowsay. And the results still need to be "put together" nicely in an independent script as part of the xcowsay-generator package. But you get the idea. As you know sed better than I do, perhaps you can fix the trailing newline problem. Basically we don't want any trailing new lines except the last one. I think your idea of having the tags available as comboboxes and lists is what we want in the end.

With kind regards,
vovchik
Attachments
xcowmarkup.tar.gz
(1.81 KiB) Downloaded 667 times

Minnesota
Posts: 326
Joined: Thu 11 Sep 2008, 11:25

Sound

#49 Post by Minnesota »

Been following the fun for the past few days. .was going to ask if it would talk.. then the reference to "festival".... is there a pet for the festival that will run on Luci or any version for that matter? Looked at the reference thread... but did not see a download link. Or did I miss it?

Keep up the FUN!

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#50 Post by vovchik »

Dear Minnesota,

Lobster did this festival pet back in 2008, and I think it is the one I have installed: http://tmxxine.com/festival/festival.pet.

The link is alive and the pet should work.

With kind regards,
vovchik

Post Reply