package org.lodder.subtools.multisubdownloader.lib.control;

import java.util.List;

import org.lodder.subtools.multisubdownloader.settings.model.Settings;
import org.lodder.subtools.sublibrary.Manager;
import org.lodder.subtools.sublibrary.data.IMDB.IMDBAPI;
import org.lodder.subtools.sublibrary.data.IMDB.IMDBException;
import org.lodder.subtools.sublibrary.data.IMDB.IMDBSearchID;
import org.lodder.subtools.sublibrary.data.IMDB.model.IMDBDetails;
import org.lodder.subtools.sublibrary.exception.ReleaseControlException;
import org.lodder.subtools.sublibrary.logging.Logger;
import org.lodder.subtools.sublibrary.model.MovieRelease;
import org.lodder.subtools.sublibrary.settings.model.MappingTvdbScene;

public class MovieReleaseControl extends ReleaseControl {
  private final IMDBSearchID imdbSearchID;
  private final IMDBAPI imdbapi;

  public MovieReleaseControl(MovieRelease movieRelease, Settings settings, Manager manager) {
    super(movieRelease, settings, manager);
    imdbapi = new IMDBAPI(manager);
    imdbSearchID = new IMDBSearchID(manager);
  }

  @Override
  public void process(List<MappingTvdbScene> dict) throws ReleaseControlException {
    Logger.instance.trace("MovieFileControl", "process", "");
    MovieRelease movieRelease = (MovieRelease) release;
    if (movieRelease.getTitle().equals("")) {
      throw new ReleaseControlException("Unable to extract/find title, check file", release);
    } else {
      int imdbid = -1;
      try {
        imdbid = imdbSearchID.getImdbId(movieRelease.getTitle(), movieRelease.getYear());
        if (imdbid > 0) {
          movieRelease.setImdbid(imdbid);
          IMDBDetails imdbinfo;

          imdbinfo = imdbapi.getIMDBMovieDetails(movieRelease.getImdbidAsString());
          if (imdbinfo != null) {
            movieRelease.setYear(imdbinfo.getYear());
            movieRelease.setTitle(imdbinfo.getTitle());
          } else {
            Logger.instance
                .error("Unable to get details from IMDB API, continue with filename info" + release);
          }
        } else {
          throw new ReleaseControlException("Movie not found on IMDB, check file", release);
        }
      } catch (IMDBException e) {
        throw new ReleaseControlException("IMDBAPI Failed", release);
      }
    }
  }

}

@@ -522,62 +522,8 @@
 on;%0A
-import org.lodder.subtools.sublibrary.logging.Logger;%0A
 impo
@@ -576,16 +576,16 @@
 elease;%0A
+
 import o
@@ -646,16 +646,73 @@
 dbScene;
+%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;
 %0A%0Apublic
@@ -838,16 +838,110 @@
 imdbapi;
+%0A  %0A  private static final Logger LOGGER = LoggerFactory.getLogger(MovieReleaseControl.class);
 %0A%0A  publ
@@ -1259,70 +1259,8 @@
 n %7B%0A
-    Logger.instance.trace(%22MovieFileControl%22, %22process%22, %22%22);%0A
     
@@ -1954,39 +1954,13 @@
    L
-ogger.instance%0A                
+OGGER
 .err
@@ -2031,11 +2031,13 @@
 info
-%22 +
+ %7B%7D%22,
  rel

Convert MovieReleaseControl from old logger to new LOGGER slf4j