Initial
This commit is contained in:
+8
-11
@@ -13,26 +13,23 @@ public class DownloadList {
|
||||
{
|
||||
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);
|
||||
for (File fileNiv2 : fileNiv1.listFiles()) {
|
||||
if (fileNiv2.isDirectory() && !fileNiv2.getName().equals("Screens")) {
|
||||
downloadList.add(fileNiv2);
|
||||
if (fileNiv2.isDirectory()) {
|
||||
for (File fileNiv3 : fileNiv2.listFiles()) {
|
||||
if (!fileNiv3.getName().equals("Screens") && fileNiv3.isDirectory()) {
|
||||
downloadList.add(fileNiv3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}//System.out.println("Dir :"+file.getName());
|
||||
}
|
||||
downloadList.add(fileNiv1);
|
||||
}
|
||||
//for (File file:downloadList
|
||||
// ) {
|
||||
|
||||
+56
-27
@@ -1,45 +1,74 @@
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Array;
|
||||
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<>();
|
||||
static ArrayList<File> orphanDownloadedTorrentList = new ArrayList<>();
|
||||
static TorrentList transmission = new TorrentList();
|
||||
static DownloadList drive = new DownloadList();
|
||||
static ArrayList<File> downloadedTorrentFiles = new ArrayList<>();
|
||||
static ArrayList<File> copiedTorrentFiles = new ArrayList<>();
|
||||
static ArrayList<File> notCopiedTorrentFiles = new ArrayList<>();
|
||||
static ArrayList<File> notCopiedPreferedTorrentFiles = new ArrayList<>();
|
||||
static String[] preferedfiles = {"tushy","blacked","blackedraw","tushyraw","bangbus","woodmancasting","private"};
|
||||
|
||||
static boolean find;
|
||||
|
||||
|
||||
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");
|
||||
/* Vide la liste des torrent orphelins */
|
||||
orphanDownloadedTorrentList.clear();
|
||||
/* Construit la liste des torrents téléchargés */
|
||||
System.out.println("Création de la liste des torrents téléchargés");
|
||||
downloadedTorrentFiles = drive.RequestList("\\F:\\var\\lib\\transmission-daemon\\downloads");
|
||||
/* Construit la liste des torrents copiés */
|
||||
System.out.println("Création de la liste des torrents copiés");
|
||||
copiedTorrentFiles = drive.RequestList("\\\\dartydisk6\\downloads");
|
||||
/* Construit la liste des torrents actifs */
|
||||
System.out.println("Création de la liste des torrents actifs");
|
||||
ArrayList<Torrent> activeTorrentList = transmission.RequestList();
|
||||
|
||||
/* Etablit la liste des torrents téléchargés mais plus actifs */
|
||||
System.out.println("Création de la liste des torrents orphelins");
|
||||
for (File file: downloadedTorrentFiles) {
|
||||
if (!transmission.FindTorrentByName(file.getName())) {
|
||||
orphanDownloadedTorrentList.add(file);
|
||||
}
|
||||
}
|
||||
|
||||
orphanDownloadedTorrentList.forEach(file -> {
|
||||
System.out.println("Orphean :" + file.getAbsolutePath());
|
||||
System.out.println("sudo rm -R \""+file.getName()+"\"");
|
||||
});
|
||||
|
||||
orphanList.forEach(file -> {
|
||||
for (File file2 : copiedFiles) {
|
||||
if (file.getName().equals(file2.getName())) {
|
||||
break;
|
||||
/* Etablit la liste des torrents téléchargés pas copiés */
|
||||
System.out.println("Création de la liste des torrents à copier");
|
||||
for (File file: downloadedTorrentFiles) {
|
||||
find = false;
|
||||
for (File copiedFile : copiedTorrentFiles) {
|
||||
if (file.getName().equals(copiedFile.getName())) {
|
||||
find = true;
|
||||
}
|
||||
}
|
||||
System.out.println("Orphean :" + file.getName());
|
||||
if (!find) {
|
||||
notCopiedTorrentFiles.add(file);
|
||||
for (String name : preferedfiles) {
|
||||
if (file.getName().toLowerCase().contains(name)) {
|
||||
notCopiedPreferedTorrentFiles.add(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
notCopiedTorrentFiles.forEach(file -> {
|
||||
System.out.println("Not Copied :" + file.getAbsolutePath());
|
||||
});
|
||||
notCopiedPreferedTorrentFiles.forEach(file -> {
|
||||
System.out.println("Not Copied Prefered :" + file.getAbsolutePath());
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
-2
@@ -6,7 +6,7 @@ import java.util.ArrayList;
|
||||
public class TorrentList {
|
||||
ArrayList<Torrent> torrentArrayList = new ArrayList<>();
|
||||
|
||||
ArrayList RequestList() throws IOException, InterruptedException {
|
||||
ArrayList<Torrent> 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() {
|
||||
@@ -48,7 +48,7 @@ public class TorrentList {
|
||||
//System.out.println(e);
|
||||
return;
|
||||
}
|
||||
Torrent e = new Torrent("name", "status", "ratio");
|
||||
Torrent e = new Torrent(name, status, ratio);
|
||||
this.torrentArrayList.add(e);
|
||||
//this.torrentArrayList.set(i, new Torrent("name", "status", "ratio"));
|
||||
//System.out.println(line);
|
||||
@@ -56,5 +56,13 @@ public class TorrentList {
|
||||
//System.out.println(status);
|
||||
//System.out.println(ratio);
|
||||
}
|
||||
boolean FindTorrentByName (String name) {
|
||||
for (Torrent torrent : this.torrentArrayList) {
|
||||
if(torrent.name.equals(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user