128 Commits
151 ... dev

Author SHA1 Message Date
  Jannik 4e0e1c4666 „README.md“ ändern 2 months ago
  Jannik f4c3b0a6f8
update the controls only when they are visible 6 months ago
  Jannik c323ac957c
add button hover effect to player gui 7 months ago
  Jannik 5c4b78436f
add linear-gradient to top & bottom bar, support start in fullscreen 7 months ago
  Jannik 257b09fc9c
add correct audio popup style 7 months ago
  Jannik e29bcc5da3
fix player resolution mismatch 7 months ago
  Jannik fb390e3169
fix SeriesDetailView, improved the timesliders animated thumb 7 months ago
  Jannik d210655dcf
add audio track selection popup, slider displays time as h:mm:ss now 7 months ago
  Jannik 834bffda93
clean up DetailViews 9 months ago
  Jannik c04a7c0d4d
add demo audio track selection popup 9 months ago
  Jannik 5e0fd8063d
use try with resourcess 10 months ago
  Jannik 0d57127d64
added replay and forward 10 sec button 10 months ago
  Jannik 965c081d05
replace stop button with back button, show media title 10 months ago
  Jannik c6b2d1a9d8
add player end time lable 10 months ago
  Jannik a8160ce65e
new media player based on vlcj [Part 2] 11 months ago
  Jannik 4184e982ea
new media player based on vlcj [Part 1] 11 months ago
  Jannik ef5d87c54c
updated some libraries 1 year ago
  Jannik 5db24f16f2 Update 'README.md' 1 year ago
  Jannik 03c69b232a
some minor cleanup 1 year ago
  Jannik e4cc195fa8
minor code cleanup 1 year ago
  Jannik 5e71bb95f0
updated some libraries 1 year ago
  Jannik a1936c138f Update 'README.md' 1 year ago
  Jannik 000b5e12c2
added drone ci 1 year ago
  Jannik ae20909012
update version to 0.8.0 1 year ago
  Jannik 75a80535a7
reworked the UpdateController 1 year ago
  Jannik d8062513e9
fixed animation coordinates for 9f8a7c0f4c 1 year ago
  Jannik 9f8a7c0f4c
fixed scrollpane jumping to the top after returning from detailview 1 year ago
  Jannik 5488bece2d
minor bugfixes and clean up 1 year ago
  Jannik 9af3ad26bd
implemented settings as nested conroller 1 year ago
  Jannik 989281ff8d
added SettingsView 1 year ago
  Jannik e84e7f9d20
removed all table-mode stuff, minor ui tweaks 1 year ago
  Jannik c38be08905
some css style improvements 1 year ago
  Jannik 512b715c1a
first working version of the PosterMode, enabled by default 1 year ago
  Jannik 693650fece
added first layout for SeriesDetailView 1 year ago
  Jannik 656c22d48a
added FilmDetailView 1 year ago
  Jannik 2bbbfff532
more FilmDeatilView work 1 year ago
  Jannik f23e6c77ea
added a sample nested controller 1 year ago
  Jannik bb8bcd460a
PosterMode now has posters, UI optimizations 1 year ago
  Jannik 4d503546ff
bug fixes 1 year ago
  Jannik 4ff8b7819f
Use a FlowPane fot the PosterMode 1 year ago
  Jannik 7dbe0d46d8
some clean up and first bits for poster mode GUI logic 1 year ago
  Jannik ea9e740552
minor clean up 1 year ago
  Jannik fdb39ea2f5
fixed missing elements when searching 1 year ago
  Jannik 46cd28a642 updated to javafx 12 1 year ago
  Jannik 3381047e76 updated javafx to 11.0.2 2 years ago
  Jannik 0786770e97 added a comment 2 years ago
  Jannik e47f3ea2f7 minor bug fixes 2 years ago
  Jannik c735583a04 cache is now date based, minor clean up 2 years ago
  Jannik 5600456556 fixed open folder btn when using Linux, more clean up 2 years ago
  Jannik cc05600e0a removed all mwc usage in DBController 2 years ago
  Jannik 291f183f5e removed more mwc dependencies & code clean up 2 years ago
  Jannik a80e077d47 code clean up and removed some unneeded mwc uses in DBController 2 years ago
  Jannik 3e80354d88 don't use mains primarystage, disabled column resizeing 2 years ago
  Jannik d3d22db7a8 moved static vars and save & load code to XMLController 2 years ago
  Jannik 060527ae03 removed travis.yml 2 years ago
  Jannik 2daeb86d67 updated readme 2 years ago
  Jannik 29c6b30168 small omdbAPI query fixes 2 years ago
  Jannik 1d06aaeaa2 clean up 2 years ago
  Jannik a677abc15c added a "next episode" button to the player 2 years ago
  Jannik c3a148b267 reworked the DBController 2 years ago
  Jannik 6585908717 minor gui fixes 2 years ago
  Jannik 201109e79d updated jfoenix 9.0.6 -> 9.0.8 2 years ago
  Jannik f1ccb04f9e „README.md“ ändern 2 years ago
  Jannik 9f8c19ab8e fixed issue #6 2 years ago
  Jannik 079f15cd59 player fixes & lib updates 2 years ago
  Jannik 0d9ffb36e5 Merge remote-tracking branch 'origin/dev' into dev 2 years ago
  Jannik 5e89faff49 use gitea instead of github 2 years ago
  Jannik fed25f2fce „README.md“ ändern 2 years ago
  Jannik 0cf02c52a6 updated gitignore 2 years ago
  Jannik b8a67fbc27 removed eclipse specific files 2 years ago
  Jannik 5a3b647060 „.project“ löschen 2 years ago
  Jannik ffe068e1b0 „.classpath“ löschen 2 years ago
  Jannik 4d31e53a7c updated gitignore to ignore eclipse files 2 years ago
  Jannik 2e86836041 small code cleanup 2 years ago
  Jannik a23b87fcb8 fixed first startup issue 2 years ago
  Jannik a1319382ff removed the usage of mwc in omdbAPIQuery 2 years ago
  Jannik a491937b30 Merge branch 'java11' of Seil0/Project-HomeFlix into dev 2 years ago
  Jannik e6ce1dc464 fixed javafx11 executable jar 2 years ago
  Jannik abbb272bff fixed java11 execution 2 years ago
  Jannik 96bfc461cb formation fixes 2 years ago
  Jannik 32fc533c00 fixed junit 2 years ago
  Jannik 76bb0fa8b1 prepare java11 2 years ago
  Jannik 8f6832c147 updated some libraries 2 years ago
  Jannik fe1dc01605 code cleanup 2 years ago
  Jannik 814bb00158 added getAllNotCachedEntries() 2 years ago
  Jannik f68b0c0feb code clean up 2 years ago
  Jannik d16e724cce documentation improvements 2 years ago
  Jannik 23ac33ca9b 'README.md' ändern 2 years ago
  Jannik 67142662d8 'README.md' ändern 2 years ago
  Jannik b603051c59 typo 2 years ago
  Jannik 3b188904f6 nothing to see here 2 years ago
  Jannik 50ae1747e6 update sqlite-jdbc 3.21.0.1 -> 3.23.1 2 years ago
  Jannik b1f9a6c505 java 9/10 2 years ago
  Jannik 4b1b20f814 build against java 9/10/11 2 years ago
  Jannik 95d29d772c try openjdk build too 2 years ago
  Jannik 3840e31849 try to build with java 10 again 2 years ago
  Jannik 031046643c save&load are now in the main class 2 years ago
  Jannik 1fca1c551d more code cleanup 2 years ago
  Jannik 036ed8ad11 DBController cleanup 2 years ago
  Jannik 26f26ec9f8 target java 9 until travis offers jdk10 2 years ago
  Jannik e1ec3cae7e travis oraclejdk9 & openjdk8 2 years ago
  Jannik 311577fe7c openjdk9 2 years ago
  Jannik 9577508311 openjdk10 2 years ago
  Jannik d7ed7c7b21 target java 10 2 years ago
  Jannik 1e0ab2b943 code cleanup 2 years ago
  Jannik 46efa77fce omdb fixes 2 years ago
  Jannik 402a004ef6 jfoenix 9.0.3 -> 9.0.4 2 years ago
  Jannik 48b9c99baa more TODO 2 years ago
  Jannik 74e8783082 HomeFLix now shows the plot for each episode of a series 2 years ago
  Jannik 391ef59f70 code cleanup 2 years ago
  Jannik 85a403a834 fixed Hamburger icon has wrong color after color change 2 years ago
  Jannik 46c1c43cab
Update README.md 2 years ago
  Jannik d7e9ce56c1 Merge remote-tracking branch 'origin/dev' into dev 2 years ago
  Jannik d70ad34df4 added travis 2 years ago
  Jannik d609715771
Merge pull request #25 from Seil0/master 2 years ago
  Jannik 53f68c9a69
Merge pull request #24 from Seil0/dev 2 years ago
  Jannik 535efd98ee release 0.7.0 2 years ago
  Jannik 9a4eae0be9 autoplay fixes 2 years ago
  Jannik 23e46b7913 cleanup 2 years ago
  Jannik d3ea1b1956 fixed api arror if title dosent exist at omdbAPI 2 years ago
  Jannik 1299748bed
Merge pull request #22 from Seil0/dev 3 years ago
  Jannik 865e732445 Merge pull request #16 from Seil0/dev 3 years ago
  Jannik 4ca4f7ad3a Merge pull request #13 from Seil0/dev 3 years ago
  Jannik 85d65b6235 Merge pull request #12 from Seil0/dev 3 years ago
  Jannik 08048d57ac Merge pull request #11 from Seil0/dev 3 years ago
  Jannik 6baa47b852 Merge pull request #10 from Seil0/dev 3 years ago
  Jannik 944151d35f Merge pull request #8 from Seil0/dev 4 years ago
  Jannik b331ffd270 Merge pull request #7 from Seil0/dev 4 years ago
79 changed files with 5687 additions and 3410 deletions
Split View
  1. +0
    -32
      .classpath
  2. +8
    -0
      .drone.yml
  3. +3
    -1
      .gitignore
  4. +0
    -23
      .project
  5. +0
    -5
      .settings/org.eclipse.core.resources.prefs
  6. +0
    -13
      .settings/org.eclipse.jdt.core.prefs
  7. +0
    -4
      .settings/org.eclipse.m2e.core.prefs
  8. +9
    -14
      README.md
  9. +147
    -102
      pom.xml
  10. +0
    -240
      src/main/java/kellerkinder/HomeFlix/application/Main.java
  11. +0
    -1134
      src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java
  12. +0
    -778
      src/main/java/kellerkinder/HomeFlix/controller/DBController.java
  13. +0
    -125
      src/main/java/kellerkinder/HomeFlix/controller/OMDbAPIController.java
  14. +0
    -162
      src/main/java/kellerkinder/HomeFlix/controller/UpdateController.java
  15. +0
    -147
      src/main/java/kellerkinder/HomeFlix/datatypes/FilmTabelDataType.java
  16. +0
    -86
      src/main/java/kellerkinder/HomeFlix/player/Player.java
  17. +0
    -276
      src/main/java/kellerkinder/HomeFlix/player/PlayerController.java
  18. +15
    -8
      src/main/java/org/kellerkinder/Alerts/JFX2BtnCancelAlert.java
  19. +3
    -8
      src/main/java/org/kellerkinder/Alerts/JFXInfoAlert.java
  20. +8
    -0
      src/main/java/org/mosad/homeflix/application/JavaFX11Main.java
  21. +124
    -0
      src/main/java/org/mosad/homeflix/application/Main.java
  22. +445
    -0
      src/main/java/org/mosad/homeflix/application/MainWindowController.java
  23. +316
    -0
      src/main/java/org/mosad/homeflix/application/SettingsView.java
  24. +42
    -0
      src/main/java/org/mosad/homeflix/application/view/DetailView.java
  25. +190
    -0
      src/main/java/org/mosad/homeflix/application/view/FilmDetailView.java
  26. +212
    -0
      src/main/java/org/mosad/homeflix/application/view/SeriesDetailView.java
  27. +794
    -0
      src/main/java/org/mosad/homeflix/controller/DBController.java
  28. +223
    -0
      src/main/java/org/mosad/homeflix/controller/OMDbAPIController.java
  29. +178
    -0
      src/main/java/org/mosad/homeflix/controller/SourcesController.java
  30. +131
    -0
      src/main/java/org/mosad/homeflix/controller/UpdateController.java
  31. +315
    -0
      src/main/java/org/mosad/homeflix/controller/XMLController.java
  32. +95
    -0
      src/main/java/org/mosad/homeflix/datatypes/DatabaseDataType.java
  33. +75
    -0
      src/main/java/org/mosad/homeflix/datatypes/FilmTabelDataType.java
  34. +268
    -0
      src/main/java/org/mosad/homeflix/datatypes/OMDbAPIResponseDataType.java
  35. +107
    -0
      src/main/java/org/mosad/homeflix/datatypes/PosterModeElement.java
  36. +68
    -0
      src/main/java/org/mosad/homeflix/datatypes/SeriresDVEpisode.java
  37. +2
    -2
      src/main/java/org/mosad/homeflix/datatypes/SourceDataType.java
  38. +172
    -0
      src/main/java/org/mosad/homeflix/player/HFMediaPlayerEventListener.java
  39. +165
    -0
      src/main/java/org/mosad/homeflix/player/Player.java
  40. +579
    -0
      src/main/java/org/mosad/homeflix/player/PlayerController.java
  41. +112
    -10
      src/main/resources/css/MainWindow.css
  42. +90
    -0
      src/main/resources/css/Player.css
  43. +216
    -0
      src/main/resources/fxml/FilmDetailView.fxml
  44. +14
    -164
      src/main/resources/fxml/MainWindow.fxml
  45. +137
    -28
      src/main/resources/fxml/PlayerWindow.fxml
  46. +167
    -0
      src/main/resources/fxml/SeriesDetailView.fxml
  47. +159
    -0
      src/main/resources/fxml/SettingsView.fxml
  48. BIN
      src/main/resources/icons/baseline_favorite_black_48dp.png
  49. BIN
      src/main/resources/icons/baseline_favorite_border_black_48dp.png
  50. BIN
      src/main/resources/icons/baseline_folder_black_48dp.png
  51. BIN
      src/main/resources/icons/baseline_forward_10_white_48dp.png
  52. BIN
      src/main/resources/icons/baseline_fullscreen_exit_white_48dp.png
  53. BIN
      src/main/resources/icons/baseline_fullscreen_white_48dp.png
  54. BIN
      src/main/resources/icons/baseline_keyboard_arrow_down_black_48dp.png
  55. BIN
      src/main/resources/icons/baseline_keyboard_arrow_down_white_48dp.png
  56. BIN
      src/main/resources/icons/baseline_keyboard_arrow_down_white_48dp_48x16.png
  57. BIN
      src/main/resources/icons/baseline_keyboard_backspace_white_48dp.png
  58. BIN
      src/main/resources/icons/baseline_list_black_48dp.png
  59. BIN
      src/main/resources/icons/baseline_pause_white_48dp.png
  60. BIN
      src/main/resources/icons/baseline_play_arrow_black_48dp.png
  61. BIN
      src/main/resources/icons/baseline_play_arrow_white_48dp.png
  62. BIN
      src/main/resources/icons/baseline_replay_10_white_48dp.png
  63. BIN
      src/main/resources/icons/baseline_subtitles_white_48dp.png
  64. BIN
      src/main/resources/icons/ic_favorite_black_18dp_1x.png
  65. BIN
      src/main/resources/icons/ic_favorite_border_black_18dp_1x.png
  66. BIN
      src/main/resources/icons/ic_fullscreen_black_24dp_1x.png
  67. BIN
      src/main/resources/icons/ic_fullscreen_exit_black_24dp_1x.png
  68. BIN
      src/main/resources/icons/ic_pause_black_24dp_1x.png
  69. BIN
      src/main/resources/icons/ic_play_arrow_black_18dp_1x.png
  70. BIN
      src/main/resources/icons/ic_play_arrow_black_24dp_1x.png
  71. BIN
      src/main/resources/icons/ic_play_arrow_white_18dp_1x.png
  72. BIN
      src/main/resources/icons/ic_search_black_18dp_1x.png
  73. BIN
      src/main/resources/icons/ic_skip_next_black_18dp_1x.png
  74. BIN
      src/main/resources/icons/ic_skip_next_white_18dp_1x.png
  75. BIN
      src/main/resources/icons/ic_skip_previous_black_18dp_1x.png
  76. BIN
      src/main/resources/icons/ic_skip_previous_white_18dp_1x.png
  77. BIN
      src/main/resources/icons/ic_stop_black_24dp_1x.png
  78. +49
    -24
      src/main/resources/locals/HomeFlix-Local_de_DE.properties
  79. +49
    -24
      src/main/resources/locals/HomeFlix-Local_en_US.properties

+ 0
- 32
.classpath View File

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-9">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

+ 8
- 0
.drone.yml View File

@ -0,0 +1,8 @@
kind: pipeline
name: default
steps:
- name: package
image: maven
commands:
- mvn clean package

+ 3
- 1
.gitignore View File

@ -49,4 +49,6 @@ config.xml
.directory
target/
apiKeys.json
.classpath
.project
.settings/*

+ 0
- 23
.project View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Project-HomeFlix</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

+ 0
- 5
.settings/org.eclipse.core.resources.prefs View File

@ -1,5 +0,0 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8

+ 0
- 13
.settings/org.eclipse.jdt.core.prefs View File

@ -1,13 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=9
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=9
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=9

+ 0
- 4
.settings/org.eclipse.m2e.core.prefs View File

@ -1,4 +0,0 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

+ 9
- 14
README.md View File

@ -1,24 +1,19 @@
![Total Downloads](https://img.shields.io/github/downloads/Seil0/Project-HomeFlix/total.svg?style=flat-square)
[![Latest](https://img.shields.io/github/release/Seil0/Project-HomeFlix/all.svg?style=flat-square)](https://github.com/Seil0/Project-HomeFlix/releases)
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg?style=flat-square)](https://www.gnu.org/licenses/gpl-3.0)
[![Build Status](https://drone.mosad.xyz/api/badges/Seil0/Project-HomeFlix/status.svg)](https://drone.mosad.xyz/Seil0/Project-HomeFlix) [![Latest](https://img.shields.io/badge/Download-latest-brightgreen.svg)](https://git.mosad.xyz/Seil0/Project-HomeFlix/releases)
[![Release](https://img.shields.io/badge/dynamic/json.svg?label=release&url=https://git.mosad.xyz/api/v1/repos/Seil0/Project-HomeFlix/releases&query=$[0].tag_name)](https://git.mosad.xyz/Seil0/Project-HomeFlix/releases)
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
# Project-HomeFlix
Project-HomeFlix is a Kellerkinder Project, that alowes you to sort all your local saved movies in clean UI. Project-HomeFlix is free and open-source software and uses other open-source projects to provied a nice user experience.
## Installation
Simply download the Project-HomeFlix.jar from [releases](https://github.com/Seil0/Project-HomeFlix/releases), make sure you have the latest version of java 8 oracle jre/jdk installed, open the .jar file. If you need additional information pleas visit our [wiki](https://github.com/Seil0/Project-HomeFlix/wiki).
Simply download the Project-HomeFlix.jar from [releases](https://git.mosad.xyz/Seil0/Project-HomeFlix/releases), make sure you have the latest version of java 8 oracle jre/jdk installed, open the .jar file. If you need additional information pleas visit our [wiki](https://git.mosad.xyz/Seil0/Project-HomeFlix/wiki).
## Development information
The dev branch is **only merged** into master when a **new release** is released, so **master contains the latest released version**. Please commit all changes to [dev](https://github.com/Seil0/Project-HomeFlix/tree/dev).
The dev branch is **only merged** into master when a **new release** is released, so **master contains the latest released version**. Please commit all changes to [dev](https://git.mosad.xyz/Seil0/Project-HomeFlix/src/branch/dev).
Librarys used in this Project:
JFoenix: https://github.com/jfoenixadmin/JFoenix
minimal-json: https://github.com/ralfstx/minimal-json
sqlite-jdbc: https://github.com/xerial/sqlite-jdbc
apache commons io : https://commons.apache.org/proper/commons-io/
[Libraries used in this Project](https://git.mosad.xyz/Seil0/Project-HomeFlix/wiki/Documentation#used-libraries-and-apis)
## screenshots
![Screenshot](https://github.com/Seil0/Seil0.github.io/blob/master/images/Project-HomeFlix_MainWindow.png)
## Screenshots
![Screenshot](https://raw.githubusercontent.com/Seil0/Seil0.github.io/master/images/Project-HomeFlix_MainWindow.webp)
Project-HomeFlix © 2016-2018 Kellerkinder ([Seil0](https://github.com/Seil0), [Windoofs](https://github.com/Windoofs))
www.kellerkinder.xyz
Project-HomeFlix © 2016-2019 mosad www.mosad.xyz, Project by [@Seil0](https://git.mosad.xyz/Seil0) and [@localhorst](https://git.mosad.xyz/localhorst)

+ 147
- 102
pom.xml View File

@ -1,103 +1,148 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.kellerkinder</groupId>
<artifactId>Project-HomeFlix</artifactId>
<version>0.6.99</version>
<packaging>jar</packaging>
<name>Project-HomeFlix</name>
<url>http://www.kellerkinder.xyz</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>9.0.3</version>
</dependency>
<dependency>
<groupId>com.eclipsesource.minimal-json</groupId>
<artifactId>minimal-json</artifactId>
<version>0.9.5</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.21.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>9</source>
<target>9</target>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>kellerkinder.HomeFlix.application.Main</mainClass>
</transformer>
</transformers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.mosad</groupId>
<artifactId>Project-HomeFlix</artifactId>
<version>0.8.0</version>
<packaging>jar</packaging>
<name>Project-HomeFlix</name>
<url>https://www.mosad.xyz</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javafx.version>14.0.2.1</javafx.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>uk.co.caprica</groupId>
<artifactId>vlcj</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>9.0.10</version>
</dependency>
<dependency>
<groupId>com.eclipsesource.minimal-json</groupId>
<artifactId>minimal-json</artifactId>
<version>0.9.5</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.32.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.13.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
<!--<release>11</release> -->
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>org.mosad.homeflix.application.Main</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<finalName>Project-HomeFlix</finalName>
<shadedArtifactAttached>true</shadedArtifactAttached>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.mosad.homeflix.application.JavaFX11Main</mainClass>
</transformer>
</transformers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

+ 0
- 240
src/main/java/kellerkinder/HomeFlix/application/Main.java View File

@ -1,240 +0,0 @@
/**
* Project-HomeFlix
*
* 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
* 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.application;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.ResourceBundle;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.kellerkinder.Alerts.JFX2BtnCancelAlert;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
public class Main extends Application {
private Stage primaryStage;
private Scene scene;
private AnchorPane pane;
private MainWindowController mainWindowController;
private static String userHome = System.getProperty("user.home");
private static String userName = System.getProperty("user.name");
private static String osName = System.getProperty("os.name");
private static String osArch = System.getProperty("os.arch");
private static String osVers = System.getProperty("os.version");
private static String javaVers = System.getProperty("java.version");
private static String javaVend = System.getProperty("java.vendor");
private static String local = System.getProperty("user.language") + "_" + System.getProperty("user.country");
private String dirWin = userHome + "/Documents/HomeFlix"; // Windows: C:/Users/"User"/Documents/HomeFlix
private String dirLinux = userHome + "/HomeFlix"; // Linux: /home/"User"/HomeFlix
private File directory;
private File configFile;
private File posterCache;
private ResourceBundle bundle;
private static Logger LOGGER;
@Override
public void start(Stage primaryStage) throws IOException {
LOGGER.info("OS: " + osName + " " + osVers + " " + osArch);
LOGGER.info("Java: " + javaVend + " " + javaVers);
LOGGER.info("User: " + userName + " " + userHome);
this.primaryStage = primaryStage;
mainWindow();
}
/**
* initialize the mainWindowController, GUI and load the saved settings or call addFirstSource
* initialize the primaryStage and set the file/directory paths
*/
private void mainWindow(){
try {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(ClassLoader.getSystemResource("fxml/MainWindow.fxml"));
pane = (AnchorPane) loader.load();
primaryStage.setMinHeight(600.00);
primaryStage.setMinWidth(1000.00);
primaryStage.setResizable(false);
primaryStage.setTitle("Project HomeFlix");
primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/icons/Homeflix_Icon_64x64.png"))); //adds application icon
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
public void handle(WindowEvent we) {
System.exit(1);
}
});
mainWindowController = loader.getController(); //Link of FXMLController and controller class
mainWindowController.setMain(this); //call setMain
// get OS and the specific paths
if (osName.contains("Windows")) {
directory = new File(dirWin);
configFile = new File(dirWin + "/config.xml");
posterCache = new File(dirWin + "/posterCache");
} else {
directory = new File(dirLinux);
configFile = new File(dirLinux + "/config.xml");
posterCache = new File(dirLinux + "/posterCache");
}
// generate window
scene = new Scene(pane); // create new scene, append pane to scene
scene.getStylesheets().add(getClass().getResource("/css/MainWindow.css").toExternalForm());
primaryStage.setScene(scene); // append scene to stage
primaryStage.show(); // show stage
// startup checks
if (!configFile.exists()) {
directory.mkdir();
addFirstSource();
mainWindowController.setColor("ee3523");
mainWindowController.setFontSize(17.0);
mainWindowController.setAutoUpdate(false);
mainWindowController.setLocal(local);
mainWindowController.saveSettings();
}
if (!posterCache.exists()) {
posterCache.mkdir();
}
// init here as it loads the games to the mwc and the gui, therefore the window must exist
mainWindowController.init();
mainWindowController.getDbController().init();
} catch (IOException e) {
LOGGER.error(e);
}
}
/**
* we need to get the path for the first source from the user and add it to
* sources.json, if the user ends the file-/directory-chooser the program will exit
*/
private void addFirstSource() {
switch (local) {
case "en_US":
bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US); // us_english
break;
case "de_DE":
bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.GERMAN); // German
break;
default:
bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US); // default local
break;
}
JFX2BtnCancelAlert selectFirstSource = new JFX2BtnCancelAlert(bundle.getString("addSourceHeader"),
bundle.getString("addSourceBody"),
"-fx-button-type: RAISED; -fx-background-color: #ee3523; -fx-text-fill: BLACK;",
bundle.getString("addDirectory"), bundle.getString("addStreamSource"),
bundle.getString("cancelBtnText"), primaryStage);
// directory action
EventHandler<ActionEvent> btn1Action = new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle(bundle.getString("addDirectory"));
File selectedFolder = directoryChooser.showDialog(primaryStage);
if (selectedFolder != null && selectedFolder.exists()) {
mainWindowController.addSource(selectedFolder.getPath(), "local");
selectFirstSource.getAlert().close();
} else {
LOGGER.error("The selected folder dosen't exist!");
System.exit(1);
}
}
};
// streaming action
EventHandler<ActionEvent> btn2Action = new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("addStreamSource");
File selectedFile = fileChooser.showOpenDialog(getPrimaryStage());
if (selectedFile != null && selectedFile.exists()) {
mainWindowController.addSource(selectedFile.getPath(), "stream");
selectFirstSource.getAlert().close();
} else {
LOGGER.error("The selected file dosen't exist!");
System.exit(1);
}
}
};
selectFirstSource.setBtn1Action(btn1Action);
selectFirstSource.setBtn2Action(btn2Action);
selectFirstSource.showAndWait();
}
/**
* set the log file location and initialize the logger
* launch the GUI
* @param args arguments given at the start
*/
public static void main(String[] args) {
if (System.getProperty("os.name").equals("Windows")) {
System.setProperty("logFilename", userHome + "/Documents/HomeFlix/app.log");
File logFile = new File(userHome + "/Documents/HomeFlix/app.log");
logFile.delete();
} else {
System.setProperty("logFilename", userHome + "/HomeFlix/app.log");
File logFile = new File(userHome + "/HomeFlix/app.log");
logFile.delete();
}
LOGGER = LogManager.getLogger(Main.class.getName());
launch(args);
}
public Stage getPrimaryStage() {
return primaryStage;
}
public AnchorPane getPane() {
return pane;
}
public File getDirectory() {
return directory;
}
public File getConfigFile() {
return configFile;
}
public File getPosterCache() {
return posterCache;
}
}

+ 0
- 1134
src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java
File diff suppressed because it is too large
View File


+ 0
- 778
src/main/java/kellerkinder/HomeFlix/controller/DBController.java View File

@ -1,778 +0,0 @@
/**
* Project-HomeFlix
*
* 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
* 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.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.net.URLConnection;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.eclipsesource.json.Json;
import com.eclipsesource.json.JsonArray;
import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.JsonValue;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import kellerkinder.HomeFlix.application.Main;
import kellerkinder.HomeFlix.application.MainWindowController;
import kellerkinder.HomeFlix.datatypes.SourceDataType;
import kellerkinder.HomeFlix.datatypes.FilmTabelDataType;
public class DBController {
private MainWindowController mainWindowController;
private Main main;
private String DB_PATH = System.getProperty("user.home") + "\\Documents\\HomeFlix" + "\\" + "Homeflix.db"; //path to database file
private Image favorite_black = new Image("icons/ic_favorite_black_18dp_1x.png");
private Image favorite_border_black = new Image("icons/ic_favorite_border_black_18dp_1x.png");
private List<String> filmsdbAll = new ArrayList<String>();
private List<String> filmsdbDir = new ArrayList<String>();
private List<String> filmsdbStreamURL = new ArrayList<String>(); // needed
private List<String> filmsStreamURL = new ArrayList<String>(); // needed
private Connection connection = null;
private static final Logger LOGGER = LogManager.getLogger(DBController.class.getName());
/**
* constructor for DBController
* @param main the main object
* @param mainWindowController the mainWindowController object
*/
public DBController(Main main, MainWindowController mainWindowController) {
this.main = main;
this.mainWindowController = mainWindowController;
}
/**
* initialize the {@link DBController}
* initialize the database connection
* check if there is a need to create a new database
* refresh the database
*/
public void init() {
LOGGER.info("<========== starting loading sql ==========>");
initDatabaseConnection();
createDatabase();
refreshDataBase();
LOGGER.info("<========== finished loading sql ==========>");
}
/**
* create a new connection to the HomeFlix.db database
* AutoCommit is set to false to prevent some issues, so manual commit is active!
*/
private void initDatabaseConnection() {
DB_PATH = main.getDirectory() + "/Homeflix.db";
try {
// create a database connection
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH);
connection.setAutoCommit(false);
} catch (SQLException e) {
// if the error message is "out of memory", it probably means no database file is found
LOGGER.error("error while loading the ROM database", e);
}
LOGGER.info("ROM database loaded successfull");
}
/**
* if tables don't exist create them
* films table: streamUrl is primary key
* cache table: streamUrl is primary key
*/
private void createDatabase() {
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("create table if not exists films (streamUrl, title, season, episode, favorite, cached, currentTime)");
stmt.executeUpdate("create table if not exists cache ("
+ "streamUrl, Title, Year, Rated, Released, Runtime, Genre, Director, Writer,"
+ " Actors, Plot, Language, Country, Awards, Metascore, imdbRating, imdbVotes,"
+ " imdbID, Type, Poster, Response)");
stmt.close();
} catch (SQLException e) {
LOGGER.error(e);
}
}
/**
* get all database entries
*/
private void loadDatabase() {
// get all entries from the table
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM films");
while (rs.next()) {
filmsdbDir.add(rs.getString("title"));
filmsdbStreamURL.add(rs.getString("streamUrl"));
}
stmt.close();
rs.close();
} catch (SQLException e) {
LOGGER.error("Ups! an error occured!", e);
}
// add all entries to filmsAll and filmsdbAl, for later comparing
filmsdbAll.addAll(filmsdbDir);
LOGGER.info("films in directory: " + filmsStreamURL.size());
LOGGER.info("filme in db: " + filmsdbStreamURL.size());
}
/**
* load sources from sources.json
* if mode == local, get all files and series-folder from the directory
* else mode must be streaming, read all entries from the streaming file
*/
private void loadSources() {
// remove sources from table
mainWindowController.getSourcesList().removeAll(mainWindowController.getSourcesList());
mainWindowController.getSourceRoot().getChildren().removeAll(mainWindowController.getSourceRoot().getChildren());
try {
JsonArray sources = Json.parse(new FileReader(main.getDirectory() + "/sources.json")).asArray();
for (JsonValue source : sources) {
String path = source.asObject().getString("path", "");
String mode = source.asObject().getString("mode", "");
mainWindowController.addSourceToTable(path, mode); // add source to source-table
if (mode.equals("local")) {
for (File file : new File(path).listFiles()) {
if (file.isFile() && isVideoFile(file.getPath())) {
filmsStreamURL.add(file.getPath());
} else if(file.isDirectory()) {
// get all folders (series)
for (File season : file.listFiles()) {
if (season.isDirectory()) {
for (File episode : season.listFiles()) {
if (!filmsdbStreamURL.contains(episode.getPath())) {
filmsStreamURL.add(episode.getPath());
}
}
}
}
}
}
LOGGER.info("added files from: " + path);
} else {
// getting all entries from the streaming lists
try {
JsonObject object = Json.parse(new FileReader(path)).asObject();
JsonArray items = object.get("entries").asArray();
for (JsonValue item : items) {
filmsStreamURL.add(item.asObject().getString("streamUrl", ""));
}
LOGGER.info("added films from: " + path);
} catch (IOException e) {
LOGGER.error(e);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* load the data to the mainWindowController
* order entries by title
*/
private void loadDataToMWC() {
LOGGER.info("loading data to mwc ...");
try {
//load local Data
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM films ORDER BY title");
while (rs.next()) {
// System.out.println(rs.getString("title") + "Season:" + rs.getString("season") + ":");
if (rs.getBoolean("favorite") == true) {
mainWindowController.getFilmsList().add(new FilmTabelDataType(rs.getString("streamUrl"),
rs.getString("title"), rs.getString("season"), rs.getString("episode") ,rs.getBoolean("favorite"),
rs.getBoolean("cached"), new ImageView(favorite_black)));
} else {
mainWindowController.getFilmsList().add(new FilmTabelDataType(rs.getString("streamUrl"),
rs.getString("title"), rs.getString("season"), rs.getString("episode"), rs.getBoolean("favorite"),
rs.getBoolean("cached"), new ImageView(favorite_border_black)));
}
}
stmt.close();
rs.close();
} catch (SQLException e) {
LOGGER.error("Ups! an error occured!", e);
}
LOGGER.info("loading data to the GUI ...");
mainWindowController.addDataUI(mainWindowController.getFilmsList());
}
/**
* refresh data in mainWindowController for one element
* @param streamUrl of the film
* @param index of the film in LocalFilms list
*/
public void refresh(String streamUrl, int indexList) {
LOGGER.info("refresh ...");
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM films WHERE streamUrl = \"" + streamUrl + "\";");
while (rs.next()) {
if (rs.getBoolean("favorite") == true) {
mainWindowController.getFilmsList().set(indexList, new FilmTabelDataType(rs.getString("streamUrl"),
rs.getString("title"), rs.getString("season"), rs.getString("episode"), rs.getBoolean("favorite"),
rs.getBoolean("cached"), new ImageView(favorite_black)));
} else {
mainWindowController.getFilmsList().set(indexList, new FilmTabelDataType(rs.getString("streamUrl"),
rs.getString("title"), rs.getString("season"), rs.getString("episode"), rs.getBoolean("favorite"),
rs.getBoolean("cached"), new ImageView(favorite_border_black)));
}
}
rs.close();
stmt.close();
} catch (Exception e) {
LOGGER.error("Ups! error while refreshing mwc!", e);
}
}
/**
* refresh database to contain all (new added) entries
* refresh the MainWindowController content,
* to contain all (new added) entries from the database
*/
public void refreshDataBase() {
LOGGER.info("refreshing the Database ...");
// clean all ArraLists
filmsdbAll.clear();
filmsdbDir.clear();
filmsdbStreamURL.clear();
filmsStreamURL.clear();
loadSources(); // reload all sources
loadDatabase(); // reload all films saved in the DB
try {
checkAddEntry();
checkRemoveEntry();
} catch (Exception e) {
LOGGER.error("Error while refreshing the database", e);
}
// remove all films from the mwc lists
mainWindowController.getFilmsList().removeAll(mainWindowController.getFilmsList());
mainWindowController.getFilmRoot().getChildren().removeAll(mainWindowController.getFilmRoot().getChildren());
loadDataToMWC(); // load the new data to the mwc
}
/**
* check if there are any entries that have been removed from the film-directory
*/
private void checkRemoveEntry() {
LOGGER.info("checking for entrys to remove to DB ...");
try {
Statement stmt = connection.createStatement();
for (String entry : filmsdbStreamURL) {
if (!filmsStreamURL.contains(entry)) {
stmt.executeUpdate("delete from films where streamUrl = \"" + entry + "\"");
connection.commit();
LOGGER.info("removed \"" + entry + "\" from database");
}
}
stmt.close();
} catch (Exception e) {
LOGGER.error(e);
}
}
/**
* check if there are new films in the film-directory
* @throws SQLException
* @throws FileNotFoundException
* @throws IOException
*/
private void checkAddEntry() throws SQLException, FileNotFoundException, IOException {
Statement stmt = connection.createStatement();
PreparedStatement ps = connection.prepareStatement("insert into films values (?, ?, ?, ?, ?, ?, ?)");
LOGGER.info("checking for entrys to add to DB ...");
// source is a single source of the sources list
for (SourceDataType source : mainWindowController.getSourcesList()) {
// if it's a local source check the folder for new film
if (source.getMode().equals("local")) {
for (File file : new File(source.getPath()).listFiles()) {
if (file.isFile()) {
// get all files (films)
if (!filmsdbStreamURL.contains(file.getPath())) {
stmt.executeUpdate("insert into films values ("
+ "'" + file.getPath() + "',"
+ "'" + cutOffEnd(file.getName()) + "', '', '', 0, 0, 0.0)");
connection.commit();
stmt.close();
LOGGER.info("Added \"" + file.getName() + "\" to database");
filmsdbStreamURL.add(file.getPath());
}
} else {
// get all folders (series)
int sn = 1;
for (File season : file.listFiles()) {
if (season.isDirectory()) {
int ep = 1;
for (File episode : season.listFiles()) {
if (!filmsdbStreamURL.contains(episode.getPath())) {
LOGGER.info("Added \"" + file.getName() + "\", Episode: " + episode.getName() + " to database");
stmt.executeUpdate("insert into films values ("
+ "'" + episode.getPath().replace("'", "''") + "',"
+ "'" + cutOffEnd(file.getName()) + "','" + sn + "','" + ep + "', 0, 0, 0.0)");
connection.commit();
stmt.close();
filmsStreamURL.add(episode.getPath());
filmsdbStreamURL.add(episode.getPath());
ep++;
}
}
sn++;
}
}
}
}
} else {
// if it's a streaming source check the file for new films
for (String entry : filmsStreamURL) {
if (!filmsdbStreamURL.contains(entry)) {
JsonArray items = Json.parse(new FileReader(source.getPath())).asObject().get("entries").asArray();
// for each item, check if it's the needed
for (JsonValue item : items) {
String streamUrl = item.asObject().getString("streamUrl", "");
String title = item.asObject().getString("title", "");
// if it's the needed add it to the database
if (streamUrl.equals(entry)) {
ps.setString(1, streamUrl);
ps.setString(2, title);
ps.setString(3, item.asObject().getString("season", ""));
ps.setString(4, item.asObject().getString("episode", ""));
ps.setInt(5, 0);
ps.setBoolean(6, false);
ps.setDouble(7, 0);
ps.addBatch(); // adds the entry
LOGGER.info("Added \"" + title + "\" to database");
filmsdbStreamURL.add(streamUrl);
}
}
}
}
ps.executeBatch();
connection.commit();
ps.close();
}
}
}
/**
* DEBUG
* prints all entries from the database to the console
*/
public void printAllDBEntriesDEBUG() {
System.out.println("Outputting all entries ... \n");
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM films");
while (rs.next()) {
System.out.println(rs.getString("streamUrl"));
System.out.println(rs.getString("title"));
System.out.println(rs.getString("season"));
System.out.println(rs.getString("episode"));
System.out.println(rs.getString("rating"));
System.out.println(rs.getString("cached"));
System.out.println(rs.getString("currentTime") + "\n");
}
stmt.close();
rs.close();
} catch (SQLException e) {
LOGGER.error("An error occured, while printing all entries", e);
}
}
/**
* update the database entry for the given film, favorite = 0
* @param streamUrl URL of the film
*/
public void dislike(String streamUrl) {
LOGGER.info("dislike " + streamUrl);
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE films SET favorite=0 WHERE streamUrl=\"" + streamUrl + "\";");
connection.commit();
stmt.close();
} catch (SQLException e) {
LOGGER.error("Ups! an error occured!", e);
}
}
/**
* update the database entry for the given film, favorite = 1
* @param streamUrl URL of the film
*/
public void like(String streamUrl) {
LOGGER.info("like " + streamUrl);
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE films SET favorite=1 WHERE streamUrl=\"" + streamUrl + "\";");
connection.commit();
stmt.close();
} catch (SQLException e) {
LOGGER.error("Ups! an error occured!", e);
}
}
/**
* update the database entry for the given film, cached = 1
* @param streamUrl URL of the film
*/
void setCached(String streamUrl) {
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE films SET cached=1 WHERE streamUrl=\"" + streamUrl + "\";");
connection.commit();
stmt.close();
} catch (SQLException e) {
LOGGER.error("Ups! an error occured!", e);
}
refresh(streamUrl, mainWindowController.getIndexList());
}
/**
* add the received data to the cache table
* @param streamUrl URL of the film
* @param Title
* @param Year
* @param Rated
* @param Released
* @param Runtime
* @param Genre
* @param Director
* @param Writer
* @param Actors
* @param Plot
* @param Language
* @param Country
* @param Awards
* @param Metascore
* @param imdbRating
* @param Type
* @param imdbVotes
* @param imdbID
* @param Poster
* @param Response
* @throws SQLException
*/
void addCache( String streamUrl, String Title, String Year, String Rated, String Released, String Runtime, String Genre, String Director,
String Writer, String Actors, String Plot, String Language, String Country, String Awards, String Metascore, String imdbRating,
String Type, String imdbVotes, String imdbID, String Poster, String Response) {
try {
PreparedStatement ps = connection.prepareStatement("insert into cache values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
LOGGER.info("adding to cache: " + Title);
ps.setString(1,streamUrl);
ps.setString(2,Title);
ps.setString(3,Year);
ps.setString(4,Rated);
ps.setString(5,Released);
ps.setString(6,Runtime);
ps.setString(7,Genre);
ps.setString(8,Director);
ps.setString(9,Writer);
ps.setString(10,Actors);
ps.setString(11,Plot);
ps.setString(12,Language);
ps.setString(13,Country);
ps.setString(14,Awards);
ps.setString(15,Metascore);
ps.setString(16,imdbRating);
ps.setString(17,imdbVotes);
ps.setString(18,imdbID);
ps.setString(19,Type);
ps.setString(20,Poster);
ps.setString(21,Response);
ps.addBatch();
ps.executeBatch();
connection.commit();
ps.close();
LOGGER.info("done!");
} catch (Exception e) {
LOGGER.error(e);
}
}
/**
* checks if there is already a entry with the given streamUrl in the cache
* @param streamUrl URL of the element
* @return true if the element is already cached, else false
*/
public boolean searchCache(String streamUrl) {
boolean retValue = false;
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM cache WHERE streamUrl = \"" + streamUrl + "\";");
retValue = rs.next();
rs.close();
stmt.close();
} catch (Exception e) {
LOGGER.error("Ups! error while getting the current time!", e);
}
return retValue;
}
/**
* sets the cached data to mwc's TextFlow
* @param streamUrl URL of the film
*/
public void readCache(String streamUrl) {
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM cache WHERE streamUrl=\"" + streamUrl + "\";");
ArrayList<Text> nameText = new ArrayList<Text>();
ArrayList<Text> responseText = new ArrayList<Text>();
Image im;
int fontSize = (int) Math.round(mainWindowController.getFontSize());
int j = 2;
nameText.add(0, new Text(mainWindowController.getBundle().getString("title") + ": "));
nameText.add(1, new Text(mainWindowController.getBundle().getString("year") + ": "));
nameText.add(2, new Text(mainWindowController.getBundle().getString("rating") + ": "));
nameText.add(3, new Text(mainWindowController.getBundle().getString("publishedOn") + ": "));
nameText.add(4, new Text(mainWindowController.getBundle().getString("duration") + ": "));
nameText.add(5, new Text(mainWindowController.getBundle().getString("genre") + ": "));
nameText.add(6, new Text(mainWindowController.getBundle().getString("director") + ": "));
nameText.add(7, new Text(mainWindowController.getBundle().getString("writer") + ": "));
nameText.add(8, new Text(mainWindowController.getBundle().getString("actors") + ": "));
nameText.add(9, new Text(mainWindowController.getBundle().getString("plot") + ": "));
nameText.add(10, new Text(mainWindowController.getBundle().getString("language") + ": "));
nameText.add(11, new Text(mainWindowController.getBundle().getString("country") + ": "));
nameText.add(12, new Text(mainWindowController.getBundle().getString("awards") + ": "));
nameText.add(13, new Text(mainWindowController.getBundle().getString("metascore") + ": "));
nameText.add(14, new Text(mainWindowController.getBundle().getString("imdbRating") + ": "));
nameText.add(15, new Text(mainWindowController.getBundle().getString("type") + ": "));
for (int i = 0; i < 15; i++) {
responseText.add(new Text(rs.getString(j) + "\n"));
j++;
}
responseText.add(new Text(rs.getString(19) + "\n"));
im = new Image(new File(rs.getString(20)).toURI().toString());
stmt.close();
rs.close();
for (int i = 0; i < nameText.size(); i++) {
nameText.get(i).setFont(Font.font("System", FontWeight.BOLD, fontSize));
responseText.get(i).setFont(Font.font("System", fontSize));
}
mainWindowController.getTextFlow().getChildren().remove(0,
mainWindowController.getTextFlow().getChildren().size());
for (int i = 0; i < nameText.size(); i++) {
mainWindowController.getTextFlow().getChildren().addAll(nameText.get(i), responseText.get(i));
}
try {
mainWindowController.getPosterImageView().setImage(im);
} catch (Exception e) {
mainWindowController.getPosterImageView().setImage(new Image("resources/icons/close_black_2048x2048.png"));
LOGGER.error(e);
}
} catch (SQLException e) {
LOGGER.error("Ups! an error occured!", e);
}
}
/**
* return the currentTime in ms saved in the database
* @param streamUrl URL of the film
* @return {@link Double} currentTime in ms
*/
public double getCurrentTime(String streamUrl) {
LOGGER.info("currentTime: " + streamUrl);
double currentTime = 0;
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM films WHERE streamUrl = \"" + streamUrl + "\";");
currentTime = rs.getDouble("currentTime");
rs.close();
stmt.close();
} catch (Exception e) {
LOGGER.error("Ups! error while getting the current time!", e);