Posted on November 1, 2008 in Computers by seadog28 Comments »

Είναι πολύ ευχάριστο που μερικοί σταθμοί βγάζουν τις εκπομπές τους online, όπως ο Σκαι και ο City. Ο σκάι μάλιστα βγάζει και το τηλεοπτικό και το ραδιοφωνικό υλικό. Το όλο εγχείρημα κινείται προς την κατεύθυνση του content on demand, μόνο που παράλειψαν να κάνουν κάτι βασικό… RSS feeds! Χωρίς αυτά δεν μπορείς να συγχρονίσεις αυτόματα προγράμματα για podcasts ή για videocasts όπως το banshee και το miro ή το τελευταίο gadget που πήρες (π.χ. το wifi enabled κινητό σου! ;).

Έφτιαξα ένα απλό bash script για να κάνει download τα επεισόδια χρησιμοποιώντας το wget και το ffmpeg για την μετατροπή τους σε mp3 (γιατί wma αγαπητό Σκαι;). Το ενδιαφέρον κομμάτι όμως ήταν το πως μπορείς να παράγεις το rss feed δυναμικά κάθε μέρα. Και τώρα το django έρχεται στο παιχνίδι!

Το django είναι ένα web framework. Για να δημιουργεί τις δυναμικές σελίδες έχει μία γλώσσα templating, την οποία μπορείς να χρησιμοποιήσεις και χωρίς το υπόλοιπο django. Με λίγη python και django, μπορείς να διαβάζεις τα περιεχόμενα ενός φακέλου με mp3 αρχεία και να δημιουργείς ένα xml feed σύμφωνα με ένα template που έχεις φτιάξει, που στην συνέχεια το ταΐζεις στο podcast reader σου.

Μέχρι στιγμής έχω κάνει feeds για την ελληνοφρένεια του Αποστόλη και του Θύμιου στον Σκάι, για το Infowar του Άρη Χατζηστέφανου επίσης στον Σκάι και για τον Δούρειο Ήχο του Πανούση στον City.

Ο κώδικας του bash script, του Django Template και του django python είναι διαθέσιμος για τα code geeks.

Καλή ακρόαση!

edit:

Πρόσθεσα και το Μαγκαζίνο του Σκάι, καθημερινή ενημερωτική εκπομπή και επίσης την εκπομπή Σιδερένια Άλογα, για αυτοκίνητο και μοτοσυκλέτα, μετά από αίτημα του charoui :)

Είναι εντυπωσιακό τελικά πόσοι χρησιμοποιούν το feed:

  • Δούρειος Ήχος: 50
  • Ελληνοφρένεια: 60
  • Infowar: 28
Posted on June 4, 2008 in Computers by seadogNo Comments »

Ας πούμε τα πράγματα με το όνομά τους: Το gnotime είναι χάλια! Δεν ξέρω εάν έπρεπε να αφιερώσω περισσότερο χρόνο για να το μάθω, αλλά όπως και να το κάνουμε το πρόγραμμα πάσχει από έλλειψη χρηστικότητας και λειτουργικοτήτων. Μπερδεύεσαι απίστευτα μέχρι να καταλάβεις τι πρέπει να κάνεις, τα reports είναι πολύ περιοριστικά και γενικά η εφαρμογή δείχνει τα χρόνια της και παραπέμπτει περισσότερο σε εφαρμογές linux προ-πενταετίας.

Στη προσπάθεια αναζήτησης μίας time tracking εφαρμογής (εκτός του gnotimer), δηλαδή μιας εφαρμογής που να μπορεί να καταγράφει τον χρόνο που αφιερώνεις σε μία εργασία, ώστε να μπορείς να διαχειριστείς καλύτερα τον χρόνο σου και να κοστολογήσεις την δουλειά σου, βρήκα το hamster applet.

Το hamster είναι ένα συμπαθητικό προγραμματάκι που κάνει ακριβώς αυτή τη δουλειά. Παρουσιάζει τον χρονικό καταμερισμό με απλά αλλά όμορφη διαγράμματα και το κυριότερο είναι applet. Κάθετε δηλαδή ήσυχα στο gnome deskbar και μετράει πόση ώρα ασχολείσαι με κάτι. Η μέτρηση, όπως και στα περισσότερα τέτοιου τύπου προγράμματα, σταματά εάν ο υπολογιστής είναι idle. Πάσχει ωστόσο από δυνατότητα εξόδου των δεδομένων σε οποιοδήποτε format, πράγμα που την καθιστά αποκλειστικά προσωπικής χρήσης. Εφαρμογή είναι σίγουρα ενδιαφέρουσα και χρίζει προσοχής. Είναι και python… yammi!

Προσοχή, το hamster δεν υπάρχει στα repositories του ubuntu. Μπορείτε όμως να πάρετε το deb απευθείας από εδώ

Posted on April 13, 2008 in Computers by seadogNo Comments »

Being a old user of Image Magick command line tools, I decided to give a try to magick’s python bindings, PythonMagick and PythonMagickWand. PythonMagick is a more complete binding solution which I didn’t get the change to try, because there wasn’t a package for Ubuntu Gutsy (and I didn’t manage to compile the source code in under 2 minutes, so I gave up :)

On the other hand PythonMagickWand uses ctypes to bind with Image Magick. The interface is not pythonic at all, the the library seems to have a lot of rough edges but it does resize! And it provides the great quality results of Image Magick!

Here is a small example

1
2
3
4
5
6
from PythonMagickWand import *
MagickWandGenesis()
wand = NewMagickWand()
MagickReadImage(wand, 'test.png')
MagickScaleImage(wand,800,600)
MagickWriteImage(wand, "out.png")

Not exactly what we except from an OO language, but I can live with that, until Ubuntu Heron releases, which does have PythonMagick in repositories :)

PythonMagickWand is an one-file python module, which means you can transfer it with ease to your hosting provider and start using it at no time.

Tips:

  • You should not try to ‘import PythonMagickWand’ or you will get a bunch of ‘undefined symbols’. Use ‘from PythonMagickWand import *’ instead.
  • Don’t forget to change ctypes.CDLL in line 76 to the correct path. For ubuntu users, and maybe others, the correct line is
_magick = ctypes.CDLL('/usr/lib/libWand.so.9')
  • Seems that when you use MagickReadImage command to read an image, wand doesn’t get overwritten. Remember reset wand variable when you are done with an image.
 wand = NewMagickWand()
Posted on April 12, 2008 in Computers by seadog2 Comments »

Python Image Library (PYL) is a fully featured, quick image manipulation library for python. The default saving behaviour is a problem though, because it produces really low quality images. Remember that save function has a quality parameter, use values greater than 90 to get quality results!


from PIL import Image
image = Image.open("foo.jpg")
image = image.resize((800,600), Image.ANTIALIAS)
image.save("bar.jpg", quality=95)

Posted on November 12, 2007 in Computers by seadog2 Comments »

Ένα μικρό script για να κάνεις resize εικονές μέσα από το ναυτίλο. Ένα popup χρησιμοποιείται για να επιλέξεις το μέγεθος και μετά με την χρήση του convert απο το πακέτο imagemagick, γίνεται το resize σεβόμενο την αναλογία της είκονας.

Κατέβασέ το από εδώ και untar και τρέξε το ‘install.sh’. Από εκεί και μετά όταν επιλέγεις εικόνες (φυσικά μπορείς να κάνεις μαζικό resize), δεξί κλικ -> scripts -> Resize Images.

Posted on November 10, 2007 in Computers by seadogNo Comments »

Αυτές της μέρες γράφω για την διπλωματική μου έναν event manager που θα διαχειρίζεται δράσεις σε ένα αυτοματοποιημένο κτήριο. Διάφορες συσκευές θα μπορούν να παίρνουν input (και να δίνουν αναφορά κατάστασης καθώς και άλλες πληροφορίες) ως χρήστες ενός jabber δικτύου.

Όταν λοιπόν η καφετιέρα σου γίνει buddy στον pidgin σου θέλεις να μπορείς να της γράψεις “turn on @ tomorrow at 8:00″ και καταλάβει τη εννοείς! Βρήκα το python module dateutil που επεκτίνει με ενδιαφέροντα τρόπο το datetime, παρέχοντας μεταξύ των άλλων και έναν parser ακριβώς για τέτοιες προτάσεις και επιστρέφοντας ένα datetime.datetime object.


>>> from dateutil.parser import parse
>>> parse("next monday at 5:00", fuzzy=True)
datetime.datetime(2007, 11, 12, 5, 0)

Δυστυχώς έχω ανακαλύψει δύο bugs που θα πρέπει να λύσω:
Ο κώδικάς

>>> parse("tomorrow", fuzzy=True)

Επιστρέφει πάντα σημερινή ημερομηνία

και το

>>> parse("in 5 minutes", fuzzy=True)

επιστρέφει datetime 5 λεπτά μετά τα μεσάνυχτα της σημερινής ημερομηνίας!

Όπως και να έχει το module είναι αρκετά χρήσιμο και ενδιαφέρον!

To dateutil υπάρχει σε πακέτο για το ubuntu

sudo apt-get install python-dateutil

Και επίσης ανανέωσα την python διανομή για την CRIS αρχιτεκτονική με το module. Τελευταία έκδοση 0.5

Dateutil official site

Posted on November 4, 2007 in Computers by seadog1 Comment »

Fixed a bug related to python-xml and libexpat. Download the latest version from here

Posted on November 2, 2007 in Computers by seadog3 Comments »

I hacked a small gnome deskbar handler to send my sms using a fast and cheap way. This is just a front end to smssend which supports dozens of free and paid sms providers (the projects seems dead the last months, not even the site exists, but many scripts are working ok)

To install smssend:

sudo apt-get install smssend

To install voipbuster provider script (sms to Greece costs only 5 cents!)

wget http://www.sealabs.net/seadog/files/voipbuster.sms
mv voipbuster.sms ~/.smssend/

You should also make a smssend profile. See smssend man page for instructions

echo "voipbuster voipbuster.sms username passwd" > ~/.smssend/profiles

To install my deskbar handler

http://www.sealabs.net/seadog/files/smshandler2.py.txt
mv smshandler2.py.txt ~/.gnome2/deskbar-applet/modules-2.20-compatible/smshandler2.py

Enable sms send from deskbar preferences and configure your preferred smssend profile!

Now you can type +[phone] (e.g. +306912345678) [message] and press enter to send your sms. You can also use smssend aliases (very useful!) by typing @[alias] [message]

Smssend aliases lives in ~/.smssend/aliases

~$ cat ~/.smssend/aliases
dad 00306912345678
sis 00306987654321
...
...

Check smssend manual page for more

Don’t forget to add credits!

To develop your own handlers take a look at this tutorial

Posted on November 1, 2007 in Computers by seadogNo Comments »

I have just added bluetooth support in my python distribution for the CRIS architecture. You can download the latest python 2.5.1 package (which also features Twisted Python, PyXML and bzr support) from here.

Don’t forget to recompile your AcmeLinux images with libbluetooth.so.2 which you can fetch precompiled from my repo.

You can follow this great tutorial to compile your own image for FoxBoard. Be careful to place libbluetooth.so.2 in /devboard-R2_01/usr/lib/ and not in /devboard-R2_01/usr !

After installing you can test by executing in your cris python console

import bluetooth
bluetooth.discover_devices()

Posted on October 9, 2007 in Computers by seadogNo Comments »

You can download a new version of python 2.5.1 for CRIS platform with zlib which wasn’t compiled on previous versions. Still missing curses libraries. This release also contains bzr vcs (see CHANGES for more)

Download or update your bzr repo

bzr update http://www.sealabs.net/cris/cris-binary/

Next Page »