I just discoverer this nice application and I liked a lot, but I miss a feature that is not included in any similar application neither.
But this application has source code available, so I download it and include a little code for this feature, keeping subtitle language, I mean for .srt files ending like this:
TVShow - Season - Episode.Eng.srt
or
TVShow - Season - Episode.Spa.srt
I code this in a few minutes and is not checked properly and I don't know if is coded right way according with the author but I just shared here if someone is interested:
in the function:
- Code: Select all
public void RenameAndMissingCheck(SetProgressDelegate prog, ShowItem specific)
look for the line:
- Code: Select all
if (renCheck && this.Settings.UsefulExtension(fi.Extension, true)) // == RENAMING CHECK ==
and substitute the whole if for this new one:
- Code: Select all
if (renCheck && this.Settings.UsefulExtension(fi.Extension, true)) // == RENAMING CHECK ==
{
string newname;
if (fi.Extension != ".srt")
newname = this.Settings.FilenameFriendly(this.Settings.NamingStyle.NameForExt(ep, fi.Extension));
else
{
//! Code for preserving subtitle language
string subtitleLanguage = "";
string filename = fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length);
int indexDot = filename.LastIndexOf(".");
if (indexDot > filename.Length - 5)
subtitleLanguage = filename.Substring(indexDot, filename.Length - indexDot);
newname = this.Settings.FilenameFriendly(this.Settings.NamingStyle.NameForExt(ep, fi.Extension));
newname = newname.Substring(0, newname.Length - fi.Extension.Length) + subtitleLanguage + fi.Extension;
}
if (newname != actualFile.Name)
{
actualFile = Helpers.FileInFolder(folder, newname); // rename updates the filename
this.TheActionList.Add(new ActionCopyMoveRename(ActionCopyMoveRename.Op.Rename, fi, actualFile, ep));
}
}
I would like to say a BIG THANK YOU to the author of this cool application TVRename. If you do not like this, please feel free to delete it
Best regards,
Rafa
