SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 Re: Off Topic / General Chat » What's your favorite Dropbox alternative? » 2014-09-29 09:05:20

Just to refresh - what is the problem with Dropbox? The fact that it's not open source? Small space allowance? (It's been working very well for me the last 2~3 years.)

#2 Re: Tips, Tricks & Scripts » Shoutcast and Radionomy tuner for mplayer, mpg123 or radiotray » 2014-09-23 13:32:54

Shoutcast changed their web interface a while ago, breaking that part of the script. This is now fixed, and a bonus is that you now get more results. There's also a --help option. Otherwise usage is the same as post #12 :

#!/bin/bash
# shoutcast_radionomy_search.sh
# search shoutcast and radionomy,
# send url to radiotray, mpg123, mplayer or another player
# send url to streamripper to record
#
# version 3.0
#
# needs curl, [radiotray, dbus | mpg123 | mplayer], streamripper, [xsel], [perl]
# xsel enables pasting from the X selection (to a config file etc.)
# Comment out line 288 "printf '%s'..." if you don't use it.
# perl is used to urlencode the query.
# Comment out line 246 and uncomment line 245 to escape spaces only
# if your system doesn't have perl.
#
# KEYBOARD SHORTCUTS:
# Ctrl+C to exit normally
# Ctrl+\ to terminate and close player
# Ctrl+Z to start recording current station (handles SIGTSTP)

##### choose from radiotray, mpg123 or mplayer #####
player=radiotray
#player=mpg123
#player=mplayer

# Set this to something other than 'true'
# to have audio player exit with script.
# Otherwise player will continue till closed separately.
# Even with 'keep_player=true', if script is stopped with Ctrl+\
# then player will exit too.
keep_player=true

##### code to record a radio stream (url is $1) in a new terminal #####
# Add your own options to streamripper's command line,
# edit ~/.config/streamripper/streamripper.ini,
# change urxvt to another terminal
# or use a different command altogether.
recorder() {
    ( setsid urxvt -e streamripper "$1" >/dev/null 2>&1 & )
}

# where to put player control fifo
# (radiotray doesn't use this)
rpipe=/tmp/radio_pipe

HELP="This is an interactive script to query the Shoutcast and Radionomy listings,
put the results in a menu,
and load the chosen radio station in radiotray, mpg123 or mplayer.
There is also an option to record with streamripper.

If you exit the script and leave mpg123 or mplayer running,
you can close either of them with the command:
echo quit >$rpipe

KEYBOARD SHORTCUTS:
Ctrl+C to exit normally
Ctrl+\ to terminate and close player
Ctrl+Z to start recording current station (handles SIGTSTP)"

##########################################################################

case $1 in
--help|-h)
    echo "$HELP"
    exit
    ;;
esac

case $player in

##### RADIOTRAY SETTINGS #####
radiotray)
required_commands='curl streamripper radiotray'
start_player() {
    if pgrep radiotray >/dev/null
    then
        echo "$player is already running"
    else
        ( setsid radiotray >/dev/null 2>&1 & )
    fi
}
radioplay() {
    radiotray "$1"
}
cleanup() { # run just before exit
    [[ $player_ok = true ]] && [[ $keep_player = true ]] && {
        echo "$player will continue to play.
You can control it from the system tray icon
or run the script again to choose another station."
        sleep 4
        return
    }
    pkill radiotray && echo "Closed radiotray."
    sleep 4
}
;;
##### END RADIOTRAY #####

##### MPLAYER SETTINGS #####
mplayer)
required_commands='curl streamripper mplayer'
player_regex="^mplayer .*-input file=$rpipe"
launch_player() {
    [[ -p $rpipe ]] || { mkfifo "$rpipe" || error_exit "cannot make fifo $rpipe"; }
    ( setsid sh -c "mplayer -really-quiet -idle -slave -input file=$rpipe; rm -f $rpipe;" >/dev/null 2>&1 & )
    sleep 4 & launching_player=$!
}
load_url() {
    echo "loadlist $1" >"$rpipe"
}
;;&
##### END MPLAYER #####

##### MPG123 SETTINGS #####
mpg123)
required_commands='curl streamripper mpg123'
player_regex="^mpg123 .*--fifo $rpipe"
launch_player() { # mpg123 will make fifo if necessary
    ( setsid sh -c "mpg123 --remote --fifo $rpipe; rm -f $rpipe;" >/dev/null 2>&1 & )
    (sleep 2; echo 'silence' >"$rpipe") & launching_player=$!
}
load_url() {
    echo "loadlist 1 $1" >"$rpipe"
}
;;&
##### END MPG123 #####

##### COMMON TO MPLAYER AND MPG123 #####
mplayer|mpg123)
start_player() {
    if pgrep -f "$player_regex" >/dev/null
    then
        echo "$player is already running"
        [[ -p $rpipe ]] || error_exit "fifo missing $rpipe"
        (:>"$rpipe") & test_pipe=$!
        (sleep 2; kill $test_pipe 2>/dev/null && kill -s SIGPIPE $selfpid) &
    else
        launch_player
    fi
}
radioplay() {
    wait $launching_player
    [[ -p $rpipe ]] || error_exit "fifo missing $rpipe"
    pgrep -f "$player_regex" >/dev/null || error_exit "$player not running"
    load_url "$1"
}
cleanup() { # run just before exit
    [[ -p $rpipe ]] || { player_ok=false; echo "Script error: fifo $rpipe does not exist." >&2 ;}
    pgrep -f "$player_regex" >/dev/null || { player_ok=false; echo "Script error: $player not running" >&2 ;}
    [[ $player_ok = true ]] && {
        [[ $keep_player = true ]] && {
            echo "$player will continue to play.
You can stop it with the command:
echo quit >$rpipe
or run the script again to choose another station."
            sleep 4
            return
        }
        echo "closing $player..."
        echo 'quit' >"$rpipe" # try to close player nicely
        sleep 2 # time for player to quit
    }
    pkill -f "$player_regex" && echo "$player close forced."
    echo "removing $rpipe"
    rm -f "$rpipe" # in case it has become a normal file
}
;;
##### END COMMON TO MPLAYER AND MPG123 #####

*)
echo "$0: chosen player $player has not been configured.
Please check line 17 of the script" >&2
exit 1
;;
esac

##########################################################################
selfpid=$$
player_ok=true
error_exit() {
    echo "Script error: $1" >&2
    player_ok=false
    exit 1
}
trap 'cleanup' EXIT
trap 'echo " Exit script
Goodbye..."; exit' SIGHUP SIGINT
trap 'echo " Exit script
($player will be shut down)
Goodbye..."; keep_player=false; exit' SIGQUIT
trap 'error_exit "script terminated"' SIGTERM
trap 'error_exit "broken pipe"' SIGPIPE
trap 'recorder "${playing_url%.m3u}"' SIGTSTP

missing_commands=
for i in $required_commands
do
    hash $i || missing_commands+=" $i"
done
[[ $missing_commands ]] && error_exit "This script requires the following commands: $missing_commands
Please install the packages containing the missing commands
and rerun the script."

query_shoutcast() {
    curl -s --data "query=$1" "http://www.shoutcast.com/Search/UpdateSearch" | awk '
    BEGIN {
        RS="},{"
    }
    {
        url = name = $0
        if($0=="[]") {exit}
        sub(/^.*\"ID\":/,"",url)
        sub(/,.*$/,"",url)
        url = "http://yp.shoutcast.com/sbin/tunein-station.pls?id=" url
        sub(/^.*\"Name\":\"/,"",name)
        sub(/\".*$/,"",name)
        print url,name
    }
    '
}
query_radionomy() {
    curl -s "http://www.radionomy.com/en/search?q=$1" |awk '
    BEGIN {
        RS="<h2 class=\"radio-title-list\"><a href=\"/en/radio/"
        FS="</a></h2>"
    }
    NR < 2 {next}
    {
        url = name = $1
        sub(/^.*>/,"",name)
        sub(/\/index\".*$/,"",url)
        url="http://listen.radionomy.com/" url ".m3u"
        print url,name
    }
    '
}

start_player

unset playing_name playing_url
while true
do
echo "Please enter keyword(s)"
read keyword
#keyword_esc="${keyword// /%20}" # escape spaces for url
keyword_esc=$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$keyword")
results_sh=$( query_shoutcast "$keyword_esc" )
results_ra=$( query_radionomy "$keyword_esc" )

if [[ $results_sh ]] && [[ $results_ra ]]
then
    results="$results_sh"$'\n'"$results_ra"
elif [[ $results_sh ]]
then
    echo "No results for $keyword on radionomy"
    results="$results_sh"
elif [[ $results_ra ]]
then
    echo "No results for $keyword on shoutcast"
    results="$results_ra"
else
    echo "Sorry, no results for $keyword"
    continue
fi

unset list
declare -A list # make associative array
while read -r url name # read in awk's output
do
    list["$name"]="$url"
done <<< "$results"

PS3='Please enter the number of your choice > '
while true
do
    menu=("${!list[@]}")
    [[ $playing_name && $playing_url ]] && menu+=("RECORD \"$playing_name\"")
    select station in "${menu[@]}" 'SEARCH AGAIN' QUIT
    do
        [[ $station = "RECORD \"$playing_name\"" ]] && {
            recorder "${playing_url%.m3u}" # streamripper won't take m3u urls
            break
        }
        [[ $station = 'SEARCH AGAIN' ]] && break 2
        [[ $station = QUIT ]] && { echo 'Goodbye...'; exit; }
        [[ $station ]] && {
# comment out next line if you don't use xsel
            printf '%s' "${list[$station]}" | xsel --input #--clipboard  # can paste url
            radioplay "${list[$station]}"
            playing_name=$station
            playing_url=${list[$station]}
            break
        }
    done
echo "
Station last chosen was \"$playing_name\" ( $playing_url )
"
done # closes loop started at line 274

done # closes loop started at line 241

exit

#4 Re: WM/DE Talk » Trying to disable desktop changing via mouse wheel altogether » 2014-09-22 05:30:55

Also, if I remember rightly about that previous thread, this bit of code was substituded for the commented-out section so as to get desktop changing without "wrapping" or something. If you just want to disable it completely don't put it in your rc.xml:

<mousebind action="Click" button="Up">
        <action name="GoToDesktop">
          <to>previous</to>
          <wrap>no</wrap>
        </action>
      </mousebind>
      <mousebind action="Click" button="Down">
        <action name="GoToDesktop">
          <to>next</to>
          <wrap>no</wrap>
        </action>
      </mousebind>

#5 Re: Help & Support (Stable) » Clipit Copying » 2014-09-21 07:21:41

Alternatively install the little package xsel for command-line clipboard use. It won't interfere with clipit and you could do

echo "whatever" | xsel -b

to get "whatever" in the clipboard. Clipit will be able to use it, or you can use xsel again to paste it somewhere. (see man xsel of course)

#6 Re: Help & Support (Stable) » How to remove Terminator without removing cb-pipemenus and cb-welcome? » 2014-09-21 07:11:08

^sorry iMBeCil, I don't think that will work. AFAIK aliases are only for commands typed into a terminal and won't work with scripts or menus.

Another option,  @WhatsThatSmell, is to make a symlink in ~/bin called terminator which points to xfce4-terminal like this:

ln -s /usr/bin/xfce4-terminal ~/bin/terminator

If you do that you'll still need to make local copies of your scripts before uninstalling terminator, but won't have to edit them. However, any app that tries to call "terminator" will get xfce4-terminal instead.

#7 Re: Help & Support (Testing/Unstable) » Fresh install to debian testing? » 2014-09-18 09:21:34

machinebacon wrote:

Finally, I would like to point to Johnraff's Crunchbang installer script somewhere in the Tips & Tricks section here on the forums. Excellent stuff.

Edit: http://crunchbang.org/forums/viewtopic.php?id=25098 here it is

Unfortunately, it only works on Wheezy. Completely untested with, er, Testing and would probably need [a lot of|some] rewriting.
Thanks for the mention though!

#8 Re: Tips, Tricks & Scripts » How to: install Waldorf from the Debian netinstall » 2014-09-18 03:18:03

Hi smersh2 - the "sudo" command keeps its super-user privileges for several minutes after the first time you run it (I forget exactly how many minutes) so you don't have to enter your password over and over every time you use it. This means that if you used sudo just before running the script then it won't need your password at the start. However, during all the downloading and installing of packages it will probably time-out and need your password again to run the sudo commands that come at the end of the script.

I'll think about rewriting the script for Janice when it comes out. How difficult it will be depends on how much is changed in the underlying system. Anyway, it probably won't be for some months yet.

#9 Re: Tips, Tricks & Scripts » Running several versions of firefox on #! » 2014-09-03 01:56:38

↑The -no-remote option is an important point here.  cool

#10 Re: Tips, Tricks & Scripts » mps-youtube or consume youtube like a pro » 2014-09-03 01:51:15

Re legality, morality etc - if it's in the Debian repos then I guess many intelligent and high-principled people have already been over the issues, and we needn't really go through it all again here.

Still...
The legal aspects of storing media locally vs streaming vary from country to country, but the internet is very widely accessible (I'd like to say universally accessible, but let's not forget countries like China) so software which is legal to use where it was written may not be legal in the country where you live. shifty.gif

Until the Internet Police find a way of monitoring your activity, it's basically up to you and your conscience...

btw there are also YouTube downloader addons available for Firefox on the Mozilla site, so they also have presumably thought this stuff through to some extent.

#11 Re: Tips, Tricks & Scripts » How to: install Waldorf from the Debian netinstall » 2014-08-09 10:26:26

It was there actually:

post#1 wrote:

(Use up/down arrows to move, spacebar to toggle selection.)

smile

#12 Re: Tips, Tricks & Scripts » CrunchBang-XFCE-Openbox respin » 2014-08-09 10:10:34

re this particular respin, if you choose the "openbox" option at login instead of the default "xfce", you'll get pretty much the standard #! Waldorf. The openbox config files for the xfce session are kept separate, so you can configure the two sessions independently to some extent.

#13 Re: Help & Support (Testing/Unstable) » [Solved] CB-Exit script » 2014-07-03 05:26:21

Try this:
make a copy of the cb-exit script, put it somewhere convenient, and make sure it's executable.
Now edit it and remove the line
os.system("openbox --exit")
so that it won't shut down your system.

Now run this new test script from a terminal.
Try editing the line
               os.system("aplay -D plughw -q /home/william/Soundfiles/tada.wav")
trying various commands to see if anything works.
Error messages in the terminal you called it from might give you a hint.

#14 Re: Help & Support (Testing/Unstable) » [Solved] CB-Exit script » 2014-06-26 14:23:13

In your terminal command you missed a space between aplay and -D. Try it without the -q option to see any error messages.

In the logout script - hmm anyway no sound.
Can you call the logout script from a terminal to see if there are any error messages related to aplay?
Maybe temporarily remove the os.system("openbox --exit") line so it stays open.

#15 Re: Help & Support (Testing/Unstable) » [Solved] CB-Exit script » 2014-06-25 13:22:55

@Eagleshadow that aplay thing might be because it is not being run as you. I don't know python (but know that indentation matters btw) but am wondering who exactly the os.system call is running as. This is because I had a similar issue with a login script recently. It was running as root and so didn't have the necessary pulse audio cookie or something to aplay a wav file in the default mode.

After a lot of Googling around I tried

aplay -D plughw -q /path/to/sound.wav

which worked for me. Before you dive into it you could give that a try...

#16 Re: Help & Support (Stable) » Debian Menu not updating » 2014-06-25 13:05:28

You could add another panel, but a very small one holding only a menu, leaving room for tint2. (There is also xfce4-panel btw.)

There are also auto-updating application pipe menus for openbox. Some have been discussed on these forums before - try searching.

#17 Re: Help & Support (Stable) » is there a Control Centre in openbox? » 2014-06-24 11:29:21

Hi toad, welcome to CrunchBang smile

I'm glad you solved your problem, but to answer your original question - no there is no "control centre" in Openbox. As you found, on CrunchBang many administrative jobs are done by editing text files (although GUI apps are available for some of these jobs). In fact Openbox is not a "Desktop Environment" like Gnome or KDE (or Windows), it's just an application for drawing windows that happens also to come with a popup menu.

#19 Re: Tips, Tricks & Scripts » How to: install Waldorf from the Debian netinstall » 2014-06-20 11:43:04

alaskan-hippie wrote:

Also, how complicated would it be to combine all the scripts into one? Is there any thing special that would be required in the script to allow for this?

Originally I had everything in one script and there's nothing stopping you from doing that. I pulled all the various configurations into auxiliary files to make it easier for people to put together their own customized versions.

#20 Re: Tips, Tricks & Scripts » How to: install Waldorf from the Debian netinstall » 2014-06-20 11:40:17

alaskan-hippie wrote:

Ones these packages are pulled in with cb-metapackage, are the config files preconfigured for the #! specifications, or do they come with default configs and then the script sets up the proper config files?

If you mean the user config files that set things like fonts, gtk themes tint2 setup and so on, then a set of files comes with the package cb-configs and gets put in /etc/skel . From there copies are put in new users' home directories by the script. In a normal #! install that job is done by slim, the login manager.

#22 Re: Feedback & Suggestions » Username and Title confusion » 2014-06-13 04:03:00

I don't think it's such a big deal, but fwiw I'd go along with the view that if all it takes is editing a couple of lines of code in a config file then having the title below the avatar would probably look better anyway.

#23 Re: Off Topic / General Chat » Windows XP ISO (Urgent) » 2014-05-30 02:35:24

Also let's not forget that Xp is no longer getting any security upgrades from Microsoft, so virus infections, trojan incursions, keyloggers and all kinds of fun are a real possibility. Doesn't sound too cool an environment to be doing anything involving money... icon_eek.gif

#25 Re: Tips, Tricks & Scripts » Set the default browser, right this time » 2014-05-28 03:38:32

twoion wrote:

On a second thought, and because you wrote you wanted to 'shift' through variables that are layed out in an array style in the comments to your script: a nice way to make use of the set command is:

set -- ${mimes[@]}

where the positional arguments to the script are set to the expansion of the array $mimes! If you do this, you can afterwards indeed 'shift' through your array...

@alad hope you don't mind me butting in here purely for my own education, but @twoion I've learned a lot from your comments in these forums but in this case I don't quite see the advantage of doing:

set -- ${mimes[@]}
while (( $# != 0 )) ; do
  echo $1
  shift
done

compared with

for i in "${mimes[@]}";do
    echo "$i"
done

Probably I'm overlooking something?

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo