Sponsored Content
Top Forums Shell Programming and Scripting Function - play # uses mplayer random directories Post 302809195 by bdragon on Saturday 18th of May 2013 03:51:05 PM
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.
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
CMUS-REMOTE(1)						      General Commands Manual						    CMUS-REMOTE(1)

NAME
cmus-remote - control cmus SYNOPSIS
cmus-remote [OPTION]... [FILE|DIR|PLAYLIST]... cmus-remote -C COMMAND... cmus-remote DESCRIPTION
Add FILE/DIR/PLAYLIST to playlist, library (-l) or play queue (-q). If no arguments are given cmus-remote reads raw commands from stdin (one command per line). Raw commands are cmus' command mode commands. These same commands are used in configuration files and key bindings. cmus(1) contains full list of commands. For consistency also searching is supported: -C /text. When -C is given all command line arguments are treated as raw commands. OPTIONS
--server SOCKET Connect using socket SOCKET instead of ~/.cmus/socket. --help Display usage information and exit. --version Display version information and exit. -p, --play Start playing. -u, --pause Toggle pause. -s, --stop Stop playing. -n, --next Skip forward in playlist. -r, --prev Skip backward in playlist. -R, --repeat Toggle repeat. -S, --shuffle Toggle shuffle. -v, --volume VOL Change volume. See vol command in cmus(1). -k, --seek SEEK Seek. See seek command in cmus(1). -Q Get player status information. Same as -C status. Note that status is a special command only available to cmus-remote. -l, --library Modify library instead of playlist. -P, --playlist Modify playlist (default). -q, --queue Modify play queue instead of playlist. -c, --clear Clear playlist, library (-l) or play queue (-q). -C, --raw Treat arguments (instead of stdin) as raw commands. EXAMPLES
Add playlists/files/directories/URLs to library view (1 & 2): $ cmus-remote -l music.m3u http://live.urn1350.net:8080/urn_high.ogg Load (clear and add) playlist to playlist view (3): $ cmus-remote -c music.m3u Three different ways to toggle repeat: $ cmus-remote -R $ cmus-remote -C "toggle repeat" $ cmus-remote toggle repeat ^D Query settings or key bindings: $ cmus-remote -C "set repeat?" setting: 'repeat=false' $ cmus-remote -C "showbind common a" bind common a win-add-l Dump the playlist to stdout: $ cmus-remote -C "save -p -" [...] Search works too: $ cmus-remote -C /beatles SEE ALSO
cmus(1) AUTHOR
Written by Timo Hirvonen <tihirvon@gmail.com> cmus 05/11/2006 CMUS-REMOTE(1)
All times are GMT -4. The time now is 01:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy