SWick

Sysadmin-by-Nature

Entries from June 2014.

recutils JSON output
8th June 2014

Quick Python one-liner to get JSON output from recutils

data.rec

%rec: movies

Id: 4
Title: Banana Joe
Country: Italy  |  West Germany
Date: 1982
Director: Steno
Genre: Comedy
Length: 93
Add_date: 05/06/2008
Audio: German (MP3)
Identifier: 141
Location: Box 1
Media: DVD
Amount_of_Media: 1
Rating: 6
Video_file: /media/cdrom0/Banana-Joe.avi
Video_format: DX50
Viewed: 1
Borrower: none
Favourite: 0

Id: 2
Title: Baraka
Country: USA
Date: 1992
Director: Ron Fricke
Genre: Documentary
Length: 96 min
Add_date: 04/06/2008
Identifier: 858
Location: Box 1
Media: CD
Amount_of_Media: 1
Rating: 0
Video_file: /media/cdrom0/Baraka.avi
Video_format: divx
Viewed: 1
Borrower: none
Favourite: 0

Python one-liner

$ rec2csv data.rec | python -c 'import csv,json,sys; print(json.dumps(list(csv.DictReader(sys.stdin)), indent=4))'

Output

[
    {
        "Rating": "6", 
        "Identifier": "141", 
        "Title": "Banana Joe", 
        "Add_date": "05/06/2008", 
        "Country": "Italy  |  West Germany", 
        "Favourite": "0", 
        "Video_file": "/media/cdrom0/Banana-Joe.avi", 
        "Amount_of_Media": "1", 
        "Director": "Steno", 
        "Genre": "Comedy", 
        "Length": "93", 
        "Location": "Box 1", 
        "Borrower": "none", 
        "Media": "DVD", 
        "Date": "1982", 
        "Video_format": "DX50", 
        "Audio": "German (MP3)", 
        "Id": "4", 
        "Viewed": "1"
    }, 
    {
        "Rating": "0", 
        "Identifier": "858", 
        "Title": "Baraka", 
        "Add_date": "04/06/2008", 
        "Country": "USA", 
        "Favourite": "0", 
        "Video_file": "/media/cdrom0/Baraka.avi", 
        "Amount_of_Media": "1", 
        "Director": "Ron Fricke", 
        "Genre": "Documentary", 
        "Length": "96 min", 
        "Location": "Box 1", 
        "Borrower": "none", 
        "Media": "CD", 
        "Date": "1992", 
        "Video_format": "divx", 
        "Audio": "", 
        "Id": "2", 
        "Viewed": "1"
    }
]
Tags: db, nosql, python, recutils.
Need for Madness
20th June 2014

Wenn man nicht so auf langwierige Spiele steht und man etwas Spaß für zwischendurch braucht, ist man bei Need for Madness genau richtig.

Knackige Musik, rasante Rennen und genug Stunts mit Blechschaden-Garantie.

Tags: games, trailer, videos.
Boson X
20th June 2014

Der absolute Kracher zum Entspannen. Stampfende Techno-Mucke passend zum Geschwindigkeits-Rausch.

Beim hüpfenden Professor könnte man fast meinen Lester Knight Chaykin aus Another World ist zurück und springt nun in neuen Welten umher.

Reicht das immer noch nicht, dem ist noch zu helfen und zwar mit Octagon

Tags: games, trailer, videos.

RSS Feed

"People said I should accept the world. Bullshit! I don't accept the world." -- Stallman