sublight.si Wiki

searching subtitles has never been this easy
Sublight icon
RSS

Navigation





Quick Search
»
Advanced Search »

PoweredBy

Sublight: subtitle naming script examples

RSS
Modified on 2012/03/17 10:56 by macofaco Categorized as Help, Sublight
String variables
%imdb%IMDb ID
%title%Movie / TV Series title
%publisher%Publisher username
%extension%subtitle file extension
%id%subtitle ID
%llll%subtitle language
%ll%two-character subtitle language
%original_filename%original subtitle filename


Boolean variables
%has_episode%can be used to determine if subtitle is for movie or TV Series
%is_external%is subtitle from Sublight database or external source


Integer variables
%year%Movie / TV Series original year
%season%TV Series season
%episode%TV Series episode
%partnum%part number if subtitle is splitted into multiple files
%parts%total number of subtitle parts (in most cases this is 1)




Default script:

if (%is_external%)
{
    //external subtitles probably don't have all details so we use original filename
    return %original_filename%;
}

//subtitle is from Sublight database which have all details
string fileName;
if (%has_episode%)
{
    fileName = string.Format("{0} ({1}), S{2:00}E{3:00} - {4}", %title%, %year%, %season%, %episode%,  %ll%);
}
else
{
    fileName = string.Format("{0} ({1}) - {2}", %title%, %year%, %ll%);
}

if (%parts% > 1)
{
    //append part number
    fileName += string.Format(" - {0} of {1}", %partnum%, %parts%);
}

//append extension
fileName += string.Format(".{0}", %extension%);

//replace any invalid characters with empty string and return result
return EnsureValidFileName(fileName, string.Empty);

Output example:

The Big Bang Theory (2007), S05E12 - en.srt
Godfather, The (1972) - es - 1 of 2.sub
Godfather.1974.MyDvdBackup (AutoSearch).sub

Powered by ScrewTurn Wiki