Initial
This commit is contained in:
+8
-11
@@ -13,26 +13,23 @@ public class DownloadList {
|
|||||||
{
|
{
|
||||||
for (File fileNiv1: parentDirectory.listFiles())
|
for (File fileNiv1: parentDirectory.listFiles())
|
||||||
{
|
{
|
||||||
//files.add(file);
|
|
||||||
if (fileNiv1.isDirectory())
|
if (fileNiv1.isDirectory())
|
||||||
{
|
{
|
||||||
downloadList.add(fileNiv1);
|
for (File fileNiv2 : fileNiv1.listFiles()) {
|
||||||
if (fileNiv1.isDirectory()) {
|
if (fileNiv2.isDirectory() && !fileNiv2.getName().equals("Screens")) {
|
||||||
for (File directoryNiv1 : fileNiv1.listFiles()) {
|
downloadList.add(fileNiv2);
|
||||||
if (directoryNiv1.isDirectory() && !directoryNiv1.getName().equals("Screens")) {
|
if (fileNiv2.isDirectory()) {
|
||||||
downloadList.add(directoryNiv1);
|
for (File fileNiv3 : fileNiv2.listFiles()) {
|
||||||
if (directoryNiv1.isDirectory()) {
|
if (!fileNiv3.getName().equals("Screens") && fileNiv3.isDirectory()) {
|
||||||
for (File fileNiv2 : directoryNiv1.listFiles()) {
|
downloadList.add(fileNiv3);
|
||||||
if (!fileNiv2.getName().equals("Screens") && fileNiv2.isDirectory()) {
|
|
||||||
downloadList.add(fileNiv2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}//System.out.println("Dir :"+file.getName());
|
|
||||||
}
|
}
|
||||||
|
downloadList.add(fileNiv1);
|
||||||
}
|
}
|
||||||
//for (File file:downloadList
|
//for (File file:downloadList
|
||||||
// ) {
|
// ) {
|
||||||
|
|||||||
+56
-27
@@ -1,45 +1,74 @@
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Array;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
static ArrayList<File> orphanList = new ArrayList<>();
|
static ArrayList<File> orphanDownloadedTorrentList = new ArrayList<>();
|
||||||
static TorrentList torrentList = new TorrentList();
|
static TorrentList transmission = new TorrentList();
|
||||||
static DownloadList downloadList = new DownloadList();
|
static DownloadList drive = new DownloadList();
|
||||||
static DownloadList copiedList = new DownloadList();
|
static ArrayList<File> downloadedTorrentFiles = new ArrayList<>();
|
||||||
static ArrayList<File> downloadedFiles = 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 {
|
public static void main(String[] args) throws IOException, InterruptedException {
|
||||||
System.out.println("ManageTorrent by SDA Corporation");
|
System.out.println("ManageTorrent by SDA Corporation");
|
||||||
orphanList.clear();
|
/* Vide la liste des torrent orphelins */
|
||||||
downloadedFiles = downloadList.RequestList("\\F:\\var\\lib\\transmission-daemon\\downloads");
|
orphanDownloadedTorrentList.clear();
|
||||||
ArrayList<File> copiedFiles = copiedList.RequestList("\\\\dartydisk6\\downloads");
|
/* 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 -> {
|
/* Etablit la liste des torrents téléchargés pas copiés */
|
||||||
for (File file2 : copiedFiles) {
|
System.out.println("Création de la liste des torrents à copier");
|
||||||
if (file.getName().equals(file2.getName())) {
|
for (File file: downloadedTorrentFiles) {
|
||||||
break;
|
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 {
|
public class TorrentList {
|
||||||
ArrayList<Torrent> torrentArrayList = new ArrayList<>();
|
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");
|
final Process p = Runtime.getRuntime().exec("cmd /c C:\\PROGRA~1\\Transmission\\transmission-remote.exe seedbox.sda.zone:19091 -l");
|
||||||
|
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@@ -48,7 +48,7 @@ public class TorrentList {
|
|||||||
//System.out.println(e);
|
//System.out.println(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Torrent e = new Torrent("name", "status", "ratio");
|
Torrent e = new Torrent(name, status, ratio);
|
||||||
this.torrentArrayList.add(e);
|
this.torrentArrayList.add(e);
|
||||||
//this.torrentArrayList.set(i, new Torrent("name", "status", "ratio"));
|
//this.torrentArrayList.set(i, new Torrent("name", "status", "ratio"));
|
||||||
//System.out.println(line);
|
//System.out.println(line);
|
||||||
@@ -56,5 +56,13 @@ public class TorrentList {
|
|||||||
//System.out.println(status);
|
//System.out.println(status);
|
||||||
//System.out.println(ratio);
|
//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