You are not logged in.

#1 2008-06-21 00:40:08

a87
Member
Registered: 2008-06-16
Posts: 7

[SOLVED]Help me create a little mpd bash script

I want to make a bash script that stops whatever mpd server is playing at the time and play a specific song in my local library.

Then I'd like to run it through cron but I guess I can figure that out myself.

Last edited by a87 (2008-06-21 04:11:56)

Offline

#2 2008-06-21 01:07:46

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: [SOLVED]Help me create a little mpd bash script

Does the script have to honor the current playlist? It would be pretty easy to write one using mpc that would just erase current playlist, load the one song, and play it.

Offline

#3 2008-06-21 01:21:52

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: [SOLVED]Help me create a little mpd bash script

mpc clear
mpc add path/to/your/file/relative/to/root/of/music/library
mpc play

You need package "mpc" from pacman.

Last edited by peets (2008-06-21 01:25:09)

Offline

#4 2008-06-21 03:32:53

a87
Member
Registered: 2008-06-16
Posts: 7

Re: [SOLVED]Help me create a little mpd bash script

Thank you peets

Now (if I'm not asking to much for tonight) I'd like a script that raises the volume to the max.

I don't care if it's through alsa directly or mpd. Keep in mind I got the vanilla dmix software volume setup from the mpd wiki. That means mpd has it's own volume meter conveniently titled mpd.

edit: never mind i found how to do it through mpc.

Last edited by a87 (2008-06-21 04:11:44)

Offline

#5 2008-06-21 10:09:38

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,675

Re: [SOLVED]Help me create a little mpd bash script

What are you doing ? Setting up an alarm clock ? smile


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#6 2008-06-21 10:19:57

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: [SOLVED]Help me create a little mpd bash script

moljac024 wrote:

What are you doing ? Setting up an alarm clock ? smile

Scarring the hell out of his family maybe smile

Offline

#7 2008-06-21 10:40:01

elide
Member
From: Russia
Registered: 2007-12-02
Posts: 40

Re: [SOLVED]Help me create a little mpd bash script

 ~ >> cat bin/alarm
#!/bin/bash
c=${HOME}/bin/mpc
vol=$1

$c clear
$c load alarm
$c volume ${vol:-70}
$c play
export DISPLAY=:0
xset dpms force on

This script uses special playlist 'alarm' instead of hardcoded song name. It also turning my screen on, so I can find my pc in the dark and turn this scary sounds off.
Jerry Goldsmith's Omen OST is a really good choice for alarm clocks (:

Offline

#8 2008-06-21 13:11:01

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: [SOLVED]Help me create a little mpd bash script

Very smart, my only suggestion is to use DISPLAY=':0.0' smile

Offline

Board footer

Powered by FluxBB