Initial
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
|||||||
|
### IntelliJ IDEA ###
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
||||||
Generated
+3
@@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
Generated
+15
@@ -0,0 +1,15 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="commons-io-2.13.0">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$USER_HOME$/Downloads/commons-io-2.13.0-bin/commons-io-2.13.0/commons-io-2.13.0.jar!/" />
|
||||||
|
<root url="jar://$USER_HOME$/Downloads/commons-io-2.13.0-bin/commons-io-2.13.0/commons-io-2.13.0-tests.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$USER_HOME$/Downloads/commons-io-2.13.0-bin/commons-io-2.13.0/commons-io-2.13.0-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$USER_HOME$/Downloads/commons-io-2.13.0-bin/commons-io-2.13.0/commons-io-2.13.0-test-sources.jar!/" />
|
||||||
|
<root url="jar://$USER_HOME$/Downloads/commons-io-2.13.0-bin/commons-io-2.13.0/commons-io-2.13.0-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_14" default="true" project-jdk-name="14" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/ManageTorrent.iml" filepath="$PROJECT_DIR$/ManageTorrent.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="commons-io-2.13.0" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
public class Download {
|
||||||
|
String name;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import java.util.ArrayList;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
|
||||||
|
public class DownloadList {
|
||||||
|
private ArrayList<File> downloadList;
|
||||||
|
|
||||||
|
ArrayList<File> RequestList(String path)
|
||||||
|
{
|
||||||
|
File parentDirectory = new File(path);
|
||||||
|
downloadList = new ArrayList<>();
|
||||||
|
if (parentDirectory.exists() && parentDirectory.isDirectory())
|
||||||
|
{
|
||||||
|
for (File fileNiv1: parentDirectory.listFiles())
|
||||||
|
{
|
||||||
|
//files.add(file);
|
||||||
|
if (fileNiv1.isDirectory())
|
||||||
|
{
|
||||||
|
downloadList.add(fileNiv1);
|
||||||
|
if (fileNiv1.isDirectory()) {
|
||||||
|
for (File directoryNiv1 : fileNiv1.listFiles()) {
|
||||||
|
if (directoryNiv1.isDirectory() && !directoryNiv1.getName().equals("Screens")) {
|
||||||
|
downloadList.add(directoryNiv1);
|
||||||
|
if (directoryNiv1.isDirectory()) {
|
||||||
|
for (File fileNiv2 : directoryNiv1.listFiles()) {
|
||||||
|
if (!fileNiv2.getName().equals("Screens") && fileNiv2.isDirectory()) {
|
||||||
|
downloadList.add(fileNiv2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}//System.out.println("Dir :"+file.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//for (File file:downloadList
|
||||||
|
// ) {
|
||||||
|
// System.out.println(file.getName());
|
||||||
|
//}
|
||||||
|
//System.out.println(files[0].getName());
|
||||||
|
}
|
||||||
|
return downloadList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
|
||||||
|
static ArrayList<File> orphanList = new ArrayList<>();
|
||||||
|
static TorrentList torrentList = new TorrentList();
|
||||||
|
static DownloadList downloadList = new DownloadList();
|
||||||
|
static DownloadList copiedList = new DownloadList();
|
||||||
|
static ArrayList<File> downloadedFiles = new ArrayList<>();
|
||||||
|
|
||||||
|
public static void main(String[] args) throws IOException, InterruptedException {
|
||||||
|
System.out.println("ManageTorrent by SDA Corporation");
|
||||||
|
orphanList.clear();
|
||||||
|
downloadedFiles = downloadList.RequestList("\\F:\\var\\lib\\transmission-daemon\\downloads");
|
||||||
|
ArrayList<File> copiedFiles = copiedList.RequestList("\\\\dartydisk6\\downloads");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
orphanList.forEach(file -> {
|
||||||
|
for (File file2 : copiedFiles) {
|
||||||
|
if (file.getName().equals(file2.getName())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("Orphean :" + file.getName());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ListTorrents() throws IOException, InterruptedException {
|
||||||
|
ArrayList<Torrent> torrentDownloadedList = torrentList.RequestList();
|
||||||
|
|
||||||
|
for (File file:downloadedFiles
|
||||||
|
) {
|
||||||
|
for (Torrent torrent:torrentDownloadedList
|
||||||
|
) {
|
||||||
|
if (file.getName().equals(torrent.name)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
orphanList.add(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
public class Torrent {
|
||||||
|
String name;
|
||||||
|
String status;
|
||||||
|
String ratio;
|
||||||
|
|
||||||
|
|
||||||
|
public Torrent(String name, String status, String ratio) {
|
||||||
|
this.name = name;
|
||||||
|
this.status = status;
|
||||||
|
this.ratio = ratio;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class TorrentList {
|
||||||
|
ArrayList<Torrent> torrentArrayList = new ArrayList<>();
|
||||||
|
|
||||||
|
ArrayList RequestList() throws IOException, InterruptedException {
|
||||||
|
final Process p = Runtime.getRuntime().exec("cmd /c C:\\PROGRA~1\\Transmission\\transmission-remote.exe seedbox.sda.zone:19091 -l");
|
||||||
|
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||||
|
String line = null;
|
||||||
|
Integer i=0;
|
||||||
|
try {
|
||||||
|
while ((line = input.readLine()) != null)
|
||||||
|
AddTorrentToList(line,i);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
p.waitFor();
|
||||||
|
return this.torrentArrayList;
|
||||||
|
}
|
||||||
|
void AddTorrentToList(String line, Integer i) {
|
||||||
|
String name = null;
|
||||||
|
String ratio = null;
|
||||||
|
String status = null;
|
||||||
|
try {
|
||||||
|
ratio = line.substring(51,58);
|
||||||
|
} catch (StringIndexOutOfBoundsException e) {
|
||||||
|
//System.out.println(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
status = line.substring(59,65);
|
||||||
|
} catch (StringIndexOutOfBoundsException e) {
|
||||||
|
//System.out.println(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
name = line.substring(72);
|
||||||
|
} catch (StringIndexOutOfBoundsException e) {
|
||||||
|
//System.out.println(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Torrent e = new Torrent("name", "status", "ratio");
|
||||||
|
this.torrentArrayList.add(e);
|
||||||
|
//this.torrentArrayList.set(i, new Torrent("name", "status", "ratio"));
|
||||||
|
//System.out.println(line);
|
||||||
|
//System.out.println(name + " " + status + " " + ratio);
|
||||||
|
//System.out.println(status);
|
||||||
|
//System.out.println(ratio);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user