Skip to content

Commit

Permalink
Version 0.7.0
Browse files Browse the repository at this point in the history
* Reworked the UI to better utilize space.
* Added display for length of media (and its episodes).
* Category is now displayed correctly.
* Removed ability to interact with the Season-box if the media isn't a series/miniseries.
* Fixed a bug where you couldn't do a search after changing the search term while a search was already ongoing.
* Fixed a bug where the search would change if "Enter" was pressed after the search term was changed during an ongoing search.
  • Loading branch information
samsalmag committed Jan 3, 2021
1 parent 0e0d247 commit 189f50c
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 31 deletions.
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
# Rating Reader

Rating Reader is an application that reads media scores from [IMDb](https://www.imdb.com) and conveniently displays them in a spoiler-free way.
Needs an internet connection to work.
Rating Reader is an application that reads media scores from [IMDb](https://www.imdb.com) and conveniently displays them, along with other useful information, in a spoiler-free way.
Needs an internet connection to work. Tested and working on Windows 10.
<br />
<br />
By Sam Salek

## How to download
The most up-to-date version of RatingReader.exe is located under "builds/_current", a .jar version of the application also exists in the same place for those inclined.
Simply select the file and press the "Download" button to start downloading (a warning may pop up before/during the download. This is perfectly normal, however the application itself is not harmful to your computer in any way. The source code is always available if skeptical).
Older builds also exist beside the "_current" folder, these are however not recommended as they can be unstable and/or buggy.
The most up-to-date version of the application is located under "builds/_current" as a ".exe" (recommended) or a ".jar" .
Simply select the file and press the "Download" button to start downloading (a warning may pop up before/during the download. This is perfectly normal behaviour for modern browsers, however the application itself is not harmful to your computer in any way. Source code is available for those inclined).

Older builds of the application also exists in the "builds" folder, these are however not recommended as they can be unstable and/or buggy.


## Update Log
#### 0.7.0 (03/01/21):
* Reworked the UI to better utilize space.
* Added display for length of media (and its episodes).
* Category is now displayed correctly.
* Removed ability to interact with the Season-box if the media isn't a series/miniseries.
* Fixed a bug where you couldn't do a search after changing the search term while a search was already ongoing.
* Fixed a bug where the search would change if "Enter" was pressed after the search term was changed during an ongoing search.

#### 0.6.3 (27/12/20):
* Added support for video games.
* Made the application version and name always stay consistent.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file added builds/_current/RatingReader_0.7.0.exe
Binary file not shown.
Binary file added builds/_current/ratingreader-0.7.0.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,22 @@ public class Controller {
Media media;
ImdbController imdbController;
private String previousSearch;
private boolean searching;

@FXML private AnchorPane rootAnchorPane;
@FXML private TextField searchTextField;
@FXML private Button searchButton;
@FXML private ComboBox seasonComboBox;
@FXML private Label loadingLabel;
@FXML private Label resultNameLabel;
@FXML private Label resultTypeLabel;
@FXML private Label resultCategoryLabel;
@FXML private Label nameLabel;
@FXML private Label typeLabel;
@FXML private Label categoryLabel;
@FXML private Label lengthLabel;
@FXML private ScrollPane resultScrollPane;
@FXML private FlowPane resultFlowPane;

public Controller() {
init();

}

// Init for FXML objects
Expand All @@ -43,9 +44,10 @@ private void initialize() {
initSearchTextField();
initResultFlowPane();
loadingLabel.setVisible(false);
resultNameLabel.setVisible(false);
resultTypeLabel.setVisible(false);
resultCategoryLabel.setVisible(false);
nameLabel.setVisible(false);
typeLabel.setVisible(false);
categoryLabel.setVisible(false);
lengthLabel.setVisible(false);
}

// -------- INIT -------- //
Expand Down Expand Up @@ -73,11 +75,10 @@ private void initSeasonComboBox() {
}

private void initSearchTextField() {

// Add event so ENTER key can be pressed to search
searchTextField.setOnKeyPressed(keyEvent -> {
// If key pressed was enter
if(keyEvent.getCode().equals(KeyCode.ENTER)) {
// If key pressed was enter and is currently not searching
if(keyEvent.getCode().equals(KeyCode.ENTER) && !searching) {
// Do search
search(searchTextField.getText());
}
Expand All @@ -95,6 +96,7 @@ private void initResultFlowPane() {
// ------------------ ------------------ //

private void search(String searchTerm) {
System.out.println(previousSearch);
if(searchTerm.equals("") || searchTerm == null) {
return;
}
Expand All @@ -109,6 +111,8 @@ private void search(String searchTerm) {

// New thread where the media information fetch occurs to avoid freezing the JavaFX Application thread
new Thread(new SearchMediaRunnable(searchTerm)).start(); // Start the new thread
searching = true;
previousSearch = searchTextField.getText(); // Set previous search text
}

private void updateResults(int season) {
Expand All @@ -121,9 +125,10 @@ private void updateResults(int season) {
}
}

resultNameLabel.setVisible(true);
resultTypeLabel.setVisible(true);
resultCategoryLabel.setVisible(true);
nameLabel.setVisible(true);
typeLabel.setVisible(true);
categoryLabel.setVisible(true);
lengthLabel.setVisible(true);
}

private void populateSeasonComboBox() {
Expand All @@ -142,9 +147,12 @@ private void removeFocus() {
}

@FXML
private void onPressSearchButton() throws IOException {
private void onPressSearchButton() {
removeFocus();
search(searchTextField.getText());
System.out.println(searching);
if(!searching) {
search(searchTextField.getText());
}
}

// ------------------ ------------------ //
Expand Down Expand Up @@ -172,9 +180,10 @@ public void run() {
// The UI updater. This is what will happen after media information is gathered. Updater is called below.
// Runs the UI updater after JavaFX Application thread is done (after the media information is gathered)
Platform.runLater(() -> {
resultNameLabel.setText(media.getName() + " (" + media.getReleaseYear() + ")");
resultTypeLabel.setText(media.getType().getName());
resultCategoryLabel.setText(media.getCategory());
nameLabel.setText(media.getName() + " (" + media.getReleaseYear() + ")");
typeLabel.setText(media.getType().getName());
categoryLabel.setText(media.getCategory());
lengthLabel.setText(media.getLength());
updateResults(1); // Get season 1 on search

// Only do this if media is a TV Series
Expand All @@ -189,7 +198,7 @@ public void run() {

loadingLabel.setVisible(false); // Disable Loading Icon
searchButton.setDisable(false); // Enable search button after result is displayed
previousSearch = searchTextField.getText(); // Set previous search text
searching = false;
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,9 @@ private void fetchMediaReleaseYear() {
media.setReleaseYear(Integer.parseInt(releaseYear));
}

// TODO
private void fetchMediaLength() {
String length = mainWebsiteCode.getElementsByClass("subtext").first().select("time").text(); // Gets first "subtext" div and selects "time" element.
media.setLength(length);
System.out.println(length);
}

private void fetchNrSeasons() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

public class ViewConstants {

public static final int INITIAL_WIDTH = 700;
public static final int INITIAL_WIDTH = 350*2;
public static final int INITIAL_HEIGHT = 200 + 63*5;
public static final int MIN_WIDTH = INITIAL_WIDTH;
public static final int MIN_HEIGHT = INITIAL_HEIGHT;
public static final int MAX_WIDTH = 1400;
public static final int MAX_WIDTH = 350*4;
public static final int MAX_HEIGHT = 200 + 63*8;
public static final int RESULT_SCROLLPANE_SCROLLBAR_WIDTH = 15;

Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/fxml/root.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,22 @@
</font>
</Label>
<ComboBox fx:id="seasonComboBox" layoutX="81.0" layoutY="62.0" prefHeight="30.0" prefWidth="55.0" />
<Label fx:id="resultNameLabel" layoutX="350.0" layoutY="19.0" prefHeight="36.0" prefWidth="330.0" text="Name (year)" AnchorPane.leftAnchor="350.0" AnchorPane.rightAnchor="20.0">
<Label fx:id="nameLabel" layoutX="350.0" layoutY="19.0" prefHeight="36.0" prefWidth="330.0" text="Name (year)" AnchorPane.leftAnchor="350.0" AnchorPane.rightAnchor="20.0">
<font>
<Font name="System Bold" size="25.0" />
</font>
</Label>
<Label fx:id="resultTypeLabel" layoutX="350.0" layoutY="84.0" prefHeight="30.0" prefWidth="330.0" text="Type" AnchorPane.leftAnchor="350.0" AnchorPane.rightAnchor="20.0">
<Label fx:id="typeLabel" layoutX="350.0" layoutY="84.0" prefHeight="30.0" prefWidth="330.0" text="Type" AnchorPane.leftAnchor="350.0" AnchorPane.rightAnchor="20.0">
<font>
<Font size="20.0" />
</font>
</Label>
<Label fx:id="resultCategoryLabel" layoutX="350.0" layoutY="54.0" prefHeight="30.0" prefWidth="330.0" text="Category" AnchorPane.leftAnchor="350.0" AnchorPane.rightAnchor="20.0">
<Label fx:id="categoryLabel" layoutX="350.0" layoutY="54.0" prefHeight="30.0" prefWidth="330.0" text="Category" AnchorPane.leftAnchor="350.0" AnchorPane.rightAnchor="20.0">
<font>
<Font size="20.0" />
</font>
</Label>
<Label fx:id="lengthLabel" layoutX="350.0" layoutY="114.0" prefHeight="30.0" prefWidth="330.0" text="Length">
<font>
<Font size="20.0" />
</font>
Expand Down

0 comments on commit 189f50c

Please sign in to comment.