My Humax Forum » Freeview SD » PVR 9150T, 9200T, 9300T

Renaming TS files on PC

(16 posts)
  1. User has not uploaded an avatar

    simple

    junior member
    Joined: Jul '11
    Posts: 7

    offline

    Can anyone help me?
    I have only managed to transfer files over to my PC using humaxRW. I'm not using a USB hook-up and HummyReadFiles094 made lots of errors. So the humaxRW file dump was the only option.

    I want to rename the TS files using the *.epg file to include the programs full title and maybe even use the other information in some sort of tag.
    I would also like to be able to compress the TS files and keep the subtitle embedded in the original recording.

    That's a wish list but first the naming would be really great to be able to see the names of different episodes. The EPG file has the same name as the TS file but each TS file has its own EPG file.
    A batch renamer with some coding abilities or a way to rename the files on the hard disk with out the USB hook-up.

    Any help would be great, I've already spent loads of time searching but can not seem to find any answers.

    | Mon 18 Jul 2011 2:05:55 #1 |
  2. grahamlthompson

    grahamlthompson

    special member
    Joined: Feb '11
    Posts: 14,442

    offline

    Try this out

    http://www.bulkrenameutility.co.uk/Main_Intro.php

    If that's no good have you a copy of a genuine Microsoft Excel running on a PC ?

    | Mon 18 Jul 2011 9:46:49 #2 |
  3. myhumax

    myhumax

    senior admin
    Joined: Feb '11
    Posts: 453

    offline

    simple - 8 hours ago  » 

    I want to rename the TS files using the *.epg file to include the programs full title and maybe even use the other information in some sort of tag.

    Install Perl and write a renaming script... I had a go at this a long while back but found no one was really interested... But could have another go...

    | Mon 18 Jul 2011 10:10:21 #3 |
  4. User has not uploaded an avatar

    simple

    junior member
    Joined: Jul '11
    Posts: 7

    offline

    Great thanks, I think a Perl script will be the way. I'll have a look and see if I can figure it out.

    I don't have excel installed using open office instead. I did see a method using excel but was it able to get information from a txt or epg file?

    Anuhow thank for all the help. I'll let you know how I get on.

    | Mon 18 Jul 2011 21:26:39 #4 |
  5. grahamlthompson

    grahamlthompson

    special member
    Joined: Feb '11
    Posts: 14,442

    offline

    Using vba it's quite easy to read filenames in Excel. Renaming them would be fairly easy.

    | Mon 18 Jul 2011 22:01:48 #5 |
  6. User has not uploaded an avatar

    simple

    junior member
    Joined: Jul '11
    Posts: 7

    offline

    I do not think I'm going to be able to get my head around Perl any time soon.
    If you can offer any help Son-T that would be great; you really are a bright light. I'm going to be using this system for a while as I've this PVR built it to my TV...

    While posting I'd also like to thank everyone for all their efforts. I would never of got this far on my own. Just being able to backup and save recordings for prosperity is really cool. Thanks.

    | Wed 20 Jul 2011 17:56:40 #6 |
  7. myhumax

    myhumax

    senior admin
    Joined: Feb '11
    Posts: 453

    offline

    If you look on the humaxdisk wiki (http://humaxdisk.wikispaces.com/HumaxRW+scripts). There some Perl scripts written to work with humaxrw that I wrote sometime ago.

    You can have a look at this and learn a bit of Perl while I find sometime to look at writing the script for what you want to do.

    You could also contact xyz321 (PM him on this forum) who wrote humaxrw to see if he can easily add the renaming of recordings using their EPG info, straight into his application...

    | Thu 21 Jul 2011 9:56:48 #7 |
  8. myhumax

    myhumax

    senior admin
    Joined: Feb '11
    Posts: 453

    offline

    Here's a quick and dirty Perl script that I've just knocked up... It just looks in the current directory for .epg files and grabs the episode titles and renames the files with it appended. You should be able to modify it to your own liking as I've commented most of what it does.


    #look for all epg files in current directory
    @epgfiles = glob("*.epg");
    foreach $file(@epgfiles)
    {
    #open epg file and get programme title and description
    open(IN,"<$file") or die "Error: cannot open file $file";
    $epg=<IN>;
    close(IN);
    #get title at specific location (1st entry)
    $title=substr($epg,22,49);
    $title=~ s/(00+$)//g;
    #get synopsis at specific location (1st entry)
    $desc=substr($epg,74,254);
    $desc=~ s/(00+$)//g;
    # grab the first word of title in epg
    $title =~ /(\w+)/;
    print "EPG title: $1\n";
    #if filename matches first word of title then we have the correct synopsis
    if($file=~ /$1/)
    {
    # do nothing
    print "matched first entry in epg\n";
    }
    #else look at the 2nd EPG entry
    else
    {
    # check for next epg entry
    print "getting second epg entry\n";
    $title=substr($epg,354,49);
    $title=~ s/(00+$)//g;
    $desc=substr($epg,406,254);
    $desc=~ s/(00+$)//g;
    # print ">$title<\n>$desc<\n";
    }
    # search for episode name between '.' and ':'
    $desc =~ /\s+([\w+\s*]+):.*/;
    print "Episode name: $1\n";
    #if episode name exists, rename all files with episode name appended
    if($1)
    {
    @fname=split(/\./,$file);
    print "renaming $file $fname[0] $1\n";
    rename ("$fname[0].epg","$fname[0] $1.epg");
    rename ("$fname[0].elu","$fname[0] $1.elu");
    rename ("$fname[0].hre","$fname[0] $1.hre");
    rename ("$fname[0].ts","$fname[0] $1.ts");
    }
    else
    {
    print "no episode name\n";
    }
    }

    If you want to purchase a renaming program, I highly recommend Flash Renamer (used to be called FlashIt Renamer), currently only about £16. Help this site by buying it via this link.

    You can download a functional trial from the Windows Utilities download section.

    Obviously, it won't rename the files achieved off the PVR using humaxrw as required above. But it will rename multiple files using rules (capitalise, truncate, search and replace, etc) or using Exif & IPTC tags. So it will be useful for all sorts of renaming, e.g. photos, MP3, etc. Just remember to buy or register it via the purchase links posted here, especially if you download the trial version and decided it is useful...

    Attachments

    1. humax.pl (1.4 KB, 1 downloads) 12 years old
    2. flashrenamer.gif (42.1 KB, 4 downloads) 12 years old
    | Thu 21 Jul 2011 13:14:37 #8 |
  9. User has not uploaded an avatar

    simple

    junior member
    Joined: Jul '11
    Posts: 7

    offline

    Thanks, that is great.
    Mostly that works and it really helps. THANKS.
    I think it fails if it come across an uncommon expression like ( or / and such.

    | Fri 22 Jul 2011 17:33:00 #9 |
  10. User has not uploaded an avatar

    simple

    junior member
    Joined: Jul '11
    Posts: 7

    offline

    Ok I changed the end of the script a little


    rename ("$fname[0].ts","$fname[0] $1.ts");

    to

    rename ("$fname[0].ts","$title - $1.ts");

    though the ideal code would have the first 13 characters of "$fname[0]" at the end of the file to preserve any unique ID.
    I am doing this as if the names been shortened it uses ... to separate the the two half of the file name and it can not cope with : in the title, like this
    "i7The Story of Science: Power,... i7...Proof and Passion. 3/6. How Did We Get Here?: Michael M"

    Also I would like to be able to keep 2/3 or 1/5 in the file name as 2of3 or 1of5 but your code seems to remove any numbers from the $fname and I can't figure it out or how to change / to 'of' ....right now.

    Thanks again,

    | Fri 22 Jul 2011 22:51:54 #10 |

RSS feed for this topic

Reply »

You must log in to post.