Author Archives: rclobus

Bulk conversion of audio files

My MP3 player needs MP3 files (hence the name).

The following snippets use gstreamer in a for loop.

Convert *.flac to *.mp3:
Original script here

for song in *.flac ; do gst-launch filesrc location="$song" ! flacdec ! audioconvert ! lame quality=2 mode=0 vbr=4 vbr-quality=2 ! xingmux ! id3v2mux ! filesink location="${song/.flac/.mp3}" ; done

Convert *.ogg to *.mp3:

for song in *.ogg ; do gst-launch filesrc location="$song" ! decodebin2 ! audioconvert ! lame quality=2 mode=0 vbr=4 vbr-quality=2 ! xingmux ! id3v2mux ! filesink location="${song/.ogg/.mp3}" ; done

Convert *.wav to *.mp3:

for song in *.wav ; do gst-launch filesrc location="$song" ! decodebin2 ! audioconvert ! lame quality=2 mode=0 vbr=4 vbr-quality=2 ! xingmux ! id3v2mux ! filesink location="${song/.wav/.mp3}" ; done

Required packages:
gstreamer-tools, gstreamer0.10-plugins-ugly

Prepare a package (Pioneers) for a Debian i18n-release

Pioneers needs an i18n update, but Debian is in deep freeze, so only i18n related patches (and security patches) will be accepted.

  • Get all patches:
    gawk 'BEGIN { i=1812; while (i < 1844) { print "svn diff -r " (i-1) ":" i " > svn" i ".patch"; i++ }}' | sh
  • Review the patches and remove all non-i18n, non-security related patches
  • Prepare the repository, go to the moment of the last release:
    svn update -r 1812
  • Fetch all updates to the debian packaging:
    cd debian;svn update
  • Prepare quilt as instructed in the Debian wiki:
    export QUILT_PATCHES=debian/patches
    export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
  • Prepare quilt:
    quilt push -a
  • Apply each relevant patch:
    quilt new svn1819.diff
    lsdiff svn1819.patch | xargs quilt add
    quilt remove ChangeLog
    patch -p0 -i svn1819.patch
    quilt refresh
    quilt header --dep3 -e
      Description: as in the ChangeLog
      Author: as in the ChangeLog
      Origin: upstream
      Applied-upstream: svn revision 1819
  • End quilt:
    quilt pop -a
  • Add all patches to svn
  • Start the release cycle

Connecting a DVB-T stick to the SheevaPlug

The stock Debian kernel (2.6.32-5-kirkwood) does not have the kernel module for the DVB-T stick with USB-ID: 1d19:1102 (Aldi) or 0ccd:00d7 (Terratec TStick+). I’ve use the following steps from the description by Dionysios Fragkopoulos:

  • Install the kernel headers:
    # aptitude install linux-headers-`uname-r`
  • Install the requirements:
    # aptitude install patchutils libproc-processtable-perl wget bzip2
  • Get the source code:
    $ git clone git://linuxtv.org/media_build.git
  • Build it:
    $ ./build
    Note: It takes more than 630MiB, so extra disk space must be attached to the SheevaPlug (non-FAT partition)
  • Copy the modules to the kernel path (manually, because I want to save disk space on the root partition):
    # cp rtl283?.ko /lib/modules/2.6.32-5-kirkwood/kernel/drivers/media/dvb/dvb-usb
    # cp dvb-usb-rtl28xxu.ko /lib/modules/2.6.32-5-kirkwood/kernel/drivers/media/dvb/dvb-usb
    # cp dvb_usb_v2.ko /lib/modules/2.6.32-5-kirkwood/kernel/drivers/media/dvb/dvb-usb
  • Update the module list:
    # depmod -a
  • Plug in the usb device

It works!
The /dev/dvb/adapter0 devices are now present.

Next steps to write in the blog:

  1. Configure the stick
  2. Configure PVR software

Use a regular Debian kernel on the Sheevaplug

A long time ago I found information about installing ubifs on the Sheevaplug.
However, it used a non-Debian kernel. This port describes the steps to boot from a regular Debian kernel.

The information used is found here, here, here and here.

$ dpkg-reconfigure linux-image-2.6.32-5-kirkwood
A warning is issued about the name of the root device ubi0:rootfs
$ flash-kernel
It doesn’t write to the flash memory, but generates /boot/uImage and /boot/uInitrd

The following environment is used in U-Boot (version 2011.12):

baudrate=115200
bootargs=console=ttyS0,115200 mtdparts=orion_nand:512k(uboot),4m@1m(kernel),507m@5m(rootfs) rw ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs
bootcmd=run bootubi
bootdelay=3
bootnand=${x_bootcmd_kernel}; setenv bootargs ${x_bootargs} ${x_bootargs_root}; ${x_bootcmd_usb}; ${x_bootcmd_sata}; bootm 0x6400000;
bootubi=run x_bootcmd_ubi; run x_bootcmd_regular; setenv bootargs ${x_bootargs} ${x_bootargs_root}; bootm 0x800000 0x1100000;
ethact=egiga0
ethaddr=XX:XX:XX:XX:XX:XX
mtddevname=uImage
mtddevnum=0
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x0500000(rootfs)
partition=nand0,0
stderr=serial
stdin=serial
stdout=serial
x_bootargs=console=ttyS0,115200 mtdparts=orion_nand:512k(uboot),4m@1m(kernel),507m@5m(rootfs) rw
x_bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs
x_bootcmd_kernel=nand read 0x6400000 0x100000 0x400000
x_bootcmd_regular=setenv mainlineLinux yes; setenv arcNumber 2097;
x_bootcmd_sata=ide reset;
x_bootcmd_ubi=ubi part nand0,1; ubifsmount rootfs; ubifsload 0x800000 /boot/uImage; ubifsload 0x1100000 /boot/uInitrd;
x_bootcmd_usb=usb start;

In order to use the setenv command, the $ and ; must be escaped with a backslash.The highlighted parts are the parts I needed for a correct boot.

Encrypted store with EncFs for GPG keys

Information is gathered from: here and here.

  1. Preparation
    1. Become a member of the fuse group
      sudo adduser your_username fuse
      newgrp - fuse
    2. Create a directory for the encrypted files (on the remote storage)
    3. Create a mount point (somewhere in home)
  2. Create the encrypted system/Mount the encrypted system
    encfs folder_to_mount mount_point
  3. Use it
  4. Umount
    fusermount -u mount_point
  1. Create signing subkey
    gpg --edit-key 0xFFFFFFFF
    addkey
  2. Backup the key
    gpg --export 0xFFFFFFFF > publickey.gpg
    gog --export-secret-keys > secretkeys.gpg
    gpg --export-secret-subkeys > secretsubkeys.gpg
  3. Set the gnupg environment to the encrypted location
    export GNUPGHOME=mount_point
  4. Unset the gnupg environment
    unset GNUPGHOME
  5. Remove the private key for the master
    gpg --delete-secret-keys 0xFFFFFFFF
  6. Check that the private key is removed
    gpg --edit-key 0xFFFFFFFF
    gpg addkey

    Adding the subkey should fail
  7. Re-import the secret key
    gpg --import secretkey.gpg
  8. Send the key to the keyserver
    gpg --send-key 0xFFFFFFFF

Downloaden van alle foto’s van mijnalbum.nl

Zie http://keeshink.blogspot.nl/2008/09/fotos-downloaden-van-mijnalbumnl.html voor het oorspronkelijke artikel

 

Installeren: python-lxml

Daarna dit script draaien met als argument het album-id (kijk in http://www.mijnalbum.nl/Album=[AlbumID]U&Foto=[FotoID])

#!/usr/bin/python

import sys
from lxml import etree
from lxml import objectify
from urllib import urlopen

# pass the album id as a command line argument
album_id = sys.argv[1]
thumbs_url = 'http://www.mijnalbum.nl/index.php?m=albumview&a=2&key='
thumbs_url += album_id

parser = etree.HTMLParser()
page = urlopen(thumbs_url)
html = page.read()

htmltree  = etree.HTML(html)

for element in htmltree.xpath("body/table/tr/td[@class='thumbfoto']"):
    id = element.get('id')
    to_be_stripped = 'thumbcont-'
    foto_id = id.replace(to_be_stripped,'',1)
    foto_url = 'http://www.mijnalbum.nl/GroteFoto-'+foto_id+'.jpg'
    print foto_url

Daarna de uitvoer omleiden met xargs wget

QWare TB-1217 tablet USB drivers for Windows

When the tablet is initially connected to Windows, it will not be detected as an Android device.

To enable the device to be accessed from the Android SDK:

  • Install the Google USB driver from the Android Manager
  • Add the following lines in %Program Files%\Android\android-sdk\extra\google\usb-driver\android_winusb.inf in the section [Google.NTx86]:
    ; QWare tablet
    %SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_0003
    %CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_0003&MI_01
  • Reboot
  • The tablet is now correctly recognized as an Android device

Create package with build dependencies

Howto create a package that contains the build dependencies of the package you want to test:

Using equivs

  1. Download the source package of the package you want to test:
    $ apt-get source [packagename]
  2. Create a dummy package:
    $ equivs-control [packagename]-builddep
  3. In the file [packagename]-builddep do the following:
    1. Set the field Package to [packagename]-builddep
    2. Set the field Version to the version of the package
    3. Copy the Build-Depends lines from debian/control to the Depends section
    4. Change the word Build-Depends to Depends
  4. Build the *.deb file:
    $ equivs-build [packagename]-builddep
  5. Add the package to the list of known packages:
    $ sudo dpkg -i *.deb
  6. Install the dependencies:
    $ sudo aptitude install [packagename]-builddep

Using devscripts

Alternative: mk-build-deps and then continue from step 5.