v0.13 rolling. UI changes, extension filter bug fixed.

master
Dmitry Isaenko 2019-03-01 23:19:33 +03:00
parent 603f62dae1
commit 4586f71f55
9 changed files with 196 additions and 24 deletions

View File

@ -2,6 +2,8 @@
mplayer4anime is mplayer launcher to play video file with audio layer and/or subtitles (.ass, .srt, etc,,,) at once.
![Screenshot](https://farm8.staticflickr.com/7917/40285210053_fe9c781698_o.png)
## License
Source code spreads under the GNU General Public License v.3. You can find it in LICENSE file or just visit www.gnu.org (it should be there for sure).

112
pom.xml
View File

@ -5,13 +5,52 @@
<modelVersion>4.0.0</modelVersion>
<groupId>loper</groupId>
<name>mplayer4anime</name>
<artifactId>mplayer4anime</artifactId>
<version>0.12-SNAPSHOT</version>
<version>0.13-SNAPSHOT</version>
<packaging>jar</packaging>
<name>InnaIrcBot</name>
<url>https://github.com/developersu/mplayer4anime</url>
<description>
mplayer front end to play content pairs, that mostly used for anime (mka+mkv, mp4+ac3, mkv+srt)
</description>
<inceptionYear>2018-2019</inceptionYear>
<organization>
<name>Dmitry Isaenko</name>
<url>https://developersu.blogspot.com/search/label/mplayer4anime</url>
</organization>
<licenses>
<license>
<name>GPLv3</name>
<url>LICENSE</url>
<distribution>manual</distribution>
</license>
</licenses>
<developers>
<developer>
<id>developer.su</id>
<name>Dmitry Isaenko</name>
<roles>
<role>Developer</role>
</roles>
<timezone>+3</timezone>
<url>https://developersu.blogspot.com/</url>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/developer_su/${project.artifactId}/issues</url>
</issueManagement>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
@ -19,22 +58,91 @@
<version>2.8.5</version>
<scope>compile</scope>
</dependency>
<!-- openJFX Linux -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
<classifier>linux</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>11</version>
<classifier>linux</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11</version>
<classifier>linux</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>11</version>
<classifier>linux</classifier>
<scope>compile</scope>
</dependency>
<!-- openJFX Windows -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>11</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>11</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<!-- openJFX MAC -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
<classifier>mac</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>11</version>
<classifier>mac</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11</version>
<classifier>mac</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>11</version>
<classifier>mac</classifier>
<scope>compile</scope>
</dependency>
</dependencies>

View File

@ -52,7 +52,6 @@ public class AppPreferences {
/** Handle lists of the audio files extensions */
public void setAudioExtensionsList(String[] audioExtensionsList){ storeSingleStringList("AUDIO_EXTENSIONS_LIST", audioExtensionsList); }
public String[] getAudioExtensionsList(){ return preferences.get("AUDIO_EXTENSIONS_LIST", "*.mka *.ac3").split(" "); }
/** Handle lists of the subtitles extensions selector */
public void setSubsExtensionsList(String[] subsList){ storeSingleStringList("SUBS_EXTENSIONS_LIST", subsList); }
public String[] getSubsExtensionsList(){ return preferences.get("SUBS_EXTENSIONS_LIST", "*.ass *.srt ").split(" "); }

View File

@ -31,7 +31,7 @@ public class ControllerListsSelector implements Initializable {
* Must be run on start
* Set list content
*/
void setList(String[] listFromStorage, boolean isListOfExtensions){
void setList(String[] listFromStorage, boolean isListOfExtensions){
observableList = FXCollections.observableArrayList(listFromStorage);
listView.setItems(observableList);
this.listOfExtensions = isListOfExtensions;
@ -71,26 +71,30 @@ public class ControllerListsSelector implements Initializable {
private void removeRecord(){ observableList.remove(listView.getSelectionModel().getSelectedItem()); }
@FXML
private void addNewRecord(){
String addingItem = newRecordText.getText().trim();
String addingItem = newRecordText.getText().trim().toLowerCase();
if (!addingItem.isEmpty()) // If this field is non-empty
if (!addingItem.contains(" ") && !addingItem.contains("\t")) {
if (this.listOfExtensions) {
if (addingItem.startsWith("*."))
if (addingItem.startsWith("*.")) {
if (addingItem.substring(2).contains("*")) {
ServiceWindow.getErrorNotification(resourceBundle.getString("Error"), resourceBundle.getString("settings_fieldContainUnacceptedChars"));
} else {
observableList.add(addingItem);
}
else {
validateAndAdd(addingItem);
}
}
else if (addingItem.contains("*")) {
ServiceWindow.getErrorNotification(resourceBundle.getString("Error"), resourceBundle.getString("settings_fieldContainUnacceptedChars"));
} else if (addingItem.startsWith(".")) {
observableList.add("*" + addingItem);
} else {
observableList.add("*." + addingItem);
}
else if (addingItem.startsWith(".")) {
validateAndAdd("*" + addingItem);
}
else {
validateAndAdd("*." + addingItem);
}
}
else {
observableList.add(addingItem);
validateAndAdd(addingItem);
}
}
else{
@ -98,4 +102,9 @@ public class ControllerListsSelector implements Initializable {
}
newRecordText.clear();
}
}
private void validateAndAdd(String addingItem){
if (!observableList.contains(addingItem)) {
observableList.add(addingItem);
}
}
}

View File

@ -16,6 +16,7 @@ import mplayer4anime.AppPreferences;
import java.io.File;
import java.io.FilenameFilter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ResourceBundle;
@ -126,22 +127,29 @@ public class ControllerPane implements Initializable {
* */
@FXML
void openDirChooser(){
String[] filesExtension;
String[] filesExtensionTmp;
switch (paneType) {
case "Video":
filesExtension = appPreferences.getVideoExtensionsList();
filesExtensionTmp = appPreferences.getVideoExtensionsList();
break;
case "Audio":
filesExtension = appPreferences.getAudioExtensionsList();
filesExtensionTmp = appPreferences.getAudioExtensionsList();
break;
case "Subtitles":
filesExtension = appPreferences.getSubsExtensionsList();
filesExtensionTmp = appPreferences.getSubsExtensionsList();
break;
default:
filesExtension = new String[]{"*"};
filesExtensionTmp = new String[]{"*"};
break;
}
List<String> lowerAndUpperExts = new ArrayList<>();
for (String s: filesExtensionTmp) {
lowerAndUpperExts.add(s);
lowerAndUpperExts.add(s.toUpperCase());
}
String[] filesExtension = lowerAndUpperExts.toArray(new String[lowerAndUpperExts.size()]);
File directoryReceived; // Store files (folder) received from selector
DirectoryChooser dirSelect;
@ -164,7 +172,7 @@ public class ControllerPane implements Initializable {
if (Name.lastIndexOf('.') > 0) {
int lastindex = Name.lastIndexOf('.');
String ext = Name.substring(lastindex);
for (String key : filesExtension){
for (String key : filesExtension){ // TODO: add toLowerCase and validate whatever registry extension noted
if (ext.equals(key.substring(1)))
return true;
}
@ -200,6 +208,13 @@ public class ControllerPane implements Initializable {
break;
}
List<String> lowerAndUpperExts = new ArrayList<>();
for (String s: filesExtension) {
lowerAndUpperExts.add(s);
lowerAndUpperExts.add(s.toUpperCase());
}
filesExtension = lowerAndUpperExts.toArray(new String[lowerAndUpperExts.size()]);
List<File> filesRecievedList;
FileChooser fc = new FileChooser();
@ -211,7 +226,7 @@ public class ControllerPane implements Initializable {
fc.getExtensionFilters().addAll(new FileChooser.ExtensionFilter(paneType, filesExtension));
filesRecievedList = fc.showOpenMultipleDialog(paneListView.getScene().getWindow());
if (filesRecievedList != null){
if (filesRecievedList != null){ // TODO: and !filesRecieved.isEmpty()
File[] filesRecieved = new File[filesRecievedList.size()];
filesRecievedList.toArray(filesRecieved);
displayFiles(filesRecieved);

View File

@ -14,7 +14,7 @@
<VBox xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mplayer4anime.Settings.SettingsController">
<children>
<TabPane side="LEFT" tabClosingPolicy="UNAVAILABLE" tabMaxHeight="100.0" tabMaxWidth="500.0" tabMinHeight="100.0" tabMinWidth="80.0" VBox.vgrow="ALWAYS">
<TabPane side="LEFT" styleClass="tab-paneSettings" stylesheets="@../res/landing.css" tabClosingPolicy="UNAVAILABLE" tabMaxHeight="100.0" tabMaxWidth="500.0" tabMinHeight="100.0" tabMinWidth="80.0" VBox.vgrow="ALWAYS">
<tabs>
<Tab closable="false">
<content>

View File

@ -1,5 +1,5 @@
about_line1=mplayer4amine distributes under GNU GPLv3 license.
about_line2=Release: v0.12
about_line2=Release: v0.13
about_line3=Development & maintenance by Dmitry Isaenko.
about_AboutName=About
main_tab_audio=Audio

View File

@ -1,6 +1,6 @@
menu_File_Recent=\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 \u0444\u0430\u0439\u043B\u044B...
about_line1=mplayer4amine \u0440\u0430\u0441\u043F\u0440\u043E\u0441\u0442\u0440\u0430\u043D\u044F\u0435\u0442\u0441\u044F \u043F\u043E \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u0438 GNU GPLv3.
about_line2=\u0420\u0435\u043B\u0438\u0437: v0.12
about_line2=\u0420\u0435\u043B\u0438\u0437: v0.13
about_line3=\u0420\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u0430\u043D\u043E \u0438 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F \u0414\u043C\u0438\u0442\u0440\u0438\u0435\u043C \u0418\u0441\u0430\u0435\u043D\u043A\u043E.
about_AboutName=\u041E \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0438
main_tab_audio=\u0410\u0443\u0434\u0438\u043E

View File

@ -90,4 +90,43 @@
-fx-background-image: url(gjel.png);
-fx-background-position: center;
-fx-background-repeat: repeat;
}
/* -======================== TAB PANE =========================- */
.tab-paneSettings .tab SVGPath{
-fx-fill: #000000;
}
.tab-paneSettings .tab:selected SVGPath{
-fx-fill: #267a9e;
}
.tab-paneSettings .tab{
-fx-background-color: #ffffff;
-fx-focus-color: transparent;
-fx-faint-focus-color: transparent;
-fx-border-radius: 0 0 0 0;
-fx-border-width: 0 0 5 0;
-fx-border-color: #ffffff;
}
.tab-paneSettings .tab:selected{
-fx-background-color: #ebffff;
-fx-focus-color: transparent;
-fx-faint-focus-color: transparent;
-fx-border-radius: 0 0 0 0;
-fx-border-width: 0 0 5 0;
-fx-border-color: #8dbee4;
}
.tab-paneSettings > .tab-header-area {
-fx-background-insets: 0.0;
-fx-padding: 0;
}
.tab-paneSettings > .tab-header-area > .tab-header-background
{
-fx-background-color: #ffffff;
}
.tab-paneSettings > .tab-header-area > .headers-region > .tab {
-fx-padding: 10;
}