commit
b331ffd270
@ -3,9 +3,10 @@
|
|||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Jannik/workspace/Project HomeFlix/src/libraries/jfoenix.jar"/>
|
<classpathentry kind="lib" path="src/libraries/minimal-json-0.9.4.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Jannik/workspace/Project HomeFlix/src/libraries/minimal-json-0.9.4.jar"/>
|
<classpathentry kind="lib" path="src/libraries/commons-lang3-3.5.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Jannik/workspace/Project HomeFlix/src/libraries/commons-lang3-3.5.jar"/>
|
<classpathentry kind="lib" path="src/libraries/jfoenix-1.1.0.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Jannik/workspace/Project HomeFlix/src/libraries/sqlite-jdbc-3.15.1.jar"/>
|
<classpathentry kind="lib" path="src/libraries/sqlite-jdbc-3.16.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="C:/Users/Jannik/Downloads/flow-8.0.7.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
1
.project
1
.project
@ -19,5 +19,6 @@
|
|||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
|
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.fx.ide.css.nature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# Project-HomeFlix
|
# Project-HomeFlix
|
||||||
|
|
||||||
|
|
||||||
Project HomeFlix is a Kellerkinder Project, that alowes you to sort all your local saved movies in clean UI.
|
Project HomeFlix is a Kellerkinder Project, that alowes you to sort all your local saved movies in clean UI.
|
||||||
This is the master branch, it is **only merged** with dev if a **new release** is out.
|
This is the master branch, it is **only merged** with dev if a **new release** is out.
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -16,11 +16,13 @@
|
|||||||
<?import javafx.scene.layout.HBox?>
|
<?import javafx.scene.layout.HBox?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
<?import javafx.scene.text.TextFlow?>
|
||||||
|
|
||||||
<AnchorPane fx:id="anpane" prefHeight="600.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController">
|
<AnchorPane fx:id="anpane" prefHeight="600.0" prefWidth="950.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController">
|
||||||
<children>
|
<children>
|
||||||
<TreeTableView fx:id="treeTableViewfilm" layoutX="14.0" layoutY="88.0" prefHeight="400.0" prefWidth="360.0" AnchorPane.bottomAnchor="12.0" AnchorPane.leftAnchor="12.0" AnchorPane.topAnchor="88.0" />
|
<TreeTableView fx:id="treeTableViewfilm" layoutX="14.0" layoutY="88.0" prefHeight="400.0" prefWidth="360.0" AnchorPane.bottomAnchor="12.0" AnchorPane.leftAnchor="12.0" AnchorPane.rightAnchor="553.0" AnchorPane.topAnchor="88.0" />
|
||||||
<JFXTextArea fx:id="ta1" layoutX="385.0" layoutY="42.0" maxWidth="503.0" minWidth="275.0" prefHeight="546.0" prefWidth="293.0" AnchorPane.bottomAnchor="12.0" AnchorPane.leftAnchor="385.0" AnchorPane.rightAnchor="222.0" AnchorPane.topAnchor="44.0" />
|
<JFXTextArea fx:id="ta1" layoutX="385.0" layoutY="42.0" maxWidth="503.0" minWidth="275.0" prefHeight="546.0" prefWidth="293.0" AnchorPane.bottomAnchor="12.0" AnchorPane.leftAnchor="410.0" AnchorPane.rightAnchor="222.0" AnchorPane.topAnchor="44.0" />
|
||||||
|
<TextFlow fx:id="textFlow" layoutX="496.0" layoutY="131.0" prefHeight="200.0" prefWidth="200.0" visible="false" AnchorPane.bottomAnchor="15.0" AnchorPane.leftAnchor="410.0" AnchorPane.rightAnchor="220.0" AnchorPane.topAnchor="44.0" />
|
||||||
<JFXButton fx:id="playbtn" contentDisplay="CENTER" layoutX="690.0" layoutY="363.0" onAction="#playbtnclicked" prefHeight="25.0" prefWidth="198.0" AnchorPane.bottomAnchor="212.0" AnchorPane.rightAnchor="12.0">
|
<JFXButton fx:id="playbtn" contentDisplay="CENTER" layoutX="690.0" layoutY="363.0" onAction="#playbtnclicked" prefHeight="25.0" prefWidth="198.0" AnchorPane.bottomAnchor="212.0" AnchorPane.rightAnchor="12.0">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
@ -29,7 +31,7 @@
|
|||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font></JFXButton>
|
</font></JFXButton>
|
||||||
<JFXTextField fx:id="tfsearch" layoutX="12.0" layoutY="44.0" maxWidth="477.0" minWidth="359.0" prefHeight="31.0" prefWidth="359.0" promptText="Suche ..." AnchorPane.leftAnchor="12.0" AnchorPane.topAnchor="44.0">
|
<JFXTextField fx:id="tfsearch" layoutX="12.0" layoutY="44.0" maxWidth="477.0" minWidth="359.0" prefHeight="31.0" prefWidth="359.0" promptText="Suche ..." AnchorPane.leftAnchor="12.0" AnchorPane.rightAnchor="553.0" AnchorPane.topAnchor="44.0">
|
||||||
<font>
|
<font>
|
||||||
<Font name="Arial" size="12.0" />
|
<Font name="Arial" size="12.0" />
|
||||||
</font></JFXTextField>
|
</font></JFXTextField>
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/application/MainWindowController$5.class
Normal file
BIN
bin/application/MainWindowController$5.class
Normal file
Binary file not shown.
BIN
bin/application/MainWindowController$6.class
Normal file
BIN
bin/application/MainWindowController$6.class
Normal file
Binary file not shown.
BIN
bin/application/MainWindowController$7.class
Normal file
BIN
bin/application/MainWindowController$7.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
202
bin/libraries/Licenses/Apache_License.txt
Normal file
202
bin/libraries/Licenses/Apache_License.txt
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
19
bin/libraries/Licenses/MIT_License.txt
Normal file
19
bin/libraries/Licenses/MIT_License.txt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
Copyright (c) 2013, 2014 EclipseSource
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
Binary file not shown.
BIN
bin/libraries/sqlite-jdbc-3.16.1.jar
Normal file
BIN
bin/libraries/sqlite-jdbc-3.16.1.jar
Normal file
Binary file not shown.
@ -1,4 +1,4 @@
|
|||||||
# HomeFlix-Local_de_DE.properties German Local
|
# HomeFlix-Local_de_DE.properties German Local
|
||||||
info = Info
|
info = Info
|
||||||
settings = Einstellungen
|
settings = Einstellungen
|
||||||
streamingSettings = Stream Einst.
|
streamingSettings = Stream Einst.
|
||||||
@ -28,7 +28,7 @@ errorSave = Beim speichern der Einstellungen ist ein Fehler aufgetreten!
|
|||||||
noFilmFound = Kein Film mit diesem Titel gefunden!
|
noFilmFound = Kein Film mit diesem Titel gefunden!
|
||||||
linuxBug = Zurzeit werden unter Linux leider keine Dateien mit Leerzeichen unterst\u00FCtzt!
|
linuxBug = Zurzeit werden unter Linux leider keine Dateien mit Leerzeichen unterst\u00FCtzt!
|
||||||
vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt!
|
vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt!
|
||||||
infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz
|
infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016-2017 Kellerkinder www.kellerkinder.xyz
|
||||||
title = Titel
|
title = Titel
|
||||||
year = Jahr
|
year = Jahr
|
||||||
rating = Einstufung
|
rating = Einstufung
|
||||||
@ -45,3 +45,5 @@ awards = Auszeichnungen
|
|||||||
metascore = Metascore
|
metascore = Metascore
|
||||||
imdbRating = IMDB-Bewertung
|
imdbRating = IMDB-Bewertung
|
||||||
type = Type
|
type = Type
|
||||||
|
firstStartHeader = Es ist kein Stammverzeichnis f\u00FCr Filme angegeben!
|
||||||
|
firstStartContent = Stammverzeichniss angeben?
|
||||||
|
@ -28,7 +28,7 @@ errorSave = An error occurred while saving the settings!
|
|||||||
noFilmFound = No film with this title found!
|
noFilmFound = No film with this title found!
|
||||||
linuxBug = Currently no files are supported with additional space under Linux unfortunately!
|
linuxBug = Currently no files are supported with additional space under Linux unfortunately!
|
||||||
vlcNotInstalled = VLC Media Player is required to play a movie!
|
vlcNotInstalled = VLC Media Player is required to play a movie!
|
||||||
infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz
|
infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016-2017 Kellerkinder www.kellerkinder.xyz
|
||||||
title = Title
|
title = Title
|
||||||
year = Year
|
year = Year
|
||||||
rating = Rating
|
rating = Rating
|
||||||
@ -45,3 +45,5 @@ awards = Awards
|
|||||||
metascore = Metascore
|
metascore = Metascore
|
||||||
imdbRating = IMDB-Rating
|
imdbRating = IMDB-Rating
|
||||||
type = Type
|
type = Type
|
||||||
|
firstStartHeader = There is no root directory for movies!
|
||||||
|
firstStartContent = Specify a root directory?
|
BIN
bin/recources/icons/ic_favorite_black_18dp_1x.png
Normal file
BIN
bin/recources/icons/ic_favorite_black_18dp_1x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 214 B |
BIN
bin/recources/icons/ic_favorite_border_black_18dp_1x.png
Normal file
BIN
bin/recources/icons/ic_favorite_border_black_18dp_1x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 261 B |
@ -1,26 +1,31 @@
|
|||||||
/**
|
/**
|
||||||
* DBController for Project HomeFlix
|
* DBController for Project HomeFlix
|
||||||
*
|
|
||||||
* connection is in manual commit!
|
* connection is in manual commit!
|
||||||
|
* TODO arraylists not string -> streamUIData
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package application;
|
package application;
|
||||||
|
|
||||||
import java.sql.Connection; //für Datenbank
|
import java.io.File;
|
||||||
import java.sql.DriverManager; //für Datenbank
|
import java.io.FileNotFoundException;
|
||||||
import java.sql.PreparedStatement; //für Datenbank
|
import java.io.FileReader;
|
||||||
import java.sql.ResultSet; //für Datenbank
|
import java.io.IOException;
|
||||||
import java.sql.SQLException; //für Datenbank
|
import java.sql.Connection;
|
||||||
import java.sql.Statement; //für Datenbank
|
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 com.eclipsesource.json.Json;
|
import com.eclipsesource.json.Json;
|
||||||
import com.eclipsesource.json.JsonArray;
|
import com.eclipsesource.json.JsonArray;
|
||||||
import com.eclipsesource.json.JsonObject;
|
import com.eclipsesource.json.JsonObject;
|
||||||
import com.eclipsesource.json.JsonValue;
|
import com.eclipsesource.json.JsonValue;
|
||||||
|
|
||||||
import java.io.File;
|
import javafx.scene.image.Image;
|
||||||
import java.io.FileReader;
|
import javafx.scene.image.ImageView;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class DBController {
|
public class DBController {
|
||||||
|
|
||||||
@ -29,18 +34,34 @@ public class DBController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private MainWindowController mainWindowController;
|
private MainWindowController mainWindowController;
|
||||||
private String DB_PATH = System.getProperty("user.home") + "\\Documents\\HomeFlix" + "\\" + "Homeflix.db"; // der Pfad der Datenbank-Datei
|
private String DB_PATH = System.getProperty("user.home") + "\\Documents\\HomeFlix" + "\\" + "Homeflix.db"; //path to database file
|
||||||
|
private Image favorite_black = new Image("recources/icons/ic_favorite_black_18dp_1x.png");
|
||||||
|
private Image favorite_border_black = new Image("recources/icons/ic_favorite_border_black_18dp_1x.png");
|
||||||
|
private List<String> filmsdbAll = new ArrayList<String>();
|
||||||
|
private List<String> filmsdbLocal = new ArrayList<String>();
|
||||||
|
private List<String> filmsdbStream = new ArrayList<String>();
|
||||||
|
private List<String> filmsdbStreamURL = new ArrayList<String>();
|
||||||
|
private List<String> filmsAll = new ArrayList<String>();
|
||||||
|
private List<String> filmsDir = new ArrayList<String>();
|
||||||
|
private List<String> filmsStream = new ArrayList<String>();
|
||||||
|
private List<String> filmsStreamURL = new ArrayList<String>();
|
||||||
|
private List<String> filmsStreamData = new ArrayList<String>();
|
||||||
Connection connection = null;
|
Connection connection = null;
|
||||||
|
|
||||||
public void main() {
|
public void main() {
|
||||||
|
if (System.getProperty("os.name").equals("Linux")) {
|
||||||
|
DB_PATH = System.getProperty("user.home") + "/HomeFlix/Homeflix.db";
|
||||||
|
}else{
|
||||||
|
DB_PATH = System.getProperty("user.home") + "\\Documents\\HomeFlix" + "\\" + "Homeflix.db";
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
// create a database connection
|
// create a database connection
|
||||||
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH);
|
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH);
|
||||||
// Statement statement = connection.createStatement();
|
// Statement statement = connection.createStatement();
|
||||||
// statement.setQueryTimeout(30); // set timeout to 30 sec. TODO don't know wath to do with this
|
// statement.setQueryTimeout(30); // set timeout to 30 sec. TODO don't know what to do with this
|
||||||
|
|
||||||
connection.setAutoCommit(false); //Autocommit to false -> manual commit is active!
|
connection.setAutoCommit(false); //AutoCommit to false -> manual commit is active
|
||||||
fuelleDatenbank();
|
// fuelleDatenbank();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
// if the error message is "out of memory", it probably means no database file is found
|
// if the error message is "out of memory", it probably means no database file is found
|
||||||
System.err.println(e.getMessage());
|
System.err.println(e.getMessage());
|
||||||
@ -56,177 +77,392 @@ public class DBController {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fuelleDatenbank() {
|
void createDatabase() {
|
||||||
|
System.out.println("<==========starting loading sql==========>");
|
||||||
try {
|
|
||||||
System.out.println("Erstelle Einträge local");
|
PreparedStatement ps;
|
||||||
|
PreparedStatement psS;
|
||||||
|
|
||||||
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
Statement stmtS = connection.createStatement();
|
stmt.executeUpdate("create table if not exists film_local (rating, titel, streamUrl, favIcon)");
|
||||||
stmt.executeUpdate("drop table if exists film_local");
|
stmt.executeUpdate("create table if not exists film_streaming (year, season, episode, rating, resolution, titel, streamUrl, favIcon)");
|
||||||
stmtS.executeUpdate("drop table if exists film_streaming");
|
stmt.close();
|
||||||
stmt.executeUpdate("create table film_local (rating, titel, streamUrl)"); // Tabelle "filme" und die Spalten "titel", "pfad", "bewertung" erstellen
|
} catch (SQLException e1) {
|
||||||
stmtS.executeUpdate("create table film_streaming (year, season, episode, rating, resolution, titel, streamUrl)"); // Tabelle "filme" und die Spalten "titel", "pfad", "bewertung" erstellen
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Statement stmt = connection.createStatement();
|
||||||
|
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local");
|
||||||
|
while (rs.next()) {
|
||||||
|
filmsdbLocal.add(rs.getString(2));
|
||||||
|
}
|
||||||
|
stmt.close();
|
||||||
|
rs.close();
|
||||||
|
|
||||||
|
rs = stmt.executeQuery("SELECT * FROM film_streaming;");
|
||||||
PreparedStatement ps = connection.prepareStatement("insert into film_local values (?, ?, ?)"); // SQL Befehl
|
while (rs.next()) {
|
||||||
PreparedStatement psS = connection.prepareStatement("insert into film_streaming values (?, ?, ?, ?, ?, ?, ?)"); // SQL Befehl
|
filmsdbStream.add(rs.getString(6));
|
||||||
|
filmsdbStreamURL.add(rs.getString(7));
|
||||||
String[] entries = new File(mainWindowController.getPath()).list();
|
}
|
||||||
|
stmt.close();
|
||||||
for(int i=0;i!=entries.length;i++) // Geht alle Dateien im Verzeichniss durch
|
rs.close();
|
||||||
{
|
}catch (SQLException ea){
|
||||||
//System.out.println(file[i].getName());
|
System.err.println("Ups! an error occured!");
|
||||||
ps.setInt(1, 0); // definiert Bewertung als Integer in der dritten Spalte
|
ea.printStackTrace();
|
||||||
ps.setString(2, ohneEndung(entries[i])); // definiert Name als String in der ersten Spalte
|
|
||||||
ps.setString(3,entries[i]); // definiert Pfad als String in der zweiten Spalte
|
|
||||||
ps.addBatch(); // fügt den Eintrag hinzu
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String[] entries = new File(mainWindowController.getPath()).list();
|
||||||
System.out.println("Erstelle Einträge streaming \n");
|
if(mainWindowController.getPath().equals("") || mainWindowController.getPath() == null){
|
||||||
if(mainWindowController.getStreamingPath().equals("")||mainWindowController.getStreamingPath().equals(null)){
|
System.out.println("Kein Pfad angegeben"); //if path == null or ""
|
||||||
System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist
|
|
||||||
}else{
|
}else{
|
||||||
for(int i=0; i< mainWindowController.streamingData.size(); i++){
|
System.out.println(entries.length);
|
||||||
String fileName = mainWindowController.getStreamingPath()+"/"+mainWindowController.streamingData.get(i).getStreamUrl();
|
for(int i=0;i!=entries.length;i++){
|
||||||
|
filmsDir.add(cutOffEnd(entries[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int v=0; v< mainWindowController.streamingData.size(); v++){
|
||||||
|
String fileName = mainWindowController.getStreamingPath()+"/"+mainWindowController.streamingData.get(v).getStreamUrl();
|
||||||
try {
|
try {
|
||||||
JsonObject object = Json.parse(new FileReader(fileName)).asObject();
|
JsonObject object = Json.parse(new FileReader(fileName)).asObject();
|
||||||
JsonArray items = object.get("entries").asArray();
|
JsonArray items = object.get("entries").asArray();
|
||||||
for (JsonValue item : items) {
|
for (JsonValue item : items) {
|
||||||
psS.setInt(1, item.asObject().getInt("year", 0));
|
filmsStream.add(item.asObject().getString("titel",""));
|
||||||
psS.setInt(2, item.asObject().getInt("season", 0));
|
filmsStreamURL.add(item.asObject().getString("streamUrl",""));
|
||||||
psS.setInt(3, item.asObject().getInt("episode", 0));
|
filmsStreamData.add(fileName);
|
||||||
psS.setInt(4, 0);
|
|
||||||
psS.setString(5, item.asObject().getString("resolution", ""));
|
|
||||||
psS.setString(6, item.asObject().getString("titel",""));
|
|
||||||
psS.setString(7, item.asObject().getString("streamUrl", ""));
|
|
||||||
psS.addBatch(); // fügt den Eintrag hinzu
|
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
//Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
filmsAll.addAll(filmsDir);
|
||||||
|
filmsAll.addAll(filmsStream);
|
||||||
|
filmsdbAll.addAll(filmsdbLocal);
|
||||||
|
filmsdbAll.addAll(filmsdbStream);
|
||||||
|
System.out.println("films in directory: "+filmsAll.size());
|
||||||
|
System.out.println("filme in db: "+filmsdbAll.size());
|
||||||
|
|
||||||
|
|
||||||
|
if(filmsdbAll.size() == 0){
|
||||||
|
System.out.println("creating entries ...");
|
||||||
|
|
||||||
|
try{
|
||||||
|
ps = connection.prepareStatement("insert into film_local values (?, ?, ?, ?)");
|
||||||
|
psS = connection.prepareStatement("insert into film_streaming values (?, ?, ?, ?, ?, ?, ?, ?)");
|
||||||
|
|
||||||
|
if(mainWindowController.getPath().equals("") || mainWindowController.getPath() == null){
|
||||||
|
System.out.println("Kein Pfad angegeben"); //if path == null or ""
|
||||||
|
}else{
|
||||||
|
for(int j=0;j!=entries.length;j++) //goes through all the files in the directory
|
||||||
|
{
|
||||||
|
ps.setInt(1, 0); //rating as integer 1. column
|
||||||
|
ps.setString(2, cutOffEnd(entries[j])); //name as String without ending 2. column
|
||||||
|
ps.setString(3,entries[j]); //path as String 3. column
|
||||||
|
ps.setString(4, "favorite_border_black");
|
||||||
|
ps.addBatch(); // add command to prepared statement
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mainWindowController.getStreamingPath().equals("")||mainWindowController.getStreamingPath().equals(null)){
|
||||||
|
System.out.println("Kein Pfad angegeben"); //if path == null or ""
|
||||||
|
}else{
|
||||||
|
for(int i=0; i< mainWindowController.streamingData.size(); i++){
|
||||||
|
String fileNamea = mainWindowController.getStreamingPath()+"/"+mainWindowController.streamingData.get(i).getStreamUrl();
|
||||||
|
try {
|
||||||
|
JsonObject object = Json.parse(new FileReader(fileNamea)).asObject();
|
||||||
|
JsonArray items = object.get("entries").asArray();
|
||||||
|
for (JsonValue item : items) {
|
||||||
|
psS.setInt(1, item.asObject().getInt("year", 0));
|
||||||
|
psS.setInt(2, item.asObject().getInt("season", 0));
|
||||||
|
psS.setInt(3, item.asObject().getInt("episode", 0));
|
||||||
|
psS.setInt(4, 0);
|
||||||
|
psS.setString(5, item.asObject().getString("resolution", ""));
|
||||||
|
psS.setString(6, item.asObject().getString("titel",""));
|
||||||
|
psS.setString(7, item.asObject().getString("streamUrl", ""));
|
||||||
|
psS.setString(8, "favorite_border_black");
|
||||||
|
psS.addBatch(); // add command to prepared statement
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ps.executeBatch(); //execute statement to write entries into table
|
||||||
|
psS.executeBatch();
|
||||||
|
connection.commit();
|
||||||
|
ps.close();
|
||||||
|
psS.close();
|
||||||
|
}catch (SQLException ea) {
|
||||||
|
System.err.println("Konnte nicht ausgeführt werden");
|
||||||
|
ea.printStackTrace();
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
try {
|
||||||
|
checkAddEntry();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} //check if added a new file
|
||||||
|
checkRemoveEntry(); //check if removed a file
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//loading data from database to mainWindowController
|
||||||
|
void loadData(){
|
||||||
|
System.out.println("loading data to mwc ...");
|
||||||
|
try {
|
||||||
|
//load local Data
|
||||||
|
Statement stmt = connection.createStatement();
|
||||||
|
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local");
|
||||||
|
while (rs.next()) {
|
||||||
|
if(rs.getString(4).equals("favorite_black")){
|
||||||
|
mainWindowController.newData.add( new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black)));
|
||||||
|
}else{
|
||||||
|
mainWindowController.newData.add( new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_border_black)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
stmt.close();
|
||||||
|
rs.close();
|
||||||
|
|
||||||
|
//load streaming Data TODO check if there are streaming data before loading -> maybe there is an issue now
|
||||||
|
rs = stmt.executeQuery("SELECT * FROM film_streaming;");
|
||||||
|
while (rs.next()) {
|
||||||
|
if(rs.getString(8).equals("favorite_black")){
|
||||||
|
mainWindowController.streamData.add(new streamUiData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_black)));
|
||||||
|
}else{
|
||||||
|
mainWindowController.streamData.add(new streamUiData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_border_black)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// connection.setAutoCommit(false);
|
stmt.close();
|
||||||
ps.executeBatch(); // scheibt alle Einträge in die Datenbank
|
rs.close();
|
||||||
psS.executeBatch();
|
} catch (SQLException e) {
|
||||||
connection.commit();
|
System.err.println("Ups! an error occured!");
|
||||||
ps.close();
|
e.printStackTrace();
|
||||||
psS.close();
|
}
|
||||||
//connection.close();
|
System.out.println("<==========finished loading sql==========>");
|
||||||
} catch (SQLException ea) {
|
}
|
||||||
System.err.println("Konnte nicht ausgeführt werden");
|
|
||||||
ea.printStackTrace();
|
//Refreshes the data in mainWindowController.newDaten and mainWindowController.streamData
|
||||||
|
//TODO it seems that there is an issue at the moment with streaming refreshing wrong entry if there is more than one with the same name
|
||||||
|
void refresh(String name,int i) throws SQLException{
|
||||||
|
System.out.println("refresh ...");
|
||||||
|
Statement stmt;
|
||||||
|
|
||||||
|
try {
|
||||||
|
stmt = connection.createStatement();
|
||||||
|
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local WHERE titel = '"+name+"';" );
|
||||||
|
if(rs.getString(4).equals("favorite_black")){
|
||||||
|
mainWindowController.newData.set(i, new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_black)));
|
||||||
|
}else{
|
||||||
|
mainWindowController.newData.set(i, new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), new ImageView(favorite_border_black)));
|
||||||
|
}
|
||||||
|
stmt.close();
|
||||||
|
rs.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
try {
|
||||||
|
stmt = connection.createStatement();
|
||||||
|
ResultSet rs = stmt.executeQuery("SELECT * FROM film_streaming WHERE titel = '"+name+"';" );
|
||||||
|
if(rs.getString(8).equals("favorite_black")){
|
||||||
|
mainWindowController.streamData.set(i,new streamUiData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_black)));
|
||||||
|
}else{
|
||||||
|
mainWindowController.streamData.set(i,new streamUiData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), new ImageView(favorite_border_black)));
|
||||||
|
}
|
||||||
|
stmt.close();
|
||||||
|
rs.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
System.err.println("Ups! an error occured!");
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ausgeben(){
|
private void checkRemoveEntry() throws SQLException{
|
||||||
System.out.println("Einträge ausgeben ... \n");
|
System.out.println("checking for entrys to remove to DB ...");
|
||||||
|
Statement stmt = connection.createStatement();
|
||||||
|
|
||||||
|
for(int a=0; a<filmsdbLocal.size(); a++){
|
||||||
|
if(filmsDir.contains(filmsdbLocal.get(a))){
|
||||||
|
}else{
|
||||||
|
stmt.executeUpdate("delete from film_local where titel = '"+filmsdbLocal.get(a)+"'");
|
||||||
|
connection.commit();
|
||||||
|
stmt.close();
|
||||||
|
System.out.println("removed \""+filmsdbLocal.get(a)+"\" from databsae");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int b=0; b<filmsdbStreamURL.size(); b++){
|
||||||
|
if(filmsStreamURL.contains(filmsdbStreamURL.get(b))){
|
||||||
|
}else{
|
||||||
|
stmt.executeUpdate("delete from film_streaming where titel = '"+filmsdbStream.get(b)+"'");
|
||||||
|
connection.commit();
|
||||||
|
stmt.close();
|
||||||
|
System.out.println("removed \""+filmsdbStream.get(b)+"\" from databsae");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkAddEntry() throws SQLException, FileNotFoundException, IOException{ //TODO sort alphabetical
|
||||||
|
System.out.println("checking for entrys to add to DB ...");
|
||||||
|
String[] entries = new File(mainWindowController.getPath()).list();
|
||||||
|
Statement stmt = connection.createStatement();
|
||||||
|
PreparedStatement ps = connection.prepareStatement("insert into film_streaming values (?, ?, ?, ?, ?, ?, ?, ?)");;
|
||||||
|
int i=0;
|
||||||
|
|
||||||
|
for(int a=0; a<filmsDir.size(); a++){
|
||||||
|
if(filmsdbLocal.contains(filmsDir.get(a))){
|
||||||
|
}else{
|
||||||
|
stmt.executeUpdate("insert into film_local values (0, '"+cutOffEnd(entries[a])+"', '"+entries[a]+"','favorite_border_black')");
|
||||||
|
connection.commit();
|
||||||
|
stmt.close();
|
||||||
|
System.out.println("added \""+filmsDir.get(a)+"\" to databsae");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int b=0; b<filmsStreamURL.size(); b++){
|
||||||
|
if(filmsdbStreamURL.contains(filmsStreamURL.get(b))){
|
||||||
|
}else{
|
||||||
|
JsonObject object = Json.parse(new FileReader(filmsStreamData.get(b))).asObject();
|
||||||
|
JsonArray items = object.get("entries").asArray();
|
||||||
|
System.out.println(items.size()+", "+i);
|
||||||
|
String streamURL = items.get(i).asObject().getString("streamUrl","");
|
||||||
|
String titel = items.get(i).asObject().getString("titel","");
|
||||||
|
|
||||||
|
if(streamURL.equals(filmsStreamURL.get(b))){
|
||||||
|
System.out.println("hinzuf�gen \""+titel+"\"");
|
||||||
|
|
||||||
|
ps.setInt(1, items.get(i).asObject().getInt("year", 0));
|
||||||
|
ps.setInt(2, items.get(i).asObject().getInt("season", 0));
|
||||||
|
ps.setInt(3, items.get(i).asObject().getInt("episode", 0));
|
||||||
|
ps.setInt(4, 0);
|
||||||
|
ps.setString(5, items.get(i).asObject().getString("resolution", ""));
|
||||||
|
ps.setString(6, items.get(i).asObject().getString("titel",""));
|
||||||
|
ps.setString(7, items.get(i).asObject().getString("streamUrl", ""));
|
||||||
|
ps.setString(8, "favorite_border_black");
|
||||||
|
ps.addBatch(); // adds the entry
|
||||||
|
|
||||||
|
// stmt.executeUpdate("insert into film_streaming values ("+items.get(i).asObject().getInt("year", 0)+", "+items.get(i).asObject().getInt("season", 0)+", "+items.get(i).asObject().getInt("episode", 0)+", 0, '"+items.get(i).asObject().getString("resolution", ""+"', '"+items.get(i).asObject().getString("titel","")+"', '"+items.get(i).asObject().getString("streamUrl", "")+"')"));
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ps.executeBatch();
|
||||||
|
connection.commit();
|
||||||
|
ps.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ausgeben(){
|
||||||
|
System.out.println("Eintraege ausgeben ... \n");
|
||||||
try {
|
try {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local");
|
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local");
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
System.out.println(rs.getString(1));
|
System.out.println(rs.getString(1));
|
||||||
System.out.println(rs.getString(2));
|
System.out.println(rs.getString(2));
|
||||||
System.out.println(rs.getString(3)+"\n");
|
System.out.println(rs.getString(3));
|
||||||
|
System.out.println(rs.getString(4)+"\n");
|
||||||
}
|
}
|
||||||
stmt.close();
|
stmt.close();
|
||||||
rs.close();
|
rs.close();
|
||||||
|
|
||||||
System.out.println("Streaming Entries: \n");
|
System.out.println("Streaming Entries: \n");
|
||||||
|
|
||||||
ResultSet rsS = stmt.executeQuery("SELECT * FROM film_streaming;");
|
rs = stmt.executeQuery("SELECT * FROM film_streaming;");
|
||||||
while (rsS.next()) {
|
while (rs.next()) {
|
||||||
System.out.println(rsS.getString(1));
|
System.out.println(rs.getString(1));
|
||||||
System.out.println(rsS.getString(2));
|
System.out.println(rs.getString(2));
|
||||||
System.out.println(rsS.getString(3));
|
System.out.println(rs.getString(3));
|
||||||
System.out.println(rsS.getString(4));
|
System.out.println(rs.getString(4));
|
||||||
System.out.println(rsS.getString(5));
|
System.out.println(rs.getString(5));
|
||||||
System.out.println(rsS.getString(6));
|
System.out.println(rs.getString(6));
|
||||||
System.out.println(rsS.getString(7)+"\n");
|
System.out.println(rs.getString(7));
|
||||||
|
System.out.println(rs.getString(8)+"\n");
|
||||||
}
|
}
|
||||||
stmt.close();
|
stmt.close();
|
||||||
rsS.close();
|
rs.close();
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
System.err.println("Konnte nicht ausgeführt werden");
|
System.err.println("Ups! an error occured!");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
mainWindowController.ta1.setText("Hallo");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//gibt die Favorisierung eines bestimmten Films
|
//gibt die Favorisierung eines bestimmten Films
|
||||||
public void getFavStatus(String name){
|
void getFavStatus(String name){
|
||||||
try{
|
try{
|
||||||
Statement stmta = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
ResultSet rs = stmta.executeQuery("SELECT titel, rating FROM film_local WHERE titel = '"+name+"';" ); //SQL Befehl
|
ResultSet rs = stmt.executeQuery("SELECT titel, rating, favIcon FROM film_local WHERE titel = '"+name+"';" ); //SQL Befehl
|
||||||
System.out.println("local:"+rs.getString("rating"));
|
System.out.println("local:"+rs.getString("rating")+", "+rs.getString("titel")+", "+rs.getString("favIcon"));
|
||||||
stmta.close();
|
stmt.close();
|
||||||
rs.close();
|
rs.close();
|
||||||
}catch(SQLException e){
|
}catch(SQLException e){
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println("streaming");
|
Statement stmtS = connection.createStatement();
|
||||||
Statement stmtSa = connection.createStatement();
|
ResultSet rsS = stmtS.executeQuery("SELECT titel, rating, favIcon FROM film_streaming WHERE titel = '"+name+"';" );
|
||||||
ResultSet rsS = stmtSa.executeQuery("SELECT titel, rating FROM film_streaming WHERE titel = '"+name+"';" );
|
System.out.println("streaming:"+rsS.getString("rating")+", "+rsS.getString("titel")+", "+rsS.getString("favIcon"));
|
||||||
System.out.println("streaming:"+rsS.getString("rating"));
|
stmtS.close();
|
||||||
stmtSa.close();
|
|
||||||
rsS.close();
|
rsS.close();
|
||||||
} catch (SQLException e1) {
|
} catch (SQLException e1) {
|
||||||
// System.out.println("Ups! an error occured!");
|
System.out.println("Ups! an error occured!");
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// System.out.println("Ups! an error occured!");
|
|
||||||
// e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//setzt die Defavorisierung eines bestimmten Films
|
//setzt die Defavorisierung eines bestimmten Films
|
||||||
public void defavorisieren(String name){
|
void dislike(String name,String streamUrl){
|
||||||
System.out.println("defavorisieren ...");
|
System.out.println("defavorisieren ...");
|
||||||
try{
|
try{
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("UPDATE film_local SET rating=0 WHERE titel='"+name+"';");
|
stmt.executeUpdate("UPDATE film_local SET rating=0,favIcon='favorite_border_black' WHERE titel='"+name+"';");
|
||||||
connection.commit();
|
connection.commit();
|
||||||
|
stmt.close();
|
||||||
}catch(SQLException e){
|
}catch(SQLException e){
|
||||||
System.out.println("Ups! an error occured!");
|
System.out.println("Ups! an error occured!");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Statement stmtS = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmtS.executeUpdate("UPDATE film_streaming SET rating=0 WHERE titel='"+name+"';");
|
stmt.executeUpdate("UPDATE film_streaming SET rating=0,favIcon='favorite_border_black' WHERE streamUrl='"+streamUrl+"';");
|
||||||
connection.commit();
|
connection.commit();
|
||||||
|
stmt.close();
|
||||||
} catch (SQLException e1) {
|
} catch (SQLException e1) {
|
||||||
System.out.println("Ups! an error occured!");
|
System.out.println("Ups! an error occured!");
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//setzt die Favorisierung eines bestimmten Films
|
//setzt die Favorisierung eines bestimmten Films
|
||||||
public void favorisieren(String name){
|
void like(String name,String streamUrl){
|
||||||
System.out.println("favorisieren ...");
|
System.out.println("favorisieren ...");
|
||||||
try{
|
try{
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("UPDATE film_local SET rating=1 WHERE titel='"+name+"';");
|
stmt.executeUpdate("UPDATE film_local SET rating=1,favIcon='favorite_black' WHERE titel='"+name+"';");
|
||||||
connection.commit();
|
connection.commit();
|
||||||
|
stmt.close();
|
||||||
}catch(SQLException e){
|
}catch(SQLException e){
|
||||||
System.out.println("Ups! an error occured!");
|
System.out.println("Ups! an error occured!");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Statement stmtS = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmtS.executeUpdate("UPDATE film_streaming SET rating=1 WHERE titel='"+name+"';");
|
stmt.executeUpdate("UPDATE film_streaming SET rating=1,favIcon='favorite_black' WHERE streamUrl='"+streamUrl+"';");
|
||||||
connection.commit();
|
connection.commit();
|
||||||
|
stmt.close();
|
||||||
} catch (SQLException e1) {
|
} catch (SQLException e1) {
|
||||||
System.out.println("Ups! an error occured!");
|
System.out.println("Ups! an error occured!");
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//entfernt die Endung
|
//removes the ending
|
||||||
private String ohneEndung (String str) {
|
private String cutOffEnd (String str) {
|
||||||
|
|
||||||
if (str == null) return null;
|
if (str == null) return null;
|
||||||
int pos = str.lastIndexOf(".");
|
int pos = str.lastIndexOf(".");
|
||||||
@ -236,254 +472,3 @@ public class DBController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private static final DBController dbcontroller = new DBController();
|
|
||||||
// private static Connection connection;
|
|
||||||
// private static final String DB_PATH = System.getProperty("user.home") + "\\Documents\\HomeFlix" + "\\" + "Homeflix.db"; // der Pfad der Datenbank-Datei
|
|
||||||
// private String path;
|
|
||||||
// File f;
|
|
||||||
// File file[]; //ArrayList für die Dateien
|
|
||||||
//
|
|
||||||
// public DBController(MainWindowController m){
|
|
||||||
// mainWindowController=m;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private MainWindowController mainWindowController;
|
|
||||||
//
|
|
||||||
// static {
|
|
||||||
// try {
|
|
||||||
// Class.forName("org.sqlite.JDBC"); //Datenbanktreiber
|
|
||||||
// } catch (ClassNotFoundException e) {
|
|
||||||
// System.err.println("Fehler beim Laden des JDBC-Treibers");
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void main(String input) {
|
|
||||||
// DBController datenbank = DBController.getInstance(); //neues Datenbank-Objekt wird erstellt
|
|
||||||
// datenbank.setPath(input); // Pfad zuweisen
|
|
||||||
// datenbank.f = new File(datenbank.getPath()); // für Datenbank-Datei einlesen
|
|
||||||
// datenbank.file = datenbank.f.listFiles(); // für Datenbank-Datei einlesen
|
|
||||||
// datenbank.verbindeDatenbank();
|
|
||||||
// datenbank.fuelleDatenbank();
|
|
||||||
// //datenbank.defavorisieren("Frozen");
|
|
||||||
// //datenbank.favorisieren("Frozen");
|
|
||||||
// //datenbank.ausgebenTitel();
|
|
||||||
// //System.out.println("Pfad: " + datenbank.getPfad("Frozen"));
|
|
||||||
// //System.out.println("Bewertung: " + datenbank.getFavStatus("Frozen"));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// DBController(){
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private static DBController getInstance(){
|
|
||||||
// return dbcontroller;
|
|
||||||
// }
|
|
||||||
//// Die Datenbak wird mit Hilfe des JDBC-Treibers eingebunden
|
|
||||||
// public void verbindeDatenbank() {
|
|
||||||
// try {
|
|
||||||
// if (connection != null)
|
|
||||||
// return;
|
|
||||||
// System.out.println("Erstelle Verbindung zur Datenbank...");
|
|
||||||
// connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH);
|
|
||||||
// if (!connection.isClosed())
|
|
||||||
// System.out.println("...Verbindung hergestellt");
|
|
||||||
// } catch (SQLException e) {
|
|
||||||
// throw new RuntimeException(e);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Runtime.getRuntime().addShutdownHook(new Thread() {
|
|
||||||
// public void run() {
|
|
||||||
// try {
|
|
||||||
// if (!connection.isClosed() && connection != null) {
|
|
||||||
// connection.close();
|
|
||||||
// if (connection.isClosed())
|
|
||||||
// System.out.println("Verbindung getrennt");
|
|
||||||
// }
|
|
||||||
// } catch (SQLException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
//// Die Dateien werden in die Datenbank geschrieben
|
|
||||||
// public void fuelleDatenbank() {
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// System.out.println("Erstelle Einträge local");
|
|
||||||
// Statement stmt = connection.createStatement();
|
|
||||||
// stmt.executeUpdate("DROP TABLE IF EXISTS film_local;");
|
|
||||||
// stmt.executeUpdate("CREATE TABLE film_local (rating, titel, streamUrl);"); // Tabelle "filme" und die Spalten "titel", "pfad", "bewertung" erstellen
|
|
||||||
//
|
|
||||||
// PreparedStatement ps = connection.prepareStatement("INSERT INTO film_local VALUES (?, ?, ?);"); // SQL Befehl
|
|
||||||
// PreparedStatement psS = connection.prepareStatement("INSERT INTO film_streaming VALUES (?, ?, ?, ?, ?, ?, ?);"); // SQL Befehl
|
|
||||||
//
|
|
||||||
// System.out.println("Size: "+file.length);
|
|
||||||
//
|
|
||||||
// for(int i=0;i!=file.length;i++) // Geht alle Dateien im Verzeichniss durch
|
|
||||||
// {
|
|
||||||
// //System.out.println(file[i].getName());
|
|
||||||
// ps.setInt(1, 0); // definiert Bewertung als Integer in der dritten Spalte
|
|
||||||
// ps.setString(2, ohneEndung(file[i].getName())); // definiert Name als String in der ersten Spalte
|
|
||||||
// ps.setString(3,file[i].getName()); // definiert Pfad als String in der zweiten Spalte
|
|
||||||
// ps.addBatch(); // fügt den Eintrag hinzu
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// System.out.println("Erstelle Einträge streaming");
|
|
||||||
// Statement stmtS = connection.createStatement();
|
|
||||||
// stmtS.executeUpdate("DROP TABLE IF EXISTS film_streaming;");
|
|
||||||
// stmtS.executeUpdate("CREATE TABLE film_streaming (year, season, episode, rating, resolution, titel, streamUrl);"); // Tabelle "filme" und die Spalten "titel", "pfad", "bewertung" erstellen
|
|
||||||
//
|
|
||||||
// System.out.println(mainWindowController.getStreamingPath());
|
|
||||||
// if(mainWindowController.getStreamingPath().equals("")||mainWindowController.getStreamingPath().equals(null)){
|
|
||||||
// System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist
|
|
||||||
// }else{
|
|
||||||
// for(int i=0; i< mainWindowController.streamingData.size(); i++){
|
|
||||||
// String fileName = mainWindowController.getStreamingPath()+"/"+mainWindowController.streamingData.get(i).getStreamUrl();
|
|
||||||
// try {
|
|
||||||
// JsonObject object = Json.parse(new FileReader(fileName)).asObject();
|
|
||||||
// JsonArray items = object.get("entries").asArray();
|
|
||||||
// for (JsonValue item : items) {
|
|
||||||
// psS.setInt(1, item.asObject().getInt("year", 0));
|
|
||||||
// psS.setInt(2, item.asObject().getInt("season", 0));
|
|
||||||
// psS.setInt(3, item.asObject().getInt("episode", 0));
|
|
||||||
// psS.setInt(4, 0);
|
|
||||||
// psS.setString(5, item.asObject().getString("resolution", ""));
|
|
||||||
// psS.setString(6, item.asObject().getString("titel",""));
|
|
||||||
// psS.setString(7, item.asObject().getString("streamUrl", ""));
|
|
||||||
// psS.addBatch(); // fügt den Eintrag hinzu
|
|
||||||
// }
|
|
||||||
// } catch (IOException e) {
|
|
||||||
// //Auto-generated catch block
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// connection.setAutoCommit(false);
|
|
||||||
// ps.executeBatch(); // scheibt alle Einträge in die Datenbank
|
|
||||||
// psS.executeBatch();
|
|
||||||
// connection.setAutoCommit(true);
|
|
||||||
// //connection.close();
|
|
||||||
// } catch (SQLException e) {
|
|
||||||
// System.err.println("Konnte nicht ausgeführt werden");
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void ausgeben(){
|
|
||||||
// System.out.println("Einträge ausgeben ... \n");
|
|
||||||
// try {
|
|
||||||
// Statement stmt = connection.createStatement();
|
|
||||||
// mainWindowController = new MainWindowController();
|
|
||||||
// ResultSet rs = stmt.executeQuery("SELECT * FROM film_local;");
|
|
||||||
// while (rs.next()) {
|
|
||||||
// System.out.println(rs.getString(1));
|
|
||||||
// System.out.println(rs.getString(2));
|
|
||||||
// System.out.println(rs.getString(3)+"\n");
|
|
||||||
// }
|
|
||||||
// rs.close();
|
|
||||||
//
|
|
||||||
// ResultSet rsS = stmt.executeQuery("SELECT * FROM film_streaming;");
|
|
||||||
// while (rsS.next()) {
|
|
||||||
// System.out.println(rsS.getString(1));
|
|
||||||
// System.out.println(rsS.getString(2));
|
|
||||||
// System.out.println(rsS.getString(3)+"\n");
|
|
||||||
// }
|
|
||||||
// rsS.close();
|
|
||||||
//// mainWindowController.initTabel();
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// } catch (SQLException e) {
|
|
||||||
// System.err.println("Konnte nicht ausgeführt werden");
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//// Kontroll Methode, ob ein Film wirklich in der Datenbank ist
|
|
||||||
// public String getTitel(String name){
|
|
||||||
// try {
|
|
||||||
// Statement stmt = connection.createStatement();
|
|
||||||
// ResultSet rs = stmt.executeQuery("SELECT titel, pfad FROM filme WHERE titel = '"+name+"';" );
|
|
||||||
// return rs.getString("titel");
|
|
||||||
// } catch (SQLException e) {
|
|
||||||
// System.err.println("Konnte nicht ausgeführt werden");
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// return "Error 404";
|
|
||||||
// }
|
|
||||||
//// gibt den Pfad eines bestimmten Films
|
|
||||||
// public String getPfad(String name){
|
|
||||||
// try {
|
|
||||||
// Statement stmt = connection.createStatement();
|
|
||||||
// ResultSet rs = stmt.executeQuery("SELECT titel, pfad FROM filme WHERE titel = '"+name+"';" ); //SQL Befehl
|
|
||||||
// return rs.getString("pfad");
|
|
||||||
// } catch (SQLException e) {
|
|
||||||
// System.err.println("Konnte nicht ausgeführt werden");
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// return "Error 404";
|
|
||||||
// }
|
|
||||||
//// gibt die Favorisierung eines bestimmten Films
|
|
||||||
// public boolean getFavStatus(String name){
|
|
||||||
// try {
|
|
||||||
// Statement stmt = connection.createStatement();
|
|
||||||
// ResultSet rs = stmt.executeQuery("SELECT titel, bewertung FROM filme WHERE titel = '"+name+"';" ); //SQL Befehl
|
|
||||||
// System.out.println(rs.getInt("bewertung"));
|
|
||||||
// if((rs.getInt("bewertung")) == 1){
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// else{
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// } catch (SQLException e) {
|
|
||||||
// System.err.println("Konnte nicht ausgeführt werden");
|
|
||||||
// e.printStackTrace();
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//// setzt die Defavorisierung eines bestimmten Films
|
|
||||||
// public void defavorisieren(String name){
|
|
||||||
// System.out.println("setze Bewertung");
|
|
||||||
// try {
|
|
||||||
// Statement stmt = connection.createStatement();
|
|
||||||
// String sql = ("UPDATE filme SET bewertung=0 WHERE titel='"+name+"';"); //SQL Befehl
|
|
||||||
// stmt.executeUpdate(sql);
|
|
||||||
// connection.setAutoCommit(false);
|
|
||||||
// connection.setAutoCommit(true);
|
|
||||||
// } catch (SQLException e) {
|
|
||||||
// System.err.println("Konnte nicht ausgeführt werden");
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//// setzt die Favorisierung eines bestimmten Films
|
|
||||||
// public void favorisieren(String name){
|
|
||||||
// System.out.println("setze Bewertung");
|
|
||||||
// try {
|
|
||||||
// Statement stmt = connection.createStatement();
|
|
||||||
// String sql = ("UPDATE filme SET bewertung=1 WHERE titel='"+name+"';"); //SQL Befehl
|
|
||||||
// stmt.executeUpdate(sql);
|
|
||||||
// connection.setAutoCommit(false);
|
|
||||||
// connection.setAutoCommit(true);
|
|
||||||
// } catch (SQLException e) {
|
|
||||||
// System.err.println("Konnte nicht ausgeführt werden");
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
////entfernt die Endung
|
|
||||||
// private static String ohneEndung (String str) {
|
|
||||||
//
|
|
||||||
// if (str == null) return null;
|
|
||||||
// int pos = str.lastIndexOf(".");
|
|
||||||
// if (pos == -1) return str;
|
|
||||||
// return str.substring(0, pos);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public String getPath() {
|
|
||||||
// return path;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setPath(String path) {
|
|
||||||
// this.path = path.replace("\\", "\\\\");
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Project HomeFlix
|
* Project HomeFlix
|
||||||
*
|
*
|
||||||
* Copyright 2016 <admin@kellerkinder>
|
* Copyright 2016-2017 <admin@kellerkinder>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,13 +20,12 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package application;
|
package application;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.util.Locale;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Properties;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
@ -36,24 +35,26 @@ import javafx.scene.control.Alert.AlertType;
|
|||||||
import javafx.scene.control.ButtonType;
|
import javafx.scene.control.ButtonType;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.paint.Color;
|
|
||||||
import javafx.stage.DirectoryChooser;
|
import javafx.stage.DirectoryChooser;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
public class Main extends Application {
|
public class Main extends Application {
|
||||||
|
|
||||||
public Stage primaryStage;
|
private Stage primaryStage;
|
||||||
private String path;
|
private String path;
|
||||||
private String streamingPath = System.getProperty("user.home") + "\\Documents\\HomeFlix";
|
private String streamingPathWin = System.getProperty("user.home") + "\\Documents\\HomeFlix";
|
||||||
|
private String streamingPathLinux = System.getProperty("user.home") + "/HomeFlix";
|
||||||
private String color = "ee3523";
|
private String color = "ee3523";
|
||||||
private String autoUpdate = "0";
|
private String autoUpdate = "0";
|
||||||
private String mode = "local"; //local or streaming
|
private String mode = "local"; //local or streaming
|
||||||
|
private String local = System.getProperty("user.language")+"_"+System.getProperty("user.country");
|
||||||
private double size = 12;
|
private double size = 12;
|
||||||
private int local = 0;
|
private ResourceBundle bundle;
|
||||||
private File dir = new File(System.getProperty("user.home") + "/Documents/HomeFlix"); //Windows: C:/Users/"User"/Documents/HomeFlix OSX: has to be tested Linux: has to be tested(shalt not work!)
|
|
||||||
private File file = new File(dir + "/config.xml"); //Windows: C:/Users/"User"/Documents/HomeFlix/config.xml OSX: has to be tested Linux: has to be tested(shalt not work!)
|
|
||||||
Properties props = new Properties();
|
|
||||||
private MainWindowController mainWindowController;
|
private MainWindowController mainWindowController;
|
||||||
|
private File dirWin = new File(System.getProperty("user.home") + "/Documents/HomeFlix"); //Windows: C:/Users/"User"/Documents/HomeFlix
|
||||||
|
private File dirLinux = new File(System.getProperty("user.home") + "/HomeFlix"); //Linux: /home/"User"/HomeFlix
|
||||||
|
private File fileWin = new File(dirWin + "/config.xml"); //Windows: C:/Users/"User"/Documents/HomeFlix/config.xml
|
||||||
|
private File fileLinux = new File(dirLinux + "/config.xml"); //Linux: /home/"User"/HomeFlix/config.xml
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) {
|
public void start(Stage primaryStage) {
|
||||||
@ -61,7 +62,7 @@ public class Main extends Application {
|
|||||||
mainWindow();
|
mainWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mainWindow(){
|
private void mainWindow(){
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindow.fxml"));
|
FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindow.fxml"));
|
||||||
@ -70,64 +71,84 @@ public class Main extends Application {
|
|||||||
primaryStage.setMinWidth(900.00);
|
primaryStage.setMinWidth(900.00);
|
||||||
primaryStage.setResizable(false);
|
primaryStage.setResizable(false);
|
||||||
primaryStage.setTitle("Project HomeFlix");
|
primaryStage.setTitle("Project HomeFlix");
|
||||||
primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/recources/Homeflix_Icon_64x64.png"))); //fügt Anwendungsicon hinzu
|
primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/recources/Homeflix_Icon_64x64.png"))); //adds application icon
|
||||||
|
|
||||||
mainWindowController = loader.getController(); //verknüpfung von FXMLController und Controller Klasse
|
mainWindowController = loader.getController(); //Link of FXMLController and controller class
|
||||||
mainWindowController.setAutoUpdate(autoUpdate); //setzt autoupdate
|
mainWindowController.setAutoUpdate(autoUpdate); //set auto-update
|
||||||
mainWindowController.setMain(this); //aufruf setMain
|
mainWindowController.setMain(this); //call setMain
|
||||||
|
|
||||||
//dir exists -> check config.xml TODO nur Windows getestet siehe dir und file
|
//Linux if directory exists -> check config.xml
|
||||||
if(dir.exists() == true){
|
if(System.getProperty("os.name").equals("Linux")){
|
||||||
if (file.exists() != true) {
|
if(dirLinux.exists() != true){
|
||||||
|
dirLinux.mkdir();
|
||||||
|
}else if(fileLinux.exists() != true){
|
||||||
mainWindowController.setPath(firstStart());
|
mainWindowController.setPath(firstStart());
|
||||||
mainWindowController.setStreamingPath(streamingPath);
|
mainWindowController.setStreamingPath(streamingPathLinux);
|
||||||
mainWindowController.setColor(color);
|
mainWindowController.setColor(color);
|
||||||
mainWindowController.setSize(size);
|
mainWindowController.setSize(size);
|
||||||
mainWindowController.setAutoUpdate(autoUpdate);
|
mainWindowController.setAutoUpdate(autoUpdate);
|
||||||
mainWindowController.setLoaclUI(local);
|
mainWindowController.setLocal(local);
|
||||||
mainWindowController.setMode(mode);
|
mainWindowController.setMode(mode);
|
||||||
mainWindowController.saveSettings();
|
mainWindowController.saveSettings();
|
||||||
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
|
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
|
||||||
System.exit(0); //finishes itself
|
System.exit(0); //finishes itself
|
||||||
}else{
|
}
|
||||||
loadSettings();
|
//windows
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
dir.mkdir();
|
if(dirWin.exists() != true){
|
||||||
mainWindowController.setPath(firstStart());
|
dirWin.mkdir();
|
||||||
mainWindowController.setStreamingPath(streamingPath);
|
}else if(fileWin.exists() != true){
|
||||||
mainWindowController.setColor(color);
|
mainWindowController.setPath(firstStart());
|
||||||
mainWindowController.setSize(size);
|
mainWindowController.setStreamingPath(streamingPathWin);
|
||||||
mainWindowController.setAutoUpdate(autoUpdate);
|
mainWindowController.setColor(color);
|
||||||
mainWindowController.setLoaclUI(local);
|
mainWindowController.setSize(size);
|
||||||
mainWindowController.setMode(mode);
|
mainWindowController.setAutoUpdate(autoUpdate);
|
||||||
mainWindowController.saveSettings();
|
mainWindowController.setLocal(local);
|
||||||
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
|
mainWindowController.setMode(mode);
|
||||||
System.exit(0); //finishes itself
|
mainWindowController.saveSettings();
|
||||||
|
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
|
||||||
|
System.exit(0); //finishes itself
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// mainWindowController.loadStreamingSettings();
|
|
||||||
mainWindowController.applyColor(); //setzt die Theme Farbe
|
mainWindowController.loadSettings();
|
||||||
mainWindowController.cbLocal.getSelectionModel().select(mainWindowController.getLocal()); //setzt local
|
mainWindowController.loadStreamingSettings();
|
||||||
mainWindowController.mainColor.setValue(Color.valueOf(mainWindowController.getColor()));
|
mainWindowController.initUI();
|
||||||
mainWindowController.loadData(); //läd die Daten im Controller
|
mainWindowController.initActions();
|
||||||
|
mainWindowController.initTabel();
|
||||||
|
mainWindowController.setLocalUI();
|
||||||
|
mainWindowController.applyColor(); //set theme color
|
||||||
|
|
||||||
|
mainWindowController.dbController.main(); //initialize database controller
|
||||||
|
mainWindowController.dbController.createDatabase(); //creating the database
|
||||||
|
mainWindowController.dbController.loadData(); //loading data from database to mainWindowController
|
||||||
mainWindowController.addDataUI();
|
mainWindowController.addDataUI();
|
||||||
|
|
||||||
Scene scene = new Scene(pane); //neue Scen um inhalt der stage anzuzeigen
|
Scene scene = new Scene(pane); //create new scene, append pane to scene
|
||||||
|
|
||||||
primaryStage.setScene(scene);
|
primaryStage.setScene(scene); //append scene to stage
|
||||||
primaryStage.show(); //zeige scene
|
primaryStage.show(); //show stage
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//methode für den erstmaligen Start
|
//Method for first Start
|
||||||
private String firstStart(){
|
private String firstStart(){
|
||||||
Alert alert = new Alert(AlertType.CONFIRMATION); //neuer alert mit filechooser
|
MainWindowController.firststart = true;
|
||||||
|
switch(System.getProperty("user.language")+"_"+System.getProperty("user.country")){
|
||||||
|
case "en_US": bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //us_english
|
||||||
|
break;
|
||||||
|
case "de_DE": bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.GERMAN); //German
|
||||||
|
break;
|
||||||
|
default: bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //default local
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Alert alert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser
|
||||||
alert.setTitle("Project HomeFlix");
|
alert.setTitle("Project HomeFlix");
|
||||||
alert.setHeaderText("Es ist kein Stammverzeichniss für Filme angegeben!"); //TODO translate
|
alert.setHeaderText(bundle.getString("firstStartHeader"));
|
||||||
alert.setContentText("Stammverzeichniss angeben?");
|
alert.setContentText(bundle.getString("firstStartContent"));
|
||||||
|
|
||||||
Optional<ButtonType> result = alert.showAndWait();
|
Optional<ButtonType> result = alert.showAndWait();
|
||||||
if (result.get() == ButtonType.OK){
|
if (result.get() == ButtonType.OK){
|
||||||
@ -141,26 +162,7 @@ public class Main extends Application {
|
|||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
//lädt die einstellungen aus der XML
|
|
||||||
public void loadSettings(){
|
|
||||||
try {
|
|
||||||
InputStream inputStream = new FileInputStream(file);
|
|
||||||
props.loadFromXML(inputStream);
|
|
||||||
path = props.getProperty("path"); //setzt Propselement in Pfad
|
|
||||||
streamingPath = props.getProperty("streamingPath");
|
|
||||||
color = props.getProperty("color");
|
|
||||||
size = Double.parseDouble(props.getProperty("size"));
|
|
||||||
autoUpdate = props.getProperty("autoUpdate");
|
|
||||||
local = Integer.parseInt(props.getProperty("local"));
|
|
||||||
mode = props.getProperty("mode");
|
|
||||||
inputStream.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.out.println("An error has occurred!");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
launch(args);
|
launch(args);
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,13 @@
|
|||||||
<?import javafx.scene.layout.HBox?>
|
<?import javafx.scene.layout.HBox?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
<?import javafx.scene.text.TextFlow?>
|
||||||
|
|
||||||
<AnchorPane fx:id="anpane" prefHeight="600.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController">
|
<AnchorPane fx:id="anpane" prefHeight="600.0" prefWidth="950.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController">
|
||||||
<children>
|
<children>
|
||||||
<TreeTableView fx:id="treeTableViewfilm" layoutX="14.0" layoutY="88.0" prefHeight="400.0" prefWidth="360.0" AnchorPane.bottomAnchor="12.0" AnchorPane.leftAnchor="12.0" AnchorPane.topAnchor="88.0" />
|
<TreeTableView fx:id="treeTableViewfilm" layoutX="14.0" layoutY="88.0" prefHeight="400.0" prefWidth="360.0" AnchorPane.bottomAnchor="12.0" AnchorPane.leftAnchor="12.0" AnchorPane.rightAnchor="553.0" AnchorPane.topAnchor="88.0" />
|
||||||
<JFXTextArea fx:id="ta1" layoutX="385.0" layoutY="42.0" maxWidth="503.0" minWidth="275.0" prefHeight="546.0" prefWidth="293.0" AnchorPane.bottomAnchor="12.0" AnchorPane.leftAnchor="385.0" AnchorPane.rightAnchor="222.0" AnchorPane.topAnchor="44.0" />
|
<JFXTextArea fx:id="ta1" layoutX="385.0" layoutY="42.0" maxWidth="503.0" minWidth="275.0" prefHeight="546.0" prefWidth="293.0" AnchorPane.bottomAnchor="12.0" AnchorPane.leftAnchor="410.0" AnchorPane.rightAnchor="222.0" AnchorPane.topAnchor="44.0" />
|
||||||
|
<TextFlow fx:id="textFlow" layoutX="496.0" layoutY="131.0" prefHeight="200.0" prefWidth="200.0" visible="false" AnchorPane.bottomAnchor="15.0" AnchorPane.leftAnchor="410.0" AnchorPane.rightAnchor="220.0" AnchorPane.topAnchor="44.0" />
|
||||||
<JFXButton fx:id="playbtn" contentDisplay="CENTER" layoutX="690.0" layoutY="363.0" onAction="#playbtnclicked" prefHeight="25.0" prefWidth="198.0" AnchorPane.bottomAnchor="212.0" AnchorPane.rightAnchor="12.0">
|
<JFXButton fx:id="playbtn" contentDisplay="CENTER" layoutX="690.0" layoutY="363.0" onAction="#playbtnclicked" prefHeight="25.0" prefWidth="198.0" AnchorPane.bottomAnchor="212.0" AnchorPane.rightAnchor="12.0">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
@ -29,7 +31,7 @@
|
|||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font></JFXButton>
|
</font></JFXButton>
|
||||||
<JFXTextField fx:id="tfsearch" layoutX="12.0" layoutY="44.0" maxWidth="477.0" minWidth="359.0" prefHeight="31.0" prefWidth="359.0" promptText="Suche ..." AnchorPane.leftAnchor="12.0" AnchorPane.topAnchor="44.0">
|
<JFXTextField fx:id="tfsearch" layoutX="12.0" layoutY="44.0" maxWidth="477.0" minWidth="359.0" prefHeight="31.0" prefWidth="359.0" promptText="Suche ..." AnchorPane.leftAnchor="12.0" AnchorPane.rightAnchor="553.0" AnchorPane.topAnchor="44.0">
|
||||||
<font>
|
<font>
|
||||||
<Font name="Arial" size="12.0" />
|
<Font name="Arial" size="12.0" />
|
||||||
</font></JFXTextField>
|
</font></JFXTextField>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Project HomeFlix
|
* Project HomeFlix
|
||||||
*
|
*
|
||||||
* Copyright 2016 <admin@kellerkinder>
|
* Copyright 2016-2017 <admin@kellerkinder>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -26,29 +26,25 @@ import java.io.BufferedReader;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
import java.lang.Thread.State;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import org.apache.commons.lang3.SystemUtils;
|
import org.apache.commons.lang3.SystemUtils;
|
||||||
|
|
||||||
import com.eclipsesource.json.Json;
|
|
||||||
import com.eclipsesource.json.JsonArray;
|
|
||||||
import com.eclipsesource.json.JsonObject;
|
|
||||||
import com.eclipsesource.json.JsonValue;
|
|
||||||
import com.jfoenix.controls.JFXButton;
|
import com.jfoenix.controls.JFXButton;
|
||||||
import com.jfoenix.controls.JFXColorPicker;
|
import com.jfoenix.controls.JFXColorPicker;
|
||||||
import com.jfoenix.controls.JFXDialog;
|
|
||||||
import com.jfoenix.controls.JFXSlider;
|
import com.jfoenix.controls.JFXSlider;
|
||||||
import com.jfoenix.controls.JFXTextArea;
|
import com.jfoenix.controls.JFXTextArea;
|
||||||
import com.jfoenix.controls.JFXTextField;
|
import com.jfoenix.controls.JFXTextField;
|
||||||
@ -57,23 +53,26 @@ import com.jfoenix.controls.JFXToggleButton;
|
|||||||
import javafx.animation.FadeTransition;
|
import javafx.animation.FadeTransition;
|
||||||
import javafx.animation.ParallelTransition;
|
import javafx.animation.ParallelTransition;
|
||||||
import javafx.animation.TranslateTransition;
|
import javafx.animation.TranslateTransition;
|
||||||
import javafx.beans.property.ReadOnlyObjectWrapper;
|
|
||||||
import javafx.beans.property.ReadOnlyStringWrapper;
|
|
||||||
import javafx.beans.value.ChangeListener;
|
import javafx.beans.value.ChangeListener;
|
||||||
import javafx.beans.value.ObservableValue;
|
import javafx.beans.value.ObservableValue;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.event.EventHandler;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.Alert;
|
import javafx.scene.control.Alert;
|
||||||
import javafx.scene.control.Alert.AlertType;
|
import javafx.scene.control.Alert.AlertType;
|
||||||
import javafx.scene.control.ChoiceBox;
|
import javafx.scene.control.ChoiceBox;
|
||||||
|
import javafx.scene.control.ContextMenu;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.MenuItem;
|
||||||
|
import javafx.scene.control.ScrollPane;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.TableView;
|
import javafx.scene.control.TableView;
|
||||||
import javafx.scene.control.TextArea;
|
import javafx.scene.control.TextArea;
|
||||||
import javafx.scene.control.TreeItem;
|
import javafx.scene.control.TreeItem;
|
||||||
import javafx.scene.control.TreeTableColumn;
|
import javafx.scene.control.TreeTableColumn;
|
||||||
import javafx.scene.control.TreeTableColumn.CellDataFeatures;
|
import javafx.scene.control.TreeTableColumn.SortType;
|
||||||
import javafx.scene.control.TreeTableView;
|
import javafx.scene.control.TreeTableView;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
@ -84,10 +83,11 @@ import javafx.scene.layout.Priority;
|
|||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.scene.text.Font;
|
import javafx.scene.text.Font;
|
||||||
|
import javafx.scene.text.TextFlow;
|
||||||
import javafx.stage.DirectoryChooser;
|
import javafx.stage.DirectoryChooser;
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
|
|
||||||
public class MainWindowController {
|
public class MainWindowController {
|
||||||
@FXML
|
@FXML
|
||||||
private AnchorPane anpane;
|
private AnchorPane anpane;
|
||||||
@FXML
|
@FXML
|
||||||
@ -105,6 +105,10 @@ public class MainWindowController {
|
|||||||
@FXML
|
@FXML
|
||||||
JFXTextArea ta1;
|
JFXTextArea ta1;
|
||||||
@FXML
|
@FXML
|
||||||
|
TextFlow textFlow;
|
||||||
|
@FXML
|
||||||
|
ScrollPane scrollPane;
|
||||||
|
@FXML
|
||||||
private JFXButton menubtn;
|
private JFXButton menubtn;
|
||||||
@FXML
|
@FXML
|
||||||
private JFXButton playbtn;
|
private JFXButton playbtn;
|
||||||
@ -141,12 +145,10 @@ public class MainWindowController {
|
|||||||
@FXML
|
@FXML
|
||||||
public JFXColorPicker mainColor;
|
public JFXColorPicker mainColor;
|
||||||
@FXML
|
@FXML
|
||||||
public ChoiceBox<String> cbLocal;
|
public ChoiceBox<String> cbLocal = new ChoiceBox<>();
|
||||||
@FXML
|
@FXML
|
||||||
public JFXSlider sliderFontSize;
|
public JFXSlider sliderFontSize;
|
||||||
@FXML
|
@FXML
|
||||||
private JFXDialog dialog = new JFXDialog();
|
|
||||||
@FXML
|
|
||||||
private Label versionlbl;
|
private Label versionlbl;
|
||||||
@FXML
|
@FXML
|
||||||
private Label sizelbl;
|
private Label sizelbl;
|
||||||
@ -154,27 +156,27 @@ public class MainWindowController {
|
|||||||
private Label aulbl;
|
private Label aulbl;
|
||||||
@FXML
|
@FXML
|
||||||
ImageView image1;
|
ImageView image1;
|
||||||
|
private ImageView imv1;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
TreeItem<streamUiData> root = new TreeItem<>(new streamUiData(1, 1, 1, 5.0,"1", "filme","1"));
|
TreeItem<streamUiData> root = new TreeItem<>(new streamUiData(1, 1, 1, 5.0,"1", "filme","1", imv1));
|
||||||
@FXML
|
@FXML
|
||||||
TreeTableColumn<streamUiData, Double> columnRating = new TreeTableColumn<>("Bewertung");
|
TreeTableColumn<streamUiData, ImageView> columnRating = new TreeTableColumn<>("Rating");
|
||||||
@FXML
|
@FXML
|
||||||
TreeTableColumn<streamUiData, String> columnTitel = new TreeTableColumn<>("Name");
|
TreeTableColumn<streamUiData, String> columnTitel = new TreeTableColumn<>("Titel");
|
||||||
@FXML
|
@FXML
|
||||||
TreeTableColumn<streamUiData, String> columnStreamUrl = new TreeTableColumn<>("Datei Name");
|
TreeTableColumn<streamUiData, String> columnStreamUrl = new TreeTableColumn<>("File Name");
|
||||||
@FXML
|
@FXML
|
||||||
TreeTableColumn<streamUiData, String> columnResolution = new TreeTableColumn<>("Auflösung");
|
TreeTableColumn<streamUiData, String> columnResolution = new TreeTableColumn<>("Resolution");
|
||||||
@FXML
|
@FXML
|
||||||
TreeTableColumn<streamUiData, Integer> columnYear = new TreeTableColumn<>("Jahr");
|
TreeTableColumn<streamUiData, Integer> columnYear = new TreeTableColumn<>("Year");
|
||||||
@FXML
|
@FXML
|
||||||
TreeTableColumn<streamUiData, Integer> columnSeason = new TreeTableColumn<>("Staffel");
|
TreeTableColumn<streamUiData, Integer> columnSeason = new TreeTableColumn<>("Season");
|
||||||
@FXML
|
@FXML
|
||||||
TreeTableColumn<streamUiData, Integer> columnEpisode = new TreeTableColumn<>("Episode");
|
TreeTableColumn<streamUiData, Integer> columnEpisode = new TreeTableColumn<>("Episode");
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private TreeItem<streamUiData> streamingRoot =new TreeItem<>(new streamUiData(1 ,1 ,1 ,1.0 ,"1" ,"filme" ,"1"));
|
private TreeItem<streamUiData> streamingRoot =new TreeItem<>(new streamUiData(1 ,1 ,1 ,1.0 ,"1" ,"filme" ,"1", imv1));
|
||||||
@FXML
|
@FXML
|
||||||
private TableColumn<streamUiData, String> dataNameColumn = new TableColumn<>("Datei Name");
|
private TableColumn<streamUiData, String> dataNameColumn = new TableColumn<>("Datei Name");
|
||||||
@FXML
|
@FXML
|
||||||
@ -184,20 +186,23 @@ public class MainWindowController {
|
|||||||
private boolean menutrue = false; //saves the position of menubtn (opened or closed)
|
private boolean menutrue = false; //saves the position of menubtn (opened or closed)
|
||||||
private boolean settingstrue = false;
|
private boolean settingstrue = false;
|
||||||
private boolean streamingSettingsTrue = false;
|
private boolean streamingSettingsTrue = false;
|
||||||
private String version = "0.4.0";
|
static boolean firststart = false;
|
||||||
private String buildNumber = "104";
|
private int hashA = -2055934614;
|
||||||
private String versionName = "glowing bucket";
|
private String version = "0.5.0";
|
||||||
|
private String buildNumber = "117";
|
||||||
|
private String versionName = "plasma cow";
|
||||||
private String buildURL = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/buildNumber.txt";
|
private String buildURL = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/buildNumber.txt";
|
||||||
private String downloadLink = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/downloadLink.txt";
|
private String downloadLink = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/downloadLink.txt";
|
||||||
private File dir = new File(System.getProperty("user.home") + "/Documents/HomeFlix");
|
private File dirWin = new File(System.getProperty("user.home") + "/Documents/HomeFlix");
|
||||||
private File file = new File(dir + "/config.xml");
|
private File dirLinux = new File(System.getProperty("user.home") + "/HomeFlix");
|
||||||
|
private File fileWin = new File(dirWin + "/config.xml");
|
||||||
|
private File fileLinux = new File(dirLinux + "/config.xml");
|
||||||
|
|
||||||
String errorUpdateD;
|
String errorUpdateD;
|
||||||
String errorUpdateV;
|
String errorUpdateV;
|
||||||
private String errorPlay;
|
private String errorPlay;
|
||||||
private String errorOpenStream;
|
private String errorOpenStream;
|
||||||
private String errorMode;
|
private String errorMode;
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private String errorLoad;
|
private String errorLoad;
|
||||||
private String errorSave;
|
private String errorSave;
|
||||||
String noFilmFound;
|
String noFilmFound;
|
||||||
@ -211,7 +216,10 @@ public class MainWindowController {
|
|||||||
private String Name;
|
private String Name;
|
||||||
private String datPath;
|
private String datPath;
|
||||||
private String autoUpdate;
|
private String autoUpdate;
|
||||||
private String mode;
|
private String mode;
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private String ratingSortType;
|
||||||
|
private String local;
|
||||||
String title;
|
String title;
|
||||||
String year;
|
String year;
|
||||||
String rating;
|
String rating;
|
||||||
@ -232,15 +240,14 @@ public class MainWindowController {
|
|||||||
private int last;
|
private int last;
|
||||||
private int selected;
|
private int selected;
|
||||||
private int next;
|
private int next;
|
||||||
private int local;
|
|
||||||
private File selectedFolder;
|
private File selectedFolder;
|
||||||
private File selectedStreamingFolder;
|
private File selectedStreamingFolder;
|
||||||
ResourceBundle bundle;
|
ResourceBundle bundle;
|
||||||
|
|
||||||
private ObservableList<streamUiData> newDaten = FXCollections.observableArrayList();
|
|
||||||
private ObservableList<streamUiData> filterData = FXCollections.observableArrayList();
|
private ObservableList<streamUiData> filterData = FXCollections.observableArrayList();
|
||||||
private ObservableList<streamUiData> streamData = FXCollections.observableArrayList();
|
private ObservableList<String> locals = FXCollections.observableArrayList("english (en_US)", "deutsch (de_DE)");
|
||||||
private ObservableList<String> locals = FXCollections.observableArrayList("english", "deutsch");
|
ObservableList<streamUiData> newData = FXCollections.observableArrayList(); //TODO rename to localFilms
|
||||||
|
ObservableList<streamUiData> streamData = FXCollections.observableArrayList(); //TODO rename to streamingFilms
|
||||||
ObservableList<streamUiData> streamingData = FXCollections.observableArrayList();
|
ObservableList<streamUiData> streamingData = FXCollections.observableArrayList();
|
||||||
private ImageView menu_icon_black = new ImageView(new Image("recources/icons/menu_icon_black.png"));
|
private ImageView menu_icon_black = new ImageView(new Image("recources/icons/menu_icon_black.png"));
|
||||||
private ImageView menu_icon_white = new ImageView(new Image("recources/icons/menu_icon_white.png"));
|
private ImageView menu_icon_white = new ImageView(new Image("recources/icons/menu_icon_white.png"));
|
||||||
@ -251,13 +258,15 @@ public class MainWindowController {
|
|||||||
private ImageView play_arrow_white = new ImageView(new Image("recources/icons/ic_play_arrow_white_18dp_1x.png"));
|
private ImageView play_arrow_white = new ImageView(new Image("recources/icons/ic_play_arrow_white_18dp_1x.png"));
|
||||||
private ImageView play_arrow_black = new ImageView(new Image("recources/icons/ic_play_arrow_black_18dp_1x.png"));
|
private ImageView play_arrow_black = new ImageView(new Image("recources/icons/ic_play_arrow_black_18dp_1x.png"));
|
||||||
private DirectoryChooser directoryChooser = new DirectoryChooser();
|
private DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||||
|
private MenuItem like = new MenuItem("like");
|
||||||
|
private MenuItem dislike = new MenuItem("dislike"); //TODO one option (like or dislike)
|
||||||
|
private ContextMenu menu = new ContextMenu(like, dislike);
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
|
|
||||||
private updater Updater;
|
private updater Updater;
|
||||||
private apiQuery ApiQuery;
|
private apiQuery ApiQuery;
|
||||||
private DBController dbController;
|
DBController dbController;
|
||||||
|
|
||||||
//wenn menubtn clicked
|
|
||||||
/**
|
/**
|
||||||
* TODO change value of Text-color change
|
* TODO change value of Text-color change
|
||||||
*/
|
*/
|
||||||
@ -298,7 +307,6 @@ public class MainWindowController {
|
|||||||
System.out.println(output);
|
System.out.println(output);
|
||||||
input.close();
|
input.close();
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
// Auto-generated catch block
|
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
if(output.contains("which: no vlc")||output == ""){
|
if(output.contains("which: no vlc")||output == ""){
|
||||||
@ -330,7 +338,7 @@ public class MainWindowController {
|
|||||||
}
|
}
|
||||||
}else if(mode.equals("streaming")){
|
}else if(mode.equals("streaming")){
|
||||||
try {
|
try {
|
||||||
Desktop.getDesktop().browse(new URI(datPath)); //opens the streaming url in browser (other option?)
|
Desktop.getDesktop().browse(new URI(datPath)); //open the streaming Url in browser (TODO other option?)
|
||||||
} catch (URISyntaxException | IOException e) {
|
} catch (URISyntaxException | IOException e) {
|
||||||
showErrorMsg(errorOpenStream, (IOException) e);
|
showErrorMsg(errorOpenStream, (IOException) e);
|
||||||
}
|
}
|
||||||
@ -345,7 +353,7 @@ public class MainWindowController {
|
|||||||
@FXML
|
@FXML
|
||||||
private void openfolderbtnclicked(){
|
private void openfolderbtnclicked(){
|
||||||
try {
|
try {
|
||||||
Desktop.getDesktop().open(new File(getPath())); //öffnet den aktuellen Pfad
|
Desktop.getDesktop().open(new File(getPath())); //open path when button is clicked
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -388,7 +396,7 @@ public class MainWindowController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO zusätzliche infos über die dateien
|
* TODO additional info about the "streaming.json"
|
||||||
*/
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private void streamingSettingsBtnclicked(){
|
private void streamingSettingsBtnclicked(){
|
||||||
@ -419,7 +427,7 @@ public class MainWindowController {
|
|||||||
addDataUI();
|
addDataUI();
|
||||||
settingsAnchor.setVisible(false);
|
settingsAnchor.setVisible(false);
|
||||||
streamingSettingsAnchor.setVisible(false);
|
streamingSettingsAnchor.setVisible(false);
|
||||||
sideMenuSlideOut(); //disables sidemenu
|
sideMenuSlideOut(); //disables side-menu
|
||||||
menutrue = false;
|
menutrue = false;
|
||||||
settingstrue = false;
|
settingstrue = false;
|
||||||
streamingSettingsTrue = false;
|
streamingSettingsTrue = false;
|
||||||
@ -427,12 +435,6 @@ public class MainWindowController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void debugBtnclicked(){
|
private void debugBtnclicked(){
|
||||||
// dbController.ausgeben();
|
|
||||||
dbController.getFavStatus("Zootopia");
|
|
||||||
dbController.favorisieren("Zootopia");
|
|
||||||
dbController.getFavStatus("Zootopia");
|
|
||||||
dbController.defavorisieren("Zootopia");
|
|
||||||
dbController.getFavStatus("Zootopia");
|
|
||||||
//for testing
|
//for testing
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,7 +472,13 @@ public class MainWindowController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void updateBtnAction(){
|
private void updateBtnAction(){
|
||||||
Updater.update(buildURL, downloadLink, aktBuildNumber, buildNumber);
|
// Updater.update(buildURL, downloadLink, aktBuildNumber, buildNumber);
|
||||||
|
System.out.println(Updater.getState());
|
||||||
|
if(Updater.getState() == State.NEW){
|
||||||
|
Updater.start();
|
||||||
|
}else{
|
||||||
|
Updater.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
@ -508,138 +516,106 @@ public class MainWindowController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//"Main" Methode die beim start von der Klasse Main aufgerufen wird, initialiesirung der einzellnen UI-Objekte
|
//"Main" Method called in Main.java main() when starting
|
||||||
public void setMain(Main main) {
|
void setMain(Main main) {
|
||||||
|
Updater = new updater(this,buildURL, downloadLink, aktBuildNumber, buildNumber);
|
||||||
loadSettings();
|
|
||||||
initTabel();
|
|
||||||
initActions();
|
|
||||||
|
|
||||||
Updater = new updater(this);
|
|
||||||
ApiQuery = new apiQuery(this);
|
ApiQuery = new apiQuery(this);
|
||||||
dbController = new DBController(this);
|
dbController = new DBController(this);
|
||||||
|
|
||||||
System.out.println("Mode: "+mode); //TODO debugging
|
|
||||||
|
|
||||||
loadStreamingSettings();
|
|
||||||
dbController.main();
|
|
||||||
|
|
||||||
debugBtn.setDisable(false); //debugging btn for tests
|
|
||||||
debugBtn.setVisible(true);
|
|
||||||
|
|
||||||
tfPath.setText(getPath());
|
|
||||||
|
|
||||||
sliderFontSize.setValue(getSize());
|
|
||||||
|
|
||||||
cbLocal.setItems(locals);
|
|
||||||
|
|
||||||
updateBtn.setFont(Font.font("System", 12));
|
|
||||||
|
|
||||||
if(autoUpdate.equals("1")){
|
|
||||||
autoupdateBtn.setSelected(true);
|
|
||||||
Updater.update(buildURL, downloadLink, aktBuildNumber, buildNumber);
|
|
||||||
}else{
|
|
||||||
autoupdateBtn.setSelected(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
ta1.setWrapText(true);
|
|
||||||
ta1.setEditable(false);
|
|
||||||
ta1.setFont(Font.font("System", getSize()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//initialisierung der Tabellen für filme(beide Modi) und Streaming-Settings
|
//Initialize the tables (treeTableViewfilm and tableViewStreamingdata)
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked"}) //TODO
|
||||||
private void initTabel(){
|
void initTabel(){
|
||||||
|
|
||||||
//filmtabelle
|
//film Table
|
||||||
columnRating.setMaxWidth(120);
|
columnRating.setMaxWidth(80);
|
||||||
columnTitel.setMaxWidth(240);
|
columnTitel.setMaxWidth(260);
|
||||||
columnStreamUrl.setMaxWidth(0);
|
columnStreamUrl.setMaxWidth(0);
|
||||||
dataNameColumn.setPrefWidth(130);
|
dataNameColumn.setPrefWidth(150);
|
||||||
dataNameEndColumn.setPrefWidth(170);
|
dataNameEndColumn.setPrefWidth(170);
|
||||||
|
columnRating.setStyle("-fx-alignment: CENTER;");
|
||||||
|
|
||||||
treeTableViewfilm.setRoot(root);
|
treeTableViewfilm.setRoot(root);
|
||||||
treeTableViewfilm.setColumnResizePolicy( TreeTableView.CONSTRAINED_RESIZE_POLICY );
|
treeTableViewfilm.setColumnResizePolicy( TreeTableView.CONSTRAINED_RESIZE_POLICY );
|
||||||
treeTableViewfilm.setShowRoot(false);
|
treeTableViewfilm.setShowRoot(false);
|
||||||
|
|
||||||
//inhalt in Zelle schreiben
|
|
||||||
columnTitel.setCellValueFactory((CellDataFeatures<streamUiData, String> p) ->
|
|
||||||
new ReadOnlyStringWrapper(p.getValue().getValue().getTitel()));
|
|
||||||
|
|
||||||
columnRating.setCellValueFactory((CellDataFeatures<streamUiData, Double> p) ->
|
|
||||||
new ReadOnlyObjectWrapper<Double>(p.getValue().getValue().getRating()));
|
|
||||||
|
|
||||||
columnStreamUrl.setCellValueFactory((CellDataFeatures<streamUiData, String> p) ->
|
//write content into cell
|
||||||
new ReadOnlyStringWrapper(p.getValue().getValue().getStreamUrl()));
|
columnTitel.setCellValueFactory(cellData -> cellData.getValue().getValue().titelProperty());
|
||||||
|
columnRating.setCellValueFactory(cellData -> cellData.getValue().getValue().imageProperty());
|
||||||
columnResolution.setCellValueFactory((CellDataFeatures<streamUiData, String> p) ->
|
columnStreamUrl.setCellValueFactory(cellData -> cellData.getValue().getValue().streamUrlProperty());
|
||||||
new ReadOnlyStringWrapper(p.getValue().getValue().getResolution()));
|
columnResolution.setCellValueFactory(cellData -> cellData.getValue().getValue().resolutionProperty());
|
||||||
|
columnYear.setCellValueFactory(cellData -> cellData.getValue().getValue().yearProperty().asObject());
|
||||||
columnYear.setCellValueFactory((CellDataFeatures<streamUiData, Integer> p) ->
|
columnSeason.setCellValueFactory(cellData -> cellData.getValue().getValue().seasonProperty().asObject());
|
||||||
new ReadOnlyObjectWrapper(p.getValue().getValue().getYear()));
|
columnEpisode.setCellValueFactory(cellData -> cellData.getValue().getValue().episodeProperty().asObject());
|
||||||
|
|
||||||
columnSeason.setCellValueFactory((CellDataFeatures<streamUiData, Integer> p) ->
|
|
||||||
new ReadOnlyObjectWrapper(p.getValue().getValue().getSeason()));
|
|
||||||
|
|
||||||
columnEpisode.setCellValueFactory((CellDataFeatures<streamUiData, Integer> p) ->
|
|
||||||
new ReadOnlyObjectWrapper(p.getValue().getValue().getEpisode()));
|
|
||||||
|
|
||||||
treeTableViewfilm.getColumns().addAll(columnTitel, columnRating, columnStreamUrl, columnResolution, columnYear, columnSeason, columnEpisode);
|
treeTableViewfilm.getColumns().addAll(columnTitel, columnRating, columnStreamUrl, columnResolution, columnYear, columnSeason, columnEpisode);
|
||||||
treeTableViewfilm.getColumns().get(2).setVisible(false); //blendet die Column mit den Dateinamen aus (wichtig um sie abzuspielen)
|
treeTableViewfilm.getColumns().get(2).setVisible(false); //hide columnStreamUrl (column with file path important for the player)
|
||||||
|
|
||||||
//Changelistener für TreeTable
|
//Change-listener for TreeTable
|
||||||
treeTableViewfilm.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Object>() {
|
treeTableViewfilm.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public void changed(ObservableValue<?> observable, Object oldVal, Object newVal) {
|
public void changed(ObservableValue<?> observable, Object oldVal, Object newVal) {
|
||||||
// last = selected; //für autoplay
|
// last = selected; //for auto-play
|
||||||
selected = treeTableViewfilm.getSelectionModel().getSelectedIndex(); // holt aktuelles Item
|
selected = treeTableViewfilm.getSelectionModel().getSelectedIndex(); //get selected item
|
||||||
last = selected - 1;
|
last = selected - 1;
|
||||||
next = selected + 1;
|
next = selected + 1;
|
||||||
Name = columnTitel.getCellData(selected); // holt Namen des Aktuelle Items aus der ColumnName
|
Name = columnTitel.getCellData(selected); //get name of selected item
|
||||||
datPath = columnStreamUrl.getCellData(selected); // holt den aktuellen Datei Pfad aus der ColumnDatName
|
datPath = columnStreamUrl.getCellData(selected); //get file path of selected item
|
||||||
ta1.setText(""); // löscht Text in ta1
|
ta1.setText(""); //delete text in ta1
|
||||||
ApiQuery.startQuery(Name); // startet die api abfrage
|
ApiQuery.startQuery(Name); // start api query
|
||||||
ta1.positionCaret(0); // setzt die startposition des Cursors in ta1
|
ta1.positionCaret(0); //set cursor position in ta1
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Streaming-Settings Tabelle
|
//context menu for treetableview
|
||||||
|
treeTableViewfilm.setContextMenu(menu);
|
||||||
|
|
||||||
|
//Streaming-Settings Table
|
||||||
dataNameColumn.setCellValueFactory(cellData -> cellData.getValue().titelProperty());
|
dataNameColumn.setCellValueFactory(cellData -> cellData.getValue().titelProperty());
|
||||||
dataNameEndColumn.setCellValueFactory(cellData -> cellData.getValue().streamUrlProperty());
|
dataNameEndColumn.setCellValueFactory(cellData -> cellData.getValue().streamUrlProperty());
|
||||||
|
|
||||||
tableViewStreamingdata.getColumns().addAll(dataNameColumn, dataNameEndColumn);
|
tableViewStreamingdata.getColumns().addAll(dataNameColumn, dataNameEndColumn);
|
||||||
tableViewStreamingdata.setItems(streamingData);
|
tableViewStreamingdata.setItems(streamingData);
|
||||||
}
|
}
|
||||||
|
|
||||||
//initialisierung der Button Actions
|
//Initializing the actions
|
||||||
private void initActions(){
|
void initActions(){
|
||||||
|
|
||||||
//TODO unterscheiden zwischen streaming und local
|
|
||||||
tfsearch.textProperty().addListener(new ChangeListener<String>() {
|
tfsearch.textProperty().addListener(new ChangeListener<String>() {
|
||||||
@SuppressWarnings("unchecked")
|
@Override
|
||||||
@Override
|
|
||||||
public void changed(ObservableValue<? extends String> observable,String oldValue, String newValue) {
|
public void changed(ObservableValue<? extends String> observable,String oldValue, String newValue) {
|
||||||
int counter = newDaten.size();
|
ObservableList<streamUiData> helpData;
|
||||||
filterData.removeAll(filterData);
|
filterData.removeAll(filterData);
|
||||||
root.getChildren().remove(0,root.getChildren().size());
|
root.getChildren().remove(0,root.getChildren().size());
|
||||||
|
|
||||||
for(int i = 0; i < counter; i++){
|
if(mode.equals("local")){
|
||||||
if(newDaten.get(i).getTitel().toLowerCase().contains(tfsearch.getText().toLowerCase())){
|
helpData = newData;
|
||||||
filterData.add(newDaten.get(i));
|
}else{
|
||||||
|
helpData = streamData;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < helpData.size(); i++){
|
||||||
|
if(helpData.get(i).getTitel().toLowerCase().contains(tfsearch.getText().toLowerCase())){
|
||||||
|
filterData.add(helpData.get(i)); //add data from newDaten to filteredData where title contains search input
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < filterData.size(); i++){
|
for(int i = 0; i < filterData.size(); i++){
|
||||||
root.getChildren().addAll(new TreeItem<streamUiData>(filterData.get(i))); //fügt daten zur Rootnode hinzu
|
root.getChildren().add(new TreeItem<streamUiData>(filterData.get(i))); //add filtered data to root node after search
|
||||||
}
|
}
|
||||||
|
if(tfsearch.getText().hashCode() == hashA){
|
||||||
|
setColor("000000");
|
||||||
|
applyColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cbLocal.getSelectionModel().selectedIndexProperty()
|
cbLocal.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||||
.addListener(new ChangeListener<Number>() {
|
public void changed(ObservableValue<? extends Number> ov, Number value, Number new_value) {
|
||||||
public void changed(ObservableValue<? extends Number> ov, Number value, Number new_value) {
|
String local = cbLocal.getItems().get((int) new_value).toString();
|
||||||
setLocal(new_value.intValue());
|
local = local.substring(local.length()-6,local.length()-1);
|
||||||
setLoaclUI(local);
|
setLocal(local);
|
||||||
|
setLocalUI();
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -652,78 +628,159 @@ public class MainWindowController {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
like.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
//lädt die Daten im angegeben Ordner in newDaten
|
@Override
|
||||||
void loadData(){
|
public void handle(ActionEvent event) {
|
||||||
//load local Data
|
if(mode.equals("streaming")){
|
||||||
if(getPath().equals("")||getPath().equals(null)){
|
dbController.like(Name,streamData.get(selected).getStreamUrl());
|
||||||
System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist
|
}else{
|
||||||
}else{
|
dbController.like(Name,newData.get(selected).getStreamUrl());
|
||||||
String[] entries = new File(getPath()).list();
|
}
|
||||||
for(int i = 0; i < entries.length; i++){
|
dbController.getFavStatus(Name);
|
||||||
String titel = ohneEndung(entries[i]);
|
|
||||||
String data = entries[i];
|
|
||||||
newDaten.add(new streamUiData(1, 1, 1, 5.0, "1", titel, data));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//load streaming Data TODO prüfen ob streaming daten vorhanden -> momentan evtl. fehler
|
|
||||||
String titel = null;
|
|
||||||
String resolution = null;
|
|
||||||
String streamUrl = null;
|
|
||||||
int season;
|
|
||||||
int episode;
|
|
||||||
int year;
|
|
||||||
double rating = 5.0;
|
|
||||||
if(getStreamingPath().equals("")||getStreamingPath().equals(null)){
|
|
||||||
System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist
|
|
||||||
}else{
|
|
||||||
for(int i=0; i< streamingData.size(); i++){
|
|
||||||
String fileName = streamingPath+"/"+streamingData.get(i).getStreamUrl();
|
|
||||||
try {
|
try {
|
||||||
JsonObject object = Json.parse(new FileReader(fileName)).asObject();
|
dbController.refresh(Name, selected);
|
||||||
JsonArray items = object.get("entries").asArray();
|
} catch (SQLException e) {
|
||||||
|
Alert alert = new Alert(AlertType.ERROR);
|
||||||
for (JsonValue item : items) {
|
alert.setTitle("Error");
|
||||||
titel = item.asObject().getString("titel","");
|
alert.setHeaderText("");
|
||||||
season = item.asObject().getInt("season", 0);
|
alert.setContentText("There should be an error message in the future (like problem)\nIt seems as a cat has stolen the like-methode");
|
||||||
episode = item.asObject().getInt("episode", 0);
|
|
||||||
year = item.asObject().getInt("year", 0);
|
|
||||||
resolution = item.asObject().getString("resolution", "");
|
|
||||||
streamUrl = item.asObject().getString("streamUrl", "");
|
|
||||||
streamData.add(new streamUiData(year, season, episode, rating, resolution, titel, streamUrl));
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
//Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
refreshTable();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
dislike.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
|
@Override
|
||||||
|
public void handle(ActionEvent event) {
|
||||||
|
if(mode.equals("streaming")){
|
||||||
|
dbController.dislike(Name,streamData.get(selected).getStreamUrl());
|
||||||
|
}else{
|
||||||
|
dbController.dislike(Name,newData.get(selected).getStreamUrl());
|
||||||
|
}
|
||||||
|
dbController.getFavStatus(Name);
|
||||||
|
try {
|
||||||
|
dbController.refresh(Name, selected);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Alert alert = new Alert(AlertType.ERROR);
|
||||||
|
alert.setTitle("Error");
|
||||||
|
alert.setHeaderText("");
|
||||||
|
alert.setContentText("There should be an error message in the future (dislike problem)");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
refreshTable();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO fix bug when sort by ASCENDING, wrong order
|
||||||
|
*/
|
||||||
|
columnRating.sortTypeProperty().addListener(new ChangeListener<SortType>() {
|
||||||
|
@Override
|
||||||
|
public void changed(ObservableValue<? extends SortType> paramObservableValue, SortType paramT1, SortType paramT2) {
|
||||||
|
System.out.println("NAME Clicked -- sortType = " + paramT1 + ", SortType=" + paramT2);
|
||||||
|
ArrayList<Integer> fav_true = new ArrayList<Integer>();
|
||||||
|
ArrayList<Integer> fav_false = new ArrayList<Integer>();
|
||||||
|
ObservableList<streamUiData> helpData;
|
||||||
|
filterData.removeAll(filterData);
|
||||||
|
root.getChildren().remove(0,root.getChildren().size());
|
||||||
|
|
||||||
|
if(mode.equals("local")){
|
||||||
|
helpData = newData;
|
||||||
|
}else{
|
||||||
|
helpData = streamData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for(int i = 0;i<helpData.size();i++){
|
||||||
|
if(helpData.get(i).getRating()==1.0){
|
||||||
|
fav_true.add(i);
|
||||||
|
}else{
|
||||||
|
fav_false.add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(paramT2.toString().equals("DESCENDING")){
|
||||||
|
System.out.println("Absteigend");
|
||||||
|
for(int i = 0;i<fav_true.size();i++){
|
||||||
|
filterData.add(helpData.get(fav_true.get(i)));
|
||||||
|
}
|
||||||
|
for(int i = 0;i<fav_false.size();i++){
|
||||||
|
filterData.add(helpData.get(fav_false.get(i)));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
for(int i = 0;i<fav_false.size();i++){
|
||||||
|
filterData.add(helpData.get(fav_false.get(i)));
|
||||||
|
}
|
||||||
|
for(int i = 0;i<fav_true.size();i++){
|
||||||
|
filterData.add(helpData.get(fav_true.get(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(filterData.size());
|
||||||
|
for(int i = 0; i < filterData.size(); i++){
|
||||||
|
// System.out.println(filterData.get(i).getTitel()+"; "+filterData.get(i).getRating());
|
||||||
|
root.getChildren().add(new TreeItem<streamUiData>(filterData.get(i))); //add filtered data to root node after search
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//initialize UI elements
|
||||||
|
void initUI(){
|
||||||
|
System.out.println("Mode: "+mode); //TODO debugging
|
||||||
|
debugBtn.setDisable(true); //debugging button for tests
|
||||||
|
debugBtn.setVisible(false);
|
||||||
|
|
||||||
|
tfPath.setText(getPath());
|
||||||
|
sliderFontSize.setValue(getSize());
|
||||||
|
mainColor.setValue(Color.valueOf(getColor()));
|
||||||
|
|
||||||
|
updateBtn.setFont(Font.font("System", 12));
|
||||||
|
cbLocal.setItems(locals);
|
||||||
|
|
||||||
|
//TODO rework!
|
||||||
|
if(autoUpdate.equals("1")){
|
||||||
|
autoupdateBtn.setSelected(true);
|
||||||
|
Updater.start();
|
||||||
|
}else{
|
||||||
|
autoupdateBtn.setSelected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
ta1.setWrapText(true);
|
||||||
|
ta1.setEditable(false);
|
||||||
|
ta1.setFont(Font.font("System", getSize()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshTable(){
|
||||||
|
if(mode.equals("local")){
|
||||||
|
root.getChildren().set(selected, new TreeItem<streamUiData>(newData.get(selected)));
|
||||||
|
}else if(mode.equals("streaming")){
|
||||||
|
root.getChildren().set(selected, new TreeItem<streamUiData>(streamData.get(selected)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addDataUI(){
|
void addDataUI(){
|
||||||
if(mode.equals("local")){
|
if(mode.equals("local")){
|
||||||
for(int i = 0; i < newDaten.size(); i++){
|
for(int i = 0; i < newData.size(); i++){
|
||||||
root.getChildren().add(new TreeItem<streamUiData>(newDaten.get(i))); //fügt daten zur Rootnode hinzu
|
root.getChildren().add(new TreeItem<streamUiData>(newData.get(i))); //add data to root-node
|
||||||
}
|
}
|
||||||
columnRating.setMaxWidth(120);
|
columnRating.setMaxWidth(90);
|
||||||
columnTitel.setMaxWidth(240);
|
columnTitel.setMaxWidth(290);
|
||||||
treeTableViewfilm.getColumns().get(3).setVisible(false);
|
treeTableViewfilm.getColumns().get(3).setVisible(false);
|
||||||
treeTableViewfilm.getColumns().get(4).setVisible(false);
|
treeTableViewfilm.getColumns().get(4).setVisible(false);
|
||||||
treeTableViewfilm.getColumns().get(5).setVisible(false);
|
treeTableViewfilm.getColumns().get(5).setVisible(false);
|
||||||
treeTableViewfilm.getColumns().get(6).setVisible(false);
|
treeTableViewfilm.getColumns().get(6).setVisible(false);
|
||||||
}else if(mode.equals("streaming")){
|
}else if(mode.equals("streaming")){
|
||||||
for(int i = 0; i < streamData.size(); i++){
|
for(int i = 0; i < streamData.size(); i++){
|
||||||
root.getChildren().add(new TreeItem<streamUiData>(streamData.get(i))); //fügt daten zur Rootnode hinzu
|
root.getChildren().add(new TreeItem<streamUiData>(streamData.get(i))); //add data to root-node
|
||||||
}
|
}
|
||||||
columnTitel.setMaxWidth(150);
|
columnTitel.setMaxWidth(150);
|
||||||
columnResolution.setMaxWidth(65);
|
columnResolution.setMaxWidth(65);
|
||||||
columnRating.setMaxWidth(52.5);
|
columnRating.setMaxWidth(50);
|
||||||
columnYear.setMaxWidth(40);
|
columnYear.setMaxWidth(43);
|
||||||
columnSeason.setMaxWidth(52.5);
|
columnSeason.setMaxWidth(42);
|
||||||
columnEpisode.setMaxWidth(0); //disabled for ui size reasons
|
columnEpisode.setMaxWidth(44);
|
||||||
treeTableViewfilm.getColumns().get(3).setVisible(true);
|
treeTableViewfilm.getColumns().get(3).setVisible(true);
|
||||||
treeTableViewfilm.getColumns().get(4).setVisible(true);
|
treeTableViewfilm.getColumns().get(4).setVisible(true);
|
||||||
treeTableViewfilm.getColumns().get(5).setVisible(true);
|
treeTableViewfilm.getColumns().get(5).setVisible(true);
|
||||||
@ -731,7 +788,7 @@ public class MainWindowController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadStreamingSettings(){
|
void loadStreamingSettings(){
|
||||||
if(getStreamingPath().equals("")||getStreamingPath().equals(null)){
|
if(getStreamingPath().equals("")||getStreamingPath().equals(null)){
|
||||||
System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist
|
System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist
|
||||||
}else{
|
}else{
|
||||||
@ -740,15 +797,15 @@ public class MainWindowController {
|
|||||||
if(entries[i].endsWith(".json")){
|
if(entries[i].endsWith(".json")){
|
||||||
String titel = ohneEndung(entries[i]);
|
String titel = ohneEndung(entries[i]);
|
||||||
String data = entries[i];
|
String data = entries[i];
|
||||||
streamingData.add(new streamUiData(1,1,1,5.0,"1",titel ,data));
|
streamingData.add(new streamUiData(1,1,1,5.0,"1",titel ,data, imv1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(int i = 0; i < streamingData.size(); i++){
|
for(int i = 0; i < streamingData.size(); i++){
|
||||||
streamingRoot.getChildren().add( new TreeItem<streamUiData>(streamingData.get(i))); //fügt daten zur Rootnode hinzu
|
streamingRoot.getChildren().add( new TreeItem<streamUiData>(streamingData.get(i))); //fügt daten zur Rootnode hinzu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//entfernt die Endung vom String
|
//removes the ending
|
||||||
private String ohneEndung (String str) {
|
private String ohneEndung (String str) {
|
||||||
if (str == null) return null;
|
if (str == null) return null;
|
||||||
int pos = str.lastIndexOf(".");
|
int pos = str.lastIndexOf(".");
|
||||||
@ -756,7 +813,7 @@ public class MainWindowController {
|
|||||||
return str.substring(0, pos);
|
return str.substring(0, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
//setzt die Farben für die UI-Elemente
|
//set color of UI-Elements
|
||||||
void applyColor(){
|
void applyColor(){
|
||||||
String style = "-fx-background-color: #"+getColor()+";";
|
String style = "-fx-background-color: #"+getColor()+";";
|
||||||
String btnStyleBlack = "-fx-button-type: RAISED; -fx-background-color: #"+getColor()+"; -fx-text-fill: BLACK;";
|
String btnStyleBlack = "-fx-button-type: RAISED; -fx-background-color: #"+getColor()+"; -fx-text-fill: BLACK;";
|
||||||
@ -805,9 +862,8 @@ public class MainWindowController {
|
|||||||
menubtn.setGraphic(menu_icon_black);
|
menubtn.setGraphic(menu_icon_black);
|
||||||
}
|
}
|
||||||
|
|
||||||
//das solte weg kann aber hier bleiben wicht ist dass es zum selben zeitpunkt wie aply color ausgeführt wird
|
|
||||||
if(mode.equals("local")){
|
if(mode.equals("local")){
|
||||||
switchBtn.setText("streaming"); //TODO translate
|
switchBtn.setText("streaming");
|
||||||
}else if(mode.equals("streaming")){
|
}else if(mode.equals("streaming")){
|
||||||
switchBtn.setText("local");
|
switchBtn.setText("local");
|
||||||
}
|
}
|
||||||
@ -845,14 +901,20 @@ public class MainWindowController {
|
|||||||
parallelTransition.play();
|
parallelTransition.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoaclUI(int local){
|
void setLocalUI(){
|
||||||
switch(local){
|
switch(getLocal()){
|
||||||
case 0: bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //us_english
|
case "en_US":
|
||||||
break;
|
bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //us_english
|
||||||
case 1: bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.GERMAN); //german
|
cbLocal.getSelectionModel().select(0);
|
||||||
break;
|
break;
|
||||||
default:bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //default local
|
case "de_DE":
|
||||||
break;
|
bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.GERMAN); //German
|
||||||
|
cbLocal.getSelectionModel().select(1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
bundle = ResourceBundle.getBundle("recources.HomeFlix-Local", Locale.US); //default local
|
||||||
|
cbLocal.getSelectionModel().select(0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
infoBtn.setText(bundle.getString("info"));
|
infoBtn.setText(bundle.getString("info"));
|
||||||
settingsBtn.setText(bundle.getString("settings"));
|
settingsBtn.setText(bundle.getString("settings"));
|
||||||
@ -903,7 +965,7 @@ public class MainWindowController {
|
|||||||
type = bundle.getString("type");
|
type = bundle.getString("type");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showErrorMsg(String msg, IOException exception){
|
void showErrorMsg(String msg, IOException exception){
|
||||||
Alert alert = new Alert(AlertType.ERROR);
|
Alert alert = new Alert(AlertType.ERROR);
|
||||||
alert.setTitle("Error");
|
alert.setTitle("Error");
|
||||||
alert.setHeaderText("");
|
alert.setHeaderText("");
|
||||||
@ -938,43 +1000,61 @@ public class MainWindowController {
|
|||||||
|
|
||||||
//saves the Settings
|
//saves the Settings
|
||||||
public void saveSettings(){
|
public void saveSettings(){
|
||||||
|
OutputStream outputStream; //new output-stream
|
||||||
try {
|
try {
|
||||||
props.setProperty("path", getPath()); //writes path into property
|
props.setProperty("path", getPath()); //writes path into property
|
||||||
props.setProperty("color", getColor());
|
props.setProperty("color", getColor());
|
||||||
props.setProperty("autoUpdate", getAutoUpdate());
|
props.setProperty("autoUpdate", getAutoUpdate());
|
||||||
props.setProperty("size", getSize().toString());
|
props.setProperty("size", getSize().toString());
|
||||||
props.setProperty("local", Integer.toString(getLocal()));
|
props.setProperty("local", getLocal());
|
||||||
props.setProperty("streamingPath", getStreamingPath());
|
props.setProperty("streamingPath", getStreamingPath());
|
||||||
props.setProperty("mode", getMode());
|
props.setProperty("mode", getMode());
|
||||||
OutputStream outputStream = new FileOutputStream(file); //new outputstream
|
props.setProperty("ratingSortType", columnRating.getSortType().toString());
|
||||||
|
if(System.getProperty("os.name").equals("Linux")){
|
||||||
|
outputStream = new FileOutputStream(fileLinux);
|
||||||
|
}else{
|
||||||
|
outputStream = new FileOutputStream(fileWin);
|
||||||
|
}
|
||||||
props.storeToXML(outputStream, "Project HomeFlix settings"); //writes new .xml
|
props.storeToXML(outputStream, "Project HomeFlix settings"); //writes new .xml
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
showErrorMsg(errorSave, e);
|
if(firststart == false){
|
||||||
e.printStackTrace();
|
showErrorMsg(errorLoad, e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//loads the Settings
|
//loads the Settings
|
||||||
public void loadSettings(){
|
public void loadSettings(){
|
||||||
|
System.out.println("loading settings ...");
|
||||||
|
InputStream inputStream;
|
||||||
try {
|
try {
|
||||||
InputStream inputStream = new FileInputStream(file);
|
if(System.getProperty("os.name").equals("Linux")){
|
||||||
props.loadFromXML(inputStream); //new inputstream from .xml
|
inputStream = new FileInputStream(fileLinux);
|
||||||
|
}else{
|
||||||
|
inputStream = new FileInputStream(fileWin);
|
||||||
|
}
|
||||||
|
props.loadFromXML(inputStream); //new input-stream from .xml
|
||||||
path = props.getProperty("path"); //reads path from property
|
path = props.getProperty("path"); //reads path from property
|
||||||
streamingPath = props.getProperty("streamingPath");
|
streamingPath = props.getProperty("streamingPath");
|
||||||
color = props.getProperty("color");
|
color = props.getProperty("color");
|
||||||
size = Double.parseDouble(props.getProperty("size"));
|
size = Double.parseDouble(props.getProperty("size"));
|
||||||
autoUpdate = props.getProperty("autoUpdate");
|
autoUpdate = props.getProperty("autoUpdate");
|
||||||
local = Integer.parseInt(props.getProperty("local"));
|
local = props.getProperty("local");
|
||||||
mode = props.getProperty("mode");
|
mode = props.getProperty("mode");
|
||||||
|
ratingSortType = props.getProperty("ratingSortType");
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
if(firststart == false){
|
||||||
|
showErrorMsg(errorSave, e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
// showErrorMsg(errorLoad, e); //TODO das soll beim ersten start nicht erscheinen
|
// showErrorMsg(errorLoad, e); //TODO das soll beim ersten start nicht erscheinen
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//cuts 0x of the Colorpickers return value
|
//cuts 0x of the Color-pickers return value
|
||||||
private void editColor(String input){
|
private void editColor(String input){
|
||||||
StringBuilder sb = new StringBuilder(input);
|
StringBuilder sb = new StringBuilder(input);
|
||||||
sb.delete(0, 2);
|
sb.delete(0, 2);
|
||||||
@ -1023,11 +1103,11 @@ public class MainWindowController {
|
|||||||
return autoUpdate;
|
return autoUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLocal(int input){
|
public void setLocal(String input){
|
||||||
this.local = input;
|
this.local = input;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLocal(){
|
public String getLocal(){
|
||||||
return local;
|
return local;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1038,4 +1118,4 @@ public class MainWindowController {
|
|||||||
public String getMode(){
|
public String getMode(){
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,17 +14,26 @@ import java.util.Scanner;
|
|||||||
import com.eclipsesource.json.Json;
|
import com.eclipsesource.json.Json;
|
||||||
import com.eclipsesource.json.JsonObject;
|
import com.eclipsesource.json.JsonObject;
|
||||||
|
|
||||||
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.scene.Node;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.text.Font;
|
||||||
|
import javafx.scene.text.FontWeight;
|
||||||
|
import javafx.scene.text.Text;
|
||||||
|
|
||||||
public class apiQuery {
|
public class apiQuery{
|
||||||
|
|
||||||
public apiQuery(MainWindowController m){
|
public apiQuery(MainWindowController m){
|
||||||
mainWindowController=m;
|
mainWindowController=m;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MainWindowController mainWindowController;
|
private MainWindowController mainWindowController;
|
||||||
|
private Image im;
|
||||||
|
private int fontSize = 20;
|
||||||
|
private String fontFamily = "System";
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation") //TODO
|
||||||
void startQuery(String input){
|
void startQuery(String input){
|
||||||
URL url = null;
|
URL url = null;
|
||||||
Scanner sc = null;
|
Scanner sc = null;
|
||||||
@ -52,7 +61,7 @@ public class apiQuery {
|
|||||||
//replace blank with + for api-query
|
//replace blank with + for api-query
|
||||||
moviename = moviename.replace(" ", "+");
|
moviename = moviename.replace(" ", "+");
|
||||||
|
|
||||||
//URL wird zusammengestellt abfragetypen: http,json,xml (muss json sein um späteres trennen zu ermöglichen)
|
//URL wird zusammengestellt abfragetypen: http,json,xml (muss json sein um späteres trennen zu ermöglichen)
|
||||||
dataurl = apiurl + "t=" + moviename + "&plot=full&r=json";
|
dataurl = apiurl + "t=" + moviename + "&plot=full&r=json";
|
||||||
|
|
||||||
url = new URL(dataurl);
|
url = new URL(dataurl);
|
||||||
@ -61,7 +70,7 @@ public class apiQuery {
|
|||||||
|
|
||||||
// lesen der Daten aus dem Antwort Stream
|
// lesen der Daten aus dem Antwort Stream
|
||||||
while ((retdata = dis.readLine()) != null) {
|
while ((retdata = dis.readLine()) != null) {
|
||||||
//retdata in json object parsen und anschließend das json Objekt "zerschneiden"
|
//retdata in json object parsen und anschließend das json Objekt "zerschneiden"
|
||||||
System.out.println(retdata);
|
System.out.println(retdata);
|
||||||
JsonObject object = Json.parse(retdata).asObject();
|
JsonObject object = Json.parse(retdata).asObject();
|
||||||
String titelV = object.getString("Title", "");
|
String titelV = object.getString("Title", "");
|
||||||
@ -77,7 +86,7 @@ public class apiQuery {
|
|||||||
String languageV = object.getString("Language", "");
|
String languageV = object.getString("Language", "");
|
||||||
String countryV = object.getString("Country", "");
|
String countryV = object.getString("Country", "");
|
||||||
String awardsV = object.getString("Awards", "");
|
String awardsV = object.getString("Awards", "");
|
||||||
String posterURL = object.getString("Poster", "");
|
|
||||||
String metascoreV = object.getString("Metascore", "");
|
String metascoreV = object.getString("Metascore", "");
|
||||||
String imdbRatingV = object.getString("imdbRating", "");
|
String imdbRatingV = object.getString("imdbRating", "");
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@ -85,15 +94,56 @@ public class apiQuery {
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
String imdbIDV = object.getString("imdbID", "");
|
String imdbIDV = object.getString("imdbID", "");
|
||||||
String typeV = object.getString("Type", "");
|
String typeV = object.getString("Type", "");
|
||||||
|
|
||||||
|
String posterURL = object.getString("Poster", "");
|
||||||
String response = object.getString("Response", "");
|
String response = object.getString("Response", "");
|
||||||
|
|
||||||
|
// Text titelR = new Text (object.getString("Title", "")+"\n");
|
||||||
|
// titelR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// Text yearR = new Text (object.getString("Year", "")+"\n");
|
||||||
|
// yearR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// Text ratedR = new Text (object.getString("Rated", "")+"\n");
|
||||||
|
// ratedR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// Text releasedR = new Text (object.getString("Released", "")+"\n");
|
||||||
|
// releasedR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// Text runtimeR = new Text (object.getString("Runtime", "")+"\n");
|
||||||
|
// runtimeR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// Text genreR = new Text (object.getString("Genre", ""));
|
||||||
|
// genreR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// Text directorR = new Text (object.getString("Director", "")+"\n");
|
||||||
|
// directorR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// Text writerR = new Text (object.getString("Writer", "")+"\n");
|
||||||
|
// writerR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// Text actorsR = new Text (object.getString("Actors", "")+"\n");
|
||||||
|
// actorsR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// Text plotR = new Text (object.getString("Plot", "")+"\n");
|
||||||
|
// plotR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// Text languageR = new Text (object.getString("Language", "")+"\n");
|
||||||
|
// languageR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// Text countryR = new Text (object.getString("Country", "")+"\n");
|
||||||
|
// countryR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// Text awardsR = new Text (object.getString("Awards", "")+"\n");
|
||||||
|
// awardsR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// Text metascoreR = new Text (object.getString("Metascore", "")+"\n");
|
||||||
|
// metascoreR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// Text imdbRatingR = new Text (object.getString("imdbRating", "")+"\n");
|
||||||
|
// imdbRatingR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// @SuppressWarnings("unused")
|
||||||
|
// Text imdbVotesR = new Text (object.getString("imdbVotes", "")+"\n");
|
||||||
|
// imdbVotesR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// @SuppressWarnings("unused")
|
||||||
|
// Text imdbIDR = new Text (object.getString("imdbID", "")+"\n");
|
||||||
|
// imdbIDR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
// Text typeR = new Text (object.getString("Type", "")+"\n");
|
||||||
|
// typeR.setFont(Font.font (fontFamily, fontSize));
|
||||||
|
|
||||||
|
|
||||||
if(response.equals("False")){
|
if(response.equals("False")){
|
||||||
mainWindowController.ta1.appendText(mainWindowController.noFilmFound);
|
mainWindowController.ta1.appendText(mainWindowController.noFilmFound);
|
||||||
Image im2 = new Image("recources/icons/close_black_2048x2048.png");
|
im = new Image("recources/icons/close_black_2048x2048.png");
|
||||||
mainWindowController.image1.setImage(im2);
|
mainWindowController.image1.setImage(im);
|
||||||
}else{
|
}else{
|
||||||
//ausgabe des Textes in ta1 in jeweils neuer Zeile //TODOformatting
|
//ausgabe des Textes in ta1 in jeweils neuer Zeile
|
||||||
mainWindowController.ta1.appendText(mainWindowController.title+": "+titelV+"\n");
|
mainWindowController.ta1.appendText(mainWindowController.title+": "+titelV+"\n");
|
||||||
mainWindowController.ta1.appendText(mainWindowController.year+": "+ yearV+"\n");
|
mainWindowController.ta1.appendText(mainWindowController.year+": "+ yearV+"\n");
|
||||||
mainWindowController.ta1.appendText(mainWindowController.rating+": "+ratedV+"\n");
|
mainWindowController.ta1.appendText(mainWindowController.rating+": "+ratedV+"\n");
|
||||||
@ -110,13 +160,63 @@ public class apiQuery {
|
|||||||
mainWindowController.ta1.appendText(mainWindowController.metascore+": "+metascoreV+"\n");
|
mainWindowController.ta1.appendText(mainWindowController.metascore+": "+metascoreV+"\n");
|
||||||
mainWindowController.ta1.appendText(mainWindowController.imdbRating+": "+imdbRatingV+"\n");
|
mainWindowController.ta1.appendText(mainWindowController.imdbRating+": "+imdbRatingV+"\n");
|
||||||
mainWindowController.ta1.appendText(mainWindowController.type+": "+typeV+"\n");
|
mainWindowController.ta1.appendText(mainWindowController.type+": "+typeV+"\n");
|
||||||
|
|
||||||
|
// mainWindowController.ta1.setVisible(false);
|
||||||
|
|
||||||
|
// Text title = new Text(15, 20, mainWindowController.title+": ");
|
||||||
|
// title.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
// Text year = new Text(15, 20, mainWindowController.year+": ");
|
||||||
|
// year.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
// Text rating = new Text(15, 20, mainWindowController.rating+": ");
|
||||||
|
// rating.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
// Text publishedOn = new Text(15, 20, mainWindowController.publishedOn+": ");
|
||||||
|
// publishedOn.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
// Text duration = new Text(15, 20, mainWindowController.duration+": ");
|
||||||
|
// duration.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
// Text genre = new Text(15, 20, mainWindowController.genre+": ");
|
||||||
|
// genre.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
// Text director = new Text(15, 20, mainWindowController.director+": ");
|
||||||
|
// director.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
// Text writer = new Text(15, 20, mainWindowController.writer+": ");
|
||||||
|
// writer.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
// Text actors = new Text(15, 20, mainWindowController.actors+": ");
|
||||||
|
// actors.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
// Text plot = new Text(15, 20, mainWindowController.plot+": ");
|
||||||
|
// plot.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
// Text language = new Text(15, 20, mainWindowController.language+": ");
|
||||||
|
// language.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
// Text country = new Text(15, 20, mainWindowController.country+": ");
|
||||||
|
// country.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
// Text awards = new Text(15, 20, mainWindowController.awards+": ");
|
||||||
|
// awards.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
// Text metascore = new Text(15, 20, mainWindowController.metascore+": ");
|
||||||
|
// metascore.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
// Text imdbRating = new Text(15, 20, mainWindowController.imdbRating+": ");
|
||||||
|
// imdbRating.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
// Text type = new Text(15, 20, mainWindowController.type+": ");
|
||||||
|
// type.setFont(Font.font (fontFamily, FontWeight.BOLD, fontSize));
|
||||||
|
//
|
||||||
|
// mainWindowController.textFlow.getChildren().remove(0, mainWindowController.textFlow.getChildren().size());
|
||||||
|
//
|
||||||
|
// ObservableList<Node> list = mainWindowController.textFlow.getChildren();
|
||||||
|
//
|
||||||
|
// list.addAll(title,titelR,year,yearR,rating,ratedR,
|
||||||
|
// publishedOn,releasedR,duration,runtimeR,genre,genreR,director,directorR,writer,writerR,
|
||||||
|
// actors,actorsR,plot,plotR,language,languageR,country,countryR,awards,awardsR,metascore,
|
||||||
|
// metascoreR,imdbRating,imdbRatingR,type,typeR);
|
||||||
|
//
|
||||||
|
|
||||||
Image im1 = new Image(posterURL);
|
if(posterURL.equals("N/A")){
|
||||||
mainWindowController.image1.setImage(im1);
|
im = new Image("recources/icons/close_black_2048x2048.png");
|
||||||
|
}else{
|
||||||
|
im = new Image(posterURL);
|
||||||
|
}
|
||||||
|
mainWindowController.image1.setImage(im);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
mainWindowController.ta1.setText(e.toString());
|
||||||
System.out.println(e);
|
System.out.println(e);
|
||||||
} finally {
|
} finally {
|
||||||
//closes datainputStream, InputStream,Scanner if not already done
|
//closes datainputStream, InputStream,Scanner if not already done
|
||||||
|
@ -4,21 +4,24 @@ import javafx.beans.property.DoubleProperty;
|
|||||||
import javafx.beans.property.IntegerProperty;
|
import javafx.beans.property.IntegerProperty;
|
||||||
import javafx.beans.property.SimpleDoubleProperty;
|
import javafx.beans.property.SimpleDoubleProperty;
|
||||||
import javafx.beans.property.SimpleIntegerProperty;
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
import javafx.beans.property.StringProperty;
|
import javafx.beans.property.StringProperty;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
|
|
||||||
public class streamUiData {
|
public class streamUiData {
|
||||||
|
|
||||||
private IntegerProperty year = new SimpleIntegerProperty();
|
private final IntegerProperty year = new SimpleIntegerProperty();
|
||||||
private IntegerProperty season = new SimpleIntegerProperty();
|
private final IntegerProperty season = new SimpleIntegerProperty();
|
||||||
private IntegerProperty episode = new SimpleIntegerProperty();
|
private final IntegerProperty episode = new SimpleIntegerProperty();
|
||||||
private DoubleProperty rating = new SimpleDoubleProperty();
|
private final DoubleProperty rating = new SimpleDoubleProperty();
|
||||||
private StringProperty resolution = new SimpleStringProperty();
|
private final StringProperty resolution = new SimpleStringProperty();
|
||||||
private StringProperty titel = new SimpleStringProperty();
|
private final StringProperty titel = new SimpleStringProperty();
|
||||||
private StringProperty streamUrl = new SimpleStringProperty();
|
private final StringProperty streamUrl = new SimpleStringProperty();
|
||||||
|
private final SimpleObjectProperty<ImageView> image = new SimpleObjectProperty<>();
|
||||||
|
|
||||||
//uiData ist der Typ der Daten in der TreeTabelView
|
//uiData ist der Typ der Daten in der TreeTabelView
|
||||||
public streamUiData (final int year, final int season, final int episode, final double rating, final String resolution, final String titel, final String streamUrl) {
|
public streamUiData (final int year, final int season, final int episode, final double rating, final String resolution, final String titel, final String streamUrl, final ImageView image) {
|
||||||
this.year.set(year);
|
this.year.set(year);
|
||||||
this.season.set(season);
|
this.season.set(season);
|
||||||
this.episode.set(episode);
|
this.episode.set(episode);
|
||||||
@ -26,63 +29,7 @@ public class streamUiData {
|
|||||||
this.resolution.set(resolution);
|
this.resolution.set(resolution);
|
||||||
this.titel.set(titel);
|
this.titel.set(titel);
|
||||||
this.streamUrl.set(streamUrl);
|
this.streamUrl.set(streamUrl);
|
||||||
}
|
this.image.set(image);
|
||||||
|
|
||||||
public int getYear() {
|
|
||||||
return year.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSeason() {
|
|
||||||
return season.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getEpisode() {
|
|
||||||
return episode.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getRating() {
|
|
||||||
return rating.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getResolution() {
|
|
||||||
return resolution.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitel() {
|
|
||||||
return titel.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStreamUrl() {
|
|
||||||
return streamUrl.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setYear(int year) {
|
|
||||||
this.year.set(year);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeason(int season) {
|
|
||||||
this.season.set(season);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEpisode(int season) {
|
|
||||||
this.episode.set(season);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRating(int rating) {
|
|
||||||
this.rating.set(rating);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResolution(String resolution) {
|
|
||||||
this.resolution.set(resolution);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitel(String titel) {
|
|
||||||
this.titel.set(titel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStreamUrl(StringProperty streamUrl) {
|
|
||||||
this.streamUrl = streamUrl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IntegerProperty yearProperty(){
|
public IntegerProperty yearProperty(){
|
||||||
@ -112,4 +59,74 @@ public class streamUiData {
|
|||||||
public StringProperty streamUrlProperty(){
|
public StringProperty streamUrlProperty(){
|
||||||
return streamUrl;
|
return streamUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SimpleObjectProperty<ImageView> imageProperty(){
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public final int getYear() {
|
||||||
|
return yearProperty().get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final int getSeason() {
|
||||||
|
return seasonProperty().get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final int getEpisode() {
|
||||||
|
return episodeProperty().get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final double getRating() {
|
||||||
|
return ratingProperty().get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final String getResolution() {
|
||||||
|
return resolutionProperty().get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final String getTitel() {
|
||||||
|
return titelProperty().get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final String getStreamUrl() {
|
||||||
|
return streamUrlProperty().get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final ImageView getImage() {
|
||||||
|
return imageProperty().get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public final void setYear(int year) {
|
||||||
|
yearProperty().set(year);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void setSeason(int season) {
|
||||||
|
seasonProperty().set(season);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void setEpisode(int season) {
|
||||||
|
episodeProperty().set(season);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void setRating(int rating) {
|
||||||
|
ratingProperty().set(rating);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void setResolution(String resolution) {
|
||||||
|
resolutionProperty().set(resolution);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void setTitel(String titel) {
|
||||||
|
titelProperty().set(titel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void setStreamUrl(String streamUrl) {
|
||||||
|
streamUrlProperty().set(streamUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void setImage(ImageView image) {
|
||||||
|
imageProperty().set(image);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,15 +12,23 @@ import java.net.URL;
|
|||||||
import java.nio.channels.Channels;
|
import java.nio.channels.Channels;
|
||||||
import java.nio.channels.ReadableByteChannel;
|
import java.nio.channels.ReadableByteChannel;
|
||||||
|
|
||||||
public class updater {
|
public class updater extends Thread{
|
||||||
|
|
||||||
public updater(MainWindowController m){
|
|
||||||
mainWindowController=m;
|
|
||||||
}
|
|
||||||
|
|
||||||
private MainWindowController mainWindowController;
|
private MainWindowController mainWindowController;
|
||||||
|
private String buildURL;
|
||||||
|
private String downloadLink;
|
||||||
|
private String aktBuildNumber;
|
||||||
|
private String buildNumber;
|
||||||
|
|
||||||
void update(String buildURL,String downloadLink,String aktBuildNumber,String buildNumber){
|
public updater(MainWindowController m, String buildURL,String downloadLink,String aktBuildNumber,String buildNumber){
|
||||||
|
mainWindowController=m;
|
||||||
|
this.buildURL=buildURL;
|
||||||
|
this.downloadLink=downloadLink;
|
||||||
|
this.aktBuildNumber=aktBuildNumber;
|
||||||
|
this.buildNumber=buildNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run(){
|
||||||
System.out.println("check for updates ...");
|
System.out.println("check for updates ...");
|
||||||
try {
|
try {
|
||||||
URL url = new URL(buildURL); //URL der Datei mit aktueller Versionsnummer
|
URL url = new URL(buildURL); //URL der Datei mit aktueller Versionsnummer
|
||||||
@ -37,27 +45,27 @@ public class updater {
|
|||||||
int iaktVersion = Integer.parseInt(aktBuildNumber.replace(".", ""));
|
int iaktVersion = Integer.parseInt(aktBuildNumber.replace(".", ""));
|
||||||
|
|
||||||
if(iversion >= iaktVersion){
|
if(iversion >= iaktVersion){
|
||||||
mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnNotavail"));
|
// mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnNotavail"));
|
||||||
System.out.println("no update available");
|
System.out.println("no update available");
|
||||||
}else{
|
}else{
|
||||||
mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnavail"));
|
// mainWindowController.updateBtn.setText(mainWindowController.bundle.getString("updateBtnavail"));
|
||||||
System.out.println("update available");
|
System.out.println("update available");
|
||||||
try {
|
try {
|
||||||
URL website;
|
URL website;
|
||||||
URL downloadURL = new URL(downloadLink);
|
URL downloadURL = new URL(downloadLink);
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(downloadURL.openStream()));
|
BufferedReader in = new BufferedReader(new InputStreamReader(downloadURL.openStream()));
|
||||||
String updateDataURL = in.readLine();
|
String updateDataURL = in.readLine();
|
||||||
website = new URL(updateDataURL); //Update URL
|
website = new URL(updateDataURL); //Update URL
|
||||||
ReadableByteChannel rbc = Channels.newChannel(website.openStream()); //open new Stream/Channel
|
ReadableByteChannel rbc = Channels.newChannel(website.openStream()); //open new Stream/Channel
|
||||||
FileOutputStream fos = new FileOutputStream("ProjectHomeFlix.jar"); //nea fileoutputstram for ProjectHomeFLix.jar
|
FileOutputStream fos = new FileOutputStream("ProjectHomeFlix.jar"); //nea fileoutputstram for ProjectHomeFLix.jar
|
||||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); //gets file from 0 to max size
|
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); //gets file from 0 to max size
|
||||||
fos.close(); //close fos (extrem wichtig!)
|
fos.close(); //close fos (extrem wichtig!)
|
||||||
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
|
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
|
||||||
System.exit(0); //finishes itself
|
System.exit(0); //finishes itself
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
//in case there is an error
|
//in case there is an error
|
||||||
mainWindowController.showErrorMsg(mainWindowController.errorUpdateD, e);
|
mainWindowController.showErrorMsg(mainWindowController.errorUpdateD, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
BIN
src/libraries/sqlite-jdbc-3.16.1.jar
Normal file
BIN
src/libraries/sqlite-jdbc-3.16.1.jar
Normal file
Binary file not shown.
@ -1,4 +1,4 @@
|
|||||||
# HomeFlix-Local_de_DE.properties German Local
|
# HomeFlix-Local_de_DE.properties German Local
|
||||||
info = Info
|
info = Info
|
||||||
settings = Einstellungen
|
settings = Einstellungen
|
||||||
streamingSettings = Stream Einst.
|
streamingSettings = Stream Einst.
|
||||||
@ -28,7 +28,7 @@ errorSave = Beim speichern der Einstellungen ist ein Fehler aufgetreten!
|
|||||||
noFilmFound = Kein Film mit diesem Titel gefunden!
|
noFilmFound = Kein Film mit diesem Titel gefunden!
|
||||||
linuxBug = Zurzeit werden unter Linux leider keine Dateien mit Leerzeichen unterst\u00FCtzt!
|
linuxBug = Zurzeit werden unter Linux leider keine Dateien mit Leerzeichen unterst\u00FCtzt!
|
||||||
vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt!
|
vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt!
|
||||||
infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz
|
infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016-2017 Kellerkinder www.kellerkinder.xyz
|
||||||
title = Titel
|
title = Titel
|
||||||
year = Jahr
|
year = Jahr
|
||||||
rating = Einstufung
|
rating = Einstufung
|
||||||
@ -45,3 +45,5 @@ awards = Auszeichnungen
|
|||||||
metascore = Metascore
|
metascore = Metascore
|
||||||
imdbRating = IMDB-Bewertung
|
imdbRating = IMDB-Bewertung
|
||||||
type = Type
|
type = Type
|
||||||
|
firstStartHeader = Es ist kein Stammverzeichnis f\u00FCr Filme angegeben!
|
||||||
|
firstStartContent = Stammverzeichniss angeben?
|
||||||
|
@ -28,7 +28,7 @@ errorSave = An error occurred while saving the settings!
|
|||||||
noFilmFound = No film with this title found!
|
noFilmFound = No film with this title found!
|
||||||
linuxBug = Currently no files are supported with additional space under Linux unfortunately!
|
linuxBug = Currently no files are supported with additional space under Linux unfortunately!
|
||||||
vlcNotInstalled = VLC Media Player is required to play a movie!
|
vlcNotInstalled = VLC Media Player is required to play a movie!
|
||||||
infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016 Kellerkinder www.kellerkinder.xyz
|
infoText = \nMaintainer: seilo@kellerkinder.xyz and \nhendrik.schutter@coptersicht.de \n(c) 2016-2017 Kellerkinder www.kellerkinder.xyz
|
||||||
title = Title
|
title = Title
|
||||||
year = Year
|
year = Year
|
||||||
rating = Rating
|
rating = Rating
|
||||||
@ -45,3 +45,5 @@ awards = Awards
|
|||||||
metascore = Metascore
|
metascore = Metascore
|
||||||
imdbRating = IMDB-Rating
|
imdbRating = IMDB-Rating
|
||||||
type = Type
|
type = Type
|
||||||
|
firstStartHeader = There is no root directory for movies!
|
||||||
|
firstStartContent = Specify a root directory?
|
Binary file not shown.
@ -1 +1 @@
|
|||||||
104
|
117
|
||||||
|
Loading…
Reference in New Issue
Block a user