Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Sunday, February 5, 2012

Python Functional Tools

I got the chance to come by a pretty cool project recently: Python Moka.  It consists of functional programming friendly implementations of standard Python dictionary and list classes.  Then it struck me:  wouldn't be nice to have Erlang-ish pattern matching functionality to Python?

So I crafted a small Python package scratching an itch I have had for way too long:  function dispatching based on pattern matching.  For those interested, here are the relevant links:



Feedback welcome :)

Friday, January 20, 2012

Amazon AWS tools - jldaws

Today I am open-sourcing yet another project.  It consists in a collection of Linux scripts related to Amazon Web Services (AWS).

The project's home page can be found here whilst the code repository is there.

Sunday, August 14, 2011

Media-Keys over Web-Socket

My newest open-source project is a Media-Keys over Web-Socket application.  The project's details can be found here.

Application
The main use-case I wanted to address with this component is the ability to control music playback of web-sites such as GrooveShark and Rdio through the keyboard media-keys.

Usage
A Google Chrome extension will follow shortly.

Monday, October 11, 2010

iTunes playcount updater script

I am pretty busy these days with my new job ( I am heading a start-up in the telecommunications market ) but I took a couple of hours to craft a couple of scripts.

The first script (lastfm_gettracks) downloads all of a user's song track information from Last.fm. It can be found on Pypi here.  More information can be perused here.

The second script takes as input the file generated by the former script and updates the iTunes database on an OSX machine (sorry, I don't do windozes). Documentation for this script can be found here whilst package details can be found on Pypi here.

Tuesday, August 17, 2010

Musicbrainz and Last.fm proxies updated

Just a quick note to let users of musicbrainz-proxy-dbus & lastfm-proxy-dbus applications that new versions are available on my PPA.  Notable changes include:

- Tray icon support: the main application window can now be closed and a tray icon can control them
- Help button linking to a web accessible page

Thursday, January 21, 2010

Message Bus for Gnome Object based Python projects

Whilst developing my latest software project (Rhythmbox plugin Last.fm sync), I have crafted a "Message Bus" based on Gnome GObject. Since I didn't have any experience at all with Gnome GObject previously, it took me sometimes to work out the details of the architecture.  For an example usage, please refer to my Git Repository.

""" 
    GObject based "Message Bus"
    
    @author: Jean-Lou Dupont
"""

import gobject #@UnresolvedImport

class Signals(gobject.GObject):
    """
    List of the application level signals
    """
    __gsignals__ = {

         ## NOTE: customization required here
         ## =================================
         ## Announces changes in the user's Last.fm properties
        "lastfm_username_changed":  (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_STRING,)) 
        ,'lastfm_password_changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_STRING,))

        ## Used to signal a change in the currently playing track
        ,"playing_song_changed":    (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_OBJECT,))
        
        ## Used to report a failure when accessing Last.fm web service
        ,'lastfm_request_failed':   (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
        
        ## Used for distributing the results of the query against the Last.fm web service
        ,"user_track_info":         (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_OBJECT,))
        
        ## Used to pass around the "shell" global object
        ,"rb_shell":                (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_OBJECT,))              
    }

    def __init__(self):
        gobject.GObject.__init__(self)
        
        
class Bus(object):
    """
    Message Bus
    
    Borg Pattern
    """
    _signals=Signals()

    @classmethod
    def emit(cls, name, *pa, **kwa):
        cls._signals.emit(name, *pa, **kwa)

    @classmethod
    def add_emission_hook(cls, name, callback):
        gobject.add_emission_hook(cls._signals, name, callback)
    
mbus=Bus()

## =============================================================== Tests

if __name__=="__main__":

    def callback(signal, data):
        print "callback: signal=%s, data=%s" % (signal, data)
    
    Bus.add_emission_hook("lastfm_username_changed", callback)
    
    Bus.emit("lastfm_username_changed", "jldupont")

Relevant Stackoverflow posts
Here are two Stackoverflow posts in relation with my exercise: question 1, question 2.

Thursday, September 24, 2009

Mindmap of my projects

Here is a mindmap of my projects. I intend to keep this map up-to-date.

Monday, January 12, 2009

My Python library: command-line backup tools mainly

Through my daytime work, I use online tools a lot ( e.g. Gliffy, MindMeister )  so one could say I am confident about conducting work online.  Sometimes though I feel I need a safety net and this is why I like to use my moonlight time to calm my qualms about the possibility of loosing my work.


To this effect, I have created a python library with several command-line tools ( cross-platform i.e. Windows and Linux, tested on Ubuntu ) to perform, amongst other tasks, backup of my online documents.  The library documentation page is available here.

Thursday, December 18, 2008

Gliffy diagrams backup tool

Delicious  is a useful tool. I use it in an unconventional way sometimes: I bookmark some resources with tags which serve as indicators for my backup tools. As an example, when I tag my Gliffy diagram pages with the my-diagrams tag, my backup tool grabs the corresponding diagrams and makes local copies on my server.

The backup tool I am referring to is readily available here.  I configure the backup tool to run periodically through cron jobs on my Linux server.

Monday, December 8, 2008

MindMeister map export

I use MindMeister almost daily. I wanted an easy way to backup my numerous mindmaps so I crafted a Python command-line tool for this purpose. It is available through this link and works under both Windows and Linux environments.  The tool performs logging in Windows registry or Linux /var/log/mm.log . For easier usage, the installer copies the command-line file to the  designated python script directory.


In summary, to use the tool (assuming one as a working Python installation,  3.0 <>=2.5 ):
Step 1) Register for an API key with MindMeister
Step 2) Install the tool through the command line:  easy_install jld
Step 3) Perform authorization: mm -s SECRET -k API_KEY auth
This step will open-up a browser window
Step 4) For regular backup, use a scheduler (such as Linux cron).

Suggestions are welcome!

Friday, April 11, 2008

Eggs are to Pythons as Pears are to PHP.

With the advent of Google AppEngine, I am starting to look into Python programming because, let's face it, PHP support on AppEngine might be a long way off (feature requests).

It would appear that a good way of distributing Python Modules is through eggs which, from what I can understand, offer similar functionality as PEAR packages.

PythonEggs documentation can be found here.