<?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>Omnia sunt communia &#187; identica</title>
	<atom:link href="http://www.blog.amrlima.info/archives/tag/identica/feed" rel="self" type="application/rss+xml" />
	<link>http://www.blog.amrlima.info</link>
	<description>gnu/linux, cultura livre e outras divagações</description>
	<lastBuildDate>Fri, 20 Jan 2012 20:18:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>O microblogging e o IRC</title>
		<link>http://www.blog.amrlima.info/archives/688</link>
		<comments>http://www.blog.amrlima.info/archives/688#comments</comments>
		<pubDate>Fri, 03 Apr 2009 13:32:07 +0000</pubDate>
		<dc:creator>amrlima</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[identica]]></category>
		<category><![CDATA[irc]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.blog.amrlima.info/?p=688</guid>
		<description><![CDATA[Embora seja um utilizador moderado de serviços de microblogging -  twitter e identi.ca (pouco sigo o twitter, o identi.ca interessame-me muito mais) &#8211; acho, como muitos outros, que estes serviços são um IRC à lá web 2.0. Isto demonstra que o formato IRC não está morto e que o que as pessoas querem é comunicar&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>Embora seja um utilizador moderado de serviços de microblogging -  twitter e identi.ca (pouco sigo o twitter, o identi.ca interessame-me muito mais) &#8211; acho, como muitos outros, que estes serviços são um IRC <em>à lá</em> web 2.0. Isto demonstra que o formato IRC não está morto e que o que as pessoas querem é comunicar&#8230; em texto e não com winks, extra smilies, e outras palhaçadas que o msn tornou populares.</p>
<p>Não estou aqui a dizer que as redes de IM vão morrer, mas à medida que as pessoas crescem, começam-se a fartar dos excessos do msn e outras redes de IM. Para mim seria: Windows Live Messenger for kids and Teens!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.amrlima.info/archives/688/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python scripts: Post song to identi.ca &amp; pidgin musictracker</title>
		<link>http://www.blog.amrlima.info/archives/641</link>
		<comments>http://www.blog.amrlima.info/archives/641#comments</comments>
		<pubDate>Wed, 11 Mar 2009 21:53:48 +0000</pubDate>
		<dc:creator>amrlima</dc:creator>
				<category><![CDATA[gnome]]></category>
		<category><![CDATA[Programação]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[banshee]]></category>
		<category><![CDATA[dbus]]></category>
		<category><![CDATA[identica]]></category>
		<category><![CDATA[pidgin]]></category>
		<category><![CDATA[pythoon]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://www.blog.amrlima.info/?p=641</guid>
		<description><![CDATA[Some days ago I wrote two python scripts: One that posts the current song beeing played by Banshee to identi.ca trought XMPP (using Pidgin) and a sort of musictracker for Pidgin also. Pidgin music tracker plugin crashes pidgin and it really does not work in Ubuntu Intrepid&#8230; or is it just me?
Both scripts are, well, [...]]]></description>
			<content:encoded><![CDATA[<p>Some days ago I wrote two python scripts: One that posts the current song beeing played by Banshee to identi.ca trought XMPP (using Pidgin) and a sort of <em>musictracker</em> for Pidgin also. Pidgin music tracker plugin crashes pidgin and it really does not work in Ubuntu Intrepid&#8230; or is it just me?</p>
<p>Both scripts are, well, pretty incomplete (thats being very nice to myself) and the code is not pretty, but I really didin&#8221;t have the time to improve them. Anyways, these where just to play around with python, dbus and to have fun! <img src='http://www.blog.amrlima.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>These only work with Pidgin and Banshee, thought it&#8217;s pretty simple to make them work with other IM and Music players that have a dbus interface. I&#8217;ll post the scripts and instructions on how to use the, if there&#8217;s anyone crazy enought to use them <img src='http://www.blog.amrlima.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p><strong>Post song to identi.ca</strong></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env/python</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Copyright (C) 2009 Antonio Lima</span>
<span style="color: #808080; font-style: italic;"># http://www.amrlima.info</span>
<span style="color: #808080; font-style: italic;"># This program is free software; you can redistribute it and/or</span>
<span style="color: #808080; font-style: italic;"># modify it under the terms of the GNU General Public License</span>
<span style="color: #808080; font-style: italic;"># as published by the Free Software Foundation; either version 2</span>
<span style="color: #808080; font-style: italic;"># of the License, or any later version.</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># This program is distributed in the hope that it will be useful,</span>
<span style="color: #808080; font-style: italic;"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span style="color: #808080; font-style: italic;"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<span style="color: #808080; font-style: italic;"># GNU General Public License for more details.</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> dbus
bus = dbus.<span style="color: black;">SessionBus</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
banshee = bus.<span style="color: black;">get_object</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;org.bansheeproject.Banshee&quot;</span>, <span style="color: #483d8b;">&quot;/org/bansheeproject/Banshee/PlayerEngine&quot;</span><span style="color: black;">&#41;</span>
pidgin = bus.<span style="color: black;">get_object</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;im.pidgin.purple.PurpleService&quot;</span>, <span style="color: #483d8b;">&quot;/im/pidgin/purple/PurpleObject&quot;</span><span style="color: black;">&#41;</span>
purple = dbus.<span style="color: black;">Interface</span><span style="color: black;">&#40;</span>pidgin, <span style="color: #483d8b;">&quot;im.pidgin.purple.PurpleInterface&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
currentTrack = banshee.<span style="color: black;">GetCurrentTrack</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
artist = <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>currentTrack<span style="color: black;">&#91;</span>u<span style="color: #483d8b;">'album-artist'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
album = <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>currentTrack<span style="color: black;">&#91;</span>u<span style="color: #483d8b;">'album'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
track = <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>currentTrack<span style="color: black;">&#91;</span>u<span style="color: #483d8b;">'name'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
&nbsp;
trackinfo = <span style="color: #483d8b;">&quot; %s - %s  [%s]&quot;</span> <span style="color: #66cc66;">%</span><span style="color: black;">&#40;</span>track, artist, album <span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> trackinfo
&nbsp;
account = purple.<span style="color: black;">PurpleAccountsFind</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'username@xmppserver.com/Home'</span>, <span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span>
buddy = purple.<span style="color: black;">PurpleFindBuddy</span><span style="color: black;">&#40;</span>account, <span style="color: #483d8b;">'update@identi.ca'</span><span style="color: black;">&#41;</span>
PURPLE_CONV_TYPE_IM = <span style="color: #ff4500;">1</span>
buddy_name = purple.<span style="color: black;">PurpleBuddyGetName</span><span style="color: black;">&#40;</span>buddy<span style="color: black;">&#41;</span>
&nbsp;
im = purple.<span style="color: black;">PurpleConvIm</span><span style="color: black;">&#40;</span>purple.<span style="color: black;">PurpleConversationNew</span><span style="color: black;">&#40;</span>PURPLE_CONV_TYPE_IM, account, buddy_name<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
purple.<span style="color: black;">PurpleConvImSend</span><span style="color: black;">&#40;</span>im, <span style="color: #483d8b;">&quot;!listening to &quot;</span> + trackinfo<span style="color: black;">&#41;</span></pre></div></div>

<p>If  you want to use this, you have to replace the <em>username@xmppserver.com/Home </em>field with your xmpp account (jabber, google-talk). You also need to have the XMPP activated in identi.ca. To run, just type:</p>
<p><em>$ python filename.py </em>at the script directory.</p>
<p>This is a very simple script that gets the current track info from Banhsee and sends a message to update@identi.ca. It&#8217;s acctually very easy to add support to other music players that have a dbus interface. This is done using the python-dbus library.</p>
<p><strong>Python musictracker</strong></p>
<p>This was fun to code:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env/python</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Copyright (C) 2009 Antonio Lima</span>
<span style="color: #808080; font-style: italic;"># http://www.amrlima.info</span>
<span style="color: #808080; font-style: italic;"># This program is free software; you can redistribute it and/or</span>
<span style="color: #808080; font-style: italic;"># modify it under the terms of the GNU General Public License</span>
<span style="color: #808080; font-style: italic;"># as published by the Free Software Foundation; either version 2</span>
<span style="color: #808080; font-style: italic;"># of the License, or any later version.</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># This program is distributed in the hope that it will be useful,</span>
<span style="color: #808080; font-style: italic;"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span style="color: #808080; font-style: italic;"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<span style="color: #808080; font-style: italic;"># GNU General Public License for more details.</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> dbus, gobject
<span style="color: #ff7700;font-weight:bold;">from</span> dbus.<span style="color: black;">mainloop</span>.<span style="color: black;">glib</span> <span style="color: #ff7700;font-weight:bold;">import</span> DBusGMainLoop
loop = gobject.<span style="color: black;">MainLoop</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
DBusGMainLoop<span style="color: black;">&#40;</span>set_as_default=<span style="color: #008000;">True</span><span style="color: black;">&#41;</span>
&nbsp;
bus = dbus.<span style="color: black;">SessionBus</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
banshee = bus.<span style="color: black;">get_object</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;org.bansheeproject.Banshee&quot;</span>, <span style="color: #483d8b;">&quot;/org/bansheeproject/Banshee/PlayerEngine&quot;</span><span style="color: black;">&#41;</span>
purple = bus.<span style="color: black;">get_object</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;im.pidgin.purple.PurpleService&quot;</span>, <span style="color: #483d8b;">&quot;/im/pidgin/purple/PurpleObject&quot;</span><span style="color: black;">&#41;</span>
pidgin = dbus.<span style="color: black;">Interface</span><span style="color: black;">&#40;</span>purple, <span style="color: #483d8b;">&quot;im.pidgin.purple.PurpleInterface&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
STATUS_AVAILABLE = dbus.<span style="color: black;">UInt32</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>
STATUS_AWAY = dbus.<span style="color: black;">UInt32</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> checkState<span style="color: black;">&#40;</span>state<span style="color: black;">&#41;</span>:
	currentTrack = banshee.<span style="color: black;">GetCurrentTrack</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;State Changed: %s&quot;</span> <span style="color: #66cc66;">%</span> state
	<span style="color: #ff7700;font-weight:bold;">if</span> state == <span style="color: #483d8b;">'playing'</span>:
		artist = <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>currentTrack<span style="color: black;">&#91;</span>u<span style="color: #483d8b;">'album-artist'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
		album = <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>currentTrack<span style="color: black;">&#91;</span>u<span style="color: #483d8b;">'album'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
		track = <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>currentTrack<span style="color: black;">&#91;</span>u<span style="color: #483d8b;">'name'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
		trackinfo = <span style="color: #483d8b;">&quot; %s - %s  [%s]&quot;</span> <span style="color: #66cc66;">%</span><span style="color: black;">&#40;</span>track, artist, album<span style="color: black;">&#41;</span>
		old_status = purple.<span style="color: black;">PurpleSavedstatusGetCurrent</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>		<span style="color: #808080; font-style: italic;"># get current status</span>
		status_type = purple.<span style="color: black;">PurpleSavedstatusGetType</span><span style="color: black;">&#40;</span>old_status<span style="color: black;">&#41;</span>	<span style="color: #808080; font-style: italic;"># get current status type</span>
		new_status = purple.<span style="color: black;">PurpleSavedstatusNew</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&quot;</span>, STATUS_AVAILABLE<span style="color: black;">&#41;</span>	<span style="color: #808080; font-style: italic;"># create new status with old status type</span>
		purple.<span style="color: black;">PurpleSavedstatusSetMessage</span><span style="color: black;">&#40;</span>new_status, trackinfo<span style="color: black;">&#41;</span>	<span style="color: #808080; font-style: italic;"># fill new status with status message</span>
		purple.<span style="color: black;">PurpleSavedstatusActivate</span><span style="color: black;">&#40;</span>new_status, trackinfo<span style="color: black;">&#41;</span>		<span style="color: #808080; font-style: italic;"># activate new status</span>
	<span style="color: #ff7700;font-weight:bold;">if</span> state == <span style="color: #483d8b;">'paused'</span>:
		old_status = purple.<span style="color: black;">PurpleSavedstatusGetCurrent</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>		<span style="color: #808080; font-style: italic;"># get current status</span>
		status_type = purple.<span style="color: black;">PurpleSavedstatusGetType</span><span style="color: black;">&#40;</span>old_status<span style="color: black;">&#41;</span>	<span style="color: #808080; font-style: italic;"># get current status type</span>
		new_status = purple.<span style="color: black;">PurpleSavedstatusNew</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&quot;</span>, STATUS_AWAY<span style="color: black;">&#41;</span>	<span style="color: #808080; font-style: italic;"># create new status with old status type</span>
		purple.<span style="color: black;">PurpleSavedstatusSetMessage</span><span style="color: black;">&#40;</span>new_status, <span style="color: #483d8b;">&quot;Banshee is paused. I'm probably not here now&quot;</span><span style="color: black;">&#41;</span>	<span style="color: #808080; font-style: italic;"># fill new status with status message</span>
		purple.<span style="color: black;">PurpleSavedstatusActivate</span><span style="color: black;">&#40;</span>new_status<span style="color: black;">&#41;</span>			<span style="color: #808080; font-style: italic;"># activate new status</span>
&nbsp;
bus.<span style="color: black;">add_signal_receiver</span><span style="color: black;">&#40;</span>checkState, dbus_interface=<span style="color: #483d8b;">&quot;org.bansheeproject.Banshee.PlayerEngine&quot;</span>, signal_name=<span style="color: #483d8b;">&quot;StateChanged&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
mainloop = gobject.<span style="color: black;">MainLoop</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
mainloop.<span style="color: black;">run</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>This is very incomplete. It has some stupid problems which I still didn&#8217;t have time or motivation to fix. One of them is really stupid for a music tracker: After running the script, you need to pause and resume Banshee in order the script picks the track info and set your status message. Or you can wait untill the next song starts <img src='http://www.blog.amrlima.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>It&#8217;s hardcoded to set the satus to &#8220;available&#8221; while playing and &#8220;away&#8221; while paused. It picks up the chages in the music player.</p>
<p>Non ASCII characters in track info will give an error (I&#8217;m going to try to fix it) but if the next song is ASCII it will continue all right.</p>
<p>Long post! If someone (crazy people) tries these scripts and runs into trouble let me know! Maybe I can help&#8230; or not <img src='http://www.blog.amrlima.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>EDIT: To run the scrip without having to type: $python musictracker.py every time at the command line, you can create a very simple shell script:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>python <span style="color: #000000; font-weight: bold;">/</span>scriptlocation<span style="color: #000000; font-weight: bold;">/</span>musictracker.py</pre></div></div>

<p>Make it executable and if you use GNOME-DO or deskbar-applet they will index it and you can just tipe the script name and there you go, the music tracker script runs! Don&#8217;t forget to replace &#8220;scriptlocation&#8221; with the scriptl location&#8230; <img src='http://www.blog.amrlima.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>I&#8217;m currently working (slowly) on some improvements to the script. But more on that latter.</p>
<p>Comments are welcome!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.amrlima.info/archives/641/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plugin pingPressFM</title>
		<link>http://www.blog.amrlima.info/archives/374</link>
		<comments>http://www.blog.amrlima.info/archives/374#comments</comments>
		<pubDate>Sun, 30 Nov 2008 22:16:30 +0000</pubDate>
		<dc:creator>amrlima</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[identica]]></category>
		<category><![CDATA[pingPressFM]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.blog.amrlima.info/?p=374</guid>
		<description><![CDATA[Tinha o plugin pingPressFM para wordpress desactivado e só dei por isso agora. Por isso é que não recebia os updates do identica.
Bem este post é mesmo mais para testar o plugin já que não estou a escrever nada de jeito. Já agora se alguém quiser o plugin pode sacar aqui. É muito útil, quando [...]]]></description>
			<content:encoded><![CDATA[<p>Tinha o plugin pingPressFM para wordpress desactivado e só dei por isso agora. Por isso é que não recebia os updates do identica.</p>
<p>Bem este post é mesmo mais para testar o plugin já que não estou a escrever nada de jeito. Já agora se alguém quiser o plugin pode sacar <a href="http://wordpress.org/extend/plugins/pingpressfm/" target="_blank">aqui</a>. É muito útil, quando bem utilizado <img src='http://www.blog.amrlima.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.amrlima.info/archives/374/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

