
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
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
14 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
14 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
12 years ago
Report
khertz
12 years ago
Report
gardar
12 years ago
Well wouldn't a emulator provided in the SE SDK be enough?
Report
khertz
12 years ago
Report
thomec
13 years ago
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
13 years ago
Report
gepi
13 years ago
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
13 years ago
Report
gepi
13 years ago
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
13 years ago
Well, and if you are a programmer you can try to port the script when the specifications are released ;-)
Greetings,
Khertz
Report
ereford
13 years ago
Report
alecubero
13 years ago
Thanks!
Report
MetaMorfoziS
13 years ago
It's ery intresting.
Report
khertz
13 years ago
A direct portability is not possible, the AT instructions set are totally different.
Report
schurl
14 years ago
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
14 years ago
Greetings
Report
plc
14 years ago
and btw, it also works on the Sony Ericsson Z1010, and from FreeBSD as well.
Report
SiCkTiMe
14 years ago
Report
khertz
14 years ago
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
14 years ago
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
14 years ago
Report
dennism
14 years ago
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
14 years ago
T230/T238/T226, T630 and T290 models.
Report
motin
14 years ago
THANKS FOR MAKING AND SHARING THIS AWESOME SCRIPT!
Report
supercatfrog
14 years ago
#!/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