MyNewspaper v4.0 released

../../../_images/mn-ss1.jpeg

I’m really pleased to announce a new release of MyNewspaper, a web-based personal ATOM/RSS aggregator and feeds reader.

This new version has been completely rewritten from scratch.

It’s under GNU Affero GPL License version 3 or later.

Some technical points of interest:

  • written in Python 3.2+
  • backend based on BottlePy web micro framework, FeedParser, SQLite, DateUtil
  • frontend with javascript (jQuery, jQueryUI)

More information, and download link at:

BLURB:

../../../_images/mn-ss2.jpeg

MyNewspaper can be considered an old project, as first version dates from 2005, and since then it has adopted and adapted different web paradigms: CGI running on a web server in v1.0, pure web app in v2.0, javascript and AJAX for v3.0.

../../../_images/mn-ss2.jpeg

A couple of years after v3.0 release I abandoned it to join Google Reader wave, but since the announce of its shutdown I turned to MyNewspaper as I didn’t like any of the alternatives. Thus I rewrote from scratch all the code. It was fast, I had a working version in a month, many weeks before Google Reader closed, but then it took about 10 months more to write the documentation…

Anyway, this is now version 4.0, a very fast and nice web-based feeds reader for personal use.

Of course, all comments, suggestions etc. are welcome.

Liu Cixin: Ciencia Ficción clásica made in China

En primer lugar perdonad por lo tópico del titular, pero aún así me resisto a buscar otro, éste resume perfectamente lo que trato de explicar en la presente entrada.

Liu Cixin es un escritor chino de ciencia ficción contemporáneo, y según parece, el más popular en su país. Mi primer contacto con él fue a través de una mención de @literfan en Twitter acerca de un cuento suyo gratuito en Amazon, The Sun of China. ¿Ciencia ficción china? merecía la pena probarlo, así que a por él fuimos… ¡bastante interesante!

Más adelante, y vía mención de @literfan, dí también en Twitter con @odo, autor de un gran blog de ciencia ficción y fantasía y quien se ha convertido en el gran valedor e impulsor de la obra de Liu Cixin por aquí. Por cierto, no dejéis de leer la siguiente entrevista a Verbena C.W., la editora en inglés de las obras de Cixin: http://sentidodelamaravilla.blogspot.com.es/2012/05/entrevista-con-verbena-cw-editor-de-liu.html.

Así, entre los cuentos que fueron apareciendo gratis en Amazon y un par de compras (total no más de 1.5 EUR), finalmente he podido leer todo lo que Liu Cixin tiene publicado en inglés. Se tratan todas ellas de novelettes, un formato intermedio entre los relatos cortos y las novelas, editadas durante el 2011, a excepción de Taking Care of Gods que es del 2012.

A continuación copio los twits micro-resúmenes de lo que me pareció cada obra en el mismo orden en el que fui leyéndolas:

../../../_images/sunofchina.jpeg ../../../_images/thewanderingearth.jpeg ../../../_images/mountain.jpeg ../../../_images/takingcareofgods.jpeg
  • Terminado “Sun of China”, de Liu Cixin. CF china. Tiene puntos interesantes. Estaba gratis en Amazon Kindle, ahora por menos de 1 EUR
  • Terminado “The Wandering Earth” de Liu Cixin. CF “clásica” con aire fresco. Si te va lo profundo tal vez te falte algo, pero recomendable
  • Terminado “Mountain” de Liu Cixin. Comienzo muy flojo. Luego con la historia de los extraterrestres gana algo. CF “blanda”. Al menos la idea
  • Terminado “Taking Care of Gods” de Liu Cixin. Magnífica. Pelín moralista pero excelente. Lo mejor del autor que he leído por el momento
../../../_images/thelongestfall.jpeg ../../../_images/devourer.jpeg ../../../_images/ofantsanddinosaurs.jpeg ../../../_images/themicroage.jpeg
  • Terminado “The Longest Fall” de Liu Cixin. Cixin es un escrito de ideas, y por lo general muy buenas. Lástima del estilo (o la traducción)
  • Terminado “Devourer” de Liu Cixin. Ocurrente y muy interesante. Yo diría que Cixin es el más clásico de la CF de nuestros días. Curioso, no?
  • Terminado “Of Ants and Dinosaurs” de Liu Cixin. Un “entretenimiento”. Bastante moralista. Digamos que no veo cómo poder apreciarlo
  • Terminado “The Micro-Age” de Liu Cixin. Buenrollismo. Más que chino Cixin parece aquí californiano de finales de los 60…

No soy muy dado a crear simplificaciones forzadas, pero bueno, voy a dividirlos según lo que me han gustado:

+: Taking Care of Gods, Devourer, The Wandering Earth
.: segunda parte de Mountain, The Longest Fall, Sun of China
-: primera parte de Mountain, Of Ants and Dinosaurs, The Micro-Age

Si algo tiene Cixin es imaginación, buenas ideas que trata de un modo muy clásico, sin entrar en demasiadas profundidas ni tecnológicas ni sociológicas; mucho menos adentrarse en la psicología de los personajes (y cuando lo hace falla estrepitosamente, como por ejemplo en Mountain).

También hay presente un cierto toque moralista que en mi opinión termina por empobrecer el resultado final. En este punto quizá haya que concederle el beneficio de la duda, pues desconocemos hasta qué punto la traducción es suficientemente fiel a las intenciones del autor. No obstante, a mí personalmente lo que menos me convence de estos cuentos es ese buenrollismo, el optimismo que aparece en el final de prácticamente todos los relatos. Cosas de ser un cínico, supongo. Tal vez sea que Cixin es aún demasiado joven… Esperemos que se le pase pronto esta etapa.

Pero a pesar de ello, la grandiosidad de las imágenes que nos ofrece contrarresta (y de qué manera) los puntos negativos.

Para terminar no me queda más que recomendaros que lo leáis, sus historias son realmente refrescantes. Como resumía acertadamente alguien por Twitter (perdonad, no recuerdo quién y no lo encuentro ahora), leer estos relatos de Cixin es como volver a los 12 años…

Screenshot from Kindle 4 ereader

../../../_images/kindle4.jpg

I bought a Kindle 4 ereader last November, when Amazon started selling this model in Spain.

I already own another couple of ereaders — and in fact I’m still in love with the IREX DR800, but as IREX is now out of business I don’t want to risk the integrity of this marvellous 8” device as I think it’s still the best ereader out there —. Well, I digress… Anyway, I wanted a cheap and small ereader to carry everywhere, so I got a Kindle 4.

After some months using it — I must admit it’s better than I thought initially — I read a jailbreak was already available…

Thus, I spent some hours past weekend hacking it, jailbreak, installing some third party applications and building a cross compiler toolchain. By the way, if you have ebooks in formats not supported natively by Kindle (.fb2, .epub, .chm…) and don’t like the idea of converting to .mobi format, CoolReader 3 is a must.

But I won’t talk about it now. Today we’ll write a tiny python script to convert Kindle 4 screenshots to png format.

Important

Note this script only works for Kindle 4, you should need to modify it to adapt for other models. More information on this later.

Getting the image

In order to use this you need ssh shell access to the Kindle, first to get the screenshot and then to transfer the file to your computer. Both wifi or usbnet work.

To get a copy of the screen display we can read directly from the framebuffer device. Type this command from the Kindle shell:

# dd if=/dev/fb0 of=./screenshot.raw bs=600 count=800

Note 600x800 is the resolution of Kindle 4 screen.

Then copy the file screenshot.raw to your computer.

The script

The image we got in previous step is in raw format with no information about internal colors, rows or columns. That’s why it can’t be opened with your image viewer program [1].

Kindle 4 uses 8 bits (i.e. 1 byte) per pixel [2], so in our case the processing is quite easy, we don’t need to mess with bits shifting.

1
2
3
4
5
SIZE = (600, 800)
data = open('screenshot.raw', 'rb').read()
img = Image.frombuffer('L', SIZE, data, 'raw', 'L', 0, 1)
img = ImageOps.invert(img)
img.save('screenshot.png', 'PNG')

Let’s explain:

  1. Image size definition
  2. Read the image raw data from screenshot file
  3. Create an Image object using Python Image Library:
    • L means 8-bit pixels, black and white
    • we need to specify number of columns and rows. Remember data has no format, it contains plain bytes
    • raw indicates image comes as raw bytes
  4. We need to invert colours, black to white and vice versa
  5. Finally, save image as PNG file

For more information consult PIL documentation.

Note that if you prefer to use the currently deprecated compact syntax of Image.frombuffer (line #3 below) you’ll need to flip the image (line 4), as it is read up-down.

1
2
3
4
5
6
SIZE = (600, 800)
data = open('screenshot.raw', 'rb').read()
img = Image.frombuffer('L', SIZE, data)
img = img.transpose(Image.FLIP_TOP_BOTTOM)  # or img = ImageOps.flip(img)
img = ImageOps.invert(img)
img.save('screenshot.png', 'PNG')

You can download the complete script from here.

A resized screenshot as an example:

../../../_images/screenshot.png

Note

I’ve just discovered there is a keyboard shortcut to make a screenshots in Kindle 4: press and hold keyboard button then press menu button. Screenshot will be created as .gif files in documents folder.

More tips: http://www.mobileread.com/forums/showthread.php?p=1769412#post1769412

Footnotes

[1]Yes, I’m aware of some programs that let you specify some parameters of the raw image to open it.
[2]In fact Kindle 4 uses 8 bits, but the 4 lower bits are copied in the higher 4 bits. Kindle 3 and older use 4 bits per pixel. More information on MobileRead forum.

ebook-thumbnailer.py

Today I’ve announced a new little tool I wrote a couple of weeks ago. ebook-thumbnailer.py is a python script which generates cover thumbnails for some common ebook file formats.

This blog entry is a copy of the program web page.

../../../_images/ss-ebook_thumbnailer.png

The package also includes the needed schemas to be integrated with GNOME 3 but it should easily work with any other desktop environment.

Current supported formats are:

  • .fb2
  • .epub
  • .pdf
  • .mobi, .prc, .azw, .azw4
  • .chm

Dependencies: python v2.6+, pygtk, cairo, pypoppler, mobi_unpack, python-chm

Note that, as mobi_unpack is not usually provided by your OS, download it from MobileRead, copy to your system and change line #160 in the script. Search MOBI section in source for more information.

You could even use PIL/Imaging instead of pygtk to create the image files. Code is already there, just comment/uncomment the proper lines in function create_thumb.

To download follow the link at the beggining of the post.

La Vall de Lord

Hace apenas un par de semanas cogí unos días de vacaciones de esos que aún me quedaban del año pasado y nos fuimos a una casa rural, no muy lejos al norte de Solsona, en el prepirineo de Lleida, buscando un poco de paz y que la familia viera algo de verde.

../../../_images/lavalldelord-04.jpg ../../../_images/lavalldelord-02.jpg

Llevaba unos cuantos años queriendo visitar la zona, influenciado por las canciones del grandísimo cantautor solsonés Roger Mas. Las letras de sus primeros discos están llenas de referencias a una naturaleza misteriosa poblada de extraños seres y rincones fabulosos, que entiendo yo surgieron recorriendo los paisajes de su infancia y primera adolescencia…

Así pues, con una cierta ilusión, pero tampoco con excesivo entusiasmo, nos fuimos para La Vall de Lord. La primera impresión fue bastante buena: montañas, bosques y mucho, mucho verde.

Pero según fueron sucediéndose los días el entorno empezó a enamorarme, montón de parajes extraordinarios, tranquilidad, belleza calmada y poca gente.

../../../_images/lavalldelord-01.jpg

Como se puede ver en las fotografías, en medio del valle se encuentra el Embalse de la Llosa del Cavall, rodeado de colinas y algún que otro prado donde poder tumbarse a la fresca. Por lo que ví se puede pescar en él.

Sant Llorenç de Morunys es el pueblo principal. No muy lejos de él se encuentra el Santuari de Lord y cercano a él la ermita de Sant Serni.

Subiendo por la carretera hacia La Coma i La Pedra se hallan las Fonts del Cardener, otro rincón de obligada visita. El Cardener es al parecer el mayor afluente del Llobregat.

La zona también acoge la estación de esquí del Port del Comte, creo que no tan popular como otras más al norte pues al contar con menor altitud tiene nieve menos días al año. Casualmente en estos días cayó la mayor nevada de la temporada.

No olvidéis tampoco visitar el casco histórico de Solsona, ya fuera del valle propiamente dicho, y caminar sin prisas por esas antiguas calles cercanas a la catedral.

../../../_images/lavalldelord-03.jpg ../../../_images/lavalldelord-05.jpg ../../../_images/lavalldelord-06.jpg ../../../_images/lavalldelord-07.jpg ../../../_images/lavalldelord-08.jpg ../../../_images/lavalldelord-09.jpg

En definitiva, La Vall de Lord se ha convertido posiblemente en el refugio para desconectar cercano a casa que utilizaremos durante los próximos años.