Function - play # uses mplayer random directories


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Function - play # uses mplayer random directories
# 1  
Old 05-18-2013
Function - play # uses mplayer random directories

I have this in my .bashrc and use it to play my music. It is organized by directories and this will play them in random order:

Code:
play(){ ## play directories with mplayer (random)
if [ $# -eq 0 ]
then
    # if no option show music types
    echo -n "
play {directory|style}

Styles:
-------"
    find  ~/music/ -maxdepth 1 -type d -print | cut -d'/' -f5|sort
else
    # create tmp list
    xtitle "mplayer tunes!"
    clear
    [ ! -e $1 ] && cd ~/music
    find -L $1 -type f -name \*.\* >play.$$
    if [ "$1" == "vids" ]
    then
        \mplayer -fs -msgcolor -shuffle -playlist play.$$ 2>/dev/null
    else
        \mplayer -msgcolor -shuffle -playlist play.$$ 2>/dev/null
    fi

    \rm play.* 2>/dev/null
    cd -
fi
}

I have many other tools and such, if folks find them of use I will post them.

bd - Put your hand on a hot stove for a minute and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. That's Relativity. - A.E.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Mplayer fifo.

Hi all, First of all, sorry for the pastebin link. The code tags aren't working for me. #!/bin/bash # while-menu-dialog: a menu driven - Pastebin.com This is a channel "changer" shell script i'm working on. It uses dialog to display the menus. It... (3 Replies)
Discussion started by: ignatius
3 Replies

2. Shell Programming and Scripting

Recurse directories and return random file

I have a nice program to change the background but I want it to operate on subdirectories as well. # Script to randomly set Background from files in a directory while true;do # Directory Containing Pictures DIR="/home/pc/Pictures" # Internal Field Separator set to newline, so file names... (4 Replies)
Discussion started by: triplemaya
4 Replies

3. Shell Programming and Scripting

Need to generate a file with random data. /dev/[u]random doesn't exist.

Need to use dd to generate a large file from a sample file of random data. This is because I don't have /dev/urandom. I create a named pipe then: dd if=mynamed.fifo do=myfile.fifo bs=1024 count=1024 but when I cat a file to the fifo that's 1024 random bytes: cat randomfile.txt >... (7 Replies)
Discussion started by: Devyn
7 Replies

4. Shell Programming and Scripting

Function to remove the directories from PATH variable

Hello, From the URL https://www.unix.com/shell-programming-scripting/121303-remove-path-path-environment-variable-2.html I got a function to remove the directories from a path. but looks like this isnt quite working.. i am also not able to post the comments in the thread as it is closed. ... (6 Replies)
Discussion started by: satishkumar432
6 Replies

5. Shell Programming and Scripting

Extract function names and directories from php files

I need a script that extracts function names from php files together with their location (path and file in which they are defined). The php files are located in several directories under a base directory. Ideally the output should be something like: "Path/FileName/FunctionName" for a... (2 Replies)
Discussion started by: bamse
2 Replies

6. Shell Programming and Scripting

mplayer problem

I have this problem using a script that uses mplayer. This is the error messages. INFO: Mplayer Log LOG: MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team LOG: mplayer: could not connect to socket LOG: mplayer: No such file or directory LOG: Failed to open LIRC support. You... (1 Reply)
Discussion started by: locoroco
1 Replies

7. Ubuntu

expect script for random password and random commands

Hi I am new to expect. Please if any one can help on my issue its really appreciable. here is my issue: I want expect script for random passwords and random commands generation. please can anyone help me? Many Thanks in advance (0 Replies)
Discussion started by: vanid
0 Replies

8. Solaris

mplayer on soalris

Hi all ... I would like to know how to install mplayer on solaris 10 i have been trying to understand it through the docs on their website but didnt get it that well.. So if anyone can give me step by step instructions to install it ..i would much appreciate it!!! Thanks (3 Replies)
Discussion started by: wrapster
3 Replies

9. Shell Programming and Scripting

random function script

hi, I need a command which picks the records randomly from the file. For example. i am having some 10000 entries in a file and need to extract the lines randomly without repeating the numbers. Do anybody have any idea on how to get this out. (4 Replies)
Discussion started by: prash_b
4 Replies

10. UNIX for Dummies Questions & Answers

Help me: Divx with MPlayer

Hi, I'm a beginner in linux :( I wanna play divx with MPlayer. I have mdk8.1 and I can't install MPlayer because I have gcc 2.96 I need upgrade my gcc to 2.95.2 or 2.95.4 Anyone can say me how do i do to uninstall gcc-2.96 and install gcc-2.95.2. Can you give me the exactly url to... (1 Reply)
Discussion started by: mercutio
1 Replies
Login or Register to Ask a Question
PLAIT(1)							   User Commands							  PLAIT(1)

NAME
Plait - Command-line Jukebox. DESCRIPTION
Usage is: "plait <hint about artist or album or song> [[not] <hint>]...[as <mix>]", or "plait --stream <hint> [[not] <hint>]..." OPTIONS
--list,-l -- show matching tracks but don't play --mix,-m -- play tracks matching any hint (make a mix) --queue,-q -- add tracks to queue --random,-r -- play in random order --sort -- play in sorted order --stripe -- play in alternating order --stripe2 -- play in random alternating order --fade -- play in gaussian fade order --group -- play randomly in groups --tracks,-t -- play n tracks, if possible --stream,-s -- play Shoutcast radio streams --mixfile,-f -- read hints from mixfile --device,-d -- choose target device --platform -- choose platform --coverart -- cover art mode (0 or 1) --guest,-g -- use guest configuration --interactive,-i -- interactive mode --cache,-c -- rebuild cache --install -- install Plait --uninstall -- uninstall Plait --play --pause --stop --next --prev --help -- show help --version -- show version AUTHOR
Written by Stephen Jungels (http://stephenjungels.com/contact) COPYRIGHT
Copyright (C) 2005-2008 by Stephen Jungels. Released under the GPL. Latest version and more info at http://plait.sourceforge.net/ Plait v 1.6.2 September 2008 PLAIT(1)