Friday, January 28, 2011

YouTube true fullscreen video in linux


I got tired to buggy playback with flash player and the inability to play fullsize fullscreen video. Here is a little script designed to improve the quality of life.

What it does is first get the url of the video and then start downloading it. Once it fills the predefined buffer set in the script or the download finishes, it will start playing the video.

If the youtube-dl script from a repository doesn't work try getting it straight from here: http://rg3.github.com/youtube-dl/

For pure lazyness I also made a desktop icon where I can drag an url and it will automagically start playing the video.

Try it. It's good. :)




Setting up the script in Fedora
sudo su
yum -y install youtube-dl 
wget -O /usr/local/bin/youtube-play http://sebastianmaki.fi/files/youtube-play
chmod a+x /usr/local/bin/youtube-play




/usr/local/bin/youtube-play
#!/bin/bash
#youtube-player by Sebastian Mäki

if [ $# -eq 0 ]; then
 echo "Usage: $(basename $0) \$URL"
exit 0;
fi


PLAYER_NAMES="gnome-mplayer gmplayer mplayer"

for PLAYER_CANDIDATE in $PLAYER_NAMES; do 
 if which $PLAYER_CANDIDATE > /dev/null; then 
  PLAYER=$PLAYER_CANDIDATE; 
  break; 
 fi;
done;

BUFFER=$((1024*1024*2)) #initial buffer size 2MB


TMP=`mktemp`
COOKIES=`mktemp`
rm $COOKIES

URL=$(youtube-dl --cookies=$COOKIES --get-url $1)

wget -q --load-cookies=$COOKIES -O $TMP $URL &
PID=$!

SIZE=0;
while [ $SIZE -lt $BUFFER ]; do
 if ps -lp $PID > /dev/null; then 
  SIZE=$(stat -c%s $TMP)
 else
  SIZE=$(($BUFFER+1))
 fi
 sleep 1;
done;
$PLAYER $TMP
kill -9 $PID
rm -f $TMP $COOKIES




Youtube-Player.desktop <-- put this shortcut file to your desktop
[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
Name=Youtube Player
Name[fi_FI]=Youtube Soitin
Name[sv_SE]=Youtube Spelare
Exec=youtube-play %U

Icon=/usr/share/icons/YouTube_icon.png

Wednesday, April 21, 2010

Hermesetas Hack

I'm a big user of sweeteners. At least when you tend to drink a couple dozen cups of coffee every day, little things like the functionality or the lack of your sweetener dispenser starts to matter.

The dispensers I use used to work fine before, but I suppose they must have changed to an inferior manufacturing process. The problem is that when you press the dispenser to drop a sweetener, it doesn't return to top position. You have to use both hands to return it to top position before you can try to dispense more.

This fix will add a spring in order to return it to proper position so that it will function as designed.

You can revive a malfunctioning dispenser with a simple fix/hack. All you need is a coil spring from a ballpoint pen or something similar.

1. Open the dispenser.(Separate the white part from the transparent blue part)
2. Insert stretched coil spring as shown in picture.
3. Close the dispenser.

Be careful when opening the dispenser. The goal is to open it carefully not to sprinkle the sweeteners all over.



Thursday, March 18, 2010

Karhuviesti-info

Karhuviestin kokoonpano on nyt seuraavanlainen:

  • Bäck
  • Koivumäki
  • Lamminharju
  • Majuri
  • Manninen
  • Mäki
  • Söderlund

Korkeamäki on meijjän varamies.


Koivumäellä on tällä hetkellä työvuoroeste. Katotaa kuinka käy.




Osuudet


Osuudet valitaan mahdollisuuksien mukaan kykenemisjärjestyksessä. Parempikuntoisille juoksijoille ensisijaisesti pitemmät matkat. Muutkin syyt ja toiveet otetaan huomioon.

Pistäkää kommenttialueeseen juoksunopeus ja tyypillinen lenkkipituus, niin kehitetään alustava osuuksien jako.






Joukkueen nimi


Ehdotan joukkueen nimeksi Purkutorilaiset. Olisi kiva, jos joku keksisi järkevämmän nimen. Muussa tapauksessa ilmoitan Purkutorilaiset nykyisellä kokoonpanolla kilpailuun. Viimehetken muutoksia voidaan tehdä vielä kisapaikalla loppuilmottautumisessa, mutta toivottavaa olisi, että hommat menevät suunnitelmien mukaan.


Kuljetus


Turusta lähdetään henkilöautoillen Poriin päin joko kisapäivänä tai päivänä ennen sitä. Timon Audi ottaa sisäänsä 5 henkilöä, joten loppujen juoksijoiden kanssa tarvisi olla mielellään kakkosauto. Mikäli tämä ei toteudu pitänee katsoa onko Viasveden Hait-joukkueen kakkosautossa tilaa.


Maksu


Osallistumismaksu jaetaan osallistujien kesken. Osallistumismaksu henkilöä kohden on 15€ ja se maksetaan paikan päällä. Varatkaa etukäteen mielellään tasaraha.

Tip me if you like what you're reading