• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MovieDbException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.omertron.themoviedbapi.MovieDbException的典型用法代码示例。如果您正苦于以下问题:Java MovieDbException类的具体用法?Java MovieDbException怎么用?Java MovieDbException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MovieDbException类属于com.omertron.themoviedbapi包,在下文中一共展示了MovieDbException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getMovie

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
public static Movie getMovie(MovieInfo movieInfo, Torrent torrent) {
Movie movie = torrent != null ? torrent.getMovie() : null;
if (movie == null) {
    movie = new Movie();
    if (torrent != null) {
	torrent.setMovie(movie);
    }
}
movie.setTitle(movieInfo.getTitle());
movie.setOriginalTitle(movieInfo.getOriginalTitle());
if (StringUtils.isNotBlank(movieInfo.getOverview())) {
    movie.setPlot(movieInfo.getOverview());
}
try {
    Configuration configuration = instance.getConfiguration();
    String posterPath = configuration.createImageUrl(movieInfo.getPosterPath(), configuration.getPosterSizes().get(0)).toExternalForm();
    if (StringUtils.isNotBlank(posterPath)) {
	movie.setPoster(posterPath);
    }
} catch (MovieDbException e) {
    e.printStackTrace();
}
return movie;
   }
 
开发者ID:crsmoro,项目名称:vntscraper,代码行数:25,代码来源:TheMovieDbApi.java


示例2: MovieDbPosterPlugin

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
public MovieDbPosterPlugin() {
    super();

    // Check to see if we are needed
    if (!isNeeded()) {
        return;
    }

    languageCode = PropertiesUtil.getProperty("themoviedb.language", "en");

    if (languageCode.length() > 2) {
        languageCode = languageCode.substring(0, 2).toLowerCase();
    }
    LOG.debug("Using '{}' as the language code", languageCode);

    try {
        tmdb = new TheMovieDbApi(apiKey, YamjHttpClientBuilder.getHttpClient());
    } catch (MovieDbException ex) {
        LOG.warn("Failed to initialise TheMovieDB API.");
        LOG.warn(SystemTools.getStackTrace(ex));
    }
}
 
开发者ID:YAMJ,项目名称:yamj-v2,代码行数:23,代码来源:MovieDbPosterPlugin.java


示例3: getPosterUrl

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
@Override
public IImage getPosterUrl(String id) {
    URL posterURL;

    if (StringUtils.isNumeric(id)) {
        try {
            MovieInfo moviedb = tmdb.getMovieInfo(Integer.parseInt(id), languageCode);
            LOG.debug("Movie found on TheMovieDB.org: http://www.themoviedb.org/movie/{}", id);
            posterURL = tmdb.createImageUrl(moviedb.getPosterPath(), DEFAULT_POSTER_SIZE);
            return new Image(posterURL.toString());
        } catch (MovieDbException ex) {
            LOG.warn("Failed to get the poster URL for TMDB ID {} {}", id, ex.getMessage());
        }
    }
    return Image.UNKNOWN;
}
 
开发者ID:YAMJ,项目名称:yamj-v2,代码行数:17,代码来源:MovieDbPosterPlugin.java


示例4: init

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
public void init() throws ServletException {
  InitializeWCR initWcr = new InitializeWCR();
  BackgroundTopology t = new BackgroundTopology();
  //		boolean isFakeTopologyForTest = false;
  boolean isFakeTopologyForTest = true;

  try {
    initWcr.getWiseCrowdRecConfigInfo();
    initWcr.twitterInitBack();
    initWcr.cassandraInitial();
    initWcr.coreNLPInitial();
    initWcr.themoviedbOrgInitial();
    initWcr.rabbitmqInit();

    t.startTopology(isFakeTopologyForTest, "wcr_topology_back", "I rated #IMDb");
  } catch ( NoSuchFieldException | IllegalAccessException | InstantiationException
      | ClassNotFoundException | URISyntaxException | IOException | TException | MovieDbException e) {
    e.printStackTrace();
  }
}
 
开发者ID:faustineinsun,项目名称:WiseCrowdRec,代码行数:21,代码来源:StartBackgroundTopologyAutomatically.java


示例5: getPeople

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
public List<Person> getPeople(List<Integer> peopleList) throws MovieDbException, IOException {
        if (!isInit) init();

        List<Person> returnList = new ArrayList<Person>();

        System.out.println("Obtaining Person data from TMDB...");
        for (Integer personId : peopleList) {
            com.omertron.themoviedbapi.model.Person tmdbPerson = api.getPersonInfo(personId);
            Person p = new Person();
            p.setId(tmdbPerson.getId());
            p.setName(tmdbPerson.getName());
            p.setBirthYear(Strings.isNullOrEmpty(tmdbPerson.getBirthday()) ? 1900 : Integer.parseInt(tmdbPerson.getBirthday().substring(0, 4)));
            p.setPopularity(tmdbPerson.getPopularity());
            p.setImgPath(tmdbPerson.getProfilePath());
            p.setImdbId(tmdbPerson.getImdbId());

//            /* get list of movieIds for which the person was part of the CAST */
//            TmdbResultsList<PersonCredit> tmdbResultsList = api.getPersonCredits(tmdbPerson.getId());
//            List<PersonCredit> credits = tmdbResultsList.getResults();
//            List<Integer> creditList = new ArrayList<Integer>();
//            for (PersonCredit credit : credits) {
//                /* if they are cast and don't already have a credit for the same film, add them */
//                if (credit.getPersonType().equals(PersonType.CAST) && !creditList.contains(credit.getMovieId())) creditList.add(credit.getMovieId());
//            }
//            p.setMovies(creditList);

            returnList.add(p);
        }
        System.out.println("Obtaining Person data complete.");

        return returnList;
    }
 
开发者ID:polyrob,项目名称:QuickFlix,代码行数:33,代码来源:TMDBManager.java


示例6: getMovies

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
public List<Movie> getMovies(List<Integer> movieIds) throws MovieDbException, IOException {
    List<String> strIds = new ArrayList<String>();
    for (Integer i : movieIds) {
        strIds.add(String.valueOf(i));
    }
    return getMovies(strIds, false);
}
 
开发者ID:polyrob,项目名称:QuickFlix,代码行数:8,代码来源:TMDBManager.java


示例7: getMovieCredits

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
public List<Credit> getMovieCredits(Integer movieId) throws MovieDbException {
    List<Credit> cast = new ArrayList<Credit>();

    TmdbResultsList<com.omertron.themoviedbapi.model.Person> tmdbCast = api.getMovieCasts(movieId);
    List<com.omertron.themoviedbapi.model.Person> castList = tmdbCast.getResults();
    int index = 1;
    for (com.omertron.themoviedbapi.model.Person p : castList) {
        if (p.getPersonType().equals(PersonType.CAST) && !cast.contains(p.getId()))
            cast.add(new Credit(p.getId(), movieId, index++));
    }

    return cast;
}
 
开发者ID:polyrob,项目名称:QuickFlix,代码行数:14,代码来源:TMDBManager.java


示例8: getFullImageUrl

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
public String getFullImageUrl(String posterPath, String size) {
  try {
    return movieDbApi.createImageUrl(posterPath, size).toString();
  } catch (MovieDbException e) {
    e.printStackTrace();
  }
  return "";
}
 
开发者ID:priitl,项目名称:p2p-webtv,代码行数:9,代码来源:TmdbService.java


示例9: getPopularTV

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
public ResultList<TVBasic> getPopularTV(int pageNumber) {
  try {
    return movieDbApi.getTVPopular(pageNumber, null);
  } catch (MovieDbException e) {
    e.printStackTrace();
  }
  return new ResultList<>();
}
 
开发者ID:priitl,项目名称:p2p-webtv,代码行数:9,代码来源:TmdbService.java


示例10: searchTV

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
public ResultList<TVBasic> searchTV(String title, int pageNumber) {
  try {
    return movieDbApi.searchTV(title, pageNumber, null, null, null);
  } catch (MovieDbException e) {
    e.printStackTrace();
  }
  return new ResultList<>();
}
 
开发者ID:priitl,项目名称:p2p-webtv,代码行数:9,代码来源:TmdbService.java


示例11: getTVInfo

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
public TVInfo getTVInfo(int tmdbId, String... appendToResponse) {
  try {
    return movieDbApi.getTVInfo(tmdbId, null, appendToResponse);
  } catch (MovieDbException e) {
    e.printStackTrace();
  }
  return new TVInfo();
}
 
开发者ID:priitl,项目名称:p2p-webtv,代码行数:9,代码来源:TmdbService.java


示例12: getTvSeasonInfo

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
public TVSeasonInfo getTvSeasonInfo(int tmdbId, int seasonNumber) {
  try {
    return movieDbApi.getSeasonInfo(tmdbId, seasonNumber, null);
  } catch (MovieDbException e) {
    e.printStackTrace();
  }
  return new TVSeasonInfo();
}
 
开发者ID:priitl,项目名称:p2p-webtv,代码行数:9,代码来源:TmdbService.java


示例13: getPopularMovies

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
public ResultList<MovieInfo> getPopularMovies(int pageNumber) {
  try {
    return movieDbApi.getPopularMovieList(pageNumber, null);
  } catch (MovieDbException e) {
    e.printStackTrace();
  }
  return new ResultList<>();
}
 
开发者ID:priitl,项目名称:p2p-webtv,代码行数:9,代码来源:TmdbService.java


示例14: searchMovie

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
public ResultList<MovieInfo> searchMovie(String title, int pageNumber) {
  try {
    return movieDbApi.searchMovie(title, pageNumber, null, true, null, null, null);
  } catch (MovieDbException e) {
    e.printStackTrace();
  }
  return new ResultList<>();
}
 
开发者ID:priitl,项目名称:p2p-webtv,代码行数:9,代码来源:TmdbService.java


示例15: getMovieInfo

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
public MovieInfo getMovieInfo(int tmdbId, String... appendToResponse) {
  try {
    return movieDbApi.getMovieInfo(tmdbId, null, appendToResponse);
  } catch (MovieDbException e) {
    e.printStackTrace();
  }
  return new MovieInfo();
}
 
开发者ID:priitl,项目名称:p2p-webtv,代码行数:9,代码来源:TmdbService.java


示例16: TheMovieDbPlugin

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
public TheMovieDbPlugin() {
    try {
        String apiKey = PropertiesUtil.getProperty("API_KEY_TheMovieDB");
        tmdb = new TheMovieDbApi(apiKey, YamjHttpClientBuilder.getHttpClient());
    } catch (MovieDbException ex) {
        LOG.warn("Failed to initialise TheMovieDB API: {}", ex.getMessage());
        return;
    }
    decodeLanguage();
}
 
开发者ID:YAMJ,项目名称:yamj-v2,代码行数:11,代码来源:TheMovieDbPlugin.java


示例17: searchMovieTitle

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
/**
 * Search for a movie title.
 *
 * Use a title that may be different to the actual title of the movie, but match against the full title.
 *
 * @param fullTitle
 * @param year
 * @param searchTitle
 */
private MovieInfo searchMovieTitle(Movie movie, int movieYear, final String searchTitle) {
    LOG.debug(LOG_LOCATE_MOVIE_INFORMATION, movie.getBaseName(), searchTitle, movieYear);
    MovieInfo movieDb = null;
    ResultList<MovieInfo> result;
    try {
        result = tmdb.searchMovie(searchTitle, 0, languageCode, INCLUDE_ADULT, movieYear, null, SearchType.PHRASE);
    } catch (MovieDbException ex) {
        LOG.warn("Error scanning movie '{}': {}", movie.getTitle(), ex.getMessage(), ex);
        return movieDb;
    }
    LOG.debug("{}: Found {} potential matches", movie.getBaseName(), result.getResults().size());

    List<MovieInfo> movieList = result.getResults();
    // Are the title and original title the same (used for performance)
    boolean sameTitle = StringUtils.equalsIgnoreCase(movie.getTitle(), movie.getOriginalTitle());

    // Iterate over the list until we find a match
    for (MovieInfo movieInfo : movieList) {
        String movieInfoYear = StringUtils.isBlank(movieInfo.getReleaseDate()) ? "UNKNOWN" : movieInfo.getReleaseDate().substring(0, 4);
        LOG.debug("Checking {} ({})", movieInfo.getTitle(), movieInfoYear);

        if (Compare.movies(movieInfo, movie.getTitle(), movieYear > 0 ? String.valueOf(movieYear) : "", SEARCH_MATCH, false)) {
            LOG.debug("Matched to '{}'", movie.getTitle());
            movieDb = movieInfo;
            break;
        } else if (!sameTitle && Compare.movies(movieInfo, movie.getOriginalTitle(), String.valueOf(movieYear), SEARCH_MATCH, false)) {
            // See if the original title is different and then compare it too
            LOG.debug("Matched to '{}'", movie.getOriginalTitle());
            movieDb = movieInfo;
            break;
        }
    }
    return movieDb;
}
 
开发者ID:YAMJ,项目名称:yamj-v2,代码行数:44,代码来源:TheMovieDbPlugin.java


示例18: getCollectionInfo

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
/**
 * Get the Collection information from the cache or online
 *
 * @param collectionId
 * @param languageCode
 * @return
 */
public CollectionInfo getCollectionInfo(int collectionId, String languageCode) {
    String cacheKey = getCollectionCacheKey(collectionId, languageCode);
    CollectionInfo collInfo = (CollectionInfo) CacheMemory.getFromCache(cacheKey);

    if (collInfo == null) {
        // Not found in cache, so look online
        try {
            collInfo = tmdb.getCollectionInfo(collectionId, languageCode);
            if (collInfo != null) {
                URL newUrl;

                // Update the URL to be the full URL
                if (collInfo.getPosterPath() != null) {
                    newUrl = tmdb.createImageUrl(collInfo.getPosterPath(), ORIGINAL);
                    collInfo.setPosterPath(newUrl.toString());
                }

                // Update the URL to be the full URL
                if (collInfo.getBackdropPath() != null) {
                    newUrl = tmdb.createImageUrl(collInfo.getBackdropPath(), ORIGINAL);
                    collInfo.setBackdropPath(newUrl.toString());
                }

                // Add to the cache
                CacheMemory.addToCache(cacheKey, collInfo);
            }
        } catch (MovieDbException error) {
            LOG.warn("Error getting CollectionInfo: {}", error.getMessage());
        }
    }

    return collInfo;
}
 
开发者ID:YAMJ,项目名称:yamj-v2,代码行数:41,代码来源:TheMovieDbPlugin.java


示例19: getIdFromMovieInfo

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
@Override
public String getIdFromMovieInfo(String title, String searchYear) {
    List<MovieInfo> movieList;
    try {
        int movieYear = 0;
        if (StringTools.isValidString(searchYear) && StringUtils.isNumeric(searchYear)) {
            movieYear = Integer.parseInt(searchYear);
        }

        ResultList<MovieInfo> result = tmdb.searchMovie(title, 0, languageCode, INCLUDE_ADULT, movieYear, 0, SearchType.PHRASE);
        movieList = result.getResults();
    } catch (MovieDbException ex) {
        LOG.warn("Failed to get TMDB ID for {} ({}) - {}", title, searchYear, ex.getMessage());
        return Movie.UNKNOWN;
    }

    if (movieList.isEmpty()) {
        return Movie.UNKNOWN;
    }
    
    if (movieList.size() == 1) {
        // Only one movie so return that id
        return String.valueOf(movieList.get(0).getId());
    }

    for (MovieInfo moviedb : movieList) {
        if (Compare.movies(moviedb, title, searchYear, TheMovieDbPlugin.SEARCH_MATCH)) {
            return String.valueOf(moviedb.getId());
        }
    }

    return Movie.UNKNOWN;
}
 
开发者ID:YAMJ,项目名称:yamj-v2,代码行数:34,代码来源:MovieDbPosterPlugin.java


示例20: getId

import com.omertron.themoviedbapi.MovieDbException; //导入依赖的package包/类
private String getId(Identifiable ident) {
    String response = Movie.UNKNOWN;

    if (ident != null) {
        String imdbID = ident.getId(TheMovieDbPlugin.IMDB_PLUGIN_ID);
        String tmdbID = ident.getId(TheMovieDbPlugin.TMDB_PLUGIN_ID);

        // First look to see if we have a TMDb ID as this will make looking the film up easier
        if (StringTools.isValidString(tmdbID)) {
            response = tmdbID;
        } else if (StringTools.isValidString(imdbID)) {
            // Search based on IMDb ID
            MovieInfo moviedb;
            try {
                moviedb = tmdb.getMovieInfoImdb(imdbID, languageCode);
            } catch (MovieDbException ex) {
                LOG.warn("Failed to get TMDB ID for {} - {}", imdbID, ex.getMessage());
                return response;
            }
            if (moviedb != null) {
                tmdbID = String.valueOf(moviedb.getId());
                if (StringUtils.isNumeric(tmdbID)) {
                    response = tmdbID;
                } else {
                    LOG.info("No TMDb ID found for movie!");
                }
            }
        }
    }
    return response;
}
 
开发者ID:YAMJ,项目名称:yamj-v2,代码行数:32,代码来源:MovieDbPosterPlugin.java



注:本文中的com.omertron.themoviedbapi.MovieDbException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LinkedCorrectionProposal类代码示例发布时间:2022-05-22
下一篇:
Java Min类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap