diff --git a/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java b/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java index 46b0543..8210b34 100644 --- a/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java +++ b/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java @@ -1,7 +1,7 @@ /** * Project-HomeFlix * - * Copyright 2018 <@Seil0> + * Copyright 2016-2018 <@Seil0> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -845,7 +845,7 @@ public class MainWindowController { vlcNotInstalled = getBundle().getString("vlcNotInstalled"); } - // TODO rework to material design + // TODO remove after #19 has landed public void showErrorMsg(String msg, Exception exception) { Alert alert = new Alert(AlertType.ERROR); alert.setTitle("Error"); diff --git a/src/main/java/kellerkinder/HomeFlix/controller/OMDbAPIController.java b/src/main/java/kellerkinder/HomeFlix/controller/OMDbAPIController.java index 3e7451a..6e8f5cd 100644 --- a/src/main/java/kellerkinder/HomeFlix/controller/OMDbAPIController.java +++ b/src/main/java/kellerkinder/HomeFlix/controller/OMDbAPIController.java @@ -1,6 +1,27 @@ +/** + * Project-HomeFlix + * + * Copyright 2018 <@Seil0> + * + * This program 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 + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + */ + package kellerkinder.HomeFlix.controller; -import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.File; @@ -82,10 +103,8 @@ public class OMDbAPIController implements Runnable { //resize the image to fit in the posterImageView and add it to the cache try { BufferedImage originalImage = ImageIO.read(new URL(responseString[18])); //change path to where file is located - int type = originalImage.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : originalImage.getType(); - BufferedImage resizeImagePNG = resizeImage(originalImage, type, 198, 297); posterPath = main.getPosterCache() + "/" + mainWindowController.getTitle() + ".png"; - ImageIO.write(resizeImagePNG, "png", new File(posterPath)); + ImageIO.write(originalImage, "png", new File(posterPath)); LOGGER.info("adding poster to cache: "+posterPath); } catch (Exception e) { LOGGER.error(e); @@ -104,21 +123,4 @@ public class OMDbAPIController implements Runnable { dbController.readCache(mainWindowController.getStreamUrl()); }); } - - /** - * resize a image - * @param originalImage is the original image - * @param type of the original image - * @param IMG_WIDTH width to resize - * @param IMG_HEIGHT heigth to resize - * @return resized image - */ - private static BufferedImage resizeImage(BufferedImage originalImage, int type, int IMG_WIDTH, int IMG_HEIGHT) { - BufferedImage resizedImage = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, type); - Graphics2D g = resizedImage.createGraphics(); - g.drawImage(originalImage, 0, 0, IMG_WIDTH, IMG_HEIGHT, null); - g.dispose(); - - return resizedImage; - } }