How to quicky find subtitles on web

Hi,

I have entitled all my movies in format: Director (Year) - Name (AKA Name).avi

e. g.: Zemeckis, Robert (1994) - Forrest Gump.avi

And I wanted to find subtitles on www.opensubtitles.com
The search formula is:
opensubtitles.com/cs/search2 ... est%20gump

Do you think it is possible to do it by a script assigned to some button?
I need to separate name (text between '-' and '(' or '.' ) and then make some search (the space is replace by %20), right? But I don't know how to do it... Can anyone help? :slight_smile:

Thank you!

I think something like this is best handled by a little VBScript glue. If you know a bit of VBScript (or don't mind learning), the script in this thread should serve as a good starting point:

[Working with Variable Strings and Substrings)

The most difficult thing that needs adding is URL-encoding (%20 instead of space, etc.) of the filename.

Learning? I wanted to avoid this horrible painful activity by posting my question. Oh, well... I'll try. :slight_smile:

Thanks anyway. :slight_smile:

Well, it was quite challenging, but after one evening I made it! :slight_smile:

In button fileld must be:
Find_Subtitles.vbs {file$|noext}

You also must specify where the VBScrip file is saved (in 'Start in' field)

[code]option explicit

Dim Args
Dim Pos
Dim Name
Dim CutName
Dim UrlToLaunch
Dim Shell
Dim regex

Set Args = WScript.Arguments
Set Shell = CreateObject("WScript.Shell")
Set regex = new RegExp

'Ignore Case-sensitive matching
regex.IgnoreCase = true

'All matches will be replaced, not just the first match
regex.Global = true

'Get 1st argument after script name: {file$|noext}
Name = Args.Item(0)

'Spaces are replaced by %20
regex.Pattern = " "
Name = regex.Replace(Name, "%20")

'Name of movie is cut off from its left part
'- 3 means %20 after dash
Pos = Len(Name) - InStr(Name,"-") - 3
CutName = Right(Name, Pos)

'Name of movie is cut off from its right part
if InStr (1, CutName,"(", 0) <> 0 Then
Pos = InStr(CutName,"(") - 4
CutName = Left(CutName, Pos)
elseif Instr (1, CutName,"[", 0) <> 0 Then
Pos = InStr(CutName,"[") - 4
CutName = Left(CutName, Pos)
elseif Instr (1, CutName,".", 0) <> 0 Then
Pos = InStr(CutName,".") - 1
CutName = Left(CutName, Pos)
end if

UrlToLaunch = "http://www.opensubtitles.com/cs/search2/sublanguageid-slo,cze,eng/moviename-" + CutName

Shell.Run UrlToLaunch[/code]

I must also thank to searcher123. His script helped me a lot:
[url]A question about rename scripting and RegEx]
Find_Subtitles.rar (662 Bytes)