[SLUG] nifty aliases

From: Eben King (eben01@verizon.net)
Date: Sun Mar 16 2008 - 17:09:26 EST


So I trawl the humor sites, grab movies, then when I'm done grabbing, watch
them. But some are in weird aspect ratios, some are way long and you may
not want to watch them all at one go, and so on. What to do?

I wrote these bash aliases:

movies="-e '\\.mpe*g*' -e '\\.wmv\$' -e '\\.mov\$' -e '\\.avi\$'"

alias lst='\ls -sh *.??? | sed "s/^\\(.*\\)-\\([0-9]*\.[0-9][0-9]\\)\\.\\(...\\)$/\\2 \\1-\\2.\\3/" | sort -n | sed "s/^[0-9]*\\.[0-9][0-9] //"'

for aspect in "," '121,"-aspect 1.21"' '43,"-aspect 4:3"' '85,"-aspect 8:5"' '169,"-aspect 16:9"' '229,"-aspect 22:9"' ; do
     alias pl${aspect%,*}="mpshow ${aspect#*,} \`\\ls -1tr | grep -i $movies | tail -1\`"
done

unset movies

(Be careful of line wrap!)

So, I have a bunch of long movies I've watched part of, and stuck the stop
time in the filename just before the extension. They are:

movieA-2.50.mpg
movieB-15.40.avi
movieC-0.30.wmv

(Dot's easier to type than colon, and bash doesn't throw a hissy fit over a
dot in a filename.)

eben@pc:~$ lst
movieC-0.30.wmv
movieA-2.50.mpg
movieB-15.40.avi
eben@pc:~$

It sorts them by that time.

OK, the second mess. That defines some aliases (pl, pl121, pl169, etc) to
Play the Last movie (by mod time, I think) at various common aspect ratios.
AR 1.21 undoes the wide image you sometimes see in movies pulled straight
from VCD. (TV pixels are taller than square, so the image is extra wide to
compensate.) "mpshow" is a wrapper I wrote for mplayer; it can recurse
directories, but has problems with spaces.

Got a nifty script or alias? I'd love to see it.

-- 
-eben      QebWenE01R@vTerYizUonI.nOetP      royalty.mine.nu:81
VIRGO:  All Virgos are extremely friendly and intelligent - except
for you.  Expect a big surprise today when you wind up with your
head impaled upon a stick. -- Weird Al, _Your Horoscope for Today_
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 15:26:16 EDT