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!

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