Skip to content
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@Extension
@NullMarked
public class ComponentExt {

private ComponentExt() {
Expand All @@ -21,7 +23,7 @@ public static void setRecursive(@This Component component, Consumer<Component> c
setRecursive(component, consumer, _ -> true);
}

public static void setRecursive(@This Component component, Consumer<Component> consumer,
public static void setRecursive(@This @Nullable Component component, Consumer<Component> consumer,
Predicate<Container> condition) {
if (component != null) {
consumer.accept(component);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import org.jspecify.annotations.NullMarked;

@Extension
@NullMarked
public class ContainerExt {
private ContainerExt() {
// hide utility class constructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import org.jspecify.annotations.NullMarked;

@Extension
@NullMarked
public class GridBagConstraintsExt {
private GridBagConstraintsExt() {
// hide utility class constructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import org.jspecify.annotations.NullMarked;

@Extension
@NullMarked
public class GridBagLayoutExt {

private GridBagLayoutExt() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import org.jspecify.annotations.NullMarked;
import org.lodder.subtools.sublibrary.util.function.BooleanConsumer;

@Extension
@NullMarked
public class AbstractButtonExt {
private AbstractButtonExt() {
// hide utility class constructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import org.jspecify.annotations.NullMarked;

@Extension
@NullMarked
public class JButtonExt {

private JButtonExt() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import org.jspecify.annotations.NullMarked;
import org.lodder.subtools.sublibrary.util.function.BooleanConsumer;

@Extension
@NullMarked
public class JCheckBoxExt {
private JCheckBoxExt() {
// hide utility class constructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import manifold.ext.rt.api.ThisClass;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
import org.lodder.subtools.multisubdownloader.gui.ToStringListCellRenderer;

@Extension
@NullMarked
public class JComboBoxExt {

private JComboBoxExt() {
// hide utility class constructor
}


public static <E> JComboBox<E> create(@ThisClass Class<JComboBox<E>> thisClass, E... values) {
return new JComboBox<>(values);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@Extension
@NullMarked
public class JComponentExt {

private JComponentExt() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import org.jspecify.annotations.NullMarked;


@Extension
@NullMarked
public class JProgressBarExt {

private JProgressBarExt() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import org.jspecify.annotations.NullMarked;

@Extension
@NullMarked
public class JScrollPaneExt {

private JScrollPaneExt() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import org.jspecify.annotations.NullMarked;

@Extension
@NullMarked
public class JSliderExt {

private JSliderExt() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import org.jspecify.annotations.NullMarked;

@Extension
@NullMarked
public class TabbedPaneExt {

private TabbedPaneExt() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import org.jspecify.annotations.NullMarked;

@Extension
@NullMarked
public class JTableExt {

private JTableExt() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import org.jspecify.annotations.NullMarked;

@Extension
@NullMarked
public class JTextAreaExt {

private JTextAreaExt() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import org.jspecify.annotations.NullMarked;

@Extension
@NullMarked
public class JTextFieldExt {

private JTextFieldExt() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.Self;
import manifold.ext.rt.api.This;
import org.jspecify.annotations.NullMarked;

@Extension
@NullMarked
public class JTextComponentExt {

private JTextComponentExt() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.This;
import org.apache.commons.cli.CommandLine;
import org.jspecify.annotations.NullMarked;
import org.lodder.subtools.multisubdownloader.cli.CliOption;

@Extension
@NullMarked
public class CommandLineExt {

private CommandLineExt() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
import org.lodder.subtools.multisubdownloader.cli.CliOption;
import org.lodder.subtools.multisubdownloader.exceptions.CliException;
import org.lodder.subtools.multisubdownloader.framework.Bootstrapper;
Expand All @@ -31,14 +33,15 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@NullMarked
public class App {

private static final Logger LOGGER = LoggerFactory.getLogger(App.class);

private static SettingsControl prefCtrl;
private static Splash splash;
private static @Nullable Splash splash;

public static void main(String[] args) throws ReflectiveOperationException, UnsupportedLookAndFeelException {
static void main(String[] args) throws ReflectiveOperationException, UnsupportedLookAndFeelException {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

CommandLineParser parser = new DefaultParser();
Expand All @@ -52,9 +55,7 @@ public static void main(String[] args) throws ReflectiveOperationException, Unsu
return;
}

if (!line.hasCliOption(CliOption.NO_GUI)) {
splash = new Splash().showSplash();
}
splash = line.hasCliOption(CliOption.NO_GUI) ? null : new Splash().showSplash();

Preferences preferences = Preferences.userRoot();
preferences.putBoolean(CliOption.SPEEDY.value, line.hasCliOption(CliOption.SPEEDY));
Expand Down Expand Up @@ -108,7 +109,7 @@ public static void main(String[] args) throws ReflectiveOperationException, Unsu
}
new Thread(() -> {
List<String> providerNames =
app.makeSubtitleProviderStore().getAllProviders().stream().map(provider -> provider.provider)
app.makeSubtitleProviderStore().allProviders.stream().map(provider -> provider.provider)
.map(providerName -> providerName.contains("-") ? providerName.split("-")[0] : providerName)
.map(providerName -> providerName + "-").toList();
manager.getCache(CacheType.DISK, key -> providerNames.stream().noneMatch(key.provider::equals))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream;

import org.apache.commons.cli.CommandLine;
import org.jspecify.annotations.NullMarked;
import org.lodder.subtools.multisubdownloader.actions.DownloadAction;
import org.lodder.subtools.multisubdownloader.actions.FileListAction;
import org.lodder.subtools.multisubdownloader.actions.UserInteractionHandlerAction;
Expand All @@ -25,11 +25,12 @@
import org.lodder.subtools.multisubdownloader.settings.model.Settings;
import org.lodder.subtools.sublibrary.Language;
import org.lodder.subtools.sublibrary.Manager;
import org.lodder.subtools.sublibrary.model.Release;
import org.lodder.subtools.sublibrary.model.ReleaseWithPath;
import org.lodder.subtools.sublibrary.model.Subtitle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@NullMarked
public class CLI {

private static final Logger LOGGER = LoggerFactory.getLogger(CLI.class);
Expand Down Expand Up @@ -79,9 +80,9 @@ public void run() {
this.search();
}

public void download(List<Release> releases) {
public void download(List<ReleaseWithPath> releases) {
Info.downloadOptions(this.settings, true);
for (Release release : releases) {
for (ReleaseWithPath release : releases) {
try {
this.download(release);
} catch (Exception e) {
Expand Down Expand Up @@ -112,18 +113,18 @@ public void search() {
}
}

private void download(Release release) {
private void download(ReleaseWithPath release) {
List<Subtitle> selection;
if (downloadAll) {
selection = release.getMatchingSubs();
selection = release.matchingSubs;
if (!selection.isEmpty()) {
System.out.println("Downloading ALL found subtitles for release: ${release.fileName}");
System.out.println("Downloading ALL found subtitles for release: ${release.fileNameOrName}");
}
} else {
selection = userInteractionHandlerAction.subtitleSelection(release, subtitleSelection, dryRun);
}
if (selection.isEmpty()) {
System.out.println("No subtitles found for: ${release.fileName}");
System.out.println("No subtitles found for: ${release.fileNameOrName}");
} else {
AtomicInteger counter = new AtomicInteger(1);
IntStream.range(0, selection.size()).forEach(j -> {
Expand All @@ -143,7 +144,7 @@ private List<Path> getFolders(CommandLine line) {
if (line.hasCliOption(CliOption.FOLDER)) {
return List.of(Path.of(line.getCliOptionValue(CliOption.FOLDER)));
} else {
return new ArrayList<>(this.settings.defaultFolders);
return List.copyOf(this.settings.defaultFolders);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.function.Consumer;
import java.util.function.Function;

import org.jspecify.annotations.NullMarked;
import org.lodder.subtools.multisubdownloader.framework.Container;
import org.lodder.subtools.multisubdownloader.gui.Menu;
import org.lodder.subtools.multisubdownloader.gui.actions.search.FileGuiSearchAction;
Expand Down Expand Up @@ -69,6 +70,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@NullMarked
public class GUI extends JFrame implements PropertyChangeListener {

@Serial private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -214,7 +216,6 @@ private void createMenu(LoggingPanel pnlLogging) {
.withShowOnlyFound(settings.optionsShowOnlyFound)
.withFileQuitAction(this::close)
.withViewFilenameAction(() -> visibilityFunction.accept(FILENAME, menuBar.isViewFilenameSelected()))
.withViewTypeAction(() -> visibilityFunction.accept(TYPE, menuBar.isViewTypeSelected()))
.withViewTitleAction(() -> visibilityFunction.accept(TITLE, menuBar.isViewTitleSelected()))
.withViewSeasonAction(() -> visibilityFunction.accept(SEASON, menuBar.isViewSeasonSelected()))
.withViewEpisodeAction(() -> visibilityFunction.accept(EPISODE, menuBar.isViewEpisodeSelected()))
Expand Down Expand Up @@ -315,7 +316,6 @@ private CustomTable createVideoTable() {
customTable.hideColumn(SearchColumnName.OBJECT);
customTable.hideColumn(SearchColumnName.SEASON);
customTable.hideColumn(SearchColumnName.EPISODE);
customTable.hideColumn(SearchColumnName.TYPE);
customTable.hideColumn(SearchColumnName.TITLE);
return customTable;
}
Expand All @@ -334,7 +334,6 @@ private void restoreScreenSettings() {
menuBar::withViewEpisodeSelected);
visibilityConsumer.accept(FILENAME, screenSettings.hideFilename, menuBar::withViewFileNameSelected);
visibilityConsumer.accept(SearchColumnName.SEASON, screenSettings.hideSeason, menuBar::withViewSeasonSelected);
visibilityConsumer.accept(SearchColumnName.TYPE, screenSettings.hideType, menuBar::withViewTypeSelected);
visibilityConsumer.accept(SearchColumnName.TITLE, screenSettings.hideTitle, menuBar::withViewTitleSelected);
}

Expand Down Expand Up @@ -490,7 +489,6 @@ private void storeScreenSettings() {
settingsControl.settings.screenSettings.hideFilename = customTable.isHideColumn(FILENAME);
settingsControl.settings.screenSettings.hideSeason = customTable.isHideColumn(SearchColumnName.SEASON);
settingsControl.settings.screenSettings.hideTitle = customTable.isHideColumn(SearchColumnName.TITLE);
settingsControl.settings.screenSettings.hideType = customTable.isHideColumn(SearchColumnName.TYPE);
}

public ProgressDialog setProgressDialog(Cancelable worker) {
Expand Down
Loading
Loading