com.moviejukebox.plugin.ImdbPlugin Maven / Gradle / Ivy
Show all versions of yamj Show documentation
/*
* Copyright (c) 2004-2013 YAMJ Members
* http://code.google.com/p/moviejukebox/people/list
*
* This file is part of the Yet Another Movie Jukebox (YAMJ).
*
* The YAMJ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* YAMJ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the YAMJ. If not, see .
*
* Web: http://code.google.com/p/moviejukebox/
*
*/
package com.moviejukebox.plugin;
import static com.moviejukebox.tools.PropertiesUtil.FALSE;
import static com.moviejukebox.tools.PropertiesUtil.TRUE;
import static com.moviejukebox.tools.StringTools.isNotValidString;
import static com.moviejukebox.tools.StringTools.isValidString;
import static com.moviejukebox.tools.StringTools.trimToLength;
import java.io.IOException;
import java.net.MalformedURLException;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.pojava.datetime.DateTime;
import com.moviejukebox.model.Award;
import com.moviejukebox.model.AwardEvent;
import com.moviejukebox.model.Filmography;
import com.moviejukebox.model.Identifiable;
import com.moviejukebox.model.ImdbSiteDataDefinition;
import com.moviejukebox.model.Library;
import com.moviejukebox.model.Movie;
import com.moviejukebox.model.MovieFile;
import com.moviejukebox.model.Person;
import com.moviejukebox.scanner.artwork.FanartScanner;
import com.moviejukebox.tools.AspectRatioTools;
import com.moviejukebox.tools.FileTools;
import com.moviejukebox.tools.HTMLTools;
import com.moviejukebox.tools.OverrideTools;
import com.moviejukebox.tools.PropertiesUtil;
import com.moviejukebox.tools.StringTools;
import com.moviejukebox.tools.SystemTools;
import com.moviejukebox.tools.WebBrowser;
public class ImdbPlugin implements MovieDatabasePlugin {
public static final String IMDB_PLUGIN_ID = "imdb";
private static final Logger LOG = Logger.getLogger(ImdbPlugin.class);
private static final String LOG_MESSAGE = "ImdbPlugin: ";
protected String preferredCountry;
private String imdbPlot;
protected WebBrowser webBrowser;
protected boolean downloadFanart;
private boolean extractCertificationFromMPAA;
private boolean fullInfo;
protected String fanartToken;
protected String fanartExtension;
private int preferredBiographyLength;
private int preferredFilmographyMax;
protected int actorMax;
protected int directorMax;
protected int writerMax;
private int triviaMax;
protected ImdbSiteDataDefinition siteDefinition;
protected static final String DEFAULT_SITE_DEF = "us";
protected ImdbInfo imdbInfo;
protected AspectRatioTools aspectTools;
private boolean skipFaceless;
private boolean skipVG;
private boolean skipTV;
private boolean skipV;
private List jobsInclude;
private boolean scrapeAwards; // Should we scrape the award information
private boolean scrapeWonAwards;// Should we scrape the won awards only
private boolean scrapeBusiness; // Should we scrape the business information
private boolean scrapeTrivia; // Shoulw we scrape the trivia information
// Literals
private static final String HTML_H5_END = ":";
private static final String HTML_H5_START = "";
private static final String HTML_DIV = "