Converted to maven project, spotbugs and cleanup
This commit is contained in:
parent
7705a7e152
commit
52f59bc9f4
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="lib" path="C:/Users/subhro/lib/commons-net-3.6.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/subhro/lib/json-simple-1.1.1.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/subhro/lib/xz-1.8.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
1
XDM_NEON/.gitignore
vendored
1
XDM_NEON/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/bin/
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
@ -1,11 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,13 +0,0 @@
|
||||
package xdman.network;
|
||||
|
||||
public abstract class Channel {
|
||||
private volatile long length, startOff, downloaded;
|
||||
private byte[] buf;
|
||||
private volatile boolean stopFlag;
|
||||
|
||||
public abstract boolean open();
|
||||
|
||||
protected Channel() {
|
||||
buf = new byte[8192];
|
||||
}
|
||||
}
|
@ -1,277 +0,0 @@
|
||||
package xdman.network.http.proxy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class BrowserProxyInfo
|
||||
{
|
||||
private int type = 0;
|
||||
private String _httpHost;
|
||||
private int _httpPort = -1;
|
||||
private String _httpsHost;
|
||||
private int _httpsPort = -1;
|
||||
private String _ftpHost;
|
||||
private int _ftpPort = -1;
|
||||
private String _gopherHost;
|
||||
private int _gopherPort = -1;
|
||||
private String _socksHost;
|
||||
private int _socksPort = -1;
|
||||
private String[] _overrides = null;
|
||||
private String _autoConfigURL;
|
||||
private boolean _hintOnly;
|
||||
private boolean _isWPADEnabled;
|
||||
|
||||
public int getType()
|
||||
{
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(int paramInt)
|
||||
{
|
||||
this.type = paramInt;
|
||||
}
|
||||
|
||||
public String getHttpHost()
|
||||
{
|
||||
return this._httpHost;
|
||||
}
|
||||
|
||||
public void setHttpHost(String paramString)
|
||||
{
|
||||
this._httpHost = paramString;
|
||||
}
|
||||
|
||||
public int getHttpPort()
|
||||
{
|
||||
return this._httpPort;
|
||||
}
|
||||
|
||||
public void setHttpPort(int paramInt)
|
||||
{
|
||||
this._httpPort = paramInt;
|
||||
}
|
||||
|
||||
public String getHttpsHost()
|
||||
{
|
||||
return this._httpsHost;
|
||||
}
|
||||
|
||||
public void setHttpsHost(String paramString)
|
||||
{
|
||||
this._httpsHost = paramString;
|
||||
}
|
||||
|
||||
public int getHttpsPort()
|
||||
{
|
||||
return this._httpsPort;
|
||||
}
|
||||
|
||||
public void setHttpsPort(int paramInt)
|
||||
{
|
||||
this._httpsPort = paramInt;
|
||||
}
|
||||
|
||||
public String getFtpHost()
|
||||
{
|
||||
return this._ftpHost;
|
||||
}
|
||||
|
||||
public void setFtpHost(String paramString)
|
||||
{
|
||||
this._ftpHost = paramString;
|
||||
}
|
||||
|
||||
public int getFtpPort()
|
||||
{
|
||||
return this._ftpPort;
|
||||
}
|
||||
|
||||
public void setFtpPort(int paramInt)
|
||||
{
|
||||
this._ftpPort = paramInt;
|
||||
}
|
||||
|
||||
public String getGopherHost()
|
||||
{
|
||||
return this._gopherHost;
|
||||
}
|
||||
|
||||
public void setGopherHost(String paramString)
|
||||
{
|
||||
this._gopherHost = paramString;
|
||||
}
|
||||
|
||||
public int getGopherPort()
|
||||
{
|
||||
return this._gopherPort;
|
||||
}
|
||||
|
||||
public void setGopherPort(int paramInt)
|
||||
{
|
||||
this._gopherPort = paramInt;
|
||||
}
|
||||
|
||||
public String getSocksHost()
|
||||
{
|
||||
return this._socksHost;
|
||||
}
|
||||
|
||||
public void setSocksHost(String paramString)
|
||||
{
|
||||
this._socksHost = paramString;
|
||||
}
|
||||
|
||||
public int getSocksPort()
|
||||
{
|
||||
return this._socksPort;
|
||||
}
|
||||
|
||||
public void setSocksPort(int paramInt)
|
||||
{
|
||||
this._socksPort = paramInt;
|
||||
}
|
||||
|
||||
public String[] getOverrides()
|
||||
{
|
||||
return this._overrides;
|
||||
}
|
||||
|
||||
public String getOverridesString()
|
||||
{
|
||||
String str = "";
|
||||
if ((this._overrides != null) && (this._overrides.length > 0)) {
|
||||
for (int i = 0; i < this._overrides.length; i++) {
|
||||
if (i != this._overrides.length - 1) {
|
||||
str = str.concat(this._overrides[i] + "|");
|
||||
} else {
|
||||
str = str.concat(this._overrides[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public void setOverrides(String[] paramArrayOfString)
|
||||
{
|
||||
this._overrides = paramArrayOfString;
|
||||
}
|
||||
|
||||
public void setOverrides(List paramList)
|
||||
{
|
||||
if (paramList != null)
|
||||
{
|
||||
ArrayList localArrayList = new ArrayList(paramList);
|
||||
this._overrides = new String[localArrayList.size()];
|
||||
this._overrides = ((String[])localArrayList.toArray(this._overrides));
|
||||
}
|
||||
}
|
||||
|
||||
public String getAutoConfigURL()
|
||||
{
|
||||
return this._autoConfigURL;
|
||||
}
|
||||
|
||||
public void setAutoConfigURL(String paramString)
|
||||
{
|
||||
this._autoConfigURL = paramString;
|
||||
}
|
||||
|
||||
public void setHintOnly(boolean paramBoolean)
|
||||
{
|
||||
this._hintOnly = paramBoolean;
|
||||
}
|
||||
|
||||
public boolean isAutoProxyDetectionEnabled()
|
||||
{
|
||||
return this._isWPADEnabled;
|
||||
}
|
||||
|
||||
public void setAutoProxyDetectionEnabled(boolean paramBoolean)
|
||||
{
|
||||
this._isWPADEnabled = paramBoolean;
|
||||
}
|
||||
|
||||
public boolean isHintOnly()
|
||||
{
|
||||
return this._hintOnly;
|
||||
}
|
||||
|
||||
// public String toString()
|
||||
// {
|
||||
// StringBuffer localStringBuffer = new StringBuffer();
|
||||
// localStringBuffer.append(ResourceManager.getMessage("net.proxy.configuration.text"));
|
||||
// switch (this.type)
|
||||
// {
|
||||
// case 3:
|
||||
// localStringBuffer.append(ResourceManager.getMessage("net.proxy.type.browser"));
|
||||
// break;
|
||||
// case 2:
|
||||
// localStringBuffer.append(ResourceManager.getMessage("net.proxy.type.auto"));
|
||||
// localStringBuffer.append("\n");
|
||||
// localStringBuffer.append(" URL: " + this._autoConfigURL);
|
||||
// break;
|
||||
// case 1:
|
||||
// localStringBuffer.append(ResourceManager.getMessage("net.proxy.type.manual"));
|
||||
// localStringBuffer.append("\n");
|
||||
// localStringBuffer.append(" " + ResourceManager.getMessage("net.proxy.text"));
|
||||
// if (this._httpHost != null)
|
||||
// {
|
||||
// localStringBuffer.append("http=" + this._httpHost);
|
||||
// if (this._httpPort != -1) {
|
||||
// localStringBuffer.append(":" + this._httpPort);
|
||||
// }
|
||||
// }
|
||||
// if (this._httpsHost != null)
|
||||
// {
|
||||
// localStringBuffer.append(",https=" + this._httpsHost);
|
||||
// if (this._httpsPort != -1) {
|
||||
// localStringBuffer.append(":" + this._httpsPort);
|
||||
// }
|
||||
// }
|
||||
// if (this._ftpHost != null)
|
||||
// {
|
||||
// localStringBuffer.append(",ftp=" + this._ftpHost);
|
||||
// if (this._ftpPort != -1) {
|
||||
// localStringBuffer.append(":" + this._ftpPort);
|
||||
// }
|
||||
// }
|
||||
// if (this._gopherHost != null)
|
||||
// {
|
||||
// localStringBuffer.append(",gopher=" + this._gopherHost);
|
||||
// if (this._gopherPort != -1) {
|
||||
// localStringBuffer.append(":" + this._gopherPort);
|
||||
// }
|
||||
// }
|
||||
// if (this._socksHost != null)
|
||||
// {
|
||||
// localStringBuffer.append(",socks=" + this._socksHost);
|
||||
// if (this._socksPort != -1) {
|
||||
// localStringBuffer.append(":" + this._socksPort);
|
||||
// }
|
||||
// }
|
||||
// localStringBuffer.append("\n");
|
||||
// localStringBuffer.append(" " + ResourceManager.getMessage("net.proxy.override.text"));
|
||||
// if (this._overrides != null)
|
||||
// {
|
||||
// int i = 1;
|
||||
// for (int j = 0; j < this._overrides.length; j++)
|
||||
// {
|
||||
// if (j != 0) {
|
||||
// localStringBuffer.append(",");
|
||||
// }
|
||||
// localStringBuffer.append(this._overrides[j]);
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// case 0:
|
||||
// localStringBuffer.append(ResourceManager.getMessage("net.proxy.type.none"));
|
||||
// break;
|
||||
// case 4:
|
||||
// localStringBuffer.append(ResourceManager.getMessage("net.proxy.type.system"));
|
||||
// break;
|
||||
// default:
|
||||
// localStringBuffer.append("<Unrecognized Proxy Type>");
|
||||
// }
|
||||
// return localStringBuffer.toString();
|
||||
// }
|
||||
}
|
32
XDM_NEON/xdman/.classpath
Normal file
32
XDM_NEON/xdman/.classpath
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-9">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
@ -1,17 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>XDM_NEON</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>xdman</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,5 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/main/resources=UTF-8
|
||||
encoding//src/test/java=UTF-8
|
||||
encoding/<project>=UTF-8
|
6
XDM_NEON/xdman/.settings/org.eclipse.jdt.core.prefs
Normal file
6
XDM_NEON/xdman/.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,6 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=9
|
||||
org.eclipse.jdt.core.compiler.compliance=9
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=9
|
4
XDM_NEON/xdman/.settings/org.eclipse.m2e.core.prefs
Normal file
4
XDM_NEON/xdman/.settings/org.eclipse.m2e.core.prefs
Normal file
@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
83
XDM_NEON/xdman/pom.xml
Normal file
83
XDM_NEON/xdman/pom.xml
Normal file
@ -0,0 +1,83 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>xdman</groupId>
|
||||
<artifactId>xdman</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>xdman</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.9</maven.compiler.source>
|
||||
<maven.compiler.target>1.9</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/commons-net/commons-net -->
|
||||
<dependency>
|
||||
<groupId>commons-net</groupId>
|
||||
<artifactId>commons-net</artifactId>
|
||||
<version>3.6</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.tukaani/xz -->
|
||||
<dependency>
|
||||
<groupId>org.tukaani</groupId>
|
||||
<artifactId>xz</artifactId>
|
||||
<version>1.8</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<!-- <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId>
|
||||
<version>3.8.1</version> <scope>test</scope> </dependency> -->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>xdman</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>xdman.Main</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
<classifier></classifier>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id> <!-- this is used for inheritance merges -->
|
||||
<phase>package</phase> <!-- bind to the packaging phase -->
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M3</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
@ -1,8 +1,5 @@
|
||||
package xdman;
|
||||
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.FlavorEvent;
|
||||
import java.awt.datatransfer.FlavorListener;
|
||||
import java.net.URL;
|
||||
|
||||
import xdman.downloaders.metadata.HttpMetadata;
|
@ -3,9 +3,6 @@ package xdman;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.print.attribute.standard.Finishings;
|
||||
|
||||
import xdman.ui.laf.XDMProgressBarUI;
|
||||
import xdman.util.Logger;
|
||||
|
||||
public class DownloadQueue {
|
@ -16,6 +16,7 @@ import java.util.UUID;
|
||||
|
||||
import xdman.ui.res.StringResource;
|
||||
import xdman.util.Logger;
|
||||
import xdman.util.XDMUtils;
|
||||
|
||||
public class QueueManager {
|
||||
private static QueueManager _this;
|
||||
@ -67,23 +68,31 @@ public class QueueManager {
|
||||
|
||||
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
|
||||
try (BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")))) {
|
||||
|
||||
String str = reader.readLine();
|
||||
int count = Integer.parseInt((str == null ? "0" : str).trim());
|
||||
for (int i = 0; i < count; i++) {
|
||||
String id = reader.readLine().trim();
|
||||
String name = reader.readLine().trim();
|
||||
String strLn = reader.readLine();
|
||||
if (strLn == null) {
|
||||
throw new IOException("Unexpected EOF");
|
||||
}
|
||||
String id = strLn.trim();
|
||||
strLn = reader.readLine();
|
||||
if (strLn == null) {
|
||||
throw new IOException("Unexpected EOF");
|
||||
}
|
||||
String name = strLn.trim();
|
||||
DownloadQueue queue = null;
|
||||
if ("".equals(id)) {
|
||||
queue = defaultQ;
|
||||
} else {
|
||||
queue = new DownloadQueue(id, name);
|
||||
}
|
||||
int c = Integer.parseInt(reader.readLine().trim());
|
||||
int c = Integer.parseInt(XDMUtils.readLineSafe(reader).trim());
|
||||
for (int j = 0; j < c; j++) {
|
||||
queue.getQueuedItems().add(reader.readLine().trim());
|
||||
queue.getQueuedItems().add(XDMUtils.readLineSafe(reader).trim());
|
||||
}
|
||||
boolean hasStartTime = Integer.parseInt(reader.readLine()) == 1;
|
||||
if (hasStartTime) {
|
||||
@ -111,11 +120,6 @@ public class QueueManager {
|
||||
} catch (Exception e) {
|
||||
Logger.log(e);
|
||||
}
|
||||
try {
|
||||
if (reader != null)
|
||||
reader.close();
|
||||
} catch (Exception e1) {
|
||||
}
|
||||
}
|
||||
|
||||
public void saveQueues() {
|
@ -10,13 +10,13 @@ import xdman.util.UpdateChecker;
|
||||
import xdman.util.XDMUtils;
|
||||
|
||||
public class QueueScheduler implements Runnable {
|
||||
private boolean stop;
|
||||
// private boolean stop;
|
||||
private long lastKeepAwakePing = 0L;
|
||||
|
||||
private static QueueScheduler _this;
|
||||
|
||||
private QueueScheduler() {
|
||||
stop = false;
|
||||
// stop = false;
|
||||
}
|
||||
|
||||
public static QueueScheduler getInstance() {
|
@ -61,7 +61,7 @@ import xdman.util.XDMUtils;
|
||||
|
||||
public class XDMApp implements DownloadListener, DownloadWindowListener, Comparator<String> {
|
||||
|
||||
public static final String APP_VERSION = "7.2.8";
|
||||
public static final String APP_VERSION = "7.2.9";
|
||||
|
||||
private ArrayList<ListChangeListener> listChangeListeners;
|
||||
private Map<String, DownloadEntry> downloads;
|
||||
@ -729,12 +729,18 @@ public class XDMApp implements DownloadListener, DownloadWindowListener, Compara
|
||||
return;
|
||||
}
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
|
||||
int count = Integer.parseInt(reader.readLine().trim());
|
||||
// BufferedReader reader = null;
|
||||
try (BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")))) {
|
||||
// reader = new BufferedReader(new InputStreamReader(new FileInputStream(file),
|
||||
// Charset.forName("UTF-8")));
|
||||
String line = reader.readLine();
|
||||
if (line == null) {
|
||||
throw new NullPointerException("Unexpected EOF");
|
||||
}
|
||||
int count = Integer.parseInt(line.trim());
|
||||
for (int i = 0; i < count; i++) {
|
||||
int fieldCount = Integer.parseInt(reader.readLine().trim());
|
||||
int fieldCount = Integer.parseInt(XDMUtils.readLineSafe(reader).trim());
|
||||
DownloadEntry ent = new DownloadEntry();
|
||||
for (int j = 0; j < fieldCount; j++) {
|
||||
String ln = reader.readLine();
|
||||
@ -790,11 +796,7 @@ public class XDMApp implements DownloadListener, DownloadWindowListener, Compara
|
||||
} catch (Exception e) {
|
||||
Logger.log(e);
|
||||
}
|
||||
try {
|
||||
if (reader != null)
|
||||
reader.close();
|
||||
} catch (Exception e1) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void saveDownloadList() {
|
@ -10,13 +10,10 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
import xdman.Config;
|
||||
import xdman.DownloadListener;
|
||||
import xdman.XDMConstants;
|
||||
import xdman.downloaders.http.HttpChannel;
|
||||
import xdman.downloaders.metadata.DashMetadata;
|
||||
@ -24,7 +21,6 @@ import xdman.mediaconversion.FFmpeg;
|
||||
import xdman.mediaconversion.MediaConversionListener;
|
||||
import xdman.mediaconversion.MediaFormats;
|
||||
import xdman.util.FormatUtilities;
|
||||
import xdman.util.HttpDateParser;
|
||||
import xdman.util.Logger;
|
||||
import xdman.util.StringUtils;
|
||||
import xdman.util.XDMUtils;
|
||||
@ -503,10 +499,10 @@ public abstract class SegmentDownloader extends Downloader implements SegmentLis
|
||||
this.downloaded = Long.parseLong(br.readLine());
|
||||
int chunkCount = Integer.parseInt(br.readLine());
|
||||
for (int i = 0; i < chunkCount; i++) {
|
||||
String cid = br.readLine();
|
||||
long len = Long.parseLong(br.readLine());
|
||||
long off = Long.parseLong(br.readLine());
|
||||
long dwn = Long.parseLong(br.readLine());
|
||||
String cid = XDMUtils.readLineSafe(br);
|
||||
long len = Long.parseLong(XDMUtils.readLineSafe(br));
|
||||
long off = Long.parseLong(XDMUtils.readLineSafe(br));
|
||||
long dwn = Long.parseLong(XDMUtils.readLineSafe(br));
|
||||
Segment seg = new SegmentImpl(folder, cid, off, len, dwn);
|
||||
// handle case of single dash stream
|
||||
if (getMetadata() instanceof DashMetadata) {
|
@ -1,7 +1,6 @@
|
||||
package xdman.downloaders;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.UUID;
|
@ -10,12 +10,10 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import xdman.Config;
|
||||
import xdman.DownloadListener;
|
||||
import xdman.XDMConstants;
|
||||
import xdman.downloaders.AbstractChannel;
|
||||
import xdman.downloaders.Downloader;
|
||||
@ -32,7 +30,6 @@ import xdman.mediaconversion.FFmpeg;
|
||||
import xdman.mediaconversion.MediaConversionListener;
|
||||
import xdman.mediaconversion.MediaFormats;
|
||||
import xdman.util.FormatUtilities;
|
||||
import xdman.util.HttpDateParser;
|
||||
import xdman.util.Logger;
|
||||
import xdman.util.StringUtils;
|
||||
import xdman.util.XDMUtils;
|
||||
@ -594,18 +591,18 @@ public class DashDownloader extends Downloader implements SegmentListener, Media
|
||||
this.len2 = Long.parseLong(br.readLine());
|
||||
int chunkCount = Integer.parseInt(br.readLine());
|
||||
for (int i = 0; i < chunkCount; i++) {
|
||||
String cid = br.readLine();
|
||||
String cid = XDMUtils.readLineSafe(br);
|
||||
long len = Long.parseLong(br.readLine());
|
||||
long off = Long.parseLong(br.readLine());
|
||||
long dwn = Long.parseLong(br.readLine());
|
||||
String tag = br.readLine();
|
||||
String tag = XDMUtils.readLineSafe(br);//br.readLine();
|
||||
Segment seg = new SegmentImpl(folder, cid, off, len, dwn);
|
||||
seg.setTag(tag);
|
||||
Logger.log("id: " + seg.getId() + "\nlength: " + seg.getLength() + "\noffset: " + seg.getStartOffset()
|
||||
+ "\ndownload: " + seg.getDownloaded());
|
||||
chunks.add(seg);
|
||||
}
|
||||
this.lastModified = br.readLine();
|
||||
this.lastModified = XDMUtils.readLineSafe(br);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
Logger.log("Failed to load saved state");
|
@ -18,8 +18,8 @@ public class FtpChannel extends AbstractChannel {
|
||||
private FtpClient hc;
|
||||
private InputStream in;
|
||||
private boolean redirected;
|
||||
private String redirectUrl;
|
||||
private long length;
|
||||
// private String redirectUrl;
|
||||
private long length;
|
||||
|
||||
public FtpChannel(Segment chunk, String url) {
|
||||
super(chunk);
|
||||
@ -101,7 +101,7 @@ public class FtpChannel extends AbstractChannel {
|
||||
return false;
|
||||
} else {
|
||||
passwd = Authenticator.requestPasswordAuthentication(null, hc.getPort(), "ftp", "", "ftp");
|
||||
Logger.log("Passwd: "+passwd);
|
||||
Logger.log("Passwd: " + passwd);
|
||||
throw new JavaClientRequiredException();
|
||||
}
|
||||
}
|
||||
@ -119,7 +119,7 @@ public class FtpChannel extends AbstractChannel {
|
||||
}
|
||||
|
||||
length = hc.getContentLength();
|
||||
|
||||
|
||||
if (hc.getContentLength() > 0 && XDMUtils.getFreeSpace(null) < hc.getContentLength()) {
|
||||
Logger.log("Disk is full");
|
||||
errorCode = XDMConstants.DISK_FAIURE;
|
||||
@ -182,6 +182,6 @@ public class FtpChannel extends AbstractChannel {
|
||||
}
|
||||
|
||||
public String getRedirectUrl() {
|
||||
return redirectUrl;
|
||||
return null;// return redirectUrl;
|
||||
}
|
||||
}
|
@ -5,12 +5,10 @@ import xdman.downloaders.AbstractChannel;
|
||||
import xdman.downloaders.Segment;
|
||||
import xdman.downloaders.SegmentDownloader;
|
||||
import xdman.downloaders.metadata.HttpMetadata;
|
||||
import xdman.util.Logger;
|
||||
import xdman.util.XDMUtils;
|
||||
|
||||
public class FtpDownloader extends SegmentDownloader {
|
||||
private HttpMetadata metadata;
|
||||
private String newFileName;
|
||||
//private String newFileName;
|
||||
|
||||
public FtpDownloader(String id, String folder, HttpMetadata metadata) {
|
||||
super(id, folder);
|
||||
@ -30,13 +28,16 @@ public class FtpDownloader extends SegmentDownloader {
|
||||
|
||||
@Override
|
||||
public boolean isFileNameChanged() {
|
||||
Logger.log("Checking for filename change " + (newFileName != null));
|
||||
return newFileName != null;
|
||||
return false;
|
||||
/*
|
||||
* Logger.log("Checking for filename change " + (newFileName != null)); return
|
||||
* newFileName != null;
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNewFile() {
|
||||
return newFileName;
|
||||
return null;//newFileName;
|
||||
}
|
||||
|
||||
@Override
|
@ -10,11 +10,9 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import xdman.Config;
|
||||
import xdman.DownloadListener;
|
||||
import xdman.XDMConstants;
|
||||
import xdman.downloaders.AbstractChannel;
|
||||
import xdman.downloaders.Downloader;
|
||||
@ -306,11 +304,11 @@ public class HdsDownloader extends Downloader implements SegmentListener, MediaC
|
||||
info.setDownloaded(progress);
|
||||
info.setLength(100);
|
||||
info.setStart(0);
|
||||
long diff = downloaded - lastDownloaded;
|
||||
//long diff = downloaded - lastDownloaded;
|
||||
long timeSpend = now - prevTime;
|
||||
if (timeSpend > 0) {
|
||||
//float rate = ((float) diff / timeSpend) * 1000;
|
||||
//downloadSpeed = rate;
|
||||
// float rate = ((float) diff / timeSpend) * 1000;
|
||||
// downloadSpeed = rate;
|
||||
|
||||
int prgDiff = progress - lastProgress;
|
||||
if (prgDiff > 0) {
|
||||
@ -453,12 +451,12 @@ public class HdsDownloader extends Downloader implements SegmentListener, MediaC
|
||||
this.totalDuration = Long.parseLong(br.readLine());
|
||||
int urlCount = Integer.parseInt(br.readLine());
|
||||
for (int i = 0; i < urlCount; i++) {
|
||||
String url = br.readLine();
|
||||
String url = XDMUtils.readLineSafe(br);// br.readLine();
|
||||
urlList.add(url);
|
||||
}
|
||||
int chunkCount = Integer.parseInt(br.readLine());
|
||||
for (int i = 0; i < chunkCount; i++) {
|
||||
String cid = br.readLine();
|
||||
String cid = XDMUtils.readLineSafe(br);// br.readLine();
|
||||
long len = Long.parseLong(br.readLine());
|
||||
long off = Long.parseLong(br.readLine());
|
||||
long dwn = Long.parseLong(br.readLine());
|
||||
@ -468,7 +466,7 @@ public class HdsDownloader extends Downloader implements SegmentListener, MediaC
|
||||
+ "\ndownload: " + seg.getDownloaded());
|
||||
chunks.add(seg);
|
||||
}
|
||||
this.lastModified = br.readLine();
|
||||
this.lastModified = XDMUtils.readLineSafe(br);// br.readLine();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
Logger.log("Failed to load saved state");
|
||||
@ -536,7 +534,7 @@ public class HdsDownloader extends Downloader implements SegmentListener, MediaC
|
||||
assembleFinished = false;
|
||||
File ffOutFile = null;
|
||||
File outFile = null;
|
||||
|
||||
|
||||
XDMUtils.mkdirs(getOutputFolder());
|
||||
|
||||
// File outFile = new File(outputFormat == 0 ? getOutputFolder() : folder,
|
@ -4,9 +4,7 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.nio.charset.Charset;
|
||||
import java.security.Key;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
import java.util.Iterator;
|
||||
|
||||
@ -26,7 +24,6 @@ import xdman.network.http.JavaHttpClient;
|
||||
import xdman.network.http.WebProxy;
|
||||
import xdman.network.http.XDMHttpClient;
|
||||
import xdman.util.Logger;
|
||||
import xdman.util.StringUtils;
|
||||
import xdman.util.XDMUtils;
|
||||
|
||||
public class EncryptedHlsChannel extends HttpChannel {
|
@ -332,7 +332,7 @@ public class HlsDownloader extends Downloader implements SegmentListener, MediaC
|
||||
info.setDownloaded(progress);
|
||||
info.setLength(100);
|
||||
info.setStart(0);
|
||||
long diff = downloaded - lastDownloaded;
|
||||
//long diff = downloaded - lastDownloaded;
|
||||
long timeSpend = now - prevTime;
|
||||
if (timeSpend > 0) {
|
||||
// float rate = ((float) diff / timeSpend) * 1000;
|
||||
@ -506,7 +506,7 @@ public class HlsDownloader extends Downloader implements SegmentListener, MediaC
|
||||
int urlCount = Integer.parseInt(br.readLine());
|
||||
System.out.println("Loading urls: " + urlCount);
|
||||
for (int i = 0; i < urlCount; i++) {
|
||||
String url = br.readLine();
|
||||
String url = XDMUtils.readLineSafe(br);// br.readLine();
|
||||
HlsPlaylistItem item = new HlsPlaylistItem();
|
||||
item.setUrl(url);
|
||||
items.add(item);
|
||||
@ -514,7 +514,7 @@ public class HlsDownloader extends Downloader implements SegmentListener, MediaC
|
||||
}
|
||||
int chunkCount = Integer.parseInt(br.readLine());
|
||||
for (int i = 0; i < chunkCount; i++) {
|
||||
String cid = br.readLine();
|
||||
String cid = XDMUtils.readLineSafe(br);// br.readLine();
|
||||
long len = Long.parseLong(br.readLine());
|
||||
long off = Long.parseLong(br.readLine());
|
||||
long dwn = Long.parseLong(br.readLine());
|
||||
@ -524,7 +524,7 @@ public class HlsDownloader extends Downloader implements SegmentListener, MediaC
|
||||
+ "\ndownload: " + seg.getDownloaded());
|
||||
chunks.add(seg);
|
||||
}
|
||||
this.lastModified = br.readLine();
|
||||
this.lastModified = XDMUtils.readLineSafe(br);// br.readLine();
|
||||
|
||||
String strHasMoreInfo = br.readLine();
|
||||
if (strHasMoreInfo != null) {
|
||||
@ -533,18 +533,18 @@ public class HlsDownloader extends Downloader implements SegmentListener, MediaC
|
||||
for (int i = 0; i < urlCount; i++) {
|
||||
HlsPlaylistItem item = items.get(i);
|
||||
if ("true".equals(br.readLine())) {
|
||||
item.setKeyUrl(br.readLine());
|
||||
item.setKeyUrl(XDMUtils.readLineSafe(br));
|
||||
}
|
||||
if ("true".equals(br.readLine())) {
|
||||
item.setIV(br.readLine());
|
||||
item.setIV(XDMUtils.readLineSafe(br));
|
||||
}
|
||||
}
|
||||
|
||||
int keys = Integer.parseInt(br.readLine());
|
||||
for (int i = 0; i < keys; i++) {
|
||||
String keyUrl = br.readLine();
|
||||
String keyUrl = XDMUtils.readLineSafe(br);
|
||||
System.out.println("Keydata: " + keyUrl);
|
||||
String keyData = br.readLine();
|
||||
String keyData = XDMUtils.readLineSafe(br);
|
||||
byte[] data = Base64.getDecoder().decode(keyData);
|
||||
keyMap.put(keyUrl, data);
|
||||
}
|
||||
@ -624,18 +624,13 @@ public class HlsDownloader extends Downloader implements SegmentListener, MediaC
|
||||
for (Segment s : chunks) {
|
||||
sb.append("file '" + new File(folder, s.getId()) + "'\r\n");
|
||||
}
|
||||
OutputStream hlsTextStream = null;
|
||||
|
||||
File hlsFile = new File(folder, id + "-hls.txt");
|
||||
|
||||
try {
|
||||
hlsTextStream = new FileOutputStream(hlsFile);
|
||||
try (OutputStream hlsTextStream = new FileOutputStream(hlsFile)) {
|
||||
hlsTextStream.write(sb.toString().getBytes());
|
||||
hlsTextStream.close();
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
hlsTextStream.close();
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
this.converting = true;
|
||||
List<String> inputFiles = new ArrayList<String>();
|
@ -11,6 +11,7 @@ import java.util.List;
|
||||
import xdman.util.FormatUtilities;
|
||||
import xdman.util.Logger;
|
||||
import xdman.util.StringUtils;
|
||||
import xdman.util.XDMUtils;
|
||||
|
||||
public class PlaylistParser {
|
||||
|
||||
@ -29,7 +30,7 @@ public class PlaylistParser {
|
||||
boolean hasByteRange = false;
|
||||
try {
|
||||
r = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
|
||||
if (!r.readLine().startsWith("#EXTM3U")) {
|
||||
if (!XDMUtils.readLineSafe(r).startsWith("#EXTM3U")) {
|
||||
throw new IOException("Not a valid HLS manifest");
|
||||
}
|
||||
String prefixLine = "";
|
||||
@ -61,7 +62,7 @@ public class PlaylistParser {
|
||||
segSeq = mediaSequence;
|
||||
}
|
||||
url = line;
|
||||
if (!(hasByteRange && url.equals(lastUrl))) {
|
||||
if (!(hasByteRange && lastUrl != null && url.equals(lastUrl))) {
|
||||
HlsPlaylistItem item = new HlsPlaylistItem(getAbsUrl(url, playlistUrl),
|
||||
isEncryptedSegment ? getAbsUrl(keyUrl, playlistUrl) : null,
|
||||
isEncryptedSegment ? getIV(IV, mediaSequence) : null, resolution, bandwidth, duration);
|
@ -4,9 +4,7 @@ import xdman.XDMConstants;
|
||||
import xdman.downloaders.AbstractChannel;
|
||||
import xdman.downloaders.Segment;
|
||||
import xdman.downloaders.SegmentDownloader;
|
||||
import xdman.downloaders.metadata.DashMetadata;
|
||||
import xdman.downloaders.metadata.HttpMetadata;
|
||||
import xdman.network.ProxyResolver;
|
||||
import xdman.util.Logger;
|
||||
import xdman.util.MimeUtil;
|
||||
import xdman.util.NetUtils;
|
@ -1,15 +1,7 @@
|
||||
package xdman.downloaders.metadata;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import xdman.Config;
|
||||
import xdman.XDMConstants;
|
||||
import xdman.network.http.HeaderCollection;
|
||||
import xdman.network.http.HttpHeader;
|
||||
import xdman.util.Logger;
|
||||
|
||||
public class DashMetadata extends HttpMetadata {
|
@ -1,15 +1,6 @@
|
||||
package xdman.downloaders.metadata;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import xdman.Config;
|
||||
import xdman.XDMConstants;
|
||||
import xdman.network.http.HeaderCollection;
|
||||
import xdman.network.http.HttpHeader;
|
||||
import xdman.util.Logger;
|
||||
|
||||
public class HdsMetadata extends HttpMetadata {
|
@ -1,12 +1,6 @@
|
||||
package xdman.downloaders.metadata;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.util.Iterator;
|
||||
|
||||
import xdman.Config;
|
||||
import xdman.XDMConstants;
|
||||
import xdman.network.http.HttpHeader;
|
||||
import xdman.util.Logger;
|
||||
|
||||
public class HlsMetadata extends HttpMetadata {
|
@ -30,10 +30,9 @@ public class F4MManifest {
|
||||
private boolean live;
|
||||
private int fragCount;
|
||||
private int segStart, fragStart;
|
||||
private boolean isMetadata;
|
||||
private int fragsPerSeg;
|
||||
private F4MMedia selectedMedia;
|
||||
private int segNum, fragNum, lastFrag;
|
||||
private int segNum, fragNum;
|
||||
private String fragUrl, baseUrl;
|
||||
private int discontinuity;
|
||||
private String query;
|
||||
@ -61,8 +60,8 @@ public class F4MManifest {
|
||||
segStart = segNum;
|
||||
fragStart = fragNum;
|
||||
}
|
||||
byte[] fragmentData = new byte[0];
|
||||
lastFrag = fragNum;
|
||||
// byte[] fragmentData = new byte[0];
|
||||
// lastFrag = fragNum;
|
||||
System.out.println(fragNum + " " + fragCount);
|
||||
if (fragNum >= fragCount)
|
||||
throw new Exception("No fragment available for downloading");
|
||||
@ -80,7 +79,7 @@ public class F4MManifest {
|
||||
}
|
||||
Logger.log("fragUrl: " + fragUrl + "\nfragCount: " + fragCount + " baseUrl: " + baseUrl);
|
||||
|
||||
int fragsToDownload = fragCount - fragNum;
|
||||
// int fragsToDownload = fragCount - fragNum;
|
||||
while (fragNum < fragCount) {
|
||||
Logger.log("Remaining: " + (fragCount - fragNum));
|
||||
fragNum++;
|
||||
@ -220,7 +219,7 @@ public class F4MManifest {
|
||||
BoxInfo boxInfo = readBoxHeader(ptr);
|
||||
|
||||
pos = ptr.getPos();
|
||||
long boxSize = boxInfo.getBoxSize();
|
||||
// long boxSize = boxInfo.getBoxSize();
|
||||
String boxType = boxInfo.getBoxType();
|
||||
|
||||
if (boxType.equals("abst"))
|
||||
@ -322,7 +321,7 @@ public class F4MManifest {
|
||||
Segment firstSegment = segTable.get(0);
|
||||
Segment lastSegment = segTable.get(segTable.size() - 1);
|
||||
Fragment firstFragment = fragTable.get(0);
|
||||
Fragment lastFragment = fragTable.get(fragTable.size() - 1);
|
||||
fragTable.get(fragTable.size() - 1);
|
||||
|
||||
if (segTable.size() == 1)
|
||||
return firstSegment.firstSegment;
|
||||
@ -347,25 +346,25 @@ public class F4MManifest {
|
||||
private void parseBootstrapBox(byte[] bootstrapInfo, int pos) {
|
||||
System.out.println("parsing abst");
|
||||
live = false;
|
||||
isMetadata = true;
|
||||
int version = readByte(bootstrapInfo, pos);
|
||||
int flags = (int) readInt24(bootstrapInfo, pos + 1);
|
||||
int bootstrapVersion = (int) readInt32(bootstrapInfo, pos + 4);
|
||||
// isMetadata = true;
|
||||
readByte(bootstrapInfo, pos);
|
||||
readInt24(bootstrapInfo, pos + 1);
|
||||
readInt32(bootstrapInfo, pos + 4);
|
||||
// Console.WriteLine("bootstrapVersion: " + bootstrapVersion);
|
||||
int b = readByte(bootstrapInfo, pos + 8);
|
||||
int profile = (b & 0xC0) >> 6;
|
||||
// int profile = (b & 0xC0) >> 6;
|
||||
int update = (b & 0x10) >> 4;
|
||||
if (((b & 0x20) >> 5) > 0) {
|
||||
live = true;
|
||||
isMetadata = false;
|
||||
// isMetadata = false;
|
||||
}
|
||||
if (update == 0) {
|
||||
segTable.clear();
|
||||
fragTable.clear();
|
||||
}
|
||||
int timescale = (int) readInt32(bootstrapInfo, pos + 9);
|
||||
long currentMediaTime = readInt64(bootstrapInfo, 13);
|
||||
long smpteTimeCodeOffset = readInt64(bootstrapInfo, 21);
|
||||
readInt32(bootstrapInfo, pos + 9);
|
||||
readInt64(bootstrapInfo, 13);
|
||||
readInt64(bootstrapInfo, 21);
|
||||
pos += 29;
|
||||
|
||||
BufferPointer bPtr = new BufferPointer();
|
||||
@ -387,8 +386,8 @@ public class F4MManifest {
|
||||
|
||||
for (int i = 0; i < qualityEntryCount; i++)
|
||||
readString(bPtr);
|
||||
String drmData = readString(bPtr);
|
||||
String smetadata = readString(bPtr);
|
||||
readString(bPtr);
|
||||
readString(bPtr);
|
||||
pos = bPtr.getPos();
|
||||
int segRunTableCount = readByte(bootstrapInfo, pos++);
|
||||
|
||||
@ -492,8 +491,8 @@ public class F4MManifest {
|
||||
|
||||
private void parseAsrtBox(byte[] asrt, int pos) {
|
||||
System.out.println("parsing asrt");
|
||||
int version = readByte(asrt, (int) pos);
|
||||
int flags = (int) readInt24(asrt, pos + 1);
|
||||
readByte(asrt, (int) pos);
|
||||
readInt24(asrt, pos + 1);
|
||||
int qualityEntryCount = readByte(asrt, pos + 4);
|
||||
segTable.clear();
|
||||
pos += 5;
|
||||
@ -522,9 +521,9 @@ public class F4MManifest {
|
||||
private void parseAfrtBox(byte[] afrt, int pos) {
|
||||
System.out.println("Parse afrt");
|
||||
fragTable.clear();
|
||||
int version = readByte(afrt, pos);
|
||||
int flags = (int) readInt24(afrt, pos + 1);
|
||||
int timescale = (int) readInt32(afrt, pos + 4);
|
||||
readByte(afrt, pos);
|
||||
readInt24(afrt, pos + 1);
|
||||
readInt32(afrt, pos + 4);
|
||||
int qualityEntryCount = readByte(afrt, pos + 8);
|
||||
pos += 9;
|
||||
BufferPointer args = new BufferPointer();
|
@ -1,11 +1,11 @@
|
||||
package xdman.downloaders.metadata.manifests;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.net.*;
|
||||
|
||||
import javax.print.attribute.standard.Media;
|
||||
import javax.print.attribute.standard.MediaPrintableArea;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import xdman.util.Logger;
|
||||
import xdman.util.StringUtils;
|
@ -2,6 +2,7 @@ package xdman.mediaconversion;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -23,7 +24,7 @@ public class FFmpeg {
|
||||
private long totalDuration = 0;
|
||||
private Process proc;
|
||||
private int ffExitCode;
|
||||
private String preset = "ultrafast";
|
||||
//private String preset = "ultrafast";
|
||||
private String volume;
|
||||
private boolean useHwAccel;
|
||||
|
||||
@ -194,7 +195,7 @@ public class FFmpeg {
|
||||
|
||||
ffExitCode = proc.waitFor();
|
||||
return ffExitCode == 0 ? FF_SUCCESS : FF_CONVERSION_FAILED;
|
||||
} catch (Exception e) {
|
||||
} catch (RuntimeException | InterruptedException | IOException e) {
|
||||
return FF_LAUNCH_ERROR;
|
||||
}
|
||||
}
|
@ -259,8 +259,8 @@ public class Format {
|
||||
public String getList(List<String> list) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
boolean first = true;
|
||||
for (String s : list) {
|
||||
if (list != null) {
|
||||
if (list != null) {
|
||||
for (String s : list) {
|
||||
if (!first) {
|
||||
sb.append(" ");
|
||||
}
|
@ -24,7 +24,7 @@ public class FormatLoader {
|
||||
|
||||
while (true) {
|
||||
String ln = br.readLine();
|
||||
if (ln.length() < 1) {
|
||||
if (ln == null||ln.length() < 1) {
|
||||
break;
|
||||
}
|
||||
FormatGroup fg = new FormatGroup();
|
@ -2,12 +2,12 @@ package xdman.mediaconversion;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import xdman.ui.res.StringResource;
|
||||
import xdman.util.StringUtils;
|
||||
|
||||
public class MediaFormats {
|
||||
@ -67,7 +67,7 @@ public class MediaFormats {
|
||||
supportedFormats = list.toArray(supportedFormats);
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (RuntimeException | IOException e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
package xdman.mediaconversion;
|
||||
|
||||
import java.awt.Image;
|
||||
import java.io.File;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -10,7 +8,6 @@ import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import xdman.Config;
|
@ -84,10 +84,10 @@ public class FBHandler {
|
||||
}
|
||||
|
||||
private static ArrayList<String> findURL(String keyword, StringBuffer buf) {
|
||||
int index1 = 0;
|
||||
//int index1 = 0;
|
||||
int index = 0;
|
||||
ArrayList<String> urlList = new ArrayList<String>();
|
||||
String urlStart = ":";// "\"https";
|
||||
//String urlStart = ":";// "\"https";
|
||||
while (true) {
|
||||
index = buf.indexOf(keyword, index);
|
||||
if (index < 0)
|
||||
@ -98,7 +98,7 @@ public class FBHandler {
|
||||
break;
|
||||
}
|
||||
index += 1;
|
||||
int collonIndex = index;
|
||||
//int collonIndex = index;
|
||||
|
||||
while (true) {
|
||||
char ch = buf.charAt(index);
|
@ -36,8 +36,8 @@ public class InstagramHandler {
|
||||
}
|
||||
Matcher matcher = pattern.matcher(buf);
|
||||
if (matcher.find()) {
|
||||
int start = matcher.start();
|
||||
int end = matcher.end();
|
||||
//int start = matcher.start();
|
||||
//int end = matcher.end();
|
||||
String url = matcher.group(1);
|
||||
Logger.log("Url: " + url);
|
||||
HttpMetadata metadata = new HttpMetadata();
|
@ -1,7 +1,6 @@
|
||||
package xdman.monitoring;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import xdman.XDMApp;
|
||||
@ -9,9 +8,6 @@ import xdman.downloaders.hls.HlsPlaylist;
|
||||
import xdman.downloaders.hls.HlsPlaylistItem;
|
||||
import xdman.downloaders.hls.PlaylistParser;
|
||||
import xdman.downloaders.metadata.HlsMetadata;
|
||||
import xdman.downloaders.metadata.HttpMetadata;
|
||||
import xdman.downloaders.metadata.manifests.M3U8Manifest;
|
||||
import xdman.downloaders.metadata.manifests.M3U8Manifest.M3U8MediaInfo;
|
||||
import xdman.util.StringUtils;
|
||||
import xdman.util.XDMUtils;
|
||||
|
@ -9,7 +9,6 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.net.Socket;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -27,14 +26,14 @@ import xdman.network.http.JavaHttpClient;
|
||||
import xdman.preview.FFmpegStream;
|
||||
import xdman.preview.PreviewStream;
|
||||
import xdman.ui.components.VideoPopupItem;
|
||||
import xdman.util.Base64;
|
||||
import xdman.util.FormatUtilities;
|
||||
import xdman.util.Logger;
|
||||
import xdman.util.StringUtils;
|
||||
import xdman.util.XDMUtils;
|
||||
|
||||
public class MonitoringSession implements Runnable {
|
||||
private String msg204 = "HTTP/1.1 204 No Content\r\n" + "Content-length: 0\r\n\r\n";
|
||||
// private String msg204 = "HTTP/1.1 204 No Content\r\n" + "Content-length:
|
||||
// 0\r\n\r\n";
|
||||
|
||||
private Socket sock;
|
||||
private InputStream inStream;
|
||||
@ -397,7 +396,7 @@ public class MonitoringSession implements Runnable {
|
||||
if (metadata instanceof HlsMetadata) {
|
||||
hls = true;
|
||||
}
|
||||
String html = "";
|
||||
// String html = "";
|
||||
// if (dash) {
|
||||
// html = "<html><body><video id=\"myvideo\" width=\"640\" height=\"480\"
|
||||
// controls>\r\n"
|
||||
@ -467,11 +466,11 @@ public class MonitoringSession implements Runnable {
|
||||
|
||||
System.out.println("Finished writing");
|
||||
|
||||
html = "<html><body><video id=\"myvideo\" width=\"640\" height=\"480\" controls>\r\n"
|
||||
+ " <source src=\"http://127.0.0.1:9614/preview/video/"
|
||||
+ (hls ? XDMConstants.HLS : XDMConstants.HTTP) + "/" + metadata.getId() + "\""
|
||||
+ (hls ? "type=\"video/mp2t\"" : "") + " />\r\n" + "</video></body></html>";
|
||||
// }
|
||||
// html = "<html><body><video id=\"myvideo\" width=\"640\" height=\"480\" controls>\r\n"
|
||||
// + " <source src=\"http://127.0.0.1:9614/preview/video/"
|
||||
// + (hls ? XDMConstants.HLS : XDMConstants.HTTP) + "/" + metadata.getId() + "\""
|
||||
// + (hls ? "type=\"video/mp2t\"" : "") + " />\r\n" + "</video></body></html>";
|
||||
// // }
|
||||
|
||||
}
|
||||
} finally {
|
||||
@ -661,7 +660,7 @@ public class MonitoringSession implements Runnable {
|
||||
|
||||
private boolean processVideoManifest(ParsedHookData data) {
|
||||
String url = data.getUrl();
|
||||
String file = data.getFile();
|
||||
// String file = data.getFile();
|
||||
String contentType = data.getContentType();
|
||||
if (contentType == null) {
|
||||
contentType = "";
|
@ -4,7 +4,6 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import xdman.network.http.HeaderCollection;
|
||||
import xdman.util.Logger;
|
||||
|
||||
public class Response {
|
||||
private int code;
|
13
XDM_NEON/xdman/src/main/java/xdman/network/Channel.java
Normal file
13
XDM_NEON/xdman/src/main/java/xdman/network/Channel.java
Normal file
@ -0,0 +1,13 @@
|
||||
//package xdman.network;
|
||||
//
|
||||
//public abstract class Channel {
|
||||
//// private volatile long length, startOff, downloaded;
|
||||
//// private byte[] buf;
|
||||
//// private volatile boolean stopFlag;
|
||||
//
|
||||
// public abstract boolean open();
|
||||
//
|
||||
// protected Channel() {
|
||||
// buf = new byte[8192];
|
||||
// }
|
||||
//}
|
@ -2,8 +2,6 @@ package xdman.network.ftp;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.Authenticator;
|
||||
import java.net.PasswordAuthentication;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
@ -11,7 +9,6 @@ import org.apache.commons.net.ftp.FTPClient;
|
||||
import org.apache.commons.net.ftp.FTPFile;
|
||||
import org.apache.commons.net.ftp.FTPReply;
|
||||
|
||||
import xdman.XDMApp;
|
||||
import xdman.util.Logger;
|
||||
|
||||
public class FtpClient {
|
@ -1,9 +1,9 @@
|
||||
package xdman.network.http;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import xdman.network.ICredentialManager;
|
||||
import xdman.network.ProxyResolver;
|
||||
|
||||
public abstract class HttpClient {
|
||||
protected HeaderCollection requestHeaders;
|
@ -20,7 +20,7 @@ import xdman.util.Logger;
|
||||
public class HttpContext {
|
||||
private boolean init = false;
|
||||
private SSLContext sslContext;
|
||||
private ICredentialManager credentialMgr;
|
||||
// private ICredentialManager credentialMgr;
|
||||
private static HttpContext _this;
|
||||
|
||||
public static HttpContext getInstance() {
|
||||
@ -31,7 +31,7 @@ public class HttpContext {
|
||||
}
|
||||
|
||||
public void registerCredentialManager(ICredentialManager mgr) {
|
||||
credentialMgr = mgr;
|
||||
// credentialMgr = mgr;
|
||||
}
|
||||
|
||||
public SSLContext getSSLContext() {
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user