Author Topic: Xmms Random Play  (Read 1849 times)

dino

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
    • http://
Xmms Random Play
« on: December 08, 2004, 06:00:43 pm »
Xmms will play in the random song selection mode if you click on the icon that looks like the equalizer bar.
I have a cron job that launches xmms in the mornings, but don't know how to get xmms to come up in the random mode.  It does not seem to be saving the settings.  Can this be switched on via the command line?

For those of you trying to get cron to launch xmms heres a tip.
Open up a shell and type export to get a list of all your environment variables:
Quote
root@collie:~/.xmms# export
export HOME='/root'
export LOGNAME='root'
export PATH='/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin::/opt/QtPalmtop/bin'
export PS1='\u@\h:\w\$ '
export PWD='/root'
Copy the variables to your crontab and remove the word "export":
Quote
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.24098 installed on Wed Dec  8 15:53:28 2004)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
#Environmental Variables
HOME='/root'
LOGNAME='root'
PATH='/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin::/opt/QtPalmtop/bin'
PS1='\u@\h:\w\$ '
PWD='/root'
QTDIR='/opt/QtPalmtop'
SHELL='/bin/sh'
TERM='linux'
TERMINFO='/mnt/card/etc/terminfo'
TSLIB_TSDEVICE='/dev/ts'
TSLIB_TSEVENTTYPE='COLLIE'
USER='root'
#Cron jobs
20 06 * * 1-5 xmms -p
SL5500, Open Zaurus 3.5.2, 128MB SD

ironstorm

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • http://
Xmms Random Play
« Reply #1 on: December 09, 2004, 12:56:08 am »
um...  I have a way to accomplish the same thing....

create a script called shuffle.awk and set it chmod +x:
Code: [Select]
#!/usr/bin/awk
# AWK Shuffle from Carlos J. G. Duarte on Deja News
BEGIN { srand() }
{ while (x[sprintf("%6f%s", rand(), $0)]++){} }
END { for (i in x) print substr(i, 9) }

Then you can call it using:
Code: [Select]
cat ~/.xmms/xmms.m3u | grep -v EXTINF | grep -v EXTM3U | awk -f shuffle.awk > ~/.xmms/xmms.m3u
do that before you start xmms (either by putting it in the same line of the cron job, running it a minute before xmms or wrapping into into another script)...

Cheers....
-G
« Last Edit: December 09, 2004, 12:56:37 am by ironstorm »

dino

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
    • http://
Xmms Random Play
« Reply #2 on: December 09, 2004, 10:13:24 am »
ironstorm,
Works great!
I put the
Quote
#!/bin/sh
cat ~/.xmms/xmms.m3u | grep -v EXTINF | grep -v EXTM3U | awk -f /usr/bin/shuffle.awk > ~/.xmms/xmms.m3u
in a script called "xmmsshuffle.sh"
my cron job is
Quote
20 06 * * 1-5 xmmsshuffle.sh && xmms -p
for a wakeup at 06:20 on weekdays.  Notice I had to use the complete path to shuffle.awk to use it from cron.

People ask "Why do you run Linux?"  For one reason, it seems there is always a way to make it do what you want.
Thanks,
SL5500, Open Zaurus 3.5.2, 128MB SD