maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   OS2008 / Maemo 4 / Chinook - Diablo (https://talk.maemo.org/forumdisplay.php?f=29)
-   -   Your Favorite Apps/Mods NOT In Repositories (https://talk.maemo.org/showthread.php?t=86041)

vandys 2013-02-07 19:10

Re: Your Favorite Apps/Mods NOT In Repositories
 
Quote:

Originally Posted by Addison (Post 1321313)
What does the q and Q letters mean on some of my stations?

I believe that's Pandora's "quickmix" feature. Stations marked with "q" are included in the quickmix. The "x" command should let you toggle which ones you wish included in the quickmix. I mostly like Pandora to play across all my stations, but have it leave off special case ones like my Christmas channel.

Amusingly, setting quickmix stations in the pianobar UI is easier than setting it up on the web page! At least IMHO.

Andy

Addison 2013-02-07 19:22

Re: Your Favorite Apps/Mods NOT In Repositories
 
Thanks!

Hey, I'm terrible at scripting so how could I get all of these commands to execute with a simple launch file?

xmodmap /home/user/.Xmodmap_pan
PATH=$PATH:/usr/local/bin
llib pianobar
xte 'keydown rightparenth' 'keyup parenth' 'keydown rightparenth' 'keyup parenth' 'keydown rightparenth' 'keyup parenth' 'keydown rightparenth' 'keyup parenth' 'keydown rightparenth' 'keyup parenth' 'keydown rightparenth' 'keyup parenth'

vandys 2013-02-08 00:11

Re: Your Favorite Apps/Mods NOT In Repositories
 
Quote:

Originally Posted by Addison (Post 1321523)
Hey, I'm terrible at scripting so how could I get all of these commands to execute with a simple launch file?
'

Dunno, I'm only a CLI kind of guy! I'd just put'em in a file with
#!/bin/sh
at the top, chmod a+x <file> and then run it when I needed
to. I'm sure there's an easy way to invoke a shell script from
an icon, maybe somebody here can help?

Andy

Addison 2013-02-08 00:21

Re: Your Favorite Apps/Mods NOT In Repositories
 
I asked because it needs to run inside Xterminal or Roxterm, yes?

Also I would like to raise the default volume level but a simple copy and paste from what I posted in Xterm doesn't work either.

I'm just a little confused on how to do this, that's all.

Oh, and Xmodmap is for some hardware key shortcuts in case you were wondering. :)

Addison 2013-02-14 15:03

Re: Your Favorite Apps/Mods NOT In Repositories
 
2 Attachment(s)
My first ever script that I did on my own without any help. :)

So I've got 1 minute email notifications and a running SIP phone.

Since it takes me some time to fall asleep, I'll just run this script before I close my eyes.

If there are no new messages right away (default 15 minutes) it turns off the master and ringtone volume.

The other script brings back both sounds and stops the first one from fully executing if needed.



Goodnight
#! /bin/sh

dbus-send --print-reply --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Quiet mode in 15 minutes"
sleep 900
dbus-send --print-reply --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Goodnight...."
gconftool-2 -s "/apps/osso/sound/ringtone_volume" 0 -t INT
gconftool-2 -s "/apps/osso/sound/master_volume" 0 -t INT



Wakeup
#! /bin/sh

killall kill goodnight
dbus-send --print-reply --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Quiet mode terminated"
gconftool-2 -s "/apps/osso/sound/ringtone_volume" 100 -t INT
gconftool-2 -s "/apps/osso/sound/master_volume" 100 -t INT

Addison 2013-02-14 16:32

Re: Your Favorite Apps/Mods NOT In Repositories
 
Does anyone know if there is already an app like this? ^

If so, I would like to try it out. :)

Addison 2013-02-17 03:43

Re: Your Favorite Apps/Mods NOT In Repositories
 
Hey Andy, quick question for you.

In Xterm or any other terminal, do you know if there is a way to gag certain text output such as "|> " and "(i) Receiving new playlist... Ok."?

I know such a thing exists using Tinyfugue.

After I'm done listening on pybar, I tend to copy everything it played during that time and would like to remove some of that extra clutter when saving those list of songs.

Cheers. :)

vandys 2013-02-18 01:52

Re: Your Favorite Apps/Mods NOT In Repositories
 
Quote:

Originally Posted by Addison (Post 1323374)
In Xterm or any other terminal, do you know if there is a way to gag certain text output such as "|> " and "(i) Receiving new playlist... Ok."?

In terms of text filtering, "grep -v <pattern>" excludes lines
which match <pattern>. So:

command | grep -v "|>" > output.txt

would filter off lines with "|>" (as output by "command") and the result goes into output.txt file.

Andy

Addison 2013-02-18 01:54

Re: Your Favorite Apps/Mods NOT In Repositories
 
So I enter that command before starting pybar?

vandys 2013-02-19 00:43

Re: Your Favorite Apps/Mods NOT In Repositories
 
Quote:

Originally Posted by Addison (Post 1323538)
So I enter that command before starting pybar?

Well, step one is to find out if pianobar gets upset because its standard output is not a TTY. So change "llib pianobar" to be "llib pianobar | grep -v "|>" and see if it still runs OK.

If it doesn't, then probably it would be better to modify pianobar to do the initial setup itself. Yes, that means modifying the app, but this sounds like a reasonable enhancement (setting initial volume).

FWIW, it might be easier to grep -v the cruft after you grab the song list. Then it won't interfere with the app's TTY access, and you don't have to hack C code either. :->

Andy

Addison 2013-02-19 00:47

Re: Your Favorite Apps/Mods NOT In Repositories
 
Okay, I'll give it a try. Thanks!

Oh, and what if I want to gag multiple outputs such as
llib pianobar | grep -v "|>" "(i) Receiving new playlist... Ok."?

I don't know how to add a second filter to that grep command, and yes, I looked online for about 30 minutes on this already and couldn't find it.

Addison 2013-02-19 01:13

Re: Your Favorite Apps/Mods NOT In Repositories
 
This almost worked. :)

llib pianobar | grep -v "|>"

Instead of gagging just those two character symbols, it mutes out the entire line all together.

Is there a better way to use that grep command?

Addison 2013-02-19 01:22

Re: Your Favorite Apps/Mods NOT In Repositories
 
Okay. At least this a good start. :)

llib pianobar | grep -v "(i) Receiving new playlist... Ok."

Now it only shows the songs that have played making the output in Xterm a little less messy.

All I would like is to also get rid of all the "|> " and """ characters as well if this is possible.

Thanks Andy. :)

vandys 2013-02-19 17:12

Re: Your Favorite Apps/Mods NOT In Repositories
 
Quote:

Originally Posted by Addison (Post 1323745)
All I would like is to also get rid of all the "|> " and """ characters as well if this is possible.

Yes, grep is line oriented. To rewrite parts of lines, we use "sed" instead:

command | sed 's/|>//' > outfile.txt

Would remove the first "|>" sequence it found in each line. If you want to remove *all* such, it's 's/|>//g' (g suffix to sed substitute command).

sed can also remove whole lines:

command | sed '/foobar/d'

Matches line with "foobar" within them and deletes them. I point this out because sed can run with a whole list of rules (provided by a file) and thus can probably do all your folding, spindling, and mutilating with a single "sed" command. If the file cleanup.sed had the two lines:

/Receiving/d
s/|>//g

Then running it with:

command | sed -f cleanup.sed > output.txt

Would both trim off lines with "Receiving" as well as remove the character sequence |> (without otherwise changing the line).

Andy

Addison 2013-02-19 19:56

Re: Your Favorite Apps/Mods NOT In Repositories
 
I'm confused. :)

This seems to kind of work....

PATH=$PATH:/usr/local/bin
llib pianobar | sed 's/|> //'

That's 2 spaces after /> and not just 1.

The thing is it won't display the song now until after it has finished playing.

No big deal I guess.

Anyway, can you help me pipe all of these exceptions together?

llib pianobar | sed 's/|> //' | sed 's/ "//' | grep -v "(i) Receiving new playlist... Ok." | grep -v "Station"

If I try and do more than one filter, Xterm just hangs without doing anything.

I'm not sure what I'm doing wrong on this.

Cheers. :)

vandys 2013-02-19 20:08

Re: Your Favorite Apps/Mods NOT In Repositories
 
Quote:

Originally Posted by Addison (Post 1323901)
The thing is it won't display the song now until after it has finished playing.

That's I/O buffering for you. See if your sed takes the "-u" switch to act unbuffered.

Andy

Addison 2013-02-19 20:17

Re: Your Favorite Apps/Mods NOT In Repositories
 
Dang it I'm super dumb. :(

llib pianobar | sed -u 's/|> //'
sed: invalid option -- u

llib pianobar | sed 'u/|> //'
sed: unsupported command u

llib pianobar | sed '/|> //u'
sed: unsupported command /

How do you use the -u option?

vandys 2013-02-20 00:24

Re: Your Favorite Apps/Mods NOT In Repositories
 
Quote:

Originally Posted by Addison (Post 1323912)
Dang it I'm super dumb. :(

llib pianobar | sed -u 's/|> //'
sed: invalid option -- u

No, you're not dumb at all. You just have the default "sed" from the mini-linux environment, Busybox. I just grabbed the latest GNU source for a full sed and built it for the n810. Grab it from:

www.vsta.org/andy/pickup/n810_sed

Probably you shouldn't scribble on top of the Busybox one, just put this one in /usr/local/bin/sed (or /usr/local/bin/gsed to be really defensive) and it definitely has the -u option.

Andy

Addison 2013-02-20 00:28

Re: Your Favorite Apps/Mods NOT In Repositories
 
Thanks!

Okay, once last thing, how do I string these all together?

llib pianobar -u | sed 's/|> //' | sed -u 's/ "//' | grep -v "(i) Receiving new playlist... Ok." | grep -v "Station"

Am I using the pipe command correctly?

vandys 2013-02-20 01:33

Re: Your Favorite Apps/Mods NOT In Repositories
 
Quote:

Originally Posted by Addison (Post 1323960)
Thanks!

Okay, once last thing, how do I string these all together?

llib pianobar -u | sed 's/|> //' | sed -u 's/ "//' | grep -v "(i) Receiving new playlist... Ok." | grep -v "Station"

Am I using the pipe command correctly?

It's a little needless. Easier would be to put these four lines:

s/|> //
s/"//g
/Receiving new playlist/d
/Station/d

In one file, say "filter.sed". Then run pianobar as:
llib pianobar | sed -u -f filter.sed

I don't think pianobar looks at its command line arguments, so I left off that -u you had put for pianobar.

Andy

Addison 2013-02-20 01:36

Re: Your Favorite Apps/Mods NOT In Repositories
 
Thanks Andy!

I'll give this a try is just a few minutes.

Oh, and the reason why I wanted to weed out all of the extra junk is so that I can simply copy and paste any good song from Xterm and then head on over to this site to download it.

http://mp3juices.com/

Addison 2013-02-22 00:56

Re: Your Favorite Apps/Mods NOT In Repositories
 
I didn't get anywhere new with your advice Andy.

Sorry. :(

What am I doing wrong here?

http://imageshack.us/a/img23/5319/sc...3022119461.png

llib pianobar | sed -u -f filter.sed
sed: invalid option -- u
BusyBox v1.6.1 (2010-08-15 19:12:28 BST) multi-call binary

Usage: sed [-efinr] pattern [files...]

Wikiwide 2013-02-22 04:36

Re: Your Favorite Apps/Mods NOT In Repositories
 
Quote:

Originally Posted by Addison (Post 1324361)
I didn't get anywhere new with your advice Andy.

Sorry. :(

What am I doing wrong here?

http://imageshack.us/a/img23/5319/sc...3022119461.png

llib pianobar | sed -u -f filter.sed
sed: invalid option -- u
BusyBox v1.6.1 (2010-08-15 19:12:28 BST) multi-call binary

Usage: sed [-efinr] pattern [files...]

Quick reply...
Quote:

Originally Posted by vandys (Post 1323959)
No, you're not dumb at all. You just have the default "sed" from the mini-linux environment, Busybox. I just grabbed the latest GNU source for a full sed and built it for the n810. Grab it from:

www.vsta.org/andy/pickup/n810_sed

Probably you shouldn't scribble on top of the Busybox one, just put this one in /usr/local/bin/sed (or /usr/local/bin/gsed to be really defensive) and it definitely has the -u option.

Andy

Best wishes.
_________________
Per aspera ad astra...

Addison 2013-02-22 04:42

Re: Your Favorite Apps/Mods NOT In Repositories
 
I downloaded n810_sed, renamed the file sed, placed it in /usr/local/bin/ and made it executable like Andy suggested.

Did I somehow misread his post?

Wikiwide 2013-02-22 04:45

Re: Your Favorite Apps/Mods NOT In Repositories
 
Quote:

Originally Posted by Addison (Post 1324373)
I downloaded n810_sed, renamed the file sed, placed it in /usr/local/bin/ and made it executable like Andy suggested.

Did I somehow misread his post?

Quick reply...
Try
llib pianobar | /usr/local/bin/sed -u -f filter.sed
Best wishes.
_________________
Per aspera ad astra...

Addison 2013-02-22 04:52

Re: Your Favorite Apps/Mods NOT In Repositories
 
Joy!

This now works perfect!

llib pianobar | /usr/local/bin/sed -u -f /usr/local/bin/filter.sed

Thank you Wiki! :)


All times are GMT. The time now is 19:20.

vBulletin® Version 3.8.8