package org.lodder.subtools.multisubdownloader.lib;

import java.util.ArrayList;
import java.util.List;

import org.lodder.subtools.sublibrary.JSubAdapter;
import org.lodder.subtools.sublibrary.control.VideoFileParser;
import org.lodder.subtools.sublibrary.logging.Logger;
import org.lodder.subtools.sublibrary.model.EpisodeFile;
import org.lodder.subtools.sublibrary.model.MovieFile;
import org.lodder.subtools.sublibrary.model.Subtitle;
import org.lodder.subtools.sublibrary.model.SubtitleMatchType;
import org.lodder.subtools.sublibrary.subtitlesource.subsmax.JSubsMaxApi;
import org.lodder.subtools.sublibrary.subtitlesource.subsmax.model.SubMaxSubtitleDescriptor;

public class JSubsMaxAdapter implements JSubAdapter {

  private static JSubsMaxApi jsmapi;

  public JSubsMaxAdapter() {
    try {
      if (jsmapi == null) {
        jsmapi = new JSubsMaxApi();
      }
    } catch (Exception e) {
      Logger.instance.error("API JSubsMax INIT: " + e.getCause());
    }
  }

  @Override
  public List<Subtitle> searchSubtitles(EpisodeFile episodeFile, String... sublanguageids) {
    List<SubMaxSubtitleDescriptor> lSubtitles =
        jsmapi.searchSubtitles(episodeFile.getShow(), episodeFile.getSeason(), episodeFile
            .getEpisodeNumbers().get(0), sublanguageids[0]);
    
    List<Subtitle> listFoundSubtitles = new ArrayList<Subtitle>();
    
    for (SubMaxSubtitleDescriptor sub:lSubtitles){
      listFoundSubtitles.add(new Subtitle(Subtitle.SubtitleSource.SUBSMAX, sub.getFilename(),
        sub.getLink(), sublanguageids[0], "", SubtitleMatchType.EVERYTHING, VideoFileParser
            .extractTeam(sub.getFilename()), "", false));
    }
    
    return listFoundSubtitles;
  }

  @Override
  public List<Subtitle> searchSubtitles(MovieFile movieFile, String... sublanguageids) {
    // TODO Auto-generated method stub
    return null;
  }

}

@@ -1074,24 +1074,224 @@
 guageids) %7B%0A
+    String showName = %22%22;%0A    if (episodeFile.getOriginalShowName().length() %3E 0) %7B%0A      showName = episodeFile.getOriginalShowName();%0A    %7D else %7B%0A      showName = episodeFile.getShow();%0A    %7D%0A    %0A
     List%3CSub
@@ -1357,37 +1357,24 @@
 btitles(
-episodeFile.getShow()
+showName
 , episod

Add showOriginilName to SubsMax search