Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/java/mediathek/config/MVConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ public enum Configs {
SYSTEM_URL_OEFFNEN("Programm-Url-oeffnen"),
SYSTEM_LINUX_SHUTDOWN("Programm-Linux-Shutdown"),
SYSTEM_PLAYER_ABSPIELEN("Player-zum-Abspielen"),
SYSTEM_JDOWNLOADER_URL("system-jdownloader-url", "http://127.0.0.1:9666/flash/add"),
SYSTEM_PYLOAD_URL("system-pyload-url"),
SYSTEM_PYLOAD_USER("system-pyload-user"),
SYSTEM_PYLOAD_PASSWORD("system-pyload-password"),
// Fenstereinstellungen

SYSTEM_EIGENSCHAFTEN_TABELLE_FILME("Eigenschaften-Tabellen-Filme"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,47 @@ public PanelEinstellungenErweitert() {
handler = new TextCopyPasteHandler<>(jTextFieldProgrammShutdown);
jTextFieldProgrammShutdown.setComponentPopupMenu(handler.getPopupMenu());

jTextFieldJDownloaderUrl.setText(MVConfig.get(MVConfig.Configs.SYSTEM_JDOWNLOADER_URL));
jTextFieldJDownloaderUrl.getDocument().addDocumentListener(new BeobDoc(MVConfig.Configs.SYSTEM_JDOWNLOADER_URL, jTextFieldJDownloaderUrl));
handler = new TextCopyPasteHandler<>(jTextFieldJDownloaderUrl);
jTextFieldJDownloaderUrl.setComponentPopupMenu(handler.getPopupMenu());

jTextFieldPyLoadUrl.setText(MVConfig.get(MVConfig.Configs.SYSTEM_PYLOAD_URL));
jTextFieldPyLoadUrl.getDocument().addDocumentListener(new BeobDoc(MVConfig.Configs.SYSTEM_PYLOAD_URL, jTextFieldPyLoadUrl));
handler = new TextCopyPasteHandler<>(jTextFieldPyLoadUrl);
jTextFieldPyLoadUrl.setComponentPopupMenu(handler.getPopupMenu());

jTextFieldPyLoadUser.setText(MVConfig.get(MVConfig.Configs.SYSTEM_PYLOAD_USER));
jTextFieldPyLoadUser.getDocument().addDocumentListener(new BeobDoc(MVConfig.Configs.SYSTEM_PYLOAD_USER, jTextFieldPyLoadUser));
handler = new TextCopyPasteHandler<>(jTextFieldPyLoadUser);
jTextFieldPyLoadUser.setComponentPopupMenu(handler.getPopupMenu());

jPasswordFieldPyLoadPassword.setText(MVConfig.get(MVConfig.Configs.SYSTEM_PYLOAD_PASSWORD));
jPasswordFieldPyLoadPassword.getDocument().addDocumentListener(new DocumentListener() {
private void update() {
MVConfig.add(
MVConfig.Configs.SYSTEM_PYLOAD_PASSWORD,
new String(jPasswordFieldPyLoadPassword.getPassword())
);
}

@Override
public void insertUpdate(DocumentEvent e) {
update();
}

@Override
public void removeUpdate(DocumentEvent e) {
update();
}

@Override
public void changedUpdate(DocumentEvent e) {
update();
}
});


if (!SystemUtils.IS_OS_LINUX) {
jTextFieldProgrammShutdown.setEnabled(false);
jButtonProgrammShutdown.setEnabled(false);
Expand Down Expand Up @@ -212,6 +253,11 @@ private void initComponents() {
jCheckBoxDownloadSofortStarten = new JCheckBox();
var jPanel2 = new JPanel();
jTextFieldProgrammDateimanager = new JTextField();
jTextFieldJDownloaderUrl = new JTextField();
jTextFieldPyLoadUrl = new JTextField();
jTextFieldPyLoadUser = new JTextField();
jPasswordFieldPyLoadPassword = new JPasswordField();

jButtonProgrammDateimanager = new JButton();
var jLabel1 = new JLabel();
var jLabel2 = new JLabel();
Expand Down Expand Up @@ -320,6 +366,58 @@ private void initComponents() {
}
add(jPanel4);


//======== jPanelJDownloader ========
var jPanelJDownloader = new JPanel();
jPanelJDownloader.setBorder(new TitledBorder("JDownloader"));
jPanelJDownloader.setLayout(new MigLayout(
new LC().insets("5").hideMode(3).gridGap("5", "5"),
new AC().grow().fill().gap().fill(),
new AC().fill().fill()
));

var jLabelJDownloaderUrl = new JLabel("JDownloader-URL:");
jPanelJDownloader.add(jLabelJDownloaderUrl, new CC().cell(0, 0).spanX(2));
jTextFieldJDownloaderUrl.setToolTipText(
"<html>Wenn jDownloader nicht auf dem lokalen Host installiert ist oder unter einem anderen Port reagieren soll, hier bitte angeben.<br>" +
"Default: http://127.0.0.1:9666/flash/add</html>"
);

jPanelJDownloader.add(jTextFieldJDownloaderUrl, new CC().cell(0, 1));
add(jPanelJDownloader);


//======== jPanelPyLoad ========
var jPanelPyLoad = new JPanel();
jPanelPyLoad.setBorder(new TitledBorder("pyLoad"));
jPanelPyLoad.setLayout(new MigLayout(
new LC().insets("5").hideMode(3).gridGap("5", "5"),
new AC().grow().fill().gap().fill(),
new AC().fill().fill().fill().fill().fill().fill()
));

var jLabelPyLoadUrl = new JLabel("pyLoad-URL:");
var jLabelPyLoadUser = new JLabel("Benutzer:");
var jLabelPyLoadPassword = new JLabel("Passwort:");

jPanelPyLoad.add(jLabelPyLoadUrl, new CC().cell(0, 0).spanX(2));

jTextFieldPyLoadUrl.setToolTipText("PyLoad-URL komplett angeben (z.B.: http://127.0.0.1:8000)");
jPanelPyLoad.add(jTextFieldPyLoadUrl, new CC().cell(0, 1));

jPanelPyLoad.add(jLabelPyLoadUser, new CC().cell(0, 2).spanX(2));
jTextFieldPyLoadUser.setToolTipText("Benutzername für pyLoad");

jPanelPyLoad.add(jTextFieldPyLoadUser, new CC().cell(0, 3));

jPanelPyLoad.add(jLabelPyLoadPassword, new CC().cell(0, 4).spanX(2));
jPasswordFieldPyLoadPassword.setToolTipText("Passwort für pyLoad");

jPanelPyLoad.add(jPasswordFieldPyLoadPassword, new CC().cell(0, 5));

add(jPanelPyLoad);


//======== jPanel3 ========
{
jPanel3.setBorder(new TitledBorder("Linux: Aufruf zum Shutdown"));
Expand Down Expand Up @@ -374,5 +472,9 @@ private void initComponents() {
private JButton jButtonProgrammShutdown;
private JTextField jTextFieldProgrammShutdown;
private ShutdownActionComboBox cbDefaultShutdownHelperCommand;
private JTextField jTextFieldJDownloaderUrl;
private JTextField jTextFieldPyLoadUrl;
private JTextField jTextFieldPyLoadUser;
private JPasswordField jPasswordFieldPyLoadPassword;
// End of variables declaration//GEN-END:variables
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,98 @@ new FormModel {
"value": "cell 1 3"
} )
} )

add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 5,hidemode 3,gap 5 5"
"$columnConstraints": "[grow,fill][fill]"
"$rowConstraints": "[fill][fill]"
} ) {
name: "jPanelJDownloader"
"border": new javax.swing.border.TitledBorder( "JDownloader" )
auxiliary() {
"JavaCodeGenerator.variableLocal": true
}

add( new FormComponent( "javax.swing.JLabel" ) {
"text": "JDownloader-URL:"
auxiliary() {
"JavaCodeGenerator.variableLocal": true
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0 2 1"
} )

add( new FormComponent( "javax.swing.JTextField" ) {
name: "jTextFieldJDownloaderUrl"
"toolTipText": "<html>Wenn jDownloader nicht auf dem lokalen Host installiert ist oder unter einem anderen Port reagieren soll, hier bitte angeben.<br>Default: http://127.0.0.1:9666/flash/add</html>"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1"
} )
} )



add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 5,hidemode 3,gap 5 5"
"$columnConstraints": "[grow,fill][fill]"
"$rowConstraints": "[fill][fill][fill][fill][fill][fill]"
} ) {
name: "jPanelPyLoad"
"border": new javax.swing.border.TitledBorder( "pyLoad" )
auxiliary() {
"JavaCodeGenerator.variableLocal": true
}

add( new FormComponent( "javax.swing.JLabel" ) {
"text": "pyLoad-URL:"
auxiliary() {
"JavaCodeGenerator.variableLocal": true
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0 2 1"
} )

add( new FormComponent( "javax.swing.JTextField" ) {
name: "jTextFieldPyLoadUrl"
"toolTipText": "PyLoad-URL komplett angeben (z.B.: http://127.0.0.1:8000)"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1"
} )

add( new FormComponent( "javax.swing.JLabel" ) {
"text": "Benutzer:"
auxiliary() {
"JavaCodeGenerator.variableLocal": true
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2 2 1"
} )

add( new FormComponent( "javax.swing.JTextField" ) {
name: "jTextFieldPyLoadUser"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3"
} )

add( new FormComponent( "javax.swing.JLabel" ) {
"text": "Passwort:"
auxiliary() {
"JavaCodeGenerator.variableLocal": true
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4 2 1"
} )

add( new FormComponent( "javax.swing.JPasswordField" ) {
name: "jPasswordFieldPyLoadPassword"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 5"
} )
} )




add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 5,hidemode 3,gap 5 5"
"$columnConstraints": "[grow,fill][fill]"
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/mediathek/gui/tabs/tab_film/GuiFilme.java
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,7 @@ class TableContextMenuHandler extends MouseAdapter {
private final ActionListener unseenActionListener = new BeobHistory(false);
private final ActionListener seenActionListener = new BeobHistory(true);
private final JDownloadHelper jDownloadHelper = new JDownloadHelper();
private final PyLoadHelper pyLoadHelper = new PyLoadHelper();
private final DownloadSubtitleAction downloadSubtitleAction = new DownloadSubtitleAction(GuiFilme.this);
private Point p;

Expand Down Expand Up @@ -1324,6 +1325,8 @@ private void showMenu(MouseEvent evt) {
res.ifPresent(film -> {
jDownloadHelper.installContextMenu(film, jPopupMenu);
jPopupMenu.addSeparator();
pyLoadHelper.installContextMenu(film, jPopupMenu);
jPopupMenu.addSeparator();
setupCopytoClipboardContextMenu(film, jPopupMenu);
jPopupMenu.addSeparator();
setupSearchEntries(jPopupMenu, film);
Expand Down
21 changes: 18 additions & 3 deletions src/main/java/mediathek/gui/tabs/tab_film/JDownloadHelper.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mediathek.gui.tabs.tab_film

import mediathek.config.Konstanten
import mediathek.config.MVConfig
import mediathek.controller.history.SeenHistoryController
import mediathek.daten.DatenFilm
import mediathek.daten.FilmResolution
Expand All @@ -25,11 +26,25 @@ class JDownloadHelper {
private val historyController = SeenHistoryController()

private fun downloadUrl(url: HttpUrl, film: DatenFilm) {
val jdUrlString = MVConfig.get(MVConfig.Configs.SYSTEM_JDOWNLOADER_URL)
val jdUrl = try {
jdUrlString.toHttpUrl()
} catch (e: IllegalArgumentException) {
logger.error("Invalid JDownloader URL in config: {}", jdUrlString)
SwingErrorDialog.showExceptionMessage(
MediathekGui.ui(),
"<html>Die konfigurierte JDownloader-URL ist ungültig:<br><br><b>$jdUrlString</b></html>",
e
)
return
}
val formBody: RequestBody = FormBody.Builder()
.add("urls", url.toString())
.build()
val request = Request.Builder()
.url("http://127.0.0.1:9666/flash/add")
.url(jdUrl)
.header("Referer", "https://mediathekview")
.header("Origin", "https://mediathekview")
.post(formBody)
.build()
try {
Expand All @@ -50,8 +65,8 @@ class JDownloadHelper {
catch (e: Exception) {
logger.error("downloadUrl", e)
SwingErrorDialog.showExceptionMessage(MediathekGui.ui(),
"<html>Die URL konnte nicht mit JDownloader geladen werden.<br>" +
"Bitte wenden Sie sich bei Bedarf an das Forum.</html>", e)
"<html>Die URL konnte nicht mit JDownloader geladen werden.<br>" +
"Bitte wenden Sie sich bei Bedarf an das Forum.</html>", e)
}
}

Expand Down
Loading