Forum › Forums › Freeview SD › PVR 9150T, 9200T, 9300T › Renaming TS files on PC
- This topic has 15 replies, 5 voices, and was last updated 7 years, 2 months ago by
Anonymous.
-
AuthorPosts
-
July 18, 2011 at 1:05 am #12254
Anonymous
InactiveCan 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.
July 18, 2011 at 8:46 am #27357grahamlthompson
ParticipantTry 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 ?
July 18, 2011 at 9:10 am #27358myhumax
Participantsimple – 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…
July 18, 2011 at 8:26 pm #27359Anonymous
InactiveGreat 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.
July 18, 2011 at 9:01 pm #27360grahamlthompson
ParticipantUsing vba it’s quite easy to read filenames in Excel. Renaming them would be fairly easy.
July 20, 2011 at 4:56 pm #27361Anonymous
InactiveI 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.
July 21, 2011 at 8:56 am #27362myhumax
ParticipantIf 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…
July 21, 2011 at 12:14 pm #27363myhumax
ParticipantHere’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…
July 22, 2011 at 4:33 pm #27364Anonymous
InactiveThanks, 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.
July 22, 2011 at 9:51 pm #27365Anonymous
InactiveOk 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,
July 25, 2011 at 12:47 am #27366Anonymous
InactiveI 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”;
}
}July 25, 2011 at 4:43 am #27367Anonymous
InactiveAnd 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”;
}
}July 25, 2011 at 8:27 am #27368myhumax
ParticipantNice 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 movieOr
Code:humax.pl seriesSeptember 29, 2018 at 9:49 am #27369Anonymous
Inactiveis this posting still open for adding onto?
September 29, 2018 at 12:40 pm #27370Anonymous
InactiveAs you just did, I guess the answer would be “Yes”.
-
AuthorPosts
- You must be logged in to reply to this topic.