posting from python to WP

misc — Panayotis @ 14:09

For the last couple of days, I’ve been experimenting with a new format for my podcast. During the day I record little “audionotes” on my mobile phone. At the end of the day I move these .wav files to my MacBook Pro and use a bunch of scripts to automatically paste them together, generate the MP3 file, upload it to Amazon S3, and post a new entry to my greek blog.

To do this, I’ve written a couple of quick’n'dirty scripts in python and bash. Most of the code is ugly, and amy things are hardcoded in there. But I think someone may find them useful.

Here is one of them, post2wordpress.py. It is called from the command line like python post2wordpress.py mymp3file.mp3. It uses eyeD3 to extract some basic info from the MP3 file, and python-blogger to post a new entry to my wordpress blog.

post2wordpress.py

# coding=utf-8

import pyblog
import eyeD3
import fnmatch
import os
import datetime
import sys

blog = pyblog.WordPress('http://vrypan.net/weblog/xmlrpc.php',
        'username', 'password')

tag = eyeD3.Tag()
if len(sys.argv)>2:
        directory = sys.argv[2]
else:
        directory = './mp3'

f = sys.argv[1]
filename = os.path.join(directory,f)
filesize = float(os.stat(filename).st_size) / 1048576.0;
tag.link(filename,eyeD3.ID3_V2)

size = str(os.stat(filename).st_size)

title = tag.getTitle()
body = 'duration: '+eyeD3.Mp3AudioFile(filename).getPlayTimeString() + '\n'
body = body + 'download: '+f+''
body = body + " [%.2f MB] \n" % filesize
body = body + 'more info...'

data = {
                'title':title,
                'description': body,
                'categories': ['audionotes'],
                'post_status': 'private',
                'custom_fields': [{'value': 'http://audionotes.vrypan.net/'+f+'\n'+size+
                        '\naudio/mpeg', 'key': 'enclosure'}]
                }
blog.new_post(data)

Hackers attack LHC (some more details)

misc — Panayotis @ 03:09

According to the Telegraph, Hackers attacked the LHC.

Since the whole message they left was written in Greek, I feel that I have to explain some of the things written in it:

1. The attack was not an act against LHC or CERN, but just as they write, “they wanted to take advantage of the publicity the LHC would have, to promote their message”.
2. They write that they did not intend to cause any damage to the underlying system or the website, just to promote their message.
3. The main “message”, is nothing radical or extreme. It is more or less an internal debate of the Greek Hacking Scene.
4. The message ends “Dear CERN admins, we have fixed a serious BUG your web page had, to prevent you from becoming Dork and being defaced on a daily basis by wannabe hackers.”
5. They also mention that many sites of the Greek Government are vulnerable to hackers and lack any security measures.

Greek hackers attack an LHC site

Google Maps feature request: add time dimension?

misc — Tags: — Panayotis @ 13:09

Wouldn’t it be nice if Google added an extra dimension to Google Maps? One that would allow us to “go back in time” and see the previous versions of the maps?

Here is what I have in mind. Say, I want to see how a forest, a city, a glacier, the south pole or my neighborhood has changed over time. I navigate to the map I’m interested in and then, I go back and forth in time (actually, older versions of the same map) by sliding the “time control” much like I would zoom in or out.

I you like the idea, spread it out!

Obama’s experience in politics

misc — Panayotis @ 03:08

How much experience in politics does it take to keep the whole of US media in the dark, regarding your VP candidate name, when every single news network is after this valuable piece of information?

How much experience does it take to pick the right people around you so that your most valuable secrets remain secret?

How much experience in politics does it take to keep the most experienced journalists and reporters where you want? To have journalists wondering, on-air, “how did he manage to do it?”

I really don’t know. But Obama obviously has it.

QR codes from urlBorg

misc — Tags: , — Panayotis @ 08:08

If you need a QR code for a short URL created by urlBorg, just add ‘/qr’ at the end of it!

Here is how it works:
1. The short URL is http://ub0.cc/43/c
2. The QR code image is http://ub0.cc/43/c/qr and you can use it like this
<img src="http://ub0.cc/43/c/qr" />

Voila!

A side note: Since QR codes are expected to be used from a mobile device the link embedded in urlBorg QR codes will actually go to a urlBorg “preview” page (in the above example, http://ub0.cc/43/c/p). This makes it easier for users to use the “mobile version” link of the target page.

IronBolt: a destop app that shortens URLs

misc — Tags: , — Panayotis @ 08:08

Still in alpha, but looks great! Check out more at IronBolt homepage.

how to avoid multiple short URLs in urlBorg API

misc — Tags: — Panayotis @ 17:08

The urlBorg API will normally create a new short URL each time the ‘create’ method is called. There is a good reason for this, but many devlopers have been asking for a way to reuse already created short URLs.

I just added a new option that is currently only available through the API. Instead of using the ‘create’ method, you can now use the ‘create_or_reuse’ method. ‘create_or_reuse’ will check if the same combination of (api_key, long URL) has already been used and if so will return the short URL from the database instaed of creating a new one -if not, a new one will be created, as usual.

Check out the urlBorg API for details.

“economy” is not a smart-sounding metaphor!

misc — Tags: — Panayotis @ 11:08

Chris Anderson is right: we should stop using the word “economy” as rhetorical smoke when we describe non-monetary markets and start measuring them like the economy they really are.

I’m not an economist, and many of the words used in the above mentioned post and the comments that follow it have a much more “common” meaning to me.

However, I feel that we are talking about the production and distribution of goods, right? There are many economic models and capitalism is just one of them (I get the impression that most Americans refer to economy and economics as a synonym to capitalism and free market…). Even capitalism has changed much since Adam Smith, mainly thanks to the industrial revolution. Land, labor and capital have changed a lot!

Gutenberg made written words part of the economy, by turning any form of written word into a good that could be traded and distributed. This is what the Internet is doing now: it is turning attention into something that can be traded and distributed.

Adwords is a way of trading accumulated attention (called “reputation” or “fame”), for money. It could be said that HTML links are a way of distributing attention. [1]

It’s not something new -after all, books existed long before printing press, right? Celebrities have been doing this for decades. Brands, in general, too. But it took a lot of investment, a costly machine called mainstream media, to accumulate, distribute and trade attention, much like it took monasteries and monks and years of work to produce and distribute the Bible before Gutenberg.

During the past centuries innovation, patents, knowledge, leisure, art have become part of the economy. They have become goods, wealth, capital, labor, investment, (individual, corporate or national) they have been traded, distributed, produced. It took mechanisms like the printing press or copyright laws, the patent system or radio to get there. Now it’s attention’s turn to become an important part of the economy and the Internet is the mechanism.

I was reading [2] that, in ‘Economic Possibilities of Our Grandchildren’, Keynes states that “in the future” the problem of society will not be how to find leisure, but how to cope with unprecedented quantities of it. Like him or not, isn’t this the ‘Attention Economy’?


[1] Intangible? Yes. But there is an interesting “economic” twist here. One may say that no matter how much attention (usually measured in pagerank units in the Google universe) I give, I don’t become less famous. However, I have less attention to give! This is obvious in everyday life, but even for Google, the value of an outgoing link decreases as the number of outgoing links from a specific page increases.
[2] The Worldly Philosophers: The Lives, Times And Ideas Of The Great Economic Thinkers [7th Edition]

twitter/identi.ca/etc: XMPP and SMS

misc — Tags: , , , — Panayotis @ 10:07

I think SMS gateways should be just another XMPP client for twitter/identi.ca. Telephony providers could implement them and charge their users (that also may happen to be existing clients) for the SMS sent and recived. It makes so much more sense, instead of having the service pay for them!

Could this be twitter’s plan? To charge telcos for the right to access XMPP?

urlBorg vs. bit.ly

misc — Tags: , — Panayotis @ 14:07

Sounds like the latest url shortener, called bit.ly, got a lot of attention. As an answer to my rant, that you have to involve an a-lister to get some attention, my good friend Nikos stepped forward and did a crash test: bit.ly vs. urlBorg.

To be honest, bit.ly has some nice features and anyone interested in this kind of things should give it a try. On the other hand urlBorg is ahead of bit.ly in some areas. Give both a try!

Next Page »
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2008 vrypan|net|log | powered by WordPress with Barecity