Sunday, 8 March 2009

Convert iso to vob script

Since i own a PS3 i like to stream all my movies to it. Sadly the video support in it as of date is pretty poor, but it can play .vob. Sadly most movies "borrowed" from the internet is encapsulated into a .iso or .img files, that is iso9660 for us mortals... ;)

Anyway, upon mounting an iso you will find, if it's a dvd rip of course, two folders VIDEO_TS and AUDIO_TS. The VIDEO_TS contains the whole movie segemented into a s*itload of .vob files.
Each of these files contains x-minutes of the movie. So what you can do if you don't like changing movie file every other second. Merge the files together as one large vob. This can easily be done with a cat *.vob new_file.vob command.

But as i'm lazy by nature i wrote a script doing all this for me. I found a nifty cat progress bar implementation called Bar to see the merge status as cat has no progress report of it's own.
So here goes, my extract-vob script. Ps. Sorry about the indentation, i blame the blogs wysiwyg.


#!/bin/bash
NO_ARGS=""

#path and name of file
SRC_NAME="$1"

#DEST path
DEST="$2"

#Name of file with extension
FILE_NAME="${SRC_NAME##*/}"

#Base name of file without extension
BASE_NAME="${FILE_NAME%%.*}"

#EXTENSION of file
EXT="${FILE_NAME#*.}"

#Temporary mount to /mnt
TMP_DIR="/mnt"

#####################################
#To utilize the mount command user #
#must be/have root-previlegies #

#####################################
function check_if_root()
{
ROOT_UID=0 # Only users with $UID 0 have root privileges.
E_NOTROOT=67 # Non-root exit error.

if [ "$UID" -ne "$ROOT_UID" ];then
echo "Must be root to run this script."
exit $E_NOTROOT
fi
}

#########################
#Check for common errors#
#########################
function errors ()
{
if [[ "$SRC_NAME" == "$NO_ARGS" || "$DEST" == "$NO_ARGS" ]];then
echo "Too few arguments"
exit 0
elif [[ ! -e $SRC_NAME || -d $SRC_NAME ]];then
echo "Source does not exist"
echo "Source can not be a directory"
exit 0
elif [[ ! -d $DEST || ! -e $DEST ]];then
echo "DEST is not a directory"
echo "DEST does not exist"
exit 0
fi
}

##########################################
#Check for simple errors and correct them#
##########################################
function dest ()
{
if [[ $DEST == "." ]];then
DEST="$PWD"
elif [[ $DEST == "./" ]];then
DEST="$PWD"
elif [[ $DEST == "/" ]];then
DEST="$PWD"
fi

if [[ ! "$DEST" =~ /$ ]];then
DEST=$DEST"/"
fi
}

################
#Main function #
################
function main()
{
echo "Source : $SRC_NAME"
echo "DEST : $DEST$BASE_NAME.vob"

echo "Mount file in tmp dir"
mount -o loop -t iso9660 $SRC_NAME $TMP_DIR

echo "Extracting file to $DEST$BASE_NAME.vob"
bar -o "$DEST/$BASE_NAME.vob" -c cat $TMP_DIR/video_ts/vts_*.vob
chmod 777 "$DEST/$BASE_NAME.vob"

echo "Umount $TMP_DIR"
umount $TMP_DIR

echo "Remove $TMP_DIR"
rmdir $TMP_DIR

echo "Done! You can find extracted file at:"
echo "$DEST$BASE_NAME.vob"
}

#########################
# Function Calls #
#########################

check_if_root
errors $#
dest $DEST
main $#


Friday, 20 February 2009

CDWOW ... delays yet again!

WOW my CD is delayed again... Never order from CDWow.. Would not recomed this site to anyone.

"Hi.

First of all, i placed this order in the end of january and only one of the three items I ordered has arrived(took 11-workingdays, 3 weeks as it was sent on a wednesday).
The second one was set to "sent status" earlier this week(So i guess it will arrive in the start of March!).
But this third item, Valkyrie Chronicles,has now for the second time been delayed. So i feel the urge to really complain about this to you as i see it as unacceptable
to first give the impression of having it in stock. Then after i order it say that it's not by sending a Order Delayed message telling me nothing about when it will be back in stock!
I have now waited 20+ days and yet again a Order Delayed message arrives telling me nothing!! Now i have to wait another x-amount of days before you send me the item( or another Order Delay)
plus the additional 11 days for the delivery to arrive.

With this said, can you please tell me when the game will be back in stock so i can decide between canceling this order and get my game today by buying it
locally or if i should give you a second chance and maybe die of old age before the game arrives.

// Henrik."

Sunday, 8 February 2009

Revival!

Ok, time to revive this son of a b*tch!

I'm relaunching this blog for my GNU/Linux switch ( but as you read on, this is not my only reason). Yes everybody. Now the only OS on my computers are based on *nix. OK, Fedora ( my stationary computer) is far away from Solaris but hey. It's not Windows at least. Although when switching you realize that Msoft is not doing everything wrong. Windows is actually a pretty good OS. At least that's my two cents.. Then again I am a switcher. And it all started with OS X.

To start with I will try to update the blog once a week. I really don't care if someone reads it though. But it would be nice to get some feedback sometime. :) I intent to make this blog the creative outlet for my programming, my GNU/Linux switching and pretty much everything else between heaven and earth. You can expect blogs about How to install Compiz-Fusion, screaming at Xorg, installing Direct X 9 in WINE, installing Windows applications with the help of WINE, setting up a Squid Proxy and a whole lot more.

Finally, in the spirit of GNU/Linux. Here is the story about the cutey now called TUX.. ;)

" Linus Torvalds (torvalds@cs.helsinki.fi)

Thu, 9 May 1996 17:48:56 +0300 (EET DST)

.
Somebody had a logo competition announcement, maybe people can send their
ideas to a web-site..
.
Anyway, this one looks like the poor penguin is not really strong enough to
hold up the world, and it's going to get squashed. Not a good, positive logo,
in that respect..
.
Now, when you think about penguins, first take a deep calming breath, and
then think "cuddly". Take another breath, and think "cute". Go back to
"cuddly" for a while (and go on breathing), then think "contented".
.
With me so far? Good..
.
Now, with penguins, (cuddly such), "contented" means it has either just
gotten laid, or it's stuffed on herring. Take it from me, I'm an expert on
penguins, those are really the only two options.
.
Now, working on that angle, we don't really want to be associated with a
randy penguin (well, we do, but it's not politic, so we won't), so we
should be looking at the "stuffed to its brim with herring" angle here.
.
So when you think "penguin", you should be imagining a slighly overweight
penguin (*), sitting down after having gorged itself, and having just burped.
It's sitting there with a beatific smile - the world is a good place to be
when you have just eaten a few gallons of raw fish and you can feel another
"burp" coming.
.
(*) Not FAT, but you should be able to see that it's sitting down because
it's really too stuffed to stand up. Think "bean bag" here.
.
Now, if you have problems associating yourself with something that gets
off by eating raw fish, think "chocolate" or something, but you get the
idea.
.
Ok, so we should be thinking of a lovable, cuddly, stuffed penguin
sitting down after having gorged itself on herring. Still with me?
.
NOW comes the hard part. With this image firmly etched on your eyeballs, you
then scetch a stylizied version of it. Not a lot of detail - just a black
brush-type outline (you know the effect you get with a brush where the
thickness of the line varies). THAT requires talent. Give people the
outline, and they should say [ sickly sweet voice, babytalk almost ]"Ooh,
what a cuddly penguin, I bet he is just _stuffed_ with herring", and small
children will jump up and down and scream "mommy mommy, can I have one too?".
.
Then we can do a larger version with some more detail (maybe leaning
against a globe of the world, but I don't think we really want to give
any "macho penguin" image here about Atlas or anything). That more
detailed version can spank billy-boy to tears for all I care, or play
ice-hockey with the FreeBSD demon. But the simple, single penguin would
be the logo, and the others would just be that cuddly penguin being used
as an actor in some tableau.
.
Linus
"

Wednesday, 5 December 2007

Java and Me

Been a long time now since I updated. Actually could probably say the everytime i update.. Butthat would just point out the bleeding obvious, so no more!

Some changes have been made to my life recently, moved back and in to my GFs apartment in Skelleftehamn. Cleaned up and gave back my apartment to the landlord in Sundsvall. Quit my band, well actually we broke up as we live in different parts of the country. Started my last projekt for school at TietoEnator.

And It's this last subject i want to talk about. See im writing this program in Java. It reads data from an XML-file and converts it into inputs for outputs in a GUI. Basically it's a GUI for an already existing TeleCom product being released in a couple of weeks. Nothing fancy and it's just for TeleCom buisnesses. That being said i must say that what i do like about working in java is the premade packets. They serve most of onces needs and when they don't most of the times you can tweek them into doing so. But sometimes you jsut want to smack the creators stright in the face and scream: - "What the hell did you just do? WHAT THE HELL DID YOU DO!?!?"

Eherm .. My problem is this. I input table data in to a Object[][] the i insert this as data into a table with two columns. Each row in column two has a different ValueType. This is however not supported by default. So we have to simply overide a couple of functions. No biggi. Problem is when you update the cells. Say that you want to edit cell 1:1 - which is a Float. You edit the value. Press enter .. An it converts the value into a String. Why am i getting so uppset by this?

a) It should not do this!
b) I loos the integrity check in the cell.
c) It should not FUCKING do this!

So now two days later i still hasn't figured it out by myself. I am relying on some people on the java.swing forum to help me out. Problem is .. they tend to answer after 18 .. it's now 14. This whole day goes by so slowly .. well back to work! .. and don't complain about my grammar.. Im Sweedish god damn it, and the spell check dosn't work :(

Saturday, 17 November 2007

About the music business

I read an really interesting blog today about the music business, check it out.
I can't say that i will stop buying CDs and some such because i like to physically have them.
Yet again I agree with him and he has some good strong points. The rant is quite long so keep at it if you get bored, it will be worth it.

/Hed

Monday, 15 October 2007

Triumph!

Some background information:
Newly moved in with my GF for a couple of months and she as an external HDD with and NTFS-partition on it. The Mac OS X 10.4.* has native support for reading NTFS but not writing to it.

Solution:
Macfuse and ntfs-3g.

How to install:
You can do this by fink but i did it by *.dmg so the instructions are as follows:
  1. Download the *.dmg from Macfuse
  2. Download the *.dmg from NTFS-3G
  3. Reboot.

My system worked great after this but your might not so if it doesn't go to macosxhints

Troubleshooting:
If you are unable to mount the partition and the error message is something like this: The partition is in use, unable to mount . Here is a little troubleshoot:
If you have previously mounted the disk in Windows then remount it in Windows then unmount it by using the secure remove hardware procedure.

If you are having more problems i direct you to there own troubleshoot/faq.

Wednesday, 4 July 2007

At work!

Working night again! But this time it's different from the last time. This time and tired as hell! .. Writing this as im almost falling to sleep and I got 5h left on my shift. Don't mind telling you that the clock is about 2:30 AM... Now guessing that AM references to night time, I'm using the 24h clock and its 02:30 .. huuuge difference

*twenty seconds late i hurled *

As this post is late and I haven't updated this blog in about two months I deemed it necessary to do this now... Before I go back there again. Will be posting soon again.

Thursday, 21 June 2007

At my parents home

Boooooored! Im using my parents computer to write this and it's on a 56K modem. I'm used to 100Mbit or at least 10 so this is like hm.. Imagine this : You are driving your new sports car down the highway. No traffic is blocking your way and the sky is blue and clear. It's even a little bit sunny. Just a great day! You can't even spot a cop car for miles and miles. And as it is you have never ever tried to floor the gas pedal to the emphasized metal. So you go for it. You watch your speedometer go way up as you glare along the road. Suddenly a brick wall the size of China appears from nowhere 2" from you hood. Thats what it feel like, running straight into a *blip* wall!! Anyhow ..

Todays adventures are : eating a giant ice cream (And when I say huge I mean huuuuge!!) with some friends and later on playing a game of soccer with some others.

*makes a daring attempt starting messenger* It worked. Hot diggity damn!

And tomorrow ... urk .. work. 7-15. Then Saturday at 11 to 11 Sunday. And if you didn't know. Tomorrow it's Midsummers eve in Sweden .. yay .. No drinking for me :P .. But a lot of money at least. Have to take the good with the bad. At least there is a party the week after when I'm free the whole weekend. :D

Tuesday, 19 June 2007

First post!

Ok, here goes. This is my first post of perhaps .. supposedly many. Im writing in english, which is not my native language, just for the sake of it. This blog is supposed to be about my world. Or rather stuff that I come in contact with on a daily basis. Like the comic I am the script-writer for, computer-programming ( you will see a lot of of this, going to go bananas some times over it ) , relations ( yes, i just recently got my first GF at the mere age of 22 ), music ( as I am a musician guitar player/ singer/songwriter ) and other more undefined stuff... Whatever suites my mood i guess. Some blogs might even be in Swedish, but i think i will stay in English as it's easier to distance myself from my writings .. ore some such ^^

As it is now, I am at work. I found out that i can access a free wi-fi connection here. So i am chilling in a sofa with a cup of hot coffee and a cinnamon spongecake , got to love being in the.. well heck if know what they call it in English but a .. hmm .. nurse for multi-handicapped-people?

Anyhow tonight is a really relaxed night, only one person is staying here and she is a breeze taking care of. Just an all night sleeper. I'm working the night shift tonight if anyones is wondering. It took me 1h to take care of my chores so now I'm struggling to stay awake, but as long as i have my computer it really shouldn't be a problem.

So here's some nerd stuff for you. Guess what im doing right now. .. Could do that could you? .. Downloading xcode so I could enable the Java API for my computer. Oh it's done! .. Ok, end of post one. I guess this was a really strange and .. well confusing post whiteout direction or meaning. Expect more ;D

Quote of the night .. by me to a friend : "Oh yes, but even the simples creature like an Amoeba can survive on pure instinct... go lassi go!"


/ Caine out!