Skip to content

Commit

Permalink
Version 0.6.0
Browse files Browse the repository at this point in the history
* Episodes without a rating is now also displayed (with rating "NA").
* Episodes now correctly displays their respective episode name.
* Added functionality for Miniseries' and media that necessarily isn't a series or movie.
* Optimizations and overall better performance.
* Minor UI changes and optimizations.
* Few bug fixes.
  • Loading branch information
samsalmag committed Dec 22, 2020
1 parent 2192cb5 commit 59835dd
Show file tree
Hide file tree
Showing 15 changed files with 376 additions and 228 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@
# Maven
target/

# Other
UpdateLog.txt

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,15 @@ By Sam Salek

## How to download
The most up-to-date version of RatingReader.exe is located under builds/_current. Simply select the file and press the "Download" button to start downloading.

## Update Log
#### 0.6.0:
* Episodes without a rating is now also displayed (with rating "NA").
* Episodes now correctly displays their respective episode name.
* Added functionality for Miniseries' and media that necessarily isn't a series or movie.
* Optimizations and overall better performance.
* Minor UI changes and optimizations.
* Few bug fixes.

#### 0.5.0:
* Initial version release.
Binary file not shown.
Binary file not shown.
Binary file added builds/_current/RatingReader-0.6.0.exe
Binary file not shown.
Binary file added builds/_current/ratingreader-0.6.0.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.zemahzalek</groupId>
<artifactId>ratingreader</artifactId>
<version>0.5.0</version>
<version>0.6.0</version>
<packaging>jar</packaging>
<name>RatingReader</name>

Expand Down
29 changes: 18 additions & 11 deletions src/main/java/com/zemahzalek/ratingreader/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

public class Controller {

IMDbController imdbController;
Media media;
ImdbController imdbController;
private String previousSearch;

@FXML private AnchorPane rootAnchorPane;
Expand All @@ -37,11 +38,14 @@ private void initialize() {
initSeasonComboBox();
initSearchTextField();
loadingLabel.setVisible(false);
resultNameLabel.setVisible(false);
resultTypeLabel.setVisible(false);
}

// -------- INIT -------- //
private void init() {
imdbController = new IMDbController();
media = new Media();
imdbController = new ImdbController(media);
}

private void initSeasonComboBox() {
Expand Down Expand Up @@ -112,12 +116,12 @@ public void run() {
Runnable updater = new Runnable() {
@Override
public void run() {
resultNameLabel.setText(imdbController.getMediaName() + " (" + imdbController.getMediaReleaseYear() + ")");
resultTypeLabel.setText(imdbController.getMediaType());
resultNameLabel.setText(media.getName() + " (" + media.getReleaseYear() + ")");
resultTypeLabel.setText(media.getType().toString());
updateResults(1); // Get season 1 on search

// Only do this if media is a TV Series
if(imdbController.isTVSeries()) {
if(media.isSeries()) {
populateSeasonComboBox();
seasonComboBox.getSelectionModel().select(0); // Select 1st season on ComboBox
seasonComboBox.setDisable(false);
Expand All @@ -137,21 +141,24 @@ public void run() {
}

private void updateResults(int season) {
resultFlowPane.getChildren().clear(); // Remove all children
resultFlowPane.getChildren().clear(); // Remove all children

// Do only if media search is a TV Series
if(imdbController.isTVSeries()) {
if(media.isSeries()) {
int episodeNr = 1;
for (String rating : imdbController.getMediaEpisodeRatings(season - 1)) { // -1 because of index out of bounds
resultFlowPane.getChildren().add(new EpisodeItem(resultScrollPane, episodeNr, rating));
for (String rating : media.getEpisodeRatings().get(season-1)) { // -1 because of index out of bounds
resultFlowPane.getChildren().add(new EpisodeItem(resultScrollPane, media, season, episodeNr, rating));
episodeNr++;
}
}

resultNameLabel.setVisible(true);
resultTypeLabel.setVisible(true);
}

private void populateSeasonComboBox() {
seasonComboBox.getItems().clear(); // Empty combo box
for (int i = 1; i <= imdbController.getNrSeasons(); i++) {
seasonComboBox.getItems().clear(); // Empty combo box
for (int i = 1; i <= media.getNrSeasons(); i++) {
seasonComboBox.getItems().add(String.valueOf(i));
}
}
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/com/zemahzalek/ratingreader/EpisodeItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
public class EpisodeItem extends AnchorPane {

private ScrollPane rootNode;
private Media media;
private int season;
private int episodeNr;
@FXML private Label episodeNrLabel;
@FXML private Label ratingLabel;
@FXML private ToggleButton episodeNameToggleButton;
@FXML private Label episodeNameLabel;

public EpisodeItem(Node rootNode, int episodeNr, String rating) {
public EpisodeItem(Node rootNode, Media media, int season, int episodeNr, String rating) {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getClassLoader().getResource("fxml/episodeItem.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
Expand All @@ -32,6 +35,9 @@ public EpisodeItem(Node rootNode, int episodeNr, String rating) {
}

this.rootNode = (ScrollPane) rootNode;
this.media = media;
this.season = season;
this.episodeNr = episodeNr;
init();

episodeNrLabel.setText("EP" + String.valueOf(episodeNr));
Expand All @@ -56,6 +62,10 @@ public void changed(ObservableValue<? extends Number> observableValue, Number ol
});
}

private String getEpisodeName() {
return media.getEpisodeNames().get(season-1).get(episodeNr-1);
}

private void removeFocus() {
// Sets focus to root anchor pane instead of pressed node
rootNode.getParent().requestFocus();
Expand All @@ -70,6 +80,7 @@ private void onPressEpisodeNameToggleButton() {
// Else do opposite
if(!episodeNameToggleButton.isSelected()) {
episodeNameLabel.setVisible(true);
episodeNameLabel.setText(getEpisodeName());
} else {
episodeNameLabel.setVisible(false);
}
Expand Down
210 changes: 0 additions & 210 deletions src/main/java/com/zemahzalek/ratingreader/IMDbController.java

This file was deleted.

Loading

0 comments on commit 59835dd

Please sign in to comment.