Advertisement
filebot

Fetch Each Episode Subtitle

Oct 25th, 2013
745
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.55 KB | None | 0 0
  1. def osdb = net.sourceforge.filebot.WebServices.OpenSubtitles
  2.  
  3. def query = 'firefly'
  4. def language = 'English'
  5.  
  6. def options = osdb.search(query)
  7. println "Fetching subtitles for '${options[0]}'"
  8.  
  9.  
  10. def subs = osdb.getSubtitleList(options[0], language)
  11. println "Found ${subs.size()} subtitles"
  12.  
  13. def selection = subs.findAll{ it.languageName =~ language && parseEpisodeNumber(it.name) != null }.groupBy{ parseEpisodeNumber(it.name) }.values()*.get(0)
  14. println "Selected ${selection.size()} subtitles"
  15.  
  16. selection.each{
  17.     println it.fetch().saveAs(it.path)
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement