RipMeApp / ripme

Downloads albums in bulk
MIT License
3.72k stars 630 forks source link

Command line usage on a headless server triggers error #105

Closed heyhippari closed 6 years ago

heyhippari commented 7 years ago

Expected Behavior

The app should simply return an help page if no argument is passed, otherwise it should run the operation as intended.

Actual Behavior

The app refuses to do anything and outputs the following error:

Exception in thread "main" java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it. at java.desktop/java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:202) at java.desktop/java.awt.Window.(Window.java:534) at java.desktop/java.awt.Frame.(Frame.java:423) at java.desktop/javax.swing.JFrame.(JFrame.java:224) at com.rarchives.ripme.ui.MainWindow.(MainWindow.java:162) at com.rarchives.ripme.App.main(App.java:60)

cyian-1756 commented 7 years ago

The app should simply return an help page if no argument is passed

The issue here is that ripme considers no args being passed as GUI mode

metaprime commented 6 years ago

The only interactive mode ripme has is the GUI, so why would you want to run it from a console with no args?

heyhippari commented 6 years ago

It'd be nice to get instructions on how to use it if you're on headless, instead of the current behavior of simply throwing an exception and quitting.

I might tackle this this weekend.
I've found out about the following piece of code, which could achieve what I want:

if (GraphicsEnvironment.isHeadless()) {
     // redirect to the command line options, if no option is supplied, show an help page
} else {
     // start the gui
}

I'm mostly running it headless through a Systemd Timer for automated ripping of a list of URLs, but still, it's a "nice to have" for cleanliness on the end-user part :)