Donnerstag, November 08, 2007

write my own firefox plugin

As I don't use/like iTunes I download podcast directly from the RSS feed or the web page. Using Save Link As ... of the browser doesn't really work if you download a bulk of podcasts at the same time. So far I copy links by hand into a file and throw this at wget. This works fine. But to optimize this I would like to be able to add the link directly from firefox to the download file.

For this I need write my own plugin. I found the start point on how to write a firefox plugin on lifehacker some time ago.

This are the steps I used to write my plugin. In the lifehacker article and the referenced links you get the details.

create a new profile and set (about:config)
javascript.options.showInConsole = true
javascript.options.strict = true

not found:
nglayout.debug.disable_xul_cache = true
browser.dom.window.dump.enabled = true

install extensions:
JavaScript Debugger
Console
Chrome List
Firebug

Download the example from Mozilla knowledge base as a starting point.
install.rdf: increase the em:maxVersion to the firefox version used
overlay.xul: add the entry for your own context menu entry
  <popup id="contentAreaContextMenu"> 
<menuitem id="yb-context-tagLink"
insertafter="context-bookmarklink"
label="This is my right click"
class="menuitem-iconic"
oncommand="HelloWorld.onContextCommand(event);"/>
</popup>

overlay.js: add the function to be called from the context menu
  onContextCommand: function()
{
var file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath("/tmp/getPodcast");

var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
.createInstance(Components.interfaces.nsIFileOutputStream);

foStream.init(file, 0x02 | 0x08 | 0x10, 0666, 0); // write, create if not exists, append
foStream.write(gContextMenu.linkURL+"\n", gContextMenu.linkURL.length+1);
foStream.close();
}

The defined functions are part of an arry initialisation. So don't forget the comma as I did the first time.

Examples on file I/O is on firefox code snippets. Adding an entry to the context menu and getting the URL is from the del.icio.us extension.

Sonntag, November 04, 2007

bittorrent and dht

So far I used Enhanced CTorrent. This client is a cli tool and runs fine on the NSLU2. A few weeks ago I tired to download a torrent but the tracker was never found. I asked a friend if the is able to download the torrent with Azureus. He was able to download the torrent. Therefor I checked the features of Azureus and ctorrent. Dht (distributed hash table) caught my attention.

The only client I found that supports dht and is able to run on the NSLU2 is rtorrent. The dht support is so far not part of the official distribution. A patch to add dht is provided by Josef Drexler.

First download the patch wget http://tk.ttdpatch.net/~jdrexler/dht/dht.diff to see what revision of rtorrent you need. The first time I downloaded the wrong revision as the web page was not updated. Download with svn co -r 987 svn://rakshasa.no/libtorrent/trunk the revision the patch was created from. Or check with svn info if the already downloaded revision is the correct one.

Start with libtorrent:

  • ./autogen.sh

  • ./configure

  • nice -n 19 make

  • make check

  • sudo make install


After this do the same steps for rtorrent. If all works fine apply the patch (patch -p0 < dht.diff in trunk) and build libtorrent and rtorrent again.

add to .rtorrent.rc:

  • dht = auto

  • dht_port = forwarded port

umount: /mnt/backup: device is busy

Could not umount my external USB hard disk. The last time this happened was about a year ago. The paper I used to write down the solution was not around. Ok I could not find the note. Therefore I had to search the net again to find the command to display who is still using the device.

I should start to write down this kind of solutions on my web site. This will result not only in one place to search but also accessible from work and friends.

This block could also be the right place to collect the answers during I try to find the solution. After the problem is solved and I know all steps needed I is quickly transfered onto my web site.

Oh - the answer is lsof.

Dienstag, Oktober 30, 2007

Musik-Streaming

Habe das Debian-Paket icecast2 installiert. Icecast unterstützt mp3 und ogg streaming und ist compatible zu shoutcast (nur mp3).

In /etc/icecast2/icecast.xml alle <xxx-password> auf eigene Passwörter umsetzen. Danach in /etc/default/icecast2 ENABLE auf true setzen und icecast starten.

Umsetzen des mpd von ALSA auf shout streaming. Dazu in /etc/mpd.conf den vorhanden default Eintrag auskommentieren. Das Passwort auf das source-passwort des icecast setzen.
Achtung: bei debian wird im mpd.conf der user auf mpd gesetzt. Diesen auf source setzen, sonst nimmt icecast den Stream nicht an.

Mit mpc ganz normal eine Playlist spielen. Vom externen Rechner mit z.B. vlc einen Netzwerkstrem (http://192.168.1.1:9000/mpd.ogg) zum eingestellten port und mountpoint öffnen.

Der Versuch mit dem slimserver ist bis jetzt gescheitert. Beim starten eines Musikstücks über das Web-Interface werden nur wenige Sekunden abgespielt und beginnt dann wieder von vorne. Mit Quicktime kann ich diese Sekunden sogar hören. Der vlc bleibt stumm.

Mittwoch, Oktober 10, 2007

Wiederinbetriebnahme meines Akai GX-75

Ich wollte mir vor einiger Zeit eine meiner alten Kassetten anhören. Hörte die vertrauten Startgeräusche (Band spannen etc), dann kamen mehr oder weniger sofort die Stopgeräusche. Ein zweiter Versuch brachte das gleiche Ergebnis.

Der Versuch vor zu spulen, war nach 1sec zu Ende. Zurückspulen ging gar nicht. Meine Vermutung war ein gerissener Antriebsriehmen. Immerhin ist dieses Tapedeck über 15 Jahre alt. Mein guter Vorsatz, den defekten Riemen zu entnehmen um ihn als Muster beim nächsten Besuch eines HiFi-Geschäfts dabei zu haben, blieb beim guten Vorsatz.

Ein Zufall brachte mich in München in die Klenzestraße. Dort viel mein Blick auf eine Denon F88, aber dies ist eine andere Geschichte. Im Geschäft viel mir wieder mein Tapedeck ein. Jemand der alte HiFi-Geräte gebraucht verkauft, repariert diese doch bestimmt auch. Die Nachfrage ergab, dass das Durchsehen und Reinigen zwischen 90.- bis 160.- € kostet. Dies war mir zu viel. Ich bekam aber den Tipp, das Tapedeck ohne Kassette zu betrieben und mit einem Wattestäbchen und Spiritus alle Antriebsräder zu reinigen.

Nach abnehmen des Deckels konnte ich sehen, dass keiner der Antriebsriehmen gerissen war. Play brachte die Bandführungsrollen in Bewegung. Der Test nach dem Reinigen mit einer Kasette war aber nicht besser als vorher. Da ich auch die Klappe entfernt hatte, konnte ich sehen, dass sich der Tonkopf und die Andrucksrollen nicht bis zur Kassette bewegten.

Eine Suche im Netz nach diesem Problem brachten die abenteuerlichsten Anleitungen. Was mir einleuchtete war ein verharzen vom Fett in den Lagern. Immerhin hatte ich es für ca. 5 Jahre nicht verwendet. Nach abnehmen der Frontblende konnte ich an den linken Hebel, der den Tonkopf und die Andrucksrollen bewegt. Diesesn habe ich solange von Hand bewegt, bis Play und Stop die komplette Bewegung wieder ohne meine Hilfe konnten. Ein Versuch mit Kassette war nun erfolgreich.