WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Run Mplayer after boot  (Read 5210 times)

Offline evertvaningen

  • Jr. Member
  • **
  • Posts: 60
Run Mplayer after boot
« on: June 14, 2017, 09:52:53 AM »
I want Mplayer to automatically start playing music after boot.

I tried
Code: [Select]
echo "mplayer http://91.221.151.155:80/;?.mp3" > ~/.X.d/Playradio
No luck.

I read https://bbs.archlinux.org/viewtopic.php?id=166565 but I don't know how to do all that stuff.

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Run Mplayer after boot
« Reply #1 on: June 14, 2017, 10:06:40 AM »
I'd try
Code: [Select]
echo 'xterm -e mplayer "http://91.221.151.155:80/;?.mp3"' > ~/.X.d/Playradio
Download a copy and keep it handy: Core book ;)

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Run Mplayer after boot
« Reply #2 on: June 14, 2017, 10:11:10 AM »
Or your network isn't up yet
Code: [Select]
{
SEC=60
while [ $SEC -gt 0 ]; do
ifconfig | grep -q "Bcast" && break || sleep 1
echo -ne "Waiting for IP... $((SEC--)) \r"
done
mplayer "http://91.221.151.155:80/;?.mp3"
} &
Download a copy and keep it handy: Core book ;)

Offline evertvaningen

  • Jr. Member
  • **
  • Posts: 60
Re: Run Mplayer after boot
« Reply #3 on: June 14, 2017, 10:16:03 AM »
Or your network isn't up yet
Code: [Select]
{
SEC=60
while [ $SEC -gt 0 ]; do
ifconfig | grep -q "Bcast" && break || sleep 1
echo -ne "Waiting for IP... $((SEC--)) \r"
done
mplayer "http://91.221.151.155:80/;?.mp3"
} &

This looks great but how can I implement this?

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Run Mplayer after boot
« Reply #4 on: June 14, 2017, 10:23:32 AM »
Just put it in your ~/.X.d/Playradio  start script
Download a copy and keep it handy: Core book ;)

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Run Mplayer after boot
« Reply #5 on: June 14, 2017, 10:34:27 AM »
In the thread you posted the link to, they ping the server until it pongs back.
Might make sense.
Code: [Select]
{
while true; do ping -c1 91.221.151.155 && break || sleep 1; done
xterm -e mplayer "http://91.221.151.155:80/;?.mp3"
} &
Download a copy and keep it handy: Core book ;)

Offline evertvaningen

  • Jr. Member
  • **
  • Posts: 60
Re: Run Mplayer after boot
« Reply #6 on: June 14, 2017, 10:59:55 AM »
In the thread you posted the link to, they ping the server until it pongs back.
Might make sense.
Code: [Select]
{
while true; do ping -c1 91.221.151.155 && break || sleep 1; done
xterm -e mplayer "http://91.221.151.155:80/;?.mp3"
} &

It does open after boot but there is no sound. AlsaMixer tells me there is sound.
speaker-test: not found... :s

Getting tired of all these weird problems all the time...
Reinstalling and try again.

Install alsa.tcz

$echo "amixer set "Master" 39 unmute" > ~/.X.d/alsaunmute

To test the audio
$ speaker-test -Ddefault:0 -c2 -t wav -l1

After clean install speaker-test still missing?
« Last Edit: June 14, 2017, 11:28:06 AM by evertvaningen »

Offline evertvaningen

  • Jr. Member
  • **
  • Posts: 60
Re: Run Mplayer after boot
« Reply #7 on: June 14, 2017, 01:55:33 PM »
In the thread you posted the link to, they ping the server until it pongs back.
Might make sense.
Code: [Select]
{
while true; do ping -c1 91.221.151.155 && break || sleep 1; done
xterm -e mplayer "http://91.221.151.155:80/;?.mp3"
} &

It does open after boot but there is no sound. AlsaMixer tells me there is sound.
speaker-test: not found... :s

Getting tired of all these weird problems all the time...
Reinstalling and try again.

Install alsa.tcz

$echo "amixer set "Master" 39 unmute" > ~/.X.d/alsaunmute

To test the audio
$ speaker-test -Ddefault:0 -c2 -t wav -l1

After clean install speaker-test still missing?

Auto play Mplayer is now with sound so all is good.

I installed Alsa-Config...

Offline evertvaningen

  • Jr. Member
  • **
  • Posts: 60
Re: Run Mplayer after boot
« Reply #8 on: June 14, 2017, 02:04:40 PM »
I get the error

Cache empty, consider increasing -cache and/or -cash=min. [performance issue]

then it resumes 0.1 sec... get the error again and then the program exits.

Any way to fix this?

Something like...?
$mplayer http://91.221.151.155:80/;?.mp3 -cache
« Last Edit: June 14, 2017, 02:09:09 PM by evertvaningen »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11040
Re: Run Mplayer after boot
« Reply #9 on: June 15, 2017, 05:01:36 AM »
That's not why it exits. Look at the whole log.
The only barriers that can stop you are the ones you create yourself.