BlueamaroK
Amarok 1.x Scripts
Score 50%
Description:

BlueamaroK controls basic functions of the amaroK player with a SonyEriccson mobile telephone through a bluetooth connection.

Dependencies:
Bluez - http://www.bluez.org/
Tcl - http://tcl.sourceforge.net/

Using:
Pair your PC and phone, run rfcomm to bind the connection to a serial device, for example /dev/rfcomm0, run BlueamaroK and go to the accessories menu (Connectivity > Accessories).

Binding example:
# hcitool scan
Scanning ...
00:0E:07:3E:58:0D Khertz
# rfcomm bind rfcomm0 00:0E:07:3E:58:0D 1

Permanent binding:
Edit /etc/bluetooth/rfcomm.conf adding:
rfcomm0 {
bind yes;
device 00:0E:07:3E:58:0D;
channel 1;
comment "Khertz T610";
}

I recommend to use the KDE Bluetooth Framework (http://kde-bluetooth.sourceforge.net/). In the KDE Bluetooth Framework homepage you'll find good documentation for configuring bluetooth.

Models supported:
- T68
- T86i
- T300
- T310
- T610
- Z600
- T230/T238/T226
- T630
- T290

Author:
Pablo Chinea
N.Cat
Last changelog:

11 years ago

* Version 0.1 (03/01/2006)
- Initial Release.

* Version 0.5 (12/01/2006)
- Feature: Playlist listed in phone display.
- Feature: Select track to play from the phone.
- Feature: Added bitrate and sample rate in Track Info.
- Bugfix: Phone return an error when back button is pressed. FIXED
- Some texts changed
- Added more using information in the README

* Version 0.51 (13/01/2006)
- Bugfix: Script fail writing debug output. FIXED

* Version 0.52 (05/10/2006) by N.Cat
- Feature: Reconnect automatically.
- Feature: Improved menu, now just one Play/Pause entry.
- Feature: Show message and set status info on song change.
- Feature: Mark active song in playlist.
- Bugfix: Parsing fails when KDE applications output on stderr. FIXED
- Bugfix: Configuration can be corrupted. FIXED
- Bugfix: Infinite read loop if connection is lost. FIXED
- Bugfix: Menu is no longer displayed after certain errors. FIXED
- Bugfix: Error on long playlist items. FIXED
- Bugfix: Playlist item displayed strangely. FIXED

* Version 0.53 (10/12/2006)
- Bugfix: Incorrect title showed on song change. FIXED

gardar

9 years ago

Are there any future developments planned for this script? I would love to see this bluetooth remote working with my Sony Ericsson P1i

Report

khertz

9 years ago

No, I have no future developments planned for this script. Now I have a SE W880i, and I use the "Remote Control" feature instead of any script. Anyway, I would need a SE P1i in order to program a script for it.

Report

gardar

9 years ago

Oh I see...
Well wouldn't a emulator provided in the SE SDK be enough?

Report

khertz

9 years ago

mmm really, I haven't ever used this emulator. I suppose it would be enought.

Report

thomec

9 years ago

Hello there,
I really like this script and I'm using it a lot. Sadly since i updated to Debian/Sid it just exits with error code 255. Any suggestions on how to fix that?
Greetings, Tho

Report

thomec

9 years ago

OK, solved, installed a bunch of packages. I think some tcl-package was missing. Works fine again :-)

Report

gepi

9 years ago

Hello,

i'm a user of a SE M600i. Is it posible to make it work with this mobile? Connection every things work, but how can i controll now mi pc with my mobile? is it posible that the M600i doesn't have this menu or do i something wrong?

Hope you can help me or hopefully you can update this script. I would be glade if it will works.

Greatings
gepi

Report

khertz

9 years ago

No, it is not possible, because M60 use a different AT instrutions set. This program only works with the models listed in the description above. A direct portability is not possible, the AT instructions set are totally different.

Report

gepi

9 years ago

Ok, i understand.
I know such problems. I'm a programmer too.
I can only regret this, but this will nothing help :-)
At the moment it seams that no tool works with the M600i (to remotecontrole Amarok).

Best wishes

gepi

Report

khertz

9 years ago

I just have to realize that there is a more serious problem, Sony Ericsson has not published (yet?) the specifications of the AT commands for M600i :-S

Well, and if you are a programmer you can try to port the script when the specifications are released ;-)

Greetings,

Khertz

Report

ereford

9 years ago

Hello there. I've a SonyEricsson Z610i and I'm unable to control amarok with it. I've the same problem that AceTheFace: 3 options under Remote Control section, none of them allows me to control amarok; and accesories in Connectivity menu is disabled. Any tip ?

Report

alecubero

10 years ago

I just want to say great work! I think this script is great, I always wanted to find out how to "talk" to the phone using those AT commands.
Thanks!

Report

MetaMorfoziS

10 years ago

No way to use it with k510i?
It's ery intresting.

Report

khertz

10 years ago

Sorry, the script is not compatible with K550i, because this phone use a different AT instrutions set. Blueamarok only supports T68, T68i, T300, T310, T610, Z600, T230/T238/T226, T630 and T290 models.

A direct portability is not possible, the AT instructions set are totally different.

Report

schurl

10 years ago

Hi!
Has anybody tried to use the script with a Z520i?

When I try to load the script, my phone tells me, that my computer tries to use the phone as a modem. I accepted, and wanted to watch if the Accessories menu offers any entries...well, there were none. Any hints? Is it that the Z520i is not compatible?

Thanks for reading!

Report

khertz

10 years ago

No, Z520i is not compatible. Please, read the script description (above this lines), you'll find the compatibility list.

Greetings

Report

plc

10 years ago

This script rocks :-) .. I had no idea this was even possible.

and btw, it also works on the Sony Ericsson Z1010, and from FreeBSD as well.

Report

SiCkTiMe

10 years ago

Hi! I've been experimenting some problems when I do a tar -zxvf to the downloaded file. May be an error? Thanks

Report

khertz

10 years ago

I'm sorry, the file was compressed with bzip2 but I put the 'gz' extension instead of 'bz2'. Change the extension of your file or download it away.

Anyway you MUSN'T decompress the file, load it directly from the amarok script manager. Even you don't have to change the extension, it will detect the file format automatically.

Report

netral

10 years ago

Helo (World)

Because of not installing the kde manger at all, kdialog is not installed also.

I tried to eliminate kdialog from this script, which was not so hard at all.

If you want try that, so change your blueamarok like i did:

instead of exec kdialog i did a 'hardcoded' setting.
scripts stays here:

~/.kde/share/apps/amarok/scripts/blueamarok/

set outfile [ open $CONFIGFILE w ]
and
set CANAL [ open $DISPOSITIVO r+ ]

so no more need for kdialog..

here are the two passages:

proc configurar {} {
global CONFIGFILE
global DISPOSITIVO
if { ! [ info exists DISPOSITIVO ] || [ string equal "" $DISPOSITIVO ] } {
set DISPOSITIVO "/dev/rfcomm0"
}
set outfile [ open $CONFIGFILE w ]
puts $outfile $DISPOSITIVO
close $outfile
return 0
}



and:
proc Conectar {} {
global DISPOSITIVO
global CANAL

set CANAL [ open $DISPOSITIVO r+ ]

fconfigure $CANAL -buffering line
fileevent $CANAL readable "Leer"
}


rest stays the same..

yours,
netral

Report

dennismdk

10 years ago

How can i pair my W800i and Linux SuSE 10.1 with Gnome?

Report

dennism

10 years ago

When running the BlueAmarok-script I see on my W800i phone that the computer connects to the phone. But I don't get any new menus in Amarok.

The log says:
http://www.demaweb.dk/ba.txt

Can anybody tell me, that the problem are? Maybe the script works and I don't know how to use the Script?

I'm running Ubuntu.

Report

khertz

10 years ago

Sorry, the script is not compatible with W800i, because this phone use a different AT instrutions set. Blueamarok only supports T68, T68i, T300, T310, T610, Z600,
T230/T238/T226, T630 and T290 models.

Report

motin

10 years ago

It works great with Z800i (also known as V800) - at least 0.52 does, I got 0.51 to work only once back then.

THANKS FOR MAKING AND SHARING THIS AWESOME SCRIPT!

Report

supercatfrog

10 years ago

Ive made a change to it, below, to show the current playing track, at the top of the menu. Ive also re-ordered the menu. I appologise for the nasty, hacky code, as I dont speak spanish, tcl or the 710's AT command set.

#!/usr/bin/tclsh
#######################################################################
#
# BlueamaroK - It controls basic functions of the amaroK Player with a
# SonyEriccson mobile telephone through a bluetooth connection.
#
# This script is released under GPL free license.
#
# Pablo Chinea
# ver. 0.51 - 13/01/2006
#
#######################################################################
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#######################################################################

global CONFIGFILE
set CONFIGFILE "blueamarokrc"

#################
# Configuration #
#################
proc configurar {} {
global CONFIGFILE
global DISPOSITIVO
set outfile [open $CONFIGFILE w]
set DISPOSITIVO [ exec kdialog --inputbox "Serial device binded" "/dev/rfcomm0" --caption "BlueamaroK Configuration" ]
puts $outfile $DISPOSITIVO
close $outfile
}

######################
# Load configuration #
######################
proc cargar {} {
global CONFIGFILE
global DISPOSITIVO
if { [file exists $CONFIGFILE] } {
set infile [open $CONFIGFILE r]
set DISPOSITIVO [ gets $infile ]
close $infile
} else {
configurar
}
}

##########################
# Connect with the phone #
##########################
proc Conectar {} {
global DISPOSITIVO
global CANAL
if { [ catch { set CANAL [ open $DISPOSITIVO r+ ] } ] == 1 } {
exec kdialog --sorry "Error! Can't open $DISPOSITIVO device"
exit 1
}
fconfigure $CANAL -buffering none
fileevent $CANAL readable "Leer"
}

#######################################
# Capture the input send by the phone #
#######################################
proc Leer {} {
global CANAL
gets $CANAL entrada
puts stderr " $atcmd"
puts $CANAL $atcmd
}

#######################################
# Capture the commands sent by amaroK #
#######################################
proc iface {} {
gets stdin entrada
if { [ string match "configure" $entrada ] } {
configurar
}
}

###############################
# Execute an action in amarok #
###############################
proc action { cmd } {
exec dcop amarok player $cmd
}

###################################################
# Execute an action in amarok (with 2 parameters) #
###################################################
proc action2 { cmd1 cmd2 } {

exec dcop amarok player $cmd1 $cmd2
}

#######################
# Parsing phone input #
#######################
proc Parsear { cadena } {


global EST
global CONT
if { [ string match "OK" $cadena ] } {
global OK
set OK 1
}
if { [ string match "ERROR" $cadena ] } {
set EST 1
atsend "AT*EAID=1,0,\"BLUEAMAROK ERROR!\\0APlease, send debug output to khertz\\80gmail.com\",0"
vwait OK
vwait CONT
}
switch $EST {
0 {
if { [ string match "*EAAI" $cadena ] } {
set EST 1
kmenu 1
}
if { [ string match "*EAII: 0" $cadena ] } {
set CONT 1
}
}
1 {
if { [ string match "*EAMI*" $cadena ] } {
set val [ string range $cadena 7 end ]
if { $val != 0 } {
global MENU
eval [ lindex $MENU [ expr $val * 2 - 1 ] ]
kmenu $val
} else {
set EST 0
}
set LASTVAL $val
}
if { [ string match "*EAII*" $cadena ] } {
set CONT 1
}
}
2 {
if { [ string match "*EAII*" $cadena ] } {
if { [ string match "*EAII: 15*" $cadena ] } {
set val [ string range $cadena 10 end ]
action2 setVolume $val
} else {
set CONT 1
set EST 1
}
}
}
3 {
if { [ string match "*EAMI*" $cadena ] } {
set val [ string range $cadena 7 end ]
if { $val != 0 } {
global lista
global pag
if { ($pag != 0) } {
if { ($val == 1) } {
showplaylist -1 0
} elseif { ($val == 7) } {
showplaylist 1 0
} else {
exec dcop amarok playlist playByIndex [ expr $pag * 5 + $val - 2 ]
}
} else {
if { ( $val == 6 ) } {
showplaylist 1 0
} else {
exec dcop amarok playlist playByIndex [ expr $val - 1 ]
}
}
set CONT 1
}
set EST 1
set CONT 1
}
}
}
}

#######################
# Volume control menu #
#######################
proc volume {} {
global EST
set EST 2
set vol [ expr [ exec dcop amarok player getVolume ] / 10 ]
atsend "AT*EAID=4,2,\"Volume control\",10,$vol"
vwait CONT
}

########################
# Create the main menu #
########################
proc kmenu { sel } {


global MENU
set MENU {
"Next" "action next"
"Pause/Play" "action pause"

"Volume" volume
"Previous" "action prev"

"Backward" "action2 seekRelative -5"
"Forward" "action2 seekRelative 5"

"Mute" "action mute"
"Playlist" playlist
"Track Info" Info
"About" Acerca
}
## "Play" "action play"
## "Stop" "action stop"
set titulos ""
foreach { elem cmd } $MENU {
set titulos "$titulos,\"$elem\""
}
set long [ expr [ llength $MENU ] / 2 ]


set playing [ exec dcop amarok player title ]



set playing [ regexp -inline {\m.{1,11}$} $playing ]

#regsub -all {[^qwertyuiopasdfghjklzxcvbnm QWERTYUIOPASDFGHJKLZXCVBNM1234567890]} $playing "" playing


atsend "AT*EASM=\"$playing\",1,$sel,$long$titulos"
vwait OK


atsend "AT*EAST=\"$playing\""
atsend "AT*EAM=\"$playing\""



}

#########################
# Generate the playlist #
#########################
proc genlist { fich } {
set infile [open $fich r]
while { [ gets $infile cadena ] >= 0 } {
if { [ string match "* titulo
}
if { [ string match "**" $cadena ] } {
regexp "(.*)" [ string trim $cadena ] -> artista
}
if { [ string match "* 0 } {
set elem "$artista - $titulo"
} else {
set elem $titulo
}
lappend lista "$elem"
}
}
close $infile
return $lista
}

####################
# Get the playlist #
####################
proc playlist {} {
global EST
global lista
if { [ exec dcop amarok playlist getTotalTrackCount ] == 0 } {
atsend "AT*EAID=1,0,\"Playlist empty\",20"
vwait OK
vwait CONT
} else {
set EST 3
set lista [ genlist [ exec dcop amarok playlist saveCurrentPlaylist ] ]
exec dcop amarok playlist shortStatusMessage "Default Playlist saved by BlueamaroK"

set pos [ exec dcop amarok playlist getActiveIndex ]
global pag
if { $pos == -1 } {
set pag 0
set offset 0
} else {
set pag [ expr $pos / 5 ]
set offset [ expr $pos % 5 + 1 ]
}
showplaylist 0 $offset
}
}

##########################
# Show the playlist menu #
##########################
proc showplaylist { inc offset } {
global lista
global pag

set pag [ expr $pag + $inc ]

set longit [ llength $lista ]
set ini [ expr $pag * 5 ]
if { [ expr ($longit - 1) / 5 ] == $pag } {
set fin [ expr $longit - 1 ]
} else {
set fin [ expr $ini + 4 ]
}

set titulos ""
set long [ expr $fin - $ini + 1 ]

if { $offset } {
set sel $offset
} else {
set sel 1
}

if { $pag != 0 } {
set titulos "$titulos,\"\""
set long [ expr $long + 1 ]
set sel [ expr $sel + 1 ]
}

foreach elem [ lrange $lista $ini $fin ] {
set titulos "$titulos,\"$elem\""
}


if { [ expr ($longit - 1) / 5 ] != $pag } {
set titulos "$titulos,\"\""
set long [ expr $long + 1 ]
}

set npag [ expr $pag + 1 ]
set tpag [ expr ($longit - 1) / 5 + 1 ]

atsend "AT*EASM=\"Playlist ($npag/$tpag)\",1,$sel,$long$titulos"
vwait CONT
}

##########################
# Show track information #
##########################
proc Info {} {
set nombre [ exec dcop amarok player nowPlaying ]
set duracion [ exec dcop amarok player totalTime ]
set info "* $nombre\\0A* $duracion"

set bitrate [ exec dcop amarok player bitrate ]
set samplerate [ expr [ exec dcop amarok player sampleRate ] / 1000 ]
set info "$info\\0A* $bitrate - $samplerate Hz"

set fichero [ exec dcop amarok player path ]
if { [ file readable $fichero ] == 1 } {
set tipo [ string trim [ exec file $fichero | cut -d: -f2 ] ]
set info "$info\\0A* $tipo"
}
atsend "AT*EAID=14,2,\"Track Info\",\"$info\""
vwait CONT
}

#######################
# Show "About" dialog #
#######################
proc Acerca {} {
set a_pro "* BlueamaroK ver. 0.51"
set a_aut "* Pablo Chinea "
set a_web "* http://www.khertz.net/"
set a_lic "* This script is released under GPL free license."
set acerca "$a_pro\\0A$a_aut\\0A$a_web\\0A$a_lic"
atsend "AT*EAID=14,2,\"About\",\"$acerca\""
vwait CONT
}

#############################
# Initialize the connection #
#############################
proc IniCon {} {
atsend "ATZ"
vwait OK
atsend "ATE=0"
vwait OK

#title for menu
atsend "AT*EAM=\"Amarok\""
vwait OK
atsend "AT*EAID=1,0,\"Connected to Amarok\",20"
vwait OK
vwait CONT
atsend "AT*EAST=\"Amarok\""
vwait OK
}




#################
# Main function #
#################
proc main {} {
global EST
set EST 0
cargar
Conectar
IniCon
fileevent stdin readable "iface"
vwait BUCLEINF
}

main

Report

11 years ago

* Version 0.1 (03/01/2006)
- Initial Release.

* Version 0.5 (12/01/2006)
- Feature: Playlist listed in phone display.
- Feature: Select track to play from the phone.
- Feature: Added bitrate and sample rate in Track Info.
- Bugfix: Phone return an error when back button is pressed. FIXED
- Some texts changed
- Added more using information in the README

* Version 0.51 (13/01/2006)
- Bugfix: Script fail writing debug output. FIXED

* Version 0.52 (05/10/2006) by N.Cat
- Feature: Reconnect automatically.
- Feature: Improved menu, now just one Play/Pause entry.
- Feature: Show message and set status info on song change.
- Feature: Mark active song in playlist.
- Bugfix: Parsing fails when KDE applications output on stderr. FIXED
- Bugfix: Configuration can be corrupted. FIXED
- Bugfix: Infinite read loop if connection is lost. FIXED
- Bugfix: Menu is no longer displayed after certain errors. FIXED
- Bugfix: Error on long playlist items. FIXED
- Bugfix: Playlist item displayed strangely. FIXED

* Version 0.53 (10/12/2006)
- Bugfix: Incorrect title showed on song change. FIXED

File (click to download) Version Description Filetype Packagetype License Downloads Date Filesize OCS-Install DL
Details
version
0.53
updated Dec 10 2006
added Jan 03 2006
downloads today
0
page views today 2