Infofinder - all the programme info in one go

Sam Widges

Active Member
In preparation for returning my HDR for repair, I'm working on a couple of scripts to help people in a similar position make the best of a bad situation.

This script will read the contents of your HMT files (one of the sidecar filetypes) and will produce a sorted list of the filename and the programme info. Therefore, even if you move the files elsewhere, you can store the output of this script as well and have a better index - with a bit of tweaking, you could even turn the output into a webpage and make it browseable.

Here is some output from the tail end of my last run:
Code:
Wives and Daughters_20110617_0400
Scandal and Its Victim
Lady Harriet tries to redeem Molly's reputation and Cynthia has to face up to her past. With Tom Wilkinson and Angela Pleasence. Episode 8 of 9.

Wives and Daughters_20110618_0400
Reviving Hopes and Brightening Prospects
What will become of Osborne's wife and child? And is a marriage proposal on its way to Cynthia? Starring Kathryn Hurlbutt. Episode 9 of 9.

Zodiac_20110522_2201
Thriller based on real events, dramatising cartoonist and author Robert Graysmith's attempts to identify the so-called Zodiac killer. [2007] [AD,S]

Here is the script for 'infofinder.pl' itself
Code:
use strict;

my @hmtfiles = `find "/mnt/hd2/My Video" -name '*.hmt'`;

my %fileinfo;

foreach my $file (@hmtfiles) {

        #print "Processing: $file";

        local $/ = "\0";

        open INFILE, "<$file";
        binmode INFILE;

        my $prog;

        read (INFILE, $prog, 383);
        $prog = <INFILE>;
        my $filename = $prog;
        #print "$prog\n";

        my $length = (666-383-length($prog));

        read (INFILE, $prog, $length);

        $prog = <INFILE>;
        my $title = $prog;
        #print "$prog\n";

        $length = (1303-666-length($prog));
        read (INFILE, $prog, $length);

        $prog = <INFILE>;
        #print "The marker: $prog\n";

        $length = (1559-1303-length($prog)+index ($prog,$title));
        read (INFILE, $prog, $length);

        $prog = <INFILE>;
        #print "$prog\n";

        close INFILE;

        $fileinfo {$filename}=$prog;
}

foreach my $key ( sort keys %fileinfo ) {
        print "$key\n";
        $fileinfo{$key} =~ s/: /\n/;
        print "$fileinfo{$key}\n\n";
}

Please note, the script was written to be flexible and easily modified and for my own use (it's not pretty!), but if anyone wants to have a play or to convert it into jim, let me know.

To run the script, you will need to be running the custom firmware and have the perl package installed then it's simply a matter of
Code:
perl infofinder.pl
 
70 views and no comments which seems a little strange.

Out of interest, is it the need for Perl that is putting people off, or is it just that the script isn't useful to most?

What if I packaged it up so that it was more point-and-click?
 
Speaking for myself: I am interested but don't have the immediate need (therefore viewed without posting a comment), and fiddling with scripts would take me rather more motivation to overcome the "how do I do that" issue when there are many other demands on my time. A button to do it from the web interface and present the results on a browser page with the option to save them locally in a text file or something would make it all much more user-friendly.

I'm sure you will get far more response when a few people try it out, and even more if it doesn't work for them!

I think I speak for everybody to say we are all grateful for your effort... might just warrant me adding you to the credit list of BYTs!
 
I think I speak for everybody to say we are all grateful for your effort... might just warrant me adding you to the credit list of BYTs!

I thought I'd earned that accolade with the auto-filer, but I'll keep trying nonetheless.

I know what you mean about when scripts break - that certainly gets the posts flowing ;)

My next script will do a full export of all programmes to an external hard-drive - watch this space...
 
7
Out of interest, is it the need for Perl that is putting people off, or is it just that the script isn't useful to most?

Read it but looked fine to me : )
I'd have written it in jim but that wouldn't improve it, just personal preference.
 
Happy to swap notes but I'll let you work out how to achieve the benefits of Perl hashes in Jim!
Jim has dictionaries (effectively the same thing - even implemented using a hash table in the backend just like in Perl). There's no reason to change what you have though - I just write enough perl in my day job so jim is a refreshing change : )
 
@af123 - if you can convert it into jim, then it could be integrated into the webif frontend and I'd be happy to contribute on the conversion. I've dabbled with TCL in the past but I tend to just use sh/bash or I go for the big guns like Perl, which is what I did here.
 
Back
Top