Friday, May 18, 2007
Compiling MPlayer on linux-amd64
I now have a new desktop computer (DELL Precision Workstation 390n, RH Enterprise 4) and already spent a few days setting it up in various ways. Most of the time, it has been straightforward, but setting up MPlayer was much less than trivial.
Here is an overview of the main steps required to install it (MPlayer 1.0rc1-4.1.1 © 2000-2006)
1. 64-bit vs. 32-bit problems
(This section will not apply to you if your OS is 32-bit)MPlayer must be compiled in 32-bit mode since it invokes proprietary Windows codecs and therefore some basic 32-bit environment must be available.
- Make sure gcc -m32 can be used to compile 32-bit programs (you might also want to setup gcc4, see below; note that you will not need C++ support, plain gcc will suffice);
- Create special new directory for 32-bit stuff, e.g. /usr/local32, set your $PATH and $LD_LIBRARY_PATH accordingly;
- Install 32-bit version of libpng library, by setting export CFLAGS="-m32 -O2" and executing ./configure --prefix="/usr/local32";
- Now you need 32-bit version of gtk-2 libraries. You can compile them from scratch, but in my case I only had to setup symbolic links (in /usr/local32/lib): libatk-1.0.so -> /usr/lib/libatk-1.0.so.0 libgdk_pixbuf-2.0.so -> /usr/lib/libgdk_pixbuf-2.0.so.0 libgdk-x11-2.0.so -> /usr/lib/libgdk-x11-2.0.so.0 libglib-2.0.so -> /usr/lib/libglib-2.0.so.0 libgmodule-2.0.so -> /usr/lib/libgmodule-2.0.so.0 libgobject-2.0.so -> /usr/lib/libgobject-2.0.so.0 libgtk-x11-2.0.so -> /usr/lib/libgtk-x11-2.0.so.0 libpango-1.0.so -> /usr/lib/libpango-1.0.so.0 libpangox-1.0.so -> /usr/lib/libpangox-1.0.so.0 libpangoxft-1.0.so -> /usr/lib/libpangoxft-1.0.so.0
- Download appropriate "Binary Codec Packages", e.g. "essential" and "win32codecs" from http://www.mplayerhq.hu/MPlayer/releases/codecs/ , and install them under /usr/local32/lib/codecs;
- Download "Skins" (at least one) from main download page http://www.mplayerhq.hu/design7/dload.html, and install under /usr/local32/share/mplayer/skins, and make symbolic link "default" to default skin, e.g. default -> Blue
- Download one bitmap font from here and install per documentation, which is to say, unpack it under /usr/local32/share/mplayer and make symbolic link "font": /usr/local32/share/mplayer/font -> font-arial-14-iso-8859-1
- Install a true type font in directory ~/.mplayer and make a symbolic link subfont.ttf, e.g: ~/.mplayer/subfont.ttf -> tahoma.ttf
- unset CFLAGS (or open a new shell); otherwise, you will disregard special compilation flags used by mplayer;
- configure with the command: ./configure --enable-gui --cc='gcc4 -m32' --target=i386-linux --with-extraincdir=/usr/local32/include --with-extralibdir=/usr/local32/lib --prefix="/usr/local32" (using gcc4 is nor relevant to the crash, but was helpful with some other problems which appeared with gcc3. Versions used: gcc3 = 3.4.6, gcc4 = 4.1.1)
- in a separate directory, configure as above but with additional option --enable-debug. and compile only one object: libvo/sub.o (you can run make to compile everything, there is no harm)
- Copy libvo/sub.o from 2-nd directory to the 1-st and re-build MPlayer in the 1-st directory;
- Now execute "make install" in the 1-st directory (with appropriate permissions) and enjoy!
- Standard mplayer help suggests to use Command Line Option -slang to select subtitles, e.g. -slang en. In fact, for some reason this is not very reliable. It is in fact much more convenient to use option -sid
. This way, trying sequentially -sid 0, -sid 1, -sid 2, ... you will find what you need. E.g., most often this is what you'd use to play DVD: gmplayer -sid 0 -fs dvd://1
- Perhaps it is worth looking at new project Democracy (to be renamed to Miro), which is a multi-platform universal media player, implemented in Python and using Pyrex, xine and some other packages.
Tuesday, May 15, 2007
My favorite Firefox extensions
- Yahoo!© MyWeb Save current page (with cache) to the server
- BOThread for FireFox expand all threads in LiveJournal post
- LJ/Mine Append &style=mine to LiveJournal URLs: this will cause the page to display in your LJ style instead of in whatever eyeball-searing layout the page's author has chosen.
P.S. [9-Jul-07]. Also add to the list of useful extensions Google Browser Sync.
P.S. [13-Sep-07]. Hebrew Calendar
P.S [18-Mar-08]. dragdropupload
P.S [16-Apr-08]. Multiple Tab Handler
P.S [05-May-08]. FireStox
Tuesday, May 08, 2007
Using getmail/procmail to peek into IMAP server
I am using IMAP (in fact, Microsoft Exchange) server to read my mail. Now, I want some automated tool to take a sneak peek at all new e-mails which come my way and if these e-mails deemed "important", let's say, forward them to another e-mail account.
This could be easily done on a UNIX platform using getmail/procmail combination, but there is a fair amount of configuration required to achieve this goal, including patching getmail source in the process, so let me for the future reference underline the steps required and give some examples of configuration files I used.
1. Install procmail.,/p>
Currently, the latest version is 3.22 and source code can be copied directly from here (September 2001)
To install, you can do
make make installbut before you do, make sure that your /bin/sh is in fact bash (install it if necessary) and not regular Unix sh; if not, replace first line of file initmake with #! /bin/bash.
After installation, make sure "man procmailrc" works for you (you will need it!) and if not, adjust your $MANPATH and/or copy all *. files from "new" to an appropriate location.
2. Install getmail.
Currently, the latest version 4.7.4 is available here (April 2007). Note that you must have Python installed as getmail is Python-based.
Before you build/install getmail, make one change to file getmailcore/_retrieverbases.py : replace line
return self._getmsgpartbyid(msgid, '(RFC822)')with line
return self._getmsgpartbyid(msgid, '(BODY.PEEK)')as suggested in this e-mail thread, in order to prevent your new messages from being marked as "read' ('seen' in IMAP language). getmail, like any Python module, is installed in 2 steps:
python setup.py build python setup.py install
3. Make new directory ~/.getmail and create there file getmailrc like that:
[retriever] type = SimpleIMAPRetriever server = imap.myservername.com username = myusername port = 143 password = mypassword mailboxes = ("Inbox",) [destination] type = MDA_external path = /usr/bin/procmail arguments = ('~/.getmail/procmailrc',)
(fill out proper IMAP server credentials). If you need help with getmail configuration file, see here.
4. In the same directory ~/.getmail, create new file procmailrc like that :
PMDIR=$HOME/.getmail # Put ## before LOGFILE if you want no logging (not recommended) LOGFILE=$PMDIR/log # Set to yes when debugging VERBOSE=yes # Remove ## when debugging; set to no if you want minimal logging LOGABSTRACT=all :0: procmail.lock * ^From:.+(Petya|Vasya|Kolyanfirstname.lastname@example.org) !email@example.com :0 /dev/null
(Turn off debugging as per comments in the above file when satisfied). If you need help with procmail configuration files, use "man procmailrc".
5. Test your new setup as needed by using command:
getmail --dont-delete --newand then satisfied, add something like this in your crontable:
1,6,11,16,21,26,31,36,41,46,51,56 * * * * /usr/local/bin/getmail -q -l -n
You are all set!