Default Green Orange
Marcus Follrud
Wish I had a slogan
RSS
  • Home Page Home
  • Cruel Chipmunk Productions
  • Om
  • Projects

Posts Tagged ‘modules’

Getting Drupal Modules using Python

Linux, Programmering 0 Comment »

A good friend of mine wrote yesterday a small python script that allows the user to search and download Drupal modules directly via the official ftp.
This was made since it is quite boring/irritating to first browse through the module page on drupal.org and then copy the link to a shell where you download the module you want on your web server.

Instead, Jonas (that’s my friends name, btw) wrote this program that directly scans through the drupal module directory on the ftp and returns the output in a shell where the user just enter the choice that he/she wants. Example:

jonas@thinkpad61:~$ ./idm.py hello
Found 32436 files!
[0] hellomobile-5.x-1.0.tar.gz
[1] hellomobile-5.x-1.1.tar.gz
[2] hellomobile-5.x-1.x-dev.tar.gz
[3] hellotxt-6.x-1.x-dev.tar.gz
Which module do you want to download? 1
Ok, lets get hellomobile-5.x-1.1.tar.gz
jonas@thinkpad61:~$ ls -l hellomobile-5.x-1.1.tar.gz
-rw-r--r-- 1 jonas jonas 824473 2009-10-22 22:34 hellomobile-5.x-1.1.tar.gz

I believe that this is quite usefull and interesting. But, as Jonas mentions in this post. It does not contain the functions that you might need, such as: version filter and dev filter. Meaning that you don’t want to see results for drupal 5 if you are running six. Nor do you want to use developer packages when you are in a critical installation.

I had some time so I made some improvements on the original:

tomburk@linux-e9bm:~> python idm-mf.py --help
Usage: idm-mf.py [options]

Options:
-h, --help            show this help message and exit
-f version, --filter=version
Filter the results in version numbers.
-d, --dev             Show developer packages

This allows the user to filter between the version, of course ”all” can be applied, if one wants to show all the results. Plus, It’s possible to toggle between showing the developer packages or not.

Final result:

tomburk@linux-e9bm:~> python idm-mf.py -f 5 hello
Found a total of 32451 files!
Files containing "hello"
 Based on filter: 5
  Not showing developer packages
[0] hellomobile-5.x-1.0.tar.gz
[1] hellomobile-5.x-1.1.tar.gz
Which module do you want to download? 1
Ok, lets get hellomobile-5.x-1.1.tar.gz
tomburk@linux-e9bm:~> ls -s hellomobile-5.x-1.1.tar.gz
812 hellomobile-5.x-1.1.tar.gz

The file is available here: http://marcusfollrud.net/wp-content/idm-mf.py
Or at github: http://github.com/marcusfollrud/idm
See you!

A small update

2009-10-24 – Added support for multiple file download, Available on both github and in wp-content


oktober 23rd, 2009  
Tags: drupal, modules, python



  • Kategorier

    • Linux
    • monotouch
    • Open source
    • Planet
    • Privat
    • Programmering
    • Spel
  • Arkiv

    • januari 2012
    • september 2011
    • augusti 2011
    • januari 2010
    • december 2009
    • november 2009
    • oktober 2009
    • september 2009
    • augusti 2009
    • juli 2009
  • Etiketter

    2.6.30 16f690 Andjelka ANSI C apparmor apple axis biltema blommor c# curl debian despotify django drupal inaktivitet iphone kde Linux linux mint liseberg mono monotouch novell Open source php pic pic16f690 plasma plasmoid Programmering pump pykde pyqt python qt sdcc sommarstuga spotify spytify vatten vattna blommor virtualbox wordpress youtube
Copyright © 2012 Marcus Follrud
XHTML CSS Logga in