Renaming TS files on PC

Forum Forums Freeview SD PVR 9150T, 9200T, 9300T Renaming TS files on PC

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #12254
    Anonymous
    Inactive

    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.

    #27357
    grahamlthompson
    Participant

    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 ?

    #27358
    myhumax
    Participant

    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…

    #27359
    Anonymous
    Inactive

    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.

    :)

    #27360
    grahamlthompson
    Participant

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

    #27361
    Anonymous
    Inactive

    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.

    #27362
    myhumax
    Participant

    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…

    #27363
    myhumax
    Participant

    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.

    Code:
    #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: $1n”;
    #if filename matches first word of title then we have the correct synopsis
    if($file=~ /$1/)
    {
    # do nothing
    print “matched first entry in epgn”;
    }
    #else look at the 2nd EPG entry
    else
    {
    # check for next epg entry
    print “getting second epg entryn”;
    $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: $1n”;
    #if episode name exists, rename all files with episode name appended
    if($1)
    {
    @fname=split(/./,$file);
    print “renaming $file $fname[0] $1n”;
    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 namen”;
    }
    }

    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.

    [attachment=1718,44]

    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…

    #27364
    Anonymous
    Inactive

    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.

    :D

    #27365
    Anonymous
    Inactive

    Ok I changed the end of the script a little

    Code:
    rename (“$fname[0].ts”,”$fname[0] $1.ts”);

    to

    Code:
    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, :)

    #27366
    Anonymous
    Inactive

    I am sometiems using this code on the odd file. I am no programmer but this is where I have got to so far, it just dumps all the information minus some dodgy charter.

    This code could be a whole lot better and I will try and improve it. Just thought I’d share where I’ve got to with your help. :-)

    Code:
    #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: $1n”;

    #if filename matches first word of title then we have the correct synopsis
    if($file=~ /$1/)
    {
    # do nothing
    print “matched first entry in epgn”;
    }
    #else look at the 2nd EPG entry
    else
    {
    # check for next epg entry
    print “getting second epg entryn”;
    $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 ‘:’
    print “desc is: $descn”;
    $title =~ s/…//g;
    $title =~ s/:/-/g;
    $title =~ s/,/-/g;
    $title =~ s/;/-/g;
    $title =~ s/?/-/g;
    $desc =~ s/…//g;
    $desc =~ s/./,/g;
    $desc =~ s/?/-/g;
    $desc =~ s//+/of/g;
    $desc =~ s/[//g;
    $desc =~ s/]//g;
    $desc =~ s/:/-/g;
    $desc =~ s/,/-/g;
    $desc =~ s/;/-/g;
    print “desc2 is: $descn”;
    print “title is: $titlen”;
    $Ndesc=substr($desc,0,44);
    #$desc =~ /s+([w+s*]+):.*/;
    print “short name is: $Ndesc”;

    #if episode name exists, rename all files with episode name appended
    if($desc)
    {
    @fname=split(/./,$file);
    print ” ok– $fname[0]”;
    print ” renaming $file $title – $Ndesc”;
    rename (“$fname[0].epg”,”$title – $Ndesc.epg”);
    rename (“$fname[0].elu”,”$title – $Ndesc.elu”);
    rename (“$fname[0].hre”,”$title – $Ndesc.hre”);
    rename (“$fname[0].ts”,”$title – $Ndesc.ts”);
    }
    else
    {
    print “no episode namen”;
    }
    }

    #27367
    Anonymous
    Inactive

    And this code to get the date off films only and add them to tile in brackets.

    Code:
    #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: $1n”;

    #if filename matches first word of title then we have the correct synopsis
    if($file=~ /$1/)
    {
    # do nothing
    print “matched first entry in epgn”;
    }
    #else look at the 2nd EPG entry
    else
    {
    # check for next epg entry
    print “getting second epg entryn”;
    $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 =~ /(d{4})/;
    print “Episode name: $1n”;

    #if episode name exists, rename all files with episode name appended
    if($1)
    {
    @fname=split(/./,$file);
    print “renaming $file $title $1n”;
    rename (“$fname[0].epg”,”$title ($1).epg”);
    rename (“$fname[0].elu”,”$title ($1).elu”);
    rename (“$fname[0].hre”,”$title ($1).hre”);
    rename (“$fname[0].ts”,”$title ($1).ts”);
    }
    else
    {
    print “no episode namen”;
    }
    }

    #27368
    myhumax
    Participant

    Nice to see you getting to grips with Perl and making improvements… Yes, there’s no accounting for dodgy characters and not much error checking in the quick and dirty script.

    simple – 7 hours ago  » 

    Code:
    $title =~ s/…//g;
    $title =~ s/:/-/g;
    $title =~ s/,/-/g;
    $title =~ s/;/-/g;
    $title =~ s/?/-/g;
    $desc =~ s/…//g;
    $desc =~ s/./,/g;
    $desc =~ s/?/-/g;
    $desc =~ s//+/of/g;
    $desc =~ s/[//g;
    $desc =~ s/]//g;
    $desc =~ s/:/-/g;
    $desc =~ s/,/-/g;
    $desc =~ s/;/-/g;

    You can replace all the code above by placing the characters in square brackets, like so:

    Code:
    $title =~ s/[.:+,[]?]/-/g;
    $desc =~ s/[.:+,[]?]/-/g;

    Or safer to only allow normal characters (the ^ at the start means not matching):

    Code:
    $title =~ s/[^A-Za-z0-9]/_/g;
    $desc =~ s/[^A-Za-z0-9]/_/g;

    I prefer replacing these with an underscore ‘_’. You can also read in an argument to switch between movie and series renaming like so:

    Code:
    $type = $ARGV[0];
    if($type eq ‘movie’) { #do movie name processing here };
    if($type eq ‘series’) { #do series name processing here };

    Then you can call up the program in the cmd using:

    Code:
    humax.pl movie

    Or

    Code:
    humax.pl series

    #27369
    Anonymous
    Inactive

    is this posting still open for adding onto?

    #27370
    Anonymous
    Inactive

    As you just did, I guess the answer would be “Yes”.

Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.

The inner genius!