1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-02 08:25:02 -04:00

* move package net.sourceforge.tuned to net.sourceforge.filebot.util

This commit is contained in:
Reinhard Pointner 2014-04-01 12:36:34 +00:00
parent 55217e3ceb
commit 664f83ced0
171 changed files with 6842 additions and 290 deletions

View File

@ -187,7 +187,7 @@ tvdb_updates.each{ update ->
def imdb_name = _guarded{
if (imdbid =~ /tt(\d+)/) {
def dom = IMDb.parsePage(IMDb.getMoviePageLink(imdbid.match(/tt(\d+)/) as int).toURL())
return net.sourceforge.tuned.XPathUtilities.selectString("//META[@property='og:title']/@content", dom)
return net.sourceforge.filebot.util.XPathUtilities.selectString("//META[@property='og:title']/@content", dom)
}
}
def data = [update.time, update.id, imdbid, tvdb_name ?: '', imdb_name ?: '', rating ?: 0, votes ?: 0]

View File

@ -33,7 +33,7 @@
-Dnet.sourceforge.filebot.AcoustID.fpcalc="%EXEDIR%\fpcalc.exe"
# store preferences to text file
-Djava.util.prefs.PreferencesFactory=net.sourceforge.tuned.prefs.FilePreferencesFactory
-Djava.util.prefs.PreferencesFactory=net.sourceforge.filebot.util.prefs.FilePreferencesFactory
-Dnet.sourceforge.tuned.prefs.file="%EXEDIR%\prefs.properties"
# boost application startup speed

View File

@ -1,2 +1,2 @@
@ECHO OFF
java -XX:+TieredCompilation -Dunixfs=false -DuseExtendedFileAttributes=false -DuseCreationDate=false -Djava.net.useSystemProxies=false -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Djna.nosys=true -Dapplication.deployment=portable -Dapplication.analytics=true "-Dapplication.dir=%~dp0." "-Duser.home=%~dp0." "-Djava.io.tmpdir=%~dp0temp" "-Djna.library.path=%~dp0" "-Djava.library.path=%~dp0" -Dnet.sourceforge.filebot.AcoustID.fpcalc="%~dp0fpcalc.exe" -Djava.util.prefs.PreferencesFactory=net.sourceforge.tuned.prefs.FilePreferencesFactory "-Dnet.sourceforge.tuned.prefs.file=%~dp0prefs.properties" -jar "%~dp0FileBot.jar" %*
java -XX:+TieredCompilation -Dunixfs=false -DuseExtendedFileAttributes=false -DuseCreationDate=false -Djava.net.useSystemProxies=false -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Djna.nosys=true -Dapplication.deployment=portable -Dapplication.analytics=true "-Dapplication.dir=%~dp0." "-Duser.home=%~dp0." "-Djava.io.tmpdir=%~dp0temp" "-Djna.library.path=%~dp0" "-Djava.library.path=%~dp0" -Dnet.sourceforge.filebot.AcoustID.fpcalc="%~dp0fpcalc.exe" -Djava.util.prefs.PreferencesFactory=net.sourceforge.filebot.util.prefs.FilePreferencesFactory "-Dnet.sourceforge.tuned.prefs.file=%~dp0prefs.properties" -jar "%~dp0FileBot.jar" %*

View File

@ -6,4 +6,4 @@ dir_bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# force JVM language and encoding settings
export LANG=en_US.utf8
java -Dunixfs=false -DuseGVFS=false -DuseExtendedFileAttributes=false -DuseCreationDate=false -Dfile.encoding=UTF-8 -Djava.net.useSystemProxies=false -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Djna.nosys=true -Dapplication.deployment=portable -Dapplication.analytics=true -Dapplication.warmup=false -Dnet.sourceforge.filebot.AcoustID.fpcalc=fpcalc "-Dapplication.dir=$dir_bin" "-Djava.io.tmpdir=$dir_bin/temp" "-Duser.home=$dir_bin" "-Djna.library.path=$dir_bin" "-Djava.library.path=$dir_bin" -Djava.util.prefs.PreferencesFactory=net.sourceforge.tuned.prefs.FilePreferencesFactory "-Dnet.sourceforge.tuned.prefs.file=$dir_bin/prefs.properties" -jar "$dir_bin/FileBot.jar" "$@"
java -Dunixfs=false -DuseGVFS=false -DuseExtendedFileAttributes=false -DuseCreationDate=false -Dfile.encoding=UTF-8 -Djava.net.useSystemProxies=false -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Djna.nosys=true -Dapplication.deployment=portable -Dapplication.analytics=true -Dapplication.warmup=false -Dnet.sourceforge.filebot.AcoustID.fpcalc=fpcalc "-Dapplication.dir=$dir_bin" "-Djava.io.tmpdir=$dir_bin/temp" "-Duser.home=$dir_bin" "-Djna.library.path=$dir_bin" "-Djava.library.path=$dir_bin" -Djava.util.prefs.PreferencesFactory=net.sourceforge.filebot.util.prefs.FilePreferencesFactory "-Dnet.sourceforge.tuned.prefs.file=$dir_bin/prefs.properties" -jar "$dir_bin/FileBot.jar" "$@"

View File

@ -4,8 +4,8 @@ import static java.awt.GraphicsEnvironment.*;
import static java.util.regex.Pattern.*;
import static javax.swing.JOptionPane.*;
import static net.sourceforge.filebot.Settings.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Desktop;
import java.awt.Dialog.ModalityType;
@ -59,9 +59,9 @@ import net.sourceforge.filebot.ui.MainFrame;
import net.sourceforge.filebot.ui.PanelBuilder;
import net.sourceforge.filebot.ui.SinglePanelFrame;
import net.sourceforge.filebot.web.CachedResource;
import net.sourceforge.tuned.ByteBufferInputStream;
import net.sourceforge.tuned.PreferencesMap.PreferencesEntry;
import net.sourceforge.tuned.TeePrintStream;
import net.sourceforge.filebot.util.ByteBufferInputStream;
import net.sourceforge.filebot.util.PreferencesMap.PreferencesEntry;
import net.sourceforge.filebot.util.TeePrintStream;
import org.w3c.dom.NodeList;

View File

@ -1,7 +1,7 @@
package net.sourceforge.filebot;
import static java.util.Collections.*;
import static net.sourceforge.tuned.XPathUtilities.*;
import static net.sourceforge.filebot.util.XPathUtilities.*;
import java.util.ArrayList;
import java.util.HashMap;
@ -11,7 +11,7 @@ import java.util.Map.Entry;
import javax.xml.parsers.DocumentBuilderFactory;
import net.sourceforge.tuned.FileUtilities.ExtensionFileFilter;
import net.sourceforge.filebot.util.FileUtilities.ExtensionFileFilter;
import org.w3c.dom.Document;
import org.w3c.dom.Node;

View File

@ -3,7 +3,7 @@ package net.sourceforge.filebot;
import static java.util.Collections.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.io.File;
import java.io.IOException;

View File

@ -1,6 +1,6 @@
package net.sourceforge.filebot;
import static net.sourceforge.tuned.StringUtilities.*;
import static net.sourceforge.filebot.util.StringUtilities.*;
import java.awt.GraphicsEnvironment;
import java.io.File;
@ -9,11 +9,11 @@ import java.util.ResourceBundle;
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;
import net.sourceforge.tuned.ExceptionUtilities;
import net.sourceforge.tuned.PreferencesList;
import net.sourceforge.tuned.PreferencesMap;
import net.sourceforge.tuned.PreferencesMap.PreferencesEntry;
import net.sourceforge.tuned.PreferencesMap.StringAdapter;
import net.sourceforge.filebot.util.ExceptionUtilities;
import net.sourceforge.filebot.util.PreferencesList;
import net.sourceforge.filebot.util.PreferencesMap;
import net.sourceforge.filebot.util.PreferencesMap.PreferencesEntry;
import net.sourceforge.filebot.util.PreferencesMap.StringAdapter;
public final class Settings {

View File

@ -3,7 +3,7 @@ package net.sourceforge.filebot;
import java.io.File;
import java.io.IOException;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.filebot.util.FileUtilities;
public enum StandardRenameAction implements RenameAction {

View File

@ -23,7 +23,7 @@ import net.sf.sevenzipjbinding.SevenZipException;
import net.sourceforge.filebot.MediaTypes;
import net.sourceforge.filebot.vfs.FileInfo;
import net.sourceforge.filebot.vfs.SimpleFileInfo;
import net.sourceforge.tuned.FileUtilities.ExtensionFileFilter;
import net.sourceforge.filebot.util.FileUtilities.ExtensionFileFilter;
public class Archive implements Closeable {

View File

@ -2,7 +2,7 @@ package net.sourceforge.filebot.cli;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.io.File;
import java.util.ArrayList;

View File

@ -2,8 +2,8 @@ package net.sourceforge.filebot.cli;
import static net.sourceforge.filebot.Settings.*;
import static net.sourceforge.filebot.cli.CLILogging.*;
import static net.sourceforge.tuned.ExceptionUtilities.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.ExceptionUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.io.File;
import java.io.FileInputStream;

View File

@ -10,7 +10,7 @@ import static net.sourceforge.filebot.cli.CLILogging.*;
import static net.sourceforge.filebot.hash.VerificationUtilities.*;
import static net.sourceforge.filebot.media.MediaDetection.*;
import static net.sourceforge.filebot.subtitle.SubtitleUtilities.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.io.File;
import java.io.FileFilter;
@ -75,7 +75,7 @@ import net.sourceforge.filebot.web.SortOrder;
import net.sourceforge.filebot.web.SubtitleDescriptor;
import net.sourceforge.filebot.web.SubtitleProvider;
import net.sourceforge.filebot.web.VideoHashSubtitleService;
import net.sourceforge.tuned.FileUtilities.ParentFilter;
import net.sourceforge.filebot.util.FileUtilities.ParentFilter;
public class CmdlineOperations implements CmdlineInterface {

View File

@ -2,7 +2,7 @@ package net.sourceforge.filebot.cli;
import static java.nio.file.StandardWatchEventKinds.*;
import static java.util.Collections.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.io.Closeable;
import java.io.File;
@ -24,8 +24,8 @@ import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.sourceforge.tuned.DefaultThreadFactory;
import net.sourceforge.tuned.Timer;
import net.sourceforge.filebot.util.DefaultThreadFactory;
import net.sourceforge.filebot.util.Timer;
public abstract class FolderWatchService implements Closeable {

View File

@ -1,6 +1,6 @@
package net.sourceforge.filebot.cli;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.BorderLayout;
import java.awt.Color;
@ -39,7 +39,7 @@ import net.sourceforge.filebot.Analytics;
import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.filebot.Settings;
import net.sourceforge.filebot.cli.ArgumentProcessor.DefaultScriptProvider;
import net.sourceforge.tuned.TeePrintStream;
import net.sourceforge.filebot.util.TeePrintStream;
import org.fife.ui.rsyntaxtextarea.FileLocation;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;

View File

@ -36,7 +36,7 @@ List.metaClass.eachMediaFolder = { c -> delegate.findResults{ it.getMediaFolders
// File utility methods
import static net.sourceforge.tuned.FileUtilities.*
import static net.sourceforge.filebot.util.FileUtilities.*
File.metaClass.getNameWithoutExtension = { getNameWithoutExtension(delegate.getName()) }
File.metaClass.getPathWithoutExtension = { new File(delegate.getParentFile(), getNameWithoutExtension(delegate.getName())).getPath() }

View File

@ -9,7 +9,7 @@ import java.util.TreeMap;
import javax.script.Bindings;
import net.sourceforge.tuned.ExceptionUtilities;
import net.sourceforge.filebot.util.ExceptionUtilities;
public class ExpressionBindings extends AbstractMap<String, Object> implements Bindings {

View File

@ -2,8 +2,8 @@
package net.sourceforge.filebot.format;
import static net.sourceforge.tuned.ExceptionUtilities.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.ExceptionUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import groovy.lang.GroovyRuntimeException;
import groovy.lang.MissingPropertyException;

View File

@ -1,5 +1,5 @@
import static net.sourceforge.tuned.FileUtilities.*
import static net.sourceforge.filebot.util.FileUtilities.*
import java.util.regex.Pattern
@ -240,8 +240,8 @@ Object.metaClass.match = { Map cases ->
* Web and File IO helpers
*/
import net.sourceforge.filebot.web.WebRequest
import net.sourceforge.tuned.FileUtilities
import net.sourceforge.tuned.XPathUtilities
import net.sourceforge.filebot.util.FileUtilities
import net.sourceforge.filebot.util.XPathUtilities
URL.metaClass.getText = { FileUtilities.readAll(WebRequest.getReader(delegate.openConnection())) }
URL.metaClass.getHtml = { new XmlParser(new org.cyberneko.html.parsers.SAXParser()).parseText(delegate.getText()) }

View File

@ -8,8 +8,8 @@ import static net.sourceforge.filebot.hash.VerificationUtilities.*;
import static net.sourceforge.filebot.media.MediaDetection.*;
import static net.sourceforge.filebot.similarity.Normalization.*;
import static net.sourceforge.filebot.web.EpisodeFormat.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.tuned.StringUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import static net.sourceforge.filebot.util.StringUtilities.*;
import java.io.File;
import java.io.IOException;
@ -47,8 +47,8 @@ import net.sourceforge.filebot.web.MultiEpisode;
import net.sourceforge.filebot.web.SearchResult;
import net.sourceforge.filebot.web.SortOrder;
import net.sourceforge.filebot.web.TheTVDBSearchResult;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.tuned.FileUtilities.ExtensionFileFilter;
import net.sourceforge.filebot.util.FileUtilities;
import net.sourceforge.filebot.util.FileUtilities.ExtensionFileFilter;
import com.cedarsoftware.util.io.JsonWriter;

View File

@ -19,7 +19,7 @@ import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptException;
import net.sourceforge.tuned.ExceptionUtilities;
import net.sourceforge.filebot.util.ExceptionUtilities;
public class SecureCompiledScript extends CompiledScript {

View File

@ -5,7 +5,7 @@ package net.sourceforge.filebot.hash;
import java.util.zip.CRC32;
import net.sourceforge.filebot.MediaTypes;
import net.sourceforge.tuned.FileUtilities.ExtensionFileFilter;
import net.sourceforge.filebot.util.FileUtilities.ExtensionFileFilter;
public enum HashType {

View File

@ -2,7 +2,7 @@
package net.sourceforge.filebot.hash;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.io.File;
import java.io.FileInputStream;

View File

@ -6,7 +6,7 @@ import static net.sourceforge.filebot.MediaTypes.*;
import static net.sourceforge.filebot.Settings.*;
import static net.sourceforge.filebot.similarity.CommonSequenceMatcher.*;
import static net.sourceforge.filebot.similarity.Normalization.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.io.File;
import java.io.FileFilter;

View File

@ -6,8 +6,8 @@ import static java.util.Collections.*;
import static java.util.ResourceBundle.*;
import static java.util.regex.Pattern.*;
import static net.sourceforge.filebot.similarity.Normalization.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.tuned.StringUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import static net.sourceforge.filebot.util.StringUtilities.*;
import java.io.File;
import java.io.FileFilter;
@ -35,8 +35,8 @@ import net.sourceforge.filebot.web.AnidbSearchResult;
import net.sourceforge.filebot.web.CachedResource;
import net.sourceforge.filebot.web.Movie;
import net.sourceforge.filebot.web.TheTVDBSearchResult;
import net.sourceforge.tuned.ByteBufferInputStream;
import net.sourceforge.tuned.FileUtilities.RegexFileFilter;
import net.sourceforge.filebot.util.ByteBufferInputStream;
import net.sourceforge.filebot.util.FileUtilities.RegexFileFilter;
import org.tukaani.xz.XZInputStream;

View File

@ -5,8 +5,8 @@ import static java.util.Collections.*;
import static java.util.regex.Pattern.*;
import static net.sourceforge.filebot.Settings.*;
import static net.sourceforge.filebot.similarity.Normalization.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.tuned.StringUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import static net.sourceforge.filebot.util.StringUtilities.*;
import java.io.File;
import java.io.IOException;

View File

@ -2,7 +2,7 @@
package net.sourceforge.filebot.similarity;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.io.File;

View File

@ -2,7 +2,7 @@ package net.sourceforge.filebot.similarity;
import static java.util.Collections.*;
import static java.util.regex.Pattern.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.io.File;
import java.util.ArrayList;

View File

@ -4,7 +4,7 @@ import static java.util.Collections.*;
import static java.util.regex.Pattern.*;
import static net.sourceforge.filebot.similarity.CommonSequenceMatcher.*;
import static net.sourceforge.filebot.similarity.Normalization.*;
import static net.sourceforge.tuned.StringUtilities.*;
import static net.sourceforge.filebot.util.StringUtilities.*;
import java.io.File;
import java.text.CollationKey;
@ -25,7 +25,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sourceforge.filebot.similarity.SeasonEpisodeMatcher.SxE;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.filebot.util.FileUtilities;
public class SeriesNameMatcher {

View File

@ -2,7 +2,7 @@
package net.sourceforge.filebot.subtitle;
import static net.sourceforge.tuned.StringUtilities.*;
import static net.sourceforge.filebot.util.StringUtilities.*;
import java.util.ArrayList;
import java.util.List;

View File

@ -2,7 +2,7 @@
package net.sourceforge.filebot.subtitle;
import static net.sourceforge.tuned.StringUtilities.*;
import static net.sourceforge.filebot.util.StringUtilities.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

View File

@ -3,7 +3,7 @@ package net.sourceforge.filebot.subtitle;
import static java.util.regex.Pattern.*;
import static net.sourceforge.tuned.StringUtilities.*;
import static net.sourceforge.filebot.util.StringUtilities.*;
import java.text.DateFormat;
import java.text.ParseException;

View File

@ -3,7 +3,7 @@ package net.sourceforge.filebot.subtitle;
import net.sourceforge.filebot.MediaTypes;
import net.sourceforge.tuned.FileUtilities.ExtensionFileFilter;
import net.sourceforge.filebot.util.FileUtilities.ExtensionFileFilter;
public enum SubtitleFormat {

View File

@ -1,6 +1,6 @@
package net.sourceforge.filebot.subtitle;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.io.File;

View File

@ -6,7 +6,7 @@ import static net.sourceforge.filebot.MediaTypes.*;
import static net.sourceforge.filebot.media.MediaDetection.*;
import static net.sourceforge.filebot.similarity.EpisodeMetrics.*;
import static net.sourceforge.filebot.similarity.Normalization.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.io.File;
import java.io.IOException;

View File

@ -2,7 +2,7 @@ package net.sourceforge.filebot.ui;
import static javax.swing.ScrollPaneConstants.*;
import static net.sourceforge.filebot.ui.NotificationLogging.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Dimension;
import java.awt.Window;
@ -35,9 +35,9 @@ import net.miginfocom.swing.MigLayout;
import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.filebot.Settings;
import net.sourceforge.filebot.web.SearchResult;
import net.sourceforge.tuned.ExceptionUtilities;
import net.sourceforge.tuned.ui.LabelProvider;
import net.sourceforge.tuned.ui.SelectButton;
import net.sourceforge.filebot.util.ExceptionUtilities;
import net.sourceforge.filebot.util.ui.LabelProvider;
import net.sourceforge.filebot.util.ui.SelectButton;
import ca.odell.glazedlists.BasicEventList;
import ca.odell.glazedlists.matchers.TextMatcherEditor;
import ca.odell.glazedlists.swing.AutoCompleteSupport;

View File

@ -18,8 +18,8 @@ import javax.swing.border.TitledBorder;
import net.sourceforge.filebot.ui.transfer.DefaultTransferHandler;
import net.sourceforge.filebot.ui.transfer.TextFileExportHandler;
import net.sourceforge.filebot.ui.transfer.TransferablePolicy;
import net.sourceforge.tuned.ui.DefaultFancyListCellRenderer;
import net.sourceforge.tuned.ui.TunedUtilities;
import net.sourceforge.filebot.util.ui.DefaultFancyListCellRenderer;
import net.sourceforge.filebot.util.ui.TunedUtilities;
import ca.odell.glazedlists.BasicEventList;
import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.swing.EventListModel;

View File

@ -13,8 +13,8 @@ import javax.swing.SwingConstants;
import net.miginfocom.swing.MigLayout;
import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.tuned.ui.ProgressIndicator;
import net.sourceforge.tuned.ui.TunedUtilities;
import net.sourceforge.filebot.util.ui.ProgressIndicator;
import net.sourceforge.filebot.util.ui.TunedUtilities;
public class FileBotTabComponent extends JComponent {

View File

@ -16,9 +16,9 @@ import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.tuned.ui.GradientStyle;
import net.sourceforge.tuned.ui.notification.SeparatorBorder;
import net.sourceforge.tuned.ui.notification.SeparatorBorder.Position;
import net.sourceforge.filebot.util.ui.GradientStyle;
import net.sourceforge.filebot.util.ui.notification.SeparatorBorder;
import net.sourceforge.filebot.util.ui.notification.SeparatorBorder.Position;
class HeaderPanel extends JComponent {

View File

@ -15,7 +15,7 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants;
import net.miginfocom.swing.MigLayout;
import net.sourceforge.tuned.ui.LinkButton;
import net.sourceforge.filebot.util.ui.LinkButton;
public class HistoryPanel extends JPanel {

View File

@ -12,7 +12,7 @@ import javax.swing.border.EmptyBorder;
import net.sourceforge.filebot.Language;
import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.tuned.ui.DashedSeparator;
import net.sourceforge.filebot.util.ui.DashedSeparator;
public class LanguageComboBoxCellRenderer implements ListCellRenderer {

View File

@ -51,10 +51,10 @@ import net.sourceforge.filebot.ui.list.ListPanelBuilder;
import net.sourceforge.filebot.ui.rename.RenamePanelBuilder;
import net.sourceforge.filebot.ui.sfv.SfvPanelBuilder;
import net.sourceforge.filebot.ui.subtitle.SubtitlePanelBuilder;
import net.sourceforge.tuned.PreferencesMap.PreferencesEntry;
import net.sourceforge.tuned.ui.DefaultFancyListCellRenderer;
import net.sourceforge.tuned.ui.ShadowBorder;
import net.sourceforge.tuned.ui.TunedUtilities;
import net.sourceforge.filebot.util.PreferencesMap.PreferencesEntry;
import net.sourceforge.filebot.util.ui.DefaultFancyListCellRenderer;
import net.sourceforge.filebot.util.ui.ShadowBorder;
import net.sourceforge.filebot.util.ui.TunedUtilities;
public class MainFrame extends JFrame {

View File

@ -3,7 +3,7 @@ package net.sourceforge.filebot.ui;
import static net.sourceforge.filebot.Settings.*;
import static net.sourceforge.tuned.ui.notification.Direction.*;
import static net.sourceforge.filebot.util.ui.notification.Direction.*;
import java.awt.GraphicsEnvironment;
import java.util.logging.ConsoleHandler;
@ -16,10 +16,10 @@ import javax.swing.Icon;
import javax.swing.SwingUtilities;
import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.tuned.ExceptionUtilities;
import net.sourceforge.tuned.ui.notification.MessageNotification;
import net.sourceforge.tuned.ui.notification.NotificationManager;
import net.sourceforge.tuned.ui.notification.QueueNotificationLayout;
import net.sourceforge.filebot.util.ExceptionUtilities;
import net.sourceforge.filebot.util.ui.notification.MessageNotification;
import net.sourceforge.filebot.util.ui.notification.NotificationManager;
import net.sourceforge.filebot.util.ui.notification.QueueNotificationLayout;
public class NotificationLogging extends Handler {

View File

@ -29,8 +29,8 @@ import javax.swing.text.JTextComponent;
import net.miginfocom.swing.MigLayout;
import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.tuned.ui.SelectButton;
import net.sourceforge.tuned.ui.TunedUtilities;
import net.sourceforge.filebot.util.ui.SelectButton;
import net.sourceforge.filebot.util.ui.TunedUtilities;
public class SelectButtonTextField<T> extends JComponent {

View File

@ -2,7 +2,7 @@
package net.sourceforge.filebot.ui;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Component;
import java.awt.Dimension;
@ -26,8 +26,8 @@ import javax.swing.SwingUtilities;
import net.miginfocom.swing.MigLayout;
import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.tuned.ui.DefaultFancyListCellRenderer;
import net.sourceforge.tuned.ui.TunedUtilities;
import net.sourceforge.filebot.util.ui.DefaultFancyListCellRenderer;
import net.sourceforge.filebot.util.ui.TunedUtilities;
public class SelectDialog<T> extends JDialog {

View File

@ -14,7 +14,7 @@ import net.miginfocom.swing.MigLayout;
import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.filebot.ui.transfer.TransferablePolicy;
import net.sourceforge.filebot.ui.transfer.TransferablePolicy.TransferAction;
import net.sourceforge.tuned.ExceptionUtilities;
import net.sourceforge.filebot.util.ExceptionUtilities;
public class SinglePanelFrame extends JFrame {

View File

@ -22,7 +22,7 @@ import net.sourceforge.filebot.ui.analyze.FileTree.FolderNode;
import net.sourceforge.filebot.web.Episode;
import net.sourceforge.filebot.web.Movie;
import net.sourceforge.filebot.web.SearchResult;
import net.sourceforge.tuned.ui.LoadingOverlayPane;
import net.sourceforge.filebot.util.ui.LoadingOverlayPane;
class AttributeTool extends Tool<TableModel> {

View File

@ -1,9 +1,9 @@
package net.sourceforge.filebot.ui.analyze;
import static net.sourceforge.filebot.ui.NotificationLogging.*;
import static net.sourceforge.tuned.ExceptionUtilities.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.ExceptionUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Color;
import java.awt.Window;
@ -37,13 +37,13 @@ import net.sourceforge.filebot.archive.Archive;
import net.sourceforge.filebot.archive.FileMapper;
import net.sourceforge.filebot.ui.analyze.FileTree.FolderNode;
import net.sourceforge.filebot.vfs.FileInfo;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.tuned.ui.GradientStyle;
import net.sourceforge.tuned.ui.LoadingOverlayPane;
import net.sourceforge.tuned.ui.ProgressDialog;
import net.sourceforge.tuned.ui.ProgressDialog.Cancellable;
import net.sourceforge.tuned.ui.SwingWorkerPropertyChangeAdapter;
import net.sourceforge.tuned.ui.notification.SeparatorBorder;
import net.sourceforge.filebot.util.FileUtilities;
import net.sourceforge.filebot.util.ui.GradientStyle;
import net.sourceforge.filebot.util.ui.LoadingOverlayPane;
import net.sourceforge.filebot.util.ui.ProgressDialog;
import net.sourceforge.filebot.util.ui.ProgressDialog.Cancellable;
import net.sourceforge.filebot.util.ui.SwingWorkerPropertyChangeAdapter;
import net.sourceforge.filebot.util.ui.notification.SeparatorBorder;
class ExtractTool extends Tool<TableModel> {

View File

@ -32,9 +32,9 @@ import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.tuned.ExceptionUtilities;
import net.sourceforge.tuned.FilterIterator;
import net.sourceforge.tuned.TreeIterator;
import net.sourceforge.filebot.util.ExceptionUtilities;
import net.sourceforge.filebot.util.FilterIterator;
import net.sourceforge.filebot.util.TreeIterator;
public class FileTree extends JTree {

View File

@ -8,8 +8,8 @@ import javax.swing.JTree;
import javax.swing.tree.TreeNode;
import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.tuned.ui.FancyTreeCellRenderer;
import net.sourceforge.tuned.ui.GradientStyle;
import net.sourceforge.filebot.util.ui.FancyTreeCellRenderer;
import net.sourceforge.filebot.util.ui.GradientStyle;
public class FileTreeCellRenderer extends FancyTreeCellRenderer {

View File

@ -20,8 +20,8 @@ import net.miginfocom.swing.MigLayout;
import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.filebot.ui.transfer.DefaultTransferHandler;
import net.sourceforge.filebot.ui.transfer.LoadAction;
import net.sourceforge.tuned.ui.LoadingOverlayPane;
import net.sourceforge.tuned.ui.TunedUtilities;
import net.sourceforge.filebot.util.ui.LoadingOverlayPane;
import net.sourceforge.filebot.util.ui.TunedUtilities;
class FileTreePanel extends JComponent {

View File

@ -12,9 +12,9 @@ import net.sourceforge.filebot.ui.analyze.FileTree.AbstractTreeNode;
import net.sourceforge.filebot.ui.analyze.FileTree.FileNode;
import net.sourceforge.filebot.ui.analyze.FileTree.FolderNode;
import net.sourceforge.filebot.ui.transfer.BackgroundFileTransferablePolicy;
import net.sourceforge.tuned.ExceptionUtilities;
import net.sourceforge.tuned.FastFile;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.filebot.util.ExceptionUtilities;
import net.sourceforge.filebot.util.FastFile;
import net.sourceforge.filebot.util.FileUtilities;
class FileTreeTransferablePolicy extends BackgroundFileTransferablePolicy<AbstractTreeNode> {

View File

@ -22,10 +22,10 @@ import javax.swing.tree.TreeModel;
import net.miginfocom.swing.MigLayout;
import net.sourceforge.filebot.ui.analyze.FileTree.FolderNode;
import net.sourceforge.filebot.ui.transfer.DefaultTransferHandler;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.tuned.ui.GradientStyle;
import net.sourceforge.tuned.ui.LoadingOverlayPane;
import net.sourceforge.tuned.ui.notification.SeparatorBorder;
import net.sourceforge.filebot.util.FileUtilities;
import net.sourceforge.filebot.util.ui.GradientStyle;
import net.sourceforge.filebot.util.ui.LoadingOverlayPane;
import net.sourceforge.filebot.util.ui.notification.SeparatorBorder;
class SplitTool extends Tool<TreeModel> implements ChangeListener {

View File

@ -13,9 +13,9 @@ import javax.swing.SwingWorker;
import net.sourceforge.filebot.ui.analyze.FileTree.FileNode;
import net.sourceforge.filebot.ui.analyze.FileTree.FolderNode;
import net.sourceforge.tuned.ExceptionUtilities;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.tuned.ui.LoadingOverlayPane;
import net.sourceforge.filebot.util.ExceptionUtilities;
import net.sourceforge.filebot.util.FileUtilities;
import net.sourceforge.filebot.util.ui.LoadingOverlayPane;
abstract class Tool<M> extends JComponent {

View File

@ -19,8 +19,8 @@ import javax.swing.tree.TreeModel;
import net.miginfocom.swing.MigLayout;
import net.sourceforge.filebot.ui.analyze.FileTree.FolderNode;
import net.sourceforge.filebot.ui.transfer.DefaultTransferHandler;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.tuned.ui.LoadingOverlayPane;
import net.sourceforge.filebot.util.FileUtilities;
import net.sourceforge.filebot.util.ui.LoadingOverlayPane;
class TypeTool extends Tool<TreeModel> {

View File

@ -47,11 +47,11 @@ import net.sourceforge.filebot.web.EpisodeListProvider;
import net.sourceforge.filebot.web.SearchResult;
import net.sourceforge.filebot.web.SeasonOutOfBoundsException;
import net.sourceforge.filebot.web.SortOrder;
import net.sourceforge.tuned.StringUtilities;
import net.sourceforge.tuned.ui.LabelProvider;
import net.sourceforge.tuned.ui.SelectButton;
import net.sourceforge.tuned.ui.SimpleLabelProvider;
import net.sourceforge.tuned.ui.TunedUtilities;
import net.sourceforge.filebot.util.StringUtilities;
import net.sourceforge.filebot.util.ui.LabelProvider;
import net.sourceforge.filebot.util.ui.SelectButton;
import net.sourceforge.filebot.util.ui.SimpleLabelProvider;
import net.sourceforge.filebot.util.ui.TunedUtilities;
public class EpisodeListPanel extends AbstractSearchPanel<EpisodeListProvider, Episode> {

View File

@ -2,7 +2,7 @@
package net.sourceforge.filebot.ui.list;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.io.File;
import java.io.IOException;
@ -13,7 +13,7 @@ import net.sourceforge.filebot.MediaTypes;
import net.sourceforge.filebot.torrent.Torrent;
import net.sourceforge.filebot.ui.FileBotList;
import net.sourceforge.filebot.ui.transfer.FileTransferablePolicy;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.filebot.util.FileUtilities;
class FileListTransferablePolicy extends FileTransferablePolicy {

View File

@ -37,8 +37,8 @@ import net.sourceforge.filebot.ui.FileBotList;
import net.sourceforge.filebot.ui.FileBotListExportHandler;
import net.sourceforge.filebot.ui.transfer.LoadAction;
import net.sourceforge.filebot.ui.transfer.SaveAction;
import net.sourceforge.tuned.ExceptionUtilities;
import net.sourceforge.tuned.ui.TunedUtilities;
import net.sourceforge.filebot.util.ExceptionUtilities;
import net.sourceforge.filebot.util.ui.TunedUtilities;
public class ListPanel extends JComponent {

View File

@ -1,7 +1,7 @@
package net.sourceforge.filebot.ui.rename;
import static net.sourceforge.filebot.MediaTypes.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.awt.Component;
import java.io.File;

View File

@ -3,7 +3,7 @@ package net.sourceforge.filebot.ui.rename;
import static net.sourceforge.filebot.MediaTypes.*;
import static net.sourceforge.filebot.Settings.*;
import static net.sourceforge.filebot.ui.NotificationLogging.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Color;
import java.awt.Component;
@ -61,8 +61,8 @@ import net.sourceforge.filebot.media.MetaAttributes;
import net.sourceforge.filebot.mediainfo.MediaInfo;
import net.sourceforge.filebot.mediainfo.MediaInfo.StreamKind;
import net.sourceforge.filebot.mediainfo.MediaInfoException;
import net.sourceforge.tuned.DefaultThreadFactory;
import net.sourceforge.tuned.ui.LazyDocumentListener;
import net.sourceforge.filebot.util.DefaultThreadFactory;
import net.sourceforge.filebot.util.ui.LazyDocumentListener;
class BindingDialog extends JDialog {

View File

@ -17,7 +17,7 @@ import javax.swing.text.BadLocationException;
import javax.swing.text.Highlighter;
import javax.swing.text.JTextComponent;
import net.sourceforge.tuned.ui.GradientStyle;
import net.sourceforge.filebot.util.ui.GradientStyle;
class CharacterHighlightPainter implements Highlighter.HighlightPainter {

View File

@ -4,9 +4,9 @@ import static java.util.Collections.*;
import static net.sourceforge.filebot.MediaTypes.*;
import static net.sourceforge.filebot.Settings.*;
import static net.sourceforge.filebot.media.MediaDetection.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.tuned.StringUtilities.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import static net.sourceforge.filebot.util.StringUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Component;
import java.awt.Dimension;

View File

@ -7,7 +7,7 @@ import java.util.Map;
import net.sourceforge.filebot.similarity.Match;
import net.sourceforge.filebot.vfs.FileInfo;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.filebot.util.FileUtilities;
class FileNameFormatter implements MatchFormatter {

View File

@ -3,7 +3,7 @@ package net.sourceforge.filebot.ui.rename;
import static java.util.Arrays.*;
import static net.sourceforge.filebot.MediaTypes.*;
import static net.sourceforge.filebot.ui.transfer.FileTransferable.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.awt.datatransfer.Transferable;
import java.io.File;
@ -17,7 +17,7 @@ import java.util.logging.Logger;
import net.sourceforge.filebot.media.MediaDetection;
import net.sourceforge.filebot.ui.transfer.FileTransferablePolicy;
import net.sourceforge.tuned.FastFile;
import net.sourceforge.filebot.util.FastFile;
class FilesListTransferablePolicy extends FileTransferablePolicy {

View File

@ -3,8 +3,8 @@ package net.sourceforge.filebot.ui.rename;
import static java.awt.Font.*;
import static javax.swing.BorderFactory.*;
import static net.sourceforge.filebot.ui.NotificationLogging.*;
import static net.sourceforge.tuned.ExceptionUtilities.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.ExceptionUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Color;
import java.awt.Component;
@ -67,17 +67,17 @@ import net.sourceforge.filebot.format.MediaBindingBean;
import net.sourceforge.filebot.web.AudioTrackFormat;
import net.sourceforge.filebot.web.EpisodeFormat;
import net.sourceforge.filebot.web.MovieFormat;
import net.sourceforge.tuned.DefaultThreadFactory;
import net.sourceforge.tuned.ExceptionUtilities;
import net.sourceforge.tuned.PreferencesList;
import net.sourceforge.tuned.PreferencesMap.PreferencesEntry;
import net.sourceforge.tuned.ui.GradientStyle;
import net.sourceforge.tuned.ui.LazyDocumentListener;
import net.sourceforge.tuned.ui.LinkButton;
import net.sourceforge.tuned.ui.ProgressIndicator;
import net.sourceforge.tuned.ui.TunedUtilities;
import net.sourceforge.tuned.ui.notification.SeparatorBorder;
import net.sourceforge.tuned.ui.notification.SeparatorBorder.Position;
import net.sourceforge.filebot.util.DefaultThreadFactory;
import net.sourceforge.filebot.util.ExceptionUtilities;
import net.sourceforge.filebot.util.PreferencesList;
import net.sourceforge.filebot.util.PreferencesMap.PreferencesEntry;
import net.sourceforge.filebot.util.ui.GradientStyle;
import net.sourceforge.filebot.util.ui.LazyDocumentListener;
import net.sourceforge.filebot.util.ui.LinkButton;
import net.sourceforge.filebot.util.ui.ProgressIndicator;
import net.sourceforge.filebot.util.ui.TunedUtilities;
import net.sourceforge.filebot.util.ui.notification.SeparatorBorder;
import net.sourceforge.filebot.util.ui.notification.SeparatorBorder.Position;
import org.fife.ui.rsyntaxtextarea.RSyntaxDocument;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;

View File

@ -19,8 +19,8 @@ import javax.swing.text.BadLocationException;
import javax.swing.text.Highlighter;
import javax.swing.text.JTextComponent;
import net.sourceforge.tuned.ui.AbstractFancyListCellRenderer;
import net.sourceforge.tuned.ui.TunedUtilities;
import net.sourceforge.filebot.util.ui.AbstractFancyListCellRenderer;
import net.sourceforge.filebot.util.ui.TunedUtilities;
class HighlightListCellRenderer extends AbstractFancyListCellRenderer {

View File

@ -4,7 +4,7 @@ import static java.awt.Font.*;
import static java.util.Collections.*;
import static java.util.regex.Pattern.*;
import static javax.swing.JOptionPane.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.awt.Color;
import java.awt.Component;
@ -73,12 +73,12 @@ import net.sourceforge.filebot.ui.transfer.FileTransferablePolicy;
import net.sourceforge.filebot.ui.transfer.LoadAction;
import net.sourceforge.filebot.ui.transfer.SaveAction;
import net.sourceforge.filebot.ui.transfer.TransferablePolicy.TransferAction;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.tuned.FileUtilities.ExtensionFileFilter;
import net.sourceforge.tuned.ui.GradientStyle;
import net.sourceforge.tuned.ui.LazyDocumentListener;
import net.sourceforge.tuned.ui.notification.SeparatorBorder;
import net.sourceforge.tuned.ui.notification.SeparatorBorder.Position;
import net.sourceforge.filebot.util.FileUtilities;
import net.sourceforge.filebot.util.FileUtilities.ExtensionFileFilter;
import net.sourceforge.filebot.util.ui.GradientStyle;
import net.sourceforge.filebot.util.ui.LazyDocumentListener;
import net.sourceforge.filebot.util.ui.notification.SeparatorBorder;
import net.sourceforge.filebot.util.ui.notification.SeparatorBorder.Position;
class HistoryDialog extends JDialog {

View File

@ -1,6 +1,6 @@
package net.sourceforge.filebot.ui.rename;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Cursor;
import java.awt.Window;
@ -22,9 +22,9 @@ import net.sourceforge.filebot.similarity.EpisodeMetrics;
import net.sourceforge.filebot.similarity.Match;
import net.sourceforge.filebot.similarity.Matcher;
import net.sourceforge.filebot.similarity.SimilarityMetric;
import net.sourceforge.tuned.ui.ProgressDialog;
import net.sourceforge.tuned.ui.ProgressDialog.Cancellable;
import net.sourceforge.tuned.ui.SwingWorkerPropertyChangeAdapter;
import net.sourceforge.filebot.util.ui.ProgressDialog;
import net.sourceforge.filebot.util.ui.ProgressDialog.Cancellable;
import net.sourceforge.filebot.util.ui.SwingWorkerPropertyChangeAdapter;
class MatchAction extends AbstractAction {

View File

@ -2,7 +2,7 @@
package net.sourceforge.filebot.ui.rename;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.util.Formatter;
import java.util.Map;

View File

@ -7,8 +7,8 @@ import static net.sourceforge.filebot.Settings.*;
import static net.sourceforge.filebot.media.MediaDetection.*;
import static net.sourceforge.filebot.similarity.CommonSequenceMatcher.*;
import static net.sourceforge.filebot.similarity.Normalization.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Component;
import java.awt.Dimension;
@ -54,7 +54,7 @@ import net.sourceforge.filebot.web.Movie;
import net.sourceforge.filebot.web.MovieIdentificationService;
import net.sourceforge.filebot.web.MoviePart;
import net.sourceforge.filebot.web.SortOrder;
import net.sourceforge.tuned.FileUtilities.ParentFilter;
import net.sourceforge.filebot.util.FileUtilities.ParentFilter;
class MovieHashMatcher implements AutoCompleteMatcher {

View File

@ -3,7 +3,7 @@ package net.sourceforge.filebot.ui.rename;
import static java.awt.datatransfer.DataFlavor.*;
import static net.sourceforge.filebot.hash.VerificationUtilities.*;
import static net.sourceforge.filebot.ui.transfer.FileTransferable.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
@ -22,7 +22,7 @@ import net.sourceforge.filebot.ui.transfer.ArrayTransferable;
import net.sourceforge.filebot.ui.transfer.FileTransferablePolicy;
import net.sourceforge.filebot.vfs.SimpleFileInfo;
import net.sourceforge.filebot.web.Episode;
import net.sourceforge.tuned.FastFile;
import net.sourceforge.filebot.util.FastFile;
class NamesListTransferablePolicy extends FileTransferablePolicy {

View File

@ -4,9 +4,9 @@ import static java.util.Collections.*;
import static javax.swing.JOptionPane.*;
import static net.sourceforge.filebot.Settings.*;
import static net.sourceforge.filebot.ui.NotificationLogging.*;
import static net.sourceforge.tuned.ExceptionUtilities.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.ExceptionUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Cursor;
import java.awt.Dimension;
@ -46,9 +46,9 @@ import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.filebot.StandardRenameAction;
import net.sourceforge.filebot.media.MediaDetection;
import net.sourceforge.filebot.similarity.Match;
import net.sourceforge.tuned.ui.ProgressDialog;
import net.sourceforge.tuned.ui.ProgressDialog.Cancellable;
import net.sourceforge.tuned.ui.SwingWorkerPropertyChangeAdapter;
import net.sourceforge.filebot.util.ui.ProgressDialog;
import net.sourceforge.filebot.util.ui.ProgressDialog.Cancellable;
import net.sourceforge.filebot.util.ui.SwingWorkerPropertyChangeAdapter;
class RenameAction extends AbstractAction {

View File

@ -1,8 +1,8 @@
package net.sourceforge.filebot.ui.rename;
import static net.sourceforge.filebot.similarity.EpisodeMetrics.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.AlphaComposite;
import java.awt.Color;
@ -28,9 +28,9 @@ import net.sourceforge.filebot.similarity.MetricMin;
import net.sourceforge.filebot.similarity.SimilarityMetric;
import net.sourceforge.filebot.ui.rename.RenameModel.FormattedFuture;
import net.sourceforge.filebot.web.Episode;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.tuned.ui.DefaultFancyListCellRenderer;
import net.sourceforge.tuned.ui.GradientStyle;
import net.sourceforge.filebot.util.FileUtilities;
import net.sourceforge.filebot.util.ui.DefaultFancyListCellRenderer;
import net.sourceforge.filebot.util.ui.GradientStyle;
class RenameListCellRenderer extends DefaultFancyListCellRenderer {

View File

@ -1,6 +1,6 @@
package net.sourceforge.filebot.ui.rename;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@ -23,8 +23,8 @@ import javax.swing.SwingWorker;
import javax.swing.SwingWorker.StateValue;
import net.sourceforge.filebot.similarity.Match;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.tuned.ui.TunedUtilities;
import net.sourceforge.filebot.util.FileUtilities;
import net.sourceforge.filebot.util.ui.TunedUtilities;
import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.TransformedList;
import ca.odell.glazedlists.event.ListEvent;

View File

@ -5,9 +5,9 @@ import static javax.swing.JOptionPane.*;
import static javax.swing.KeyStroke.*;
import static javax.swing.SwingUtilities.*;
import static net.sourceforge.filebot.ui.NotificationLogging.*;
import static net.sourceforge.tuned.ExceptionUtilities.*;
import static net.sourceforge.tuned.ui.LoadingOverlayPane.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.ExceptionUtilities.*;
import static net.sourceforge.filebot.util.ui.LoadingOverlayPane.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Component;
import java.awt.Cursor;
@ -68,9 +68,9 @@ import net.sourceforge.filebot.web.MovieFormat;
import net.sourceforge.filebot.web.MovieIdentificationService;
import net.sourceforge.filebot.web.MusicIdentificationService;
import net.sourceforge.filebot.web.SortOrder;
import net.sourceforge.tuned.PreferencesMap.PreferencesEntry;
import net.sourceforge.tuned.ui.ActionPopup;
import net.sourceforge.tuned.ui.LoadingOverlayPane;
import net.sourceforge.filebot.util.PreferencesMap.PreferencesEntry;
import net.sourceforge.filebot.util.ui.ActionPopup;
import net.sourceforge.filebot.util.ui.LoadingOverlayPane;
import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.ListSelection;
import ca.odell.glazedlists.swing.EventSelectionModel;

View File

@ -4,8 +4,8 @@ package net.sourceforge.filebot.ui.rename;
import static java.util.Collections.*;
import static net.sourceforge.filebot.Settings.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Color;
import java.awt.Component;

View File

@ -13,7 +13,7 @@ import javax.swing.SwingWorker.StateValue;
import javax.swing.event.SwingPropertyChangeSupport;
import net.sourceforge.filebot.hash.HashType;
import net.sourceforge.tuned.ExceptionUtilities;
import net.sourceforge.filebot.util.ExceptionUtilities;
class ChecksumCell {

View File

@ -3,7 +3,7 @@ package net.sourceforge.filebot.ui.sfv;
import static java.awt.Font.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Color;
import java.awt.Component;
@ -14,7 +14,7 @@ import javax.swing.SwingWorker;
import javax.swing.SwingWorker.StateValue;
import javax.swing.table.DefaultTableCellRenderer;
import net.sourceforge.tuned.ExceptionUtilities;
import net.sourceforge.filebot.util.ExceptionUtilities;
public class ChecksumCellRenderer extends DefaultTableCellRenderer {

View File

@ -15,7 +15,7 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import net.sourceforge.tuned.DefaultThreadFactory;
import net.sourceforge.filebot.util.DefaultThreadFactory;
class ChecksumComputationService {

View File

@ -12,7 +12,7 @@ import javax.swing.ListSelectionModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumn;
import net.sourceforge.tuned.ui.TunedUtilities.DragDropRowTableUI;
import net.sourceforge.filebot.util.ui.TunedUtilities.DragDropRowTableUI;
class ChecksumTable extends JTable {

View File

@ -9,7 +9,7 @@ import java.io.PrintWriter;
import net.sourceforge.filebot.hash.HashType;
import net.sourceforge.filebot.hash.VerificationFileWriter;
import net.sourceforge.filebot.ui.transfer.TextFileExportHandler;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.filebot.util.FileUtilities;
class ChecksumTableExportHandler extends TextFileExportHandler {

View File

@ -19,8 +19,8 @@ import java.util.Set;
import javax.swing.table.AbstractTableModel;
import net.sourceforge.filebot.hash.HashType;
import net.sourceforge.tuned.FastFile;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.filebot.util.FastFile;
import net.sourceforge.filebot.util.FileUtilities;
class ChecksumTableModel extends AbstractTableModel {

View File

@ -5,7 +5,7 @@ package net.sourceforge.filebot.ui.sfv;
import static java.util.Collections.*;
import static net.sourceforge.filebot.hash.VerificationUtilities.*;
import static net.sourceforge.filebot.ui.NotificationLogging.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.io.File;
import java.io.IOException;
@ -20,7 +20,7 @@ import net.sourceforge.filebot.MediaTypes;
import net.sourceforge.filebot.hash.HashType;
import net.sourceforge.filebot.hash.VerificationFileReader;
import net.sourceforge.filebot.ui.transfer.BackgroundFileTransferablePolicy;
import net.sourceforge.tuned.ExceptionUtilities;
import net.sourceforge.filebot.util.ExceptionUtilities;
class ChecksumTableTransferablePolicy extends BackgroundFileTransferablePolicy<ChecksumCell> {

View File

@ -36,8 +36,8 @@ import net.sourceforge.filebot.ui.SelectDialog;
import net.sourceforge.filebot.ui.transfer.DefaultTransferHandler;
import net.sourceforge.filebot.ui.transfer.LoadAction;
import net.sourceforge.filebot.ui.transfer.SaveAction;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.tuned.ui.TunedUtilities;
import net.sourceforge.filebot.util.FileUtilities;
import net.sourceforge.filebot.util.ui.TunedUtilities;
public class SfvPanel extends JComponent {

View File

@ -3,8 +3,8 @@ package net.sourceforge.filebot.ui.subtitle;
import static javax.swing.BorderFactory.*;
import static javax.swing.JOptionPane.*;
import static net.sourceforge.filebot.subtitle.SubtitleUtilities.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Color;
import java.awt.Component;
@ -66,10 +66,10 @@ import net.sourceforge.filebot.vfs.MemoryFile;
import net.sourceforge.filebot.web.SubtitleDescriptor;
import net.sourceforge.filebot.web.SubtitleProvider;
import net.sourceforge.filebot.web.VideoHashSubtitleService;
import net.sourceforge.tuned.ui.AbstractBean;
import net.sourceforge.tuned.ui.EmptySelectionModel;
import net.sourceforge.tuned.ui.LinkButton;
import net.sourceforge.tuned.ui.RoundBorder;
import net.sourceforge.filebot.util.ui.AbstractBean;
import net.sourceforge.filebot.util.ui.EmptySelectionModel;
import net.sourceforge.filebot.util.ui.LinkButton;
import net.sourceforge.filebot.util.ui.RoundBorder;
class SubtitleAutoMatchDialog extends JDialog {

View File

@ -5,8 +5,8 @@ package net.sourceforge.filebot.ui.subtitle;
import static net.sourceforge.filebot.MediaTypes.*;
import static net.sourceforge.filebot.subtitle.SubtitleUtilities.*;
import static net.sourceforge.filebot.ui.NotificationLogging.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
@ -46,9 +46,9 @@ import net.sourceforge.filebot.subtitle.SubtitleFormat;
import net.sourceforge.filebot.ui.subtitle.SubtitlePackage.Download.Phase;
import net.sourceforge.filebot.ui.transfer.DefaultTransferHandler;
import net.sourceforge.filebot.vfs.MemoryFile;
import net.sourceforge.tuned.ExceptionUtilities;
import net.sourceforge.tuned.ui.ListView;
import net.sourceforge.tuned.ui.TunedUtilities;
import net.sourceforge.filebot.util.ExceptionUtilities;
import net.sourceforge.filebot.util.ui.ListView;
import net.sourceforge.filebot.util.ui.TunedUtilities;
import ca.odell.glazedlists.BasicEventList;
import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.FilterList;

View File

@ -4,8 +4,8 @@ import static net.sourceforge.filebot.MediaTypes.*;
import static net.sourceforge.filebot.media.MediaDetection.*;
import static net.sourceforge.filebot.ui.NotificationLogging.*;
import static net.sourceforge.filebot.ui.transfer.FileTransferable.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Color;
import java.awt.Cursor;
@ -38,8 +38,8 @@ import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.filebot.web.OpenSubtitlesClient;
import net.sourceforge.filebot.web.SubtitleProvider;
import net.sourceforge.filebot.web.VideoHashSubtitleService;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.tuned.FileUtilities.ParentFilter;
import net.sourceforge.filebot.util.FileUtilities;
import net.sourceforge.filebot.util.FileUtilities.ParentFilter;
abstract class SubtitleDropTarget extends JButton {

View File

@ -23,7 +23,7 @@ import net.sourceforge.filebot.vfs.ArchiveType;
import net.sourceforge.filebot.vfs.MemoryFile;
import net.sourceforge.filebot.web.SubtitleDescriptor;
import net.sourceforge.filebot.web.SubtitleProvider;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.filebot.util.FileUtilities;
public class SubtitlePackage {

View File

@ -12,8 +12,8 @@ import javax.swing.border.CompoundBorder;
import net.miginfocom.swing.MigLayout;
import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.tuned.ui.AbstractFancyListCellRenderer;
import net.sourceforge.tuned.ui.DashedSeparator;
import net.sourceforge.filebot.util.ui.AbstractFancyListCellRenderer;
import net.sourceforge.filebot.util.ui.DashedSeparator;
class SubtitlePackageCellRenderer extends AbstractFancyListCellRenderer {

View File

@ -3,7 +3,7 @@ package net.sourceforge.filebot.ui.subtitle;
import static net.sourceforge.filebot.Settings.*;
import static net.sourceforge.filebot.ui.LanguageComboBoxModel.*;
import static net.sourceforge.filebot.ui.NotificationLogging.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Color;
import java.awt.Cursor;
@ -45,8 +45,8 @@ import net.sourceforge.filebot.web.SearchResult;
import net.sourceforge.filebot.web.SubtitleDescriptor;
import net.sourceforge.filebot.web.SubtitleProvider;
import net.sourceforge.filebot.web.VideoHashSubtitleService;
import net.sourceforge.tuned.ui.LabelProvider;
import net.sourceforge.tuned.ui.SimpleLabelProvider;
import net.sourceforge.filebot.util.ui.LabelProvider;
import net.sourceforge.filebot.util.ui.SimpleLabelProvider;
public class SubtitlePanel extends AbstractSearchPanel<SubtitleProvider, SubtitlePackage> {

View File

@ -2,7 +2,7 @@ package net.sourceforge.filebot.ui.subtitle;
import static net.sourceforge.filebot.MediaTypes.*;
import static net.sourceforge.filebot.media.MediaDetection.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Color;
import java.awt.Component;
@ -63,9 +63,9 @@ import net.sourceforge.filebot.web.SearchResult;
import net.sourceforge.filebot.web.TheTVDBClient.SeriesInfo;
import net.sourceforge.filebot.web.TheTVDBSearchResult;
import net.sourceforge.filebot.web.VideoHashSubtitleService.CheckResult;
import net.sourceforge.tuned.FileUtilities;
import net.sourceforge.tuned.ui.AbstractBean;
import net.sourceforge.tuned.ui.EmptySelectionModel;
import net.sourceforge.filebot.util.FileUtilities;
import net.sourceforge.filebot.util.ui.AbstractBean;
import net.sourceforge.filebot.util.ui.EmptySelectionModel;
public class SubtitleUploadDialog extends JDialog {

View File

@ -5,7 +5,7 @@ package net.sourceforge.filebot.ui.subtitle;
import static java.awt.Font.*;
import static java.util.Collections.*;
import static java.util.regex.Pattern.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*;
import static net.sourceforge.filebot.util.ui.TunedUtilities.*;
import java.awt.Color;
import java.awt.Component;
@ -47,10 +47,10 @@ import javax.swing.table.TableRowSorter;
import net.miginfocom.swing.MigLayout;
import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.filebot.subtitle.SubtitleElement;
import net.sourceforge.tuned.ui.GradientStyle;
import net.sourceforge.tuned.ui.LazyDocumentListener;
import net.sourceforge.tuned.ui.notification.SeparatorBorder;
import net.sourceforge.tuned.ui.notification.SeparatorBorder.Position;
import net.sourceforge.filebot.util.ui.GradientStyle;
import net.sourceforge.filebot.util.ui.LazyDocumentListener;
import net.sourceforge.filebot.util.ui.notification.SeparatorBorder;
import net.sourceforge.filebot.util.ui.notification.SeparatorBorder.Position;
public class SubtitleViewer extends JFrame {

View File

@ -3,7 +3,7 @@ package net.sourceforge.filebot.ui.transfer;
import static net.sourceforge.filebot.Settings.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
@ -18,7 +18,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.sourceforge.tuned.TemporaryFolder;
import net.sourceforge.filebot.util.TemporaryFolder;
public class ByteBufferTransferable implements Transferable {

View File

@ -3,7 +3,7 @@ package net.sourceforge.filebot.ui.transfer;
import static net.sourceforge.filebot.ui.transfer.FileTransferable.*;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;

View File

@ -2,7 +2,7 @@
package net.sourceforge.filebot.ui.transfer;
import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.filebot.util.FileUtilities.*;
import java.awt.event.ActionEvent;
import java.io.File;

View File

@ -0,0 +1,74 @@
package net.sourceforge.filebot.util;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
public class ByteBufferInputStream extends InputStream {
private final ByteBuffer buffer;
public ByteBufferInputStream(ByteBuffer buffer) {
this.buffer = buffer;
}
@Override
public int read() throws IOException {
return (buffer.position() < buffer.limit()) ? (buffer.get() & 0xff) : -1;
}
@Override
public int read(byte[] b, int off, int len) throws IOException {
if (b == null) {
throw new NullPointerException();
} else if (off < 0 || len < 0 || len > b.length - off) {
throw new IndexOutOfBoundsException();
}
if (buffer.position() >= buffer.limit()) {
return -1;
}
if (len > buffer.remaining()) {
len = buffer.remaining();
}
if (len <= 0) {
return 0;
}
buffer.get(b, off, len);
return len;
}
@Override
public int available() throws IOException {
return buffer.remaining();
}
@Override
public boolean markSupported() {
return true;
}
@Override
public void mark(int readlimit) {
buffer.mark();
}
@Override
public void reset() throws IOException {
buffer.reset();
}
}

View File

@ -0,0 +1,131 @@
package net.sourceforge.filebot.util;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
public class ByteBufferOutputStream extends OutputStream {
private ByteBuffer buffer;
private final float loadFactor;
public ByteBufferOutputStream(long initialCapacity) {
this((int) initialCapacity);
}
public ByteBufferOutputStream(int initialCapacity) {
this(initialCapacity, 1.0f);
}
public ByteBufferOutputStream(int initialCapacity, float loadFactor) {
if (initialCapacity < 0)
throw new IllegalArgumentException("initialCapacity must not be negative");
if (loadFactor <= 0 || Float.isNaN(loadFactor))
throw new IllegalArgumentException("loadFactor must be greater than 0");
this.buffer = ByteBuffer.allocate(initialCapacity + 1);
this.loadFactor = loadFactor;
}
@Override
public void write(int b) throws IOException {
ensureCapacity(buffer.position() + 1);
buffer.put((byte) b);
}
@Override
public void write(byte[] src) throws IOException {
ensureCapacity(buffer.position() + src.length);
buffer.put(src);
}
public void write(ByteBuffer src) throws IOException {
ensureCapacity(buffer.position() + src.remaining());
buffer.put(src);
}
@Override
public void write(byte[] src, int offset, int length) throws IOException {
ensureCapacity(buffer.position() + length);
buffer.put(src, offset, length);
}
public void ensureCapacity(int minCapacity) {
if (minCapacity <= buffer.capacity())
return;
// calculate new buffer size with load factor
int newCapacity = (int) (buffer.capacity() * (1 + loadFactor));
// ensure minCapacity
if (newCapacity < minCapacity)
newCapacity = minCapacity;
// create new buffer with increased capacity
ByteBuffer newBuffer = ByteBuffer.allocate(newCapacity);
// copy current data to new buffer
buffer.flip();
newBuffer.put(buffer);
buffer = newBuffer;
}
public ByteBuffer getByteBuffer() {
ByteBuffer result = buffer.duplicate();
// flip buffer so it can be read
result.flip();
return result;
}
public byte[] getByteArray() {
ByteBuffer data = getByteBuffer();
// copy data to byte array
byte[] bytes = new byte[data.remaining()];
data.get(bytes);
return bytes;
}
public int transferFrom(ReadableByteChannel channel) throws IOException {
// make sure buffer is not at its limit
ensureCapacity(buffer.position() + 1);
return channel.read(buffer);
}
public int transferFully(InputStream inputStream) throws IOException {
return transferFully(Channels.newChannel(inputStream));
}
public int transferFully(ReadableByteChannel channel) throws IOException {
int total = 0, read = 0;
while ((read = transferFrom(channel)) >= 0) {
total += read;
}
return total;
}
public int position() {
return buffer.position();
}
public int capacity() {
return buffer.capacity();
}
public void rewind() {
buffer.rewind();
}
}

View File

@ -0,0 +1,56 @@
package net.sourceforge.filebot.util;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
public class DefaultThreadFactory implements ThreadFactory {
private final AtomicInteger threadNumber = new AtomicInteger(0);
private final ThreadGroup group;
private final int priority;
private final boolean daemon;
public DefaultThreadFactory(String name) {
this(name, Thread.NORM_PRIORITY);
}
public DefaultThreadFactory(String name, int priority) {
this(name, priority, false);
}
public DefaultThreadFactory(String groupName, int priority, boolean daemon) {
SecurityManager sm = System.getSecurityManager();
ThreadGroup parentGroup = (sm != null) ? sm.getThreadGroup() : Thread.currentThread().getThreadGroup();
this.group = new ThreadGroup(parentGroup, groupName);
this.daemon = daemon;
this.priority = priority;
}
public Thread newThread(Runnable r) {
Thread thread = new Thread(group, r, String.format("%s-thread-%d", group.getName(), threadNumber.incrementAndGet()));
if (daemon != thread.isDaemon())
thread.setDaemon(daemon);
if (priority != thread.getPriority())
thread.setPriority(priority);
return thread;
}
public ThreadGroup getThreadGroup() {
return group;
}
}

View File

@ -0,0 +1,168 @@
package net.sourceforge.filebot.util;
import static net.sourceforge.filebot.web.WebRequest.*;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.swing.SwingWorker;
public class DownloadTask extends SwingWorker<ByteBuffer, Void> {
public static final String DOWNLOAD_STATE = "download state";
public static final String DOWNLOAD_PROGRESS = "download progress";
public static enum DownloadState {
PENDING, CONNECTING, DOWNLOADING, DONE
}
private URL url;
private long contentLength = -1;
private DownloadState state = DownloadState.PENDING;
private Map<String, String> postParameters;
private Map<String, String> requestHeaders;
private Map<String, List<String>> responseHeaders;
public DownloadTask(URL url) {
this.url = url;
}
protected HttpURLConnection createConnection() throws Exception {
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
if (requestHeaders != null) {
for (Entry<String, String> entry : requestHeaders.entrySet()) {
connection.addRequestProperty(entry.getKey(), entry.getValue());
}
}
return connection;
}
@Override
protected ByteBuffer doInBackground() throws Exception {
setDownloadState(DownloadState.CONNECTING);
HttpURLConnection connection = createConnection();
if (postParameters != null) {
ByteBuffer postData = Charset.forName("UTF-8").encode(encodeParameters(postParameters, true));
// add content type and content length headers
connection.addRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.addRequestProperty("Content-Length", String.valueOf(postData.remaining()));
connection.setRequestMethod("POST");
connection.setDoOutput(true);
// write post data
WritableByteChannel out = Channels.newChannel(connection.getOutputStream());
out.write(postData);
out.close();
}
contentLength = connection.getContentLength();
responseHeaders = connection.getHeaderFields();
setDownloadState(DownloadState.DOWNLOADING);
ReadableByteChannel in = Channels.newChannel(connection.getInputStream());
ByteBufferOutputStream buffer = new ByteBufferOutputStream((int) (contentLength > 0 ? contentLength : 32 * 1024));
try {
while (!isCancelled() && ((buffer.transferFrom(in)) >= 0)) {
firePropertyChange(DOWNLOAD_PROGRESS, null, buffer.position());
if (isContentLengthKnown()) {
setProgress((int) ((buffer.position() * 100) / contentLength));
}
}
} catch (IOException e) {
// if the content length is not known in advance an IOException (Premature EOF)
// is always thrown after all the data has been read
if (isContentLengthKnown())
throw e;
} finally {
in.close();
// download either finished or an exception is thrown
setDownloadState(DownloadState.DONE);
}
return buffer.getByteBuffer();
}
protected void setDownloadState(DownloadState state) {
this.state = state;
firePropertyChange(DOWNLOAD_STATE, null, state);
}
public DownloadState getDownloadState() {
return state;
}
public URL getUrl() {
return url;
}
public boolean isContentLengthKnown() {
return contentLength >= 0;
}
public long getContentLength() {
return contentLength;
}
public void setRequestHeaders(Map<String, String> requestHeaders) {
this.requestHeaders = new HashMap<String, String>(requestHeaders);
}
public void setPostParameters(Map<String, String> postParameters) {
this.postParameters = new HashMap<String, String>(postParameters);
}
public Map<String, List<String>> getResponseHeaders() {
return responseHeaders;
}
public Map<String, String> getPostParameters() {
return postParameters;
}
public Map<String, String> getRequestHeaders() {
return requestHeaders;
}
}

View File

@ -0,0 +1,69 @@
package net.sourceforge.filebot.util;
public final class ExceptionUtilities {
public static Throwable getRootCause(Throwable t) {
while (t.getCause() != null) {
t = t.getCause();
}
return t;
}
public static <T extends Throwable> T findCause(Throwable t, Class<T> type) {
while (t != null) {
if (type.isInstance(t))
return type.cast(t);
t = t.getCause();
}
return null;
}
public static String getRootCauseMessage(Throwable t) {
return getMessage(getRootCause(t));
}
public static String getMessage(Throwable t) {
String message = t.getMessage();
if (message == null || message.isEmpty()) {
message = t.toString();
}
return message;
}
public static <T extends Throwable> T wrap(Throwable t, Class<T> type) {
if (type.isInstance(t)) {
return type.cast(t);
}
try {
return type.getConstructor(Throwable.class).newInstance(t);
} catch (Exception e) {
throw new IllegalArgumentException(e);
}
}
public static RuntimeException asRuntimeException(Throwable t) {
return wrap(t, RuntimeException.class);
}
/**
* Dummy constructor to prevent instantiation.
*/
private ExceptionUtilities() {
throw new UnsupportedOperationException();
}
}

Some files were not shown because too many files have changed in this diff Show More