Notices


Reply
Thread Tools
Posts: 43 | Thanked: 32 times | Joined on Jan 2010
#1
Hello.

When I want to listen to music in my car I have to:
- Select Menu
- Open Media Player
- Press the resume button
- Press "Now Playing" button
- Select FM Transmitter
- Enable FM Transmitter
- Save
- Press the play button.

This sucks!

I'm trying to do this with a script. Here's my (crappy) code:

Code:
#!/bin/sh

#TEXT FILE WITH THE PATH OF ALL SONGS
#TO CREATE THIS FILE: find -name "*.mp3" > /home/user/MyDocs/songs.txt
NAMES="/home/user/MyDocs/songs.txt"

if [ -f $NAMES ]
then
	#COUNT NUMBER OF SONGS 
	#wc -l $NAMES | cut -d ' ' -f 1` DOESN'T WORK IN N900
	NUMBER=0
	exec<$NAMES
	while read line
	do
	        NUMBER=`expr $NUMBER + 1`
	done

	"RANDOM" SONG
	#RANDOM VARIABLE EXISTS IN bash BUT NOT IN busybox
	max=$(($numero-1))
	random=`dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" "`
	SONG=`head -$((1+($random % $max))) $FICHERO | tail -1`

	#TURNS FM TRANSMITTER ON
	fmtx_client -p 1

	#OPEN MEDIA PLAYER WITH THE RANDOM SONG
	dbus-send --print-reply --dest=com.nokia.mediaplayer /com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:"file:///$SONG
else
	echo "ERROR: The file $NAMES doesn't exist."
fi
This script selects a random song from disk, enables fm transmitter and plays the song with media player. It doesn't work very well: It only loads the random song and if I want to listen to another song I have to return to Media Player's main menu because there is no playlist, only the song (like when you open a music file with the file admin).

I'd like to create a script that enable FM Transmitter, open Media Player, load my playlist and resume playing.
After that I'd create a desktop button. I could listen to music in my car pressing only two buttons!

Is it possible? Can you help me?
 
Posts: 523 | Thanked: 292 times | Joined on Jan 2010
#2
Why not just use the FM widget and the Music player widget, then just two button pressing does give you music via your car music player?

I use them every day without any problems.
 

The Following 2 Users Say Thank You to droitwichgas For This Useful Post:
Posts: 114 | Thanked: 109 times | Joined on Nov 2010 @ Finland
#3
I use this very simple script:

phone-control --fmtxon
phone-control --mp-resume launch

Of course you must have phone-control installed from the repos.
 

The Following User Says Thank You to Keneraali For This Useful Post:
Posts: 43 | Thanked: 32 times | Joined on Jan 2010
#4
@droitwichgas
I've several widgets installed and I didn't want to install more but I'll install media player widget.

@Keneraali
I hadn't heard about phone-control, I'll give it a try.

Thank you.
 
kl2010's Avatar
Posts: 35 | Thanked: 2 times | Joined on Jul 2010 @ lagos, Nigeria
#5
Originally Posted by isorn View Post
@droitwichgas
I've several widgets installed and I didn't want to install more but I'll install media player widget.

@Keneraali
I hadn't heard about phone-control, I'll give it a try.

Thank you.
am trying to do the ame thing, mayb u can see here http://talk.maemo.org/showthread.php?t=70405&page=47
__________________
C. Shirky: Everybody has something strange they are trying to accomplish.
 
Reply


 
Forum Jump


All times are GMT. The time now is 09:01.