The Rozabal Line by Ashwin Sanghi

the_rozabel_line_book_coverThe Rozabel Line is another book which is about the life and death of Jesus Christ combined with fiction. I guess this kind of historical fiction was started by Dan Brown in Da Vinci Code wherein he has traced the bloodline of Jesus Christ.

Ashwin has done a good amount of research  and there are about 209 references given at the back of the book. Most of the book quotes various historical timeframes and what happened then based on the latest research. The actual amount of fiction is quite less and is loosely knitted around the research material.

I like this book for the historical information and research references rather than the actual plot. Also the switching of context from history to fiction was quite random.

Overall the research done by author impresses me, but perhaps this book lacks a strong plot and good editing.

Posted in Book Reviews | Tagged , | Leave a comment

Build An MP3 Catalogue System With Perl – Conclusion

In the last post we saw how to read ID3v1 and ID3v2 tags using perl. In this post we will continue our journey towards creating a simple catalog for the MP3 collection.

Quickly Getting the Desired Information out of the MP3 – autoinfo()

Usually in my catalog I am interested in the following information about an MP3 – Title, Artist, Album, Track, Year, Genre, Comment and the Artwork. However, I do not want to loop through all available information in my program to get this data. Fortunately the MP3::Tag module provides a autoinfo() function which gets almost all the information needed for us except the Artwork, which we may need to gather separately. The autoinfo() function returns the information about the title, album, artist, track, tear, genre and comment. This information is obtained from ID3v2 tag, ID3v1 tag, CDDB file, .inf file and the mp3 filename itself, where-ever it is found first. The order of this lookup can be changed with the config() command. I want to restrict my cataloging to only ID3v2  and ID3v1 tags.

Following lines provides us with the needed information.

$mp3->config("autoinfo", "ID3v2", "ID3v1");
my ($title, $track, $artist, $album, $comment, $year, $genre) = $mp3->autoinfo();

Getting Artwork Information

The artwork information is stored in the ID3v2 tag in a frame called APIC (stands for Attached PICture). This frame has _Data and MIME Type which we would need for our purpose. In order to extract this frame and its data we do not need to loop in through all the tags. The MP3::Tag module provides us with the get_frame() method, using which we can extract any frame directly like as shown below for artwork –

my $apic_frame = $mp3->{ID3v2}->get_frame("APIC");
my $img_data = $$apic_frame{'_Data'};
my $mime_type = $$apic_frame{'MIME type'};

This $img_data can be written out in a file and the $mime_type can be used as an extension. Thus we can extract the artwork from the MP3 file. The MIME type is something like “image/jpeg” and I have used the split function to get the string for the extension of the file.

my ($mime1, $mime2) = split(/\//, $mime_type);
my $artwork_name = "artwork.$mime2";
open ARTWORK_FILE, ">$artwork_name" 
  or die "Error creating the artwork file";
binmode(ARTWORK_FILE);
print ARTWORK_FILE $img_data;
close ARTWORK_FILE;

Generating the HTML using HTML

This is a simple project so I have used HTML::Template module to generate HTML code to the standard output, which can then in turn be redirected to a file using shell redirection. For a making the table layout less cumbersome, I have used the purecss.io CSS framework. Here my HTML template code.

my $template = <<HTML;
<html>
<head>
<title>My MP3 Catalog</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/pure-min.css">
</head>
<body>
<h1>My MP3 Collection</h1>
<table class="pure-table pure-table-horizontal">
    <thead>
        <tr>
            <th>Album Artwork</th>
			<th>Album</th>
            <th>Track</th>
            <th>Title</th>
            <th>Artist</th>
			<th>Year</th>
			<th>Genre</th>
			<th>Comment</th>
        </tr>
    </thead>

    <tbody>
		<!-- TMPL_LOOP NAME=SONGS -->
		<tr>
			<td><a src="<TMPL_VAR NAME=FILEPATH>"><img src="<TMPL_VAR NAME=IMG>" height="150" width="150"/></a></td>
			<td><!-- TMPL_VAR NAME=ALBUM --></td>
			<td><!-- TMPL_VAR NAME=TRACK --></td>
			<td><!-- TMPL_VAR NAME=TITLE --></td>
			<td><!-- TMPL_VAR NAME=ARTIST --></td>
			<td><!-- TMPL_VAR NAME=YEAR --></td>
			<td><!-- TMPL_VAR NAME=GENRE --></td>
			<td><!-- TMPL_VAR NAME=COMMENT --></td>
		</tr>
		<!-- /TMPL_LOOP -->
    </tbody>
</table>

</body>
</html>
HTML
my $tmpl = HTML::Template->new(scalarref => \$template);

Complete Script

The complete script is on github, you can have a look at –

https://github.com/ajitabhpandey/learn-programming/blob/master/perl/id3-tags-manipulation/genCatalog.pl.

Posted in FLOSS, Programming, Tips/Code Snippets | Tagged , , | Leave a comment

Personal by Lee Child

Personal Book CoverIf I remember correct this is the second book in which Reacher travels outside the United States. But the first time he did was not using his own passport and then only a certain part was spend outside the US. In this story he travels to Paris and then to London and most of the plot is outside the US.

Its a bit different from other Jack Reacher series books. Its a little more descriptive than the previous books. In this book, Reacher needed lot of data from various places in order to get going. You can clearly see Reacher’s vulnerability outside the US.

However, overall Lee Child has done a very good attempt on taking the Reacher series in a different direction. This is not my favourite Reacher book, but its good.

Posted in Book Reviews | Tagged , | Leave a comment

The Eagle Has Flown by Jack Higgins

The Eagle Has Flown Cover ImageAnother excellent 2nd world war story by Jack Higgins. This is in continuation of the first book in Liam Devlin Series – The Eagle Has Landed.  This book is written in the same style as the previous one. Jack Higgins is the one who is being told the story by Liam Devlin. In this book, Liam Devlin is sent by Himmler to London in order to rescue Col Steiner from the British intelligence agency. And this book interestingly turns out to be yet another plot to kill Hitler. The book writing style is quite catching and does not let you easily leave the book in between.

Just like other Jack Higgins books which I have read earlier there is no unnecessary description and no unnecessary heroism in this book and I kind of like it that way.

Posted in Book Reviews | Tagged , | Leave a comment

Chasing The Dime by Michael Connelly

Chasing The Dime Cover ImageThis is an excellent story by Michael Connelly. A little different type of crime plot. The main character of this story is Henry Pierce, who owns a company doing research on molecular computers. Henry’s company has recently achieved a breakthrough, but they are also looking for active private funding. They need to hold off to the patent filing for their innovation until one of the investors have gone through the research and still disagrees for the funding. Meanwhile Henry has recently broken with his girlfriend, Nicole. Nicole who was also working with Henry in his firm is now leaving the firm also and Henry moved away to a different apartment.

With a new phone number at the apartment Henry started receiving calls for some Lily. His curiosity led him to investigate Lily and he found out that she is an escort who is now missing. And then the plot begins. Henry’s curiosity led him to a state where he was being investigate for a murder which he did not commit. However, using some scientific investigative techniques and breaking the problem scientifically Henry was able to uncover the plot to trap him.

I would not divulge more details about it further here. I liked the book, and I hope you would also like it.

Posted in Book Reviews | Tagged , , | Leave a comment