mirror of
https://github.com/mirror/jdownloader.git
synced 2024-11-27 05:50:51 +00:00
Property:
-DebugModeOnly, now uses new WeakStringCache WeakStringCache: -optimized String deduplication to avoid two WeakReference per String like in WeakHashMap<String, WeakReference<String>> LinkCollector: -optimized loadFile, use dedicated SimpleMapper without any special Mapper support. reuse ByteArrayOutputStream byteArray -updated save, use dedicated SimpleMapper with disabled String deduplication and disabled PrettyPrint (better zip compression) CrawlingCrawledLink: -helper class to reduce memory consumption as those information are only required/used during Linkcrawling LinkCrawler: -updated getLinkCrawlerLock, avoid hard reference to LinkCrawler instance with static LinkCrawlerLock class. ExtensionController: -added optional support for antishutdown LinkCrawlerBubble/LinkCrawlerBubbleSupport: -removed possible memleak of hard JobLinkCrawler reference AbstractNodePropertiesPanel: -added removeAbstractNodeProperties to remove reference to abstractNodeProperties that may hold Package(s)/Link(s) references DownloadPropertiesBasePanel/LinkgrabberProperties: -updated save to call AbstractNodePropertiesPanel.removeAbstractNodeProperties git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@45477 ebf7c1c2-ba36-0410-9fe8-c592906822b4 Former-commit-id: cee65817d4d2470e9b0d473cb6b8924c9efa83d8
This commit is contained in:
parent
e232b1865f
commit
de91398ae2
BIN
ressourcen/jd/captcha/methods/wcrypt/example.jpg
Normal file
BIN
ressourcen/jd/captcha/methods/wcrypt/example.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
5
ressourcen/jd/captcha/methods/wcrypt/jacinfo.xml
Normal file
5
ressourcen/jd/captcha/methods/wcrypt/jacinfo.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<jDownloader>
|
||||
<method name="wcrypt.com" author="Team" services="wcrypt.com"/>
|
||||
<format type="jpg" letterNum="4" />
|
||||
|
||||
</jDownloader>
|
31
ressourcen/jd/captcha/methods/wcrypt/letters.mth
Normal file
31
ressourcen/jd/captcha/methods/wcrypt/letters.mth
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<jDownloader>
|
||||
<letter bad="0" captchaHash="432f7b3b60c33faa447ef7fb70c7f895" good="13" id="0" value="z">0000000000|0000000000|0000000001|0000000001|1111100001|1111000001|1111000011|1111000111|1110000111|1100001111|1100001111|1100011111|1000010011|1000000000|1000000000|0000000000</letter>
|
||||
<letter bad="0" captchaHash="9ce85d4ed8218d9eff684ac6d86bf0a3" good="7" id="1" value="y">0000111110000|1000011110000|1000011110000|1000011110000|1100001110000|1100001100000|1100001100001|1100001100011|1110001000011|1110000000011|1110000000011|1111000000111|1111000000111|1111000000111|1111000000111|1111000001111|1111100001111|1111100001111|1111000001111|1111100011111|1111000011111|1110000011111</letter>
|
||||
<letter bad="0" captchaHash="5ae9b30c6f8164984bb22b2c5ea95069" good="10" id="2" value="x">000011110001|000011100001|100001100001|110001100011|110001000011|111000000011|111000000111|111000001111|111000001111|111000000111|111000000111|110000000011|110000100001|100001100001|000011110001|000011110000</letter>
|
||||
<letter bad="0" captchaHash="4b9c3eec3dfed1b245ab9dd5ef178be4" good="9" id="3" value="w">00011111110000|00001111110000|10001111110000|10001100100001|10001000100001|10000100110001|10000000100001|10000000000001|10000000000011|11000000000001|10000000000001|11000000000011|11000000000011|11000011000011|11000011000011|11100011000111</letter>
|
||||
<letter bad="0" captchaHash="ba1ab52224a78322550506a3ed99ea98" good="9" id="4" value="v">000111110000|000111110000|000011110000|000011110000|100011110001|100001100001|100001100001|110001100001|110001000011|110000000011|110000000111|111000000111|111000000111|111000000111|111000000111|111100001111</letter>
|
||||
<letter bad="0" captchaHash="5ae9b30c6f8164984bb22b2c5ea95069" good="11" id="5" value="t">1100011111|1100001111|1100001111|1100011111|0000000011|0000000011|0000000011|0000000111|1100001111|1100001111|1100001111|1100001111|1100001111|1100001111|1100001111|1100001111|1100000111|1100000000|1100000000|1111000000</letter>
|
||||
<letter bad="0" captchaHash="7c9728781b0dfc65fa9b3fd6b5a1486a" good="13" id="6" value="s">1110000111|1000000011|1000000001|0000010001|0000110000|0000111111|1000011111|1000000011|1110000001|1111100000|1111110000|1011110000|0000110000|0000100000|1000000000|1100000001</letter>
|
||||
<letter bad="0" captchaHash="7c9728781b0dfc65fa9b3fd6b5a1486a" good="10" id="7" value="r">000011100011|000011000001|000010000000|000000000000|000001110000|000011111111|000011111111|000011111111|000011111111|000011111111|000011111111|000011111111|000011111111|000011111111|000011111111|000011111111</letter>
|
||||
<letter bad="0" captchaHash="4b9c3eec3dfed1b245ab9dd5ef178be4" good="10" id="8" value="q">11100001110000|11000000110000|10000000010000|10000001000000|00000011100001|00000111110000|00001111110000|00001111110000|00001111110001|00001111110000|00001111110000|00000111000000|10000010000000|11000000010000|11000000010000|11100000110000|11111111110000|11111111110000|11111111110000|11111111110000|11111111110000|11111111110001</letter>
|
||||
<letter bad="0" captchaHash="7c9728781b0dfc65fa9b3fd6b5a1486a" good="13" id="9" value="p">0000110000111|0000100000011|0000000000011|0000000000001|0000001100001|0000011110000|0000111110000|0000111110000|0000111110000|0000111110000|0000111110000|0000011100000|0000000000001|0000000000001|0000100000001|0000110000111|0000111111111|0000111111111|0000111111111|0000111111111|0000111111111|0000111111111</letter>
|
||||
<letter bad="0" captchaHash="5ae9b30c6f8164984bb22b2c5ea95069" good="11" id="10" value="n">000111000011|000010000001|000010000001|000000000000|000000110000|000001110000|000011111000|000011110000|000011110000|000011110000|000011110000|000011110000|000011110000|000011110000|000011110000|000011110000</letter>
|
||||
<letter bad="0" captchaHash="6b2cbc6fd51c495ff40dbceb8fbaa9e6" good="11" id="11" value="m">00001011110011|00000001100001|00000000000001|00000000000000|00000000010000|00001000110000|00001000110000|00001000111000|00001000110000|00001000110000|00001000111000|00001000110000|00001000110000|00011000110000|00001000110000|00001000110000</letter>
|
||||
<letter bad="0" captchaHash="ba1ab52224a78322550506a3ed99ea98" good="12" id="12" value="k">000011111111|000011111111|000011111111|000011111111|000011111111|000111111111|000011111111|000011110001|000011100001|000011000001|000011000001|000010000011|000010000111|000000000111|000000001111|000000001111|000000000111|000000000111|000000000111|000011000011|000011100001|000011100001|000011100000</letter>
|
||||
<letter bad="0" captchaHash="5ae9b30c6f8164984bb22b2c5ea95069" good="9" id="13" value="j">10000000|10000000|10000000|10010000|11110000|11110000|11110000|11110000|11110000|11110000|11110000|11110000|11110000|11110000|11110000|11110000|11110000|11110000|00000000|00000000|00000000|00000011</letter>
|
||||
<letter bad="0" captchaHash="ba1ab52224a78322550506a3ed99ea98" good="10" id="14" value="h">000011111111|000011111111|000011111111|000011111111|000011111111|000011111111|000011111111|000111000111|000010000001|000000000001|000000000001|000001100000|000011110000|000011110000|000011110000|000011110000|000011110000|000011110000|000011110000|000011110000|000011110000|000011110000|000011110000</letter>
|
||||
<letter bad="0" captchaHash="6da19a88f6654d12d5c732b41eee9f31" good="9" id="15" value="g">1110000110000|1100000010000|1100000010000|1000000000000|0000001100000|0000011110000|0000111110000|0000111110000|0000111110000|0000111110000|0000111110000|1000111100000|1000000000000|1100000000000|1100000000000|1111000010000|1111111110000|1011111100000|1001111100001|0000000000001|1000000000001|1111000000011</letter>
|
||||
<letter bad="0" captchaHash="7c9728781b0dfc65fa9b3fd6b5a1486a" good="16" id="16" value="f">11111000000|11100000000|11100000000|11000000111|11000001111|11000011111|11000011111|00000000111|00000000111|00000000111|11000000111|11000001111|11000011111|11000011111|11000011111|11000011111|11000011111|11000011111|11000111111|11000111111|11000011111|11000011111|11000011111</letter>
|
||||
<letter bad="0" captchaHash="0486a20283fc9180f8d6f2c7adedca1b" good="8" id="17" value="d">11111111110000|11111111110000|11111111110000|11111111110000|11111111110000|11111111110000|11111111110000|11100001110000|11100000110000|11000000010000|10000000000000|10000011100000|00000111100000|00001111110000|00001111110000|00001111110001|00001111110000|10000111110000|10000111100001|10000010010000|10000000010000|11000000010000|11110000110000</letter>
|
||||
<letter bad="0" captchaHash="9eebce14bc8314837b622f9f6b1787ff" good="10" id="18" value="c">111110000111|111000000001|110000000001|100000000001|100000111011|100001111111|000001111111|000011111111|000011111111|000011111111|000011111111|000001111011|100000000001|100000000000|111000000000|111100000001</letter>
|
||||
<letter bad="0" captchaHash="4b9c3eec3dfed1b245ab9dd5ef178be4" good="17" id="19" value="b">0001111111111|0000111111111|0000111111111|0000111111111|0001111111111|0000111111111|0000111111111|0000110001111|0000100000011|0000100000001|0000000000001|0000001100001|0000011110000|0000111110000|0000111110000|0000111110000|0000111110000|0000111110000|0000011100001|0000001000001|0000100000001|0000100000011|0000111000011</letter>
|
||||
<letter bad="0" captchaHash="6da19a88f6654d12d5c732b41eee9f31" good="17" id="20" value="9">1111100010111|1100000000111|1100000000011|1000000000001|1000011100000|0000111110000|0000111110000|0000111110000|0000111110000|1000011110000|1000001000001|1000000000001|1100000000001|1111000000001|1111111000011|1111110000111|1111100000111|1111100000111|1111000001111|1111000011111|1110000011111|1110000111111|1100000111111</letter>
|
||||
<letter bad="0" captchaHash="9eebce14bc8314837b622f9f6b1787ff" good="12" id="21" value="8">111110001111|110000000011|100000000001|100000000000|000000110000|000001110000|000011110000|000011110000|100001100000|110000000001|111000000001|110000000011|100000100001|100001110000|000001110000|000011110000|000011110000|000011110000|100011100000|100000000000|110000000001|110000000001|111100000111</letter>
|
||||
<letter bad="0" captchaHash="9eebce14bc8314837b622f9f6b1787ff" good="8" id="22" value="7">00000000000|00000000000|00000000000|00000110000|11111110001|11111110001|11111100001|11111100001|11111000011|11111000011|11110000011|11110000111|11110000111|11110000111|11100000111|11100001111|11100001111|11000011111|11000011111|11000011111|11000111111|10000111111|00000111111</letter>
|
||||
<letter bad="0" captchaHash="0486a20283fc9180f8d6f2c7adedca1b" good="9" id="23" value="6">111111000011|111111000011|111110000011|111100000111|111100000111|111100001111|111000001111|111000011111|110000011111|110000001111|100000000011|100000000001|000000000000|000001110000|000011110000|000011110000|000011110000|000011110000|100011100000|100000100000|110000000001|110000000001|111100000111</letter>
|
||||
<letter bad="0" captchaHash="432f7b3b60c33faa447ef7fb70c7f895" good="9" id="24" value="5">1000000000011|1000000000001|1000000000001|1000000000001|1000011111111|1000011111111|1000011111111|1000011111111|1000010000111|1000000000011|1000000000001|1000000000001|1000000000000|1111111110000|1111111110000|1111111110000|1111111110000|1100111110000|0000011100000|1000000000000|1000000000001|1100000000011|1111000000111</letter>
|
||||
<letter bad="0" captchaHash="7c9728781b0dfc65fa9b3fd6b5a1486a" good="15" id="25" value="4">111110000001|111110000001|111100000001|111100000001|111100000001|111100100001|111000100001|111001100001|111001100001|110001100001|110011100001|100011100001|100011100001|000011100001|000110100000|000000000000|000000000000|000000000000|111111100000|111111100001|111111100001|111111100001|111111100001</letter>
|
||||
<letter bad="0" captchaHash="7c9728781b0dfc65fa9b3fd6b5a1486a" good="17" id="26" value="3">1111000011111|1100000000111|1000000000011|0000000000011|1000011110001|1111111110001|1111111110001|1111111110001|1111111100011|1111111000011|1111111000011|1111111000111|1111111000001|1111111100001|1111111110001|1001111110000|0000111110000|0000111100000|1000011100000|1000001000001|1000000000001|1100000000011|1111100001111</letter>
|
||||
<letter bad="0" captchaHash="5ae9b30c6f8164984bb22b2c5ea95069" good="8" id="27" value="2">111000001111|110000000011|100000000001|000000000000|100000100000|000001110000|000011110000|111111110000|111111110000|111111110000|111111100000|111111000001|111110000001|111110000011|111110000111|111100000111|111100001111|111000001111|111000011111|110000000000|110000000000|100000000000|000000000000</letter>
|
||||
</jDownloader>
|
54
ressourcen/jd/captcha/methods/wcrypt/script.jas
Normal file
54
ressourcen/jd/captcha/methods/wcrypt/script.jas
Normal file
@ -0,0 +1,54 @@
|
||||
#####-------------------------------------JAC-Script------------------------------------#####
|
||||
##### Dieses Script beinhaltet alle Parameter und Funktioenen die für die captcha #####
|
||||
##### erkennung nötig sind #####
|
||||
#####################################---mooshare.net---######################################
|
||||
##############Set parameter
|
||||
|
||||
param.simplifyFaktor = 1;
|
||||
param.trainOnlyUnknown=true;
|
||||
param.colorType = RGB;
|
||||
|
||||
|
||||
param.borderVarianceX=5;
|
||||
param.borderVarianceY=5;
|
||||
param.scanVarianceX=5;
|
||||
param.scanVarianceY=5;
|
||||
|
||||
param.intersectionDimensionWeight=6.0;
|
||||
|
||||
param.scanAngleLeft=0;
|
||||
param.scanAngleRight=0;
|
||||
param.scanAngleSteps=0;
|
||||
|
||||
param.errorAWeight=4;
|
||||
param.errorBWeight=4;
|
||||
|
||||
param.coverageFaktorAWeight=1;
|
||||
param.coverageFaktorBWeight=0.2;
|
||||
|
||||
param.LetterSearchLimitPerfectPercent=5;
|
||||
param.quickScanReliabilityLimit=3.0;
|
||||
param.quickScanValityLimit=20.0;
|
||||
param.preScanFilter=100;
|
||||
param.preScanFaktor=3;
|
||||
param.preScanEmergencyFilter=80;
|
||||
|
||||
param.multiplePartMergeMinSize=0;
|
||||
param.useObjectDetection = true;
|
||||
param.objectColorContrast = 0.3;
|
||||
param.objectDetectionContrast = 0.5;
|
||||
param.relativecontrast=0.85;
|
||||
param.usepeakgapdetection=true;
|
||||
param.useaveragegapdetection=true;
|
||||
param.minimumObjectArea=30;
|
||||
param.minimumLetterWidth=20;
|
||||
param.splitPixelObjectsOverlap=0;
|
||||
param.splitGapsOverlap=0;
|
||||
|
||||
|
||||
|
||||
##################Prepare captcha Funktionen
|
||||
captcha.prepare.toBlackAndWhite(0.35);
|
||||
captcha.prepare.removeSmallObjects(0.4,0.5,10);
|
||||
captcha.prepare.reduceWhiteNoise(2,0.1);
|
||||
captcha.prepare.clean();
|
BIN
ressourcen/libs/laf/radiance-neon-3.0.0.jar
Normal file
BIN
ressourcen/libs/laf/radiance-neon-3.0.0.jar
Normal file
Binary file not shown.
BIN
ressourcen/libs/laf/radiance-substance-3.0.0.jar
Normal file
BIN
ressourcen/libs/laf/radiance-substance-3.0.0.jar
Normal file
Binary file not shown.
BIN
ressourcen/libs/laf/radiance-trident-3.0.0.jar
Normal file
BIN
ressourcen/libs/laf/radiance-trident-3.0.0.jar
Normal file
Binary file not shown.
BIN
ressourcen/libs/rhino.jar
Normal file
BIN
ressourcen/libs/rhino.jar
Normal file
Binary file not shown.
3
ressourcen/libs/rhino.jar.info
Normal file
3
ressourcen/libs/rhino.jar.info
Normal file
@ -0,0 +1,3 @@
|
||||
https://github.com/mozilla/rhino
|
||||
Rhino is licensed under the MPL 2.0. https://github.com/mozilla/rhino/blob/master/LICENSE.txt
|
||||
https://mvnrepository.com/artifact/org.mozilla/rhino/1.7.13
|
@ -28,6 +28,7 @@ import java.util.WeakHashMap;
|
||||
import org.appwork.exceptions.WTFException;
|
||||
import org.appwork.storage.JSonStorage;
|
||||
import org.appwork.storage.TypeRef;
|
||||
import org.appwork.utils.DebugMode;
|
||||
|
||||
/**
|
||||
* Von dieser Klasse kann abgeleitet werden wenn die Neue Klasse Properties unterstützen soll. Die SimpleGUI elemente nutzen das um einfache
|
||||
@ -37,22 +38,29 @@ import org.appwork.storage.TypeRef;
|
||||
*
|
||||
*/
|
||||
public class Property implements Serializable {
|
||||
private final static WeakHashMap<String, WeakReference<String>> DEDUPEMAP = new WeakHashMap<String, WeakReference<String>>();
|
||||
private final static WeakHashMap<String, WeakReference<String>> DEDUPEMAP = new WeakHashMap<String, WeakReference<String>>();
|
||||
private final static WeakStringCache DEDUPECACHE = new WeakStringCache();
|
||||
|
||||
public static String dedupeString(String string) {
|
||||
if (string != null) {
|
||||
synchronized (DEDUPEMAP) {
|
||||
String ret = null;
|
||||
WeakReference<String> ref = DEDUPEMAP.get(string);
|
||||
if (ref != null && (ret = ref.get()) != null) {
|
||||
return ret;
|
||||
if (DebugMode.TRUE_IN_IDE_ELSE_FALSE) {
|
||||
synchronized (DEDUPECACHE) {
|
||||
return DEDUPECACHE.cache(string);
|
||||
}
|
||||
} else {
|
||||
synchronized (DEDUPEMAP) {
|
||||
String ret = null;
|
||||
WeakReference<String> ref = DEDUPEMAP.get(string);
|
||||
if (ref != null && (ret = ref.get()) != null) {
|
||||
return ret;
|
||||
}
|
||||
ref = new WeakReference<String>(string);
|
||||
DEDUPEMAP.put(string, ref);
|
||||
return string;
|
||||
}
|
||||
ref = new WeakReference<String>(string);
|
||||
DEDUPEMAP.put(string, ref);
|
||||
return string;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
return string;
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,6 +273,33 @@ public class Property implements Serializable {
|
||||
return def;
|
||||
}
|
||||
|
||||
public int getPropertiesSize() {
|
||||
if (NEWIMPLEMENTATION != null) {
|
||||
synchronized (NEWIMPLEMENTATION) {
|
||||
final Object[] propertiesList = this.propertiesList;
|
||||
int size = 0;
|
||||
if (propertiesList != null) {
|
||||
final int length = propertiesList.length;
|
||||
for (int index = 0; index < length; index += 2) {
|
||||
if (propertiesList[index] != null) {
|
||||
size++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
} else {
|
||||
final HashMap<String, Object> lInternal = properties;
|
||||
if (lInternal == null || lInternal.size() == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
synchronized (lInternal) {
|
||||
return lInternal.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a copy of the internal Map
|
||||
*
|
||||
|
183
src/jd/config/WeakStringCache.java
Normal file
183
src/jd/config/WeakStringCache.java
Normal file
@ -0,0 +1,183 @@
|
||||
package jd.config;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.ReferenceQueue;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.appwork.utils.StringUtils;
|
||||
|
||||
public class WeakStringCache {
|
||||
private ReferenceQueue<String> queue = new ReferenceQueue<String>();
|
||||
|
||||
protected class WeakStringCacheEntry extends WeakReference<String> {
|
||||
protected final long entryHash;
|
||||
|
||||
protected WeakStringCacheEntry(String referent) {
|
||||
super(referent, queue);
|
||||
entryHash = WeakStringCache.this.entryHash(referent);
|
||||
}
|
||||
|
||||
protected WeakStringCacheEntry(String referent, final long entryHash) {
|
||||
super(referent, queue);
|
||||
this.entryHash = entryHash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(entryHash);
|
||||
}
|
||||
|
||||
protected int getStringLength() {
|
||||
return WeakStringCache.this.getStringLength(entryHash);
|
||||
}
|
||||
}
|
||||
|
||||
protected class WeakStringCacheEntries extends ArrayList<WeakStringCacheEntry> {
|
||||
protected final int stringLength;
|
||||
|
||||
protected WeakStringCacheEntries(int stringLength) {
|
||||
this.stringLength = stringLength;
|
||||
}
|
||||
}
|
||||
|
||||
protected long entryHash(final String string) {
|
||||
final int hash = string.hashCode();
|
||||
final int length = string.length();
|
||||
final long ret = (((long) hash) << 32) | (length & 0xffffffffL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
protected int getStringHash(long entryHash) {
|
||||
return (int) (entryHash >> 32);
|
||||
}
|
||||
|
||||
protected int getStringLength(long entryHash) {
|
||||
return (int) entryHash;
|
||||
}
|
||||
|
||||
private List<WeakStringCacheEntries> entries = new ArrayList<WeakStringCacheEntries>();
|
||||
private long cacheSize = 0;
|
||||
|
||||
protected int compare(long x, long y) {
|
||||
return (x < y) ? -1 : ((x == y) ? 0 : 1);
|
||||
}
|
||||
|
||||
private WeakStringCacheEntries getWeakStringCacheEntries(final int stringLength) {
|
||||
int min = 0;
|
||||
int max = entries.size() - 1;
|
||||
int mid = 0;
|
||||
while (min <= max) {
|
||||
mid = (max + min) / 2;
|
||||
final WeakStringCacheEntries midEntry = entries.get(mid);
|
||||
final int comp = compare(stringLength, midEntry.stringLength);
|
||||
if (min == max) {
|
||||
if (stringLength == midEntry.stringLength) {
|
||||
return midEntry;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (comp < 0) {
|
||||
// searchFor is smaller
|
||||
max = mid;
|
||||
} else if (comp > 0) {
|
||||
// searchFor is larger
|
||||
min = mid + 1;
|
||||
} else {
|
||||
return midEntry;
|
||||
}
|
||||
}
|
||||
final WeakStringCacheEntries ret;
|
||||
entries.add(ret = new WeakStringCacheEntries(stringLength));
|
||||
Collections.sort(entries, new Comparator<WeakStringCacheEntries>() {
|
||||
@Override
|
||||
public int compare(WeakStringCacheEntries o1, WeakStringCacheEntries o2) {
|
||||
return WeakStringCache.this.compare(o1.stringLength, o2.stringLength);
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
public String cache(final String string) {
|
||||
clean();
|
||||
final long searchFor = entryHash(string);
|
||||
final int searchForLength = string.length();
|
||||
final WeakStringCacheEntries entries = getWeakStringCacheEntries(searchForLength);
|
||||
int min = 0;
|
||||
int max = entries.size() - 1;
|
||||
int mid = 0;
|
||||
// int search = 0;
|
||||
int next = 0;
|
||||
while (min <= max) {
|
||||
mid = (max + min) / 2;
|
||||
WeakStringCacheEntry midEntry = entries.get(mid);
|
||||
final int comp = compare(searchFor, midEntry.entryHash);
|
||||
// search++;
|
||||
if (min == max) {
|
||||
final String midValue = midEntry.get();
|
||||
if (StringUtils.equals(string, midValue)) {
|
||||
// System.out.println("hit a \t" + search + " size:" + entries.size() + "/" + cacheSize + " length:" + searchForLength);
|
||||
return midValue;
|
||||
} else {
|
||||
// System.out.println("add a \t" + search + "\t" + next + " size:" + entries.size() + "/" + cacheSize + " length:" +
|
||||
// searchForLength);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (comp < 0) {
|
||||
// searchFor is smaller
|
||||
max = mid;
|
||||
} else if (comp > 0) {
|
||||
// searchFor is larger
|
||||
min = mid + 1;
|
||||
} else {
|
||||
// searchFor matches
|
||||
while (mid <= max && midEntry.entryHash == searchFor) {
|
||||
midEntry = entries.get(mid++);
|
||||
final String midValue = midEntry.get();
|
||||
if (StringUtils.equals(string, midValue)) {
|
||||
// System.out.println("hit b \t" + search + "\t" + next + " size:" + entries.size() + "/" + cacheSize + " length:" +
|
||||
// searchForLength);
|
||||
return midValue;
|
||||
} else {
|
||||
next = next++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// System.out.println("add b \t" + search + "\t" + next + " size:" + entries.size() + "/" + cacheSize + " length:" +
|
||||
// searchForLength);
|
||||
cacheSize = cacheSize + 1;
|
||||
entries.add(min, new WeakStringCacheEntry(string, searchFor));
|
||||
Collections.sort(entries, new Comparator<WeakStringCacheEntry>() {
|
||||
@Override
|
||||
public int compare(WeakStringCacheEntry o1, WeakStringCacheEntry o2) {
|
||||
return WeakStringCache.this.compare(o1.entryHash, o2.entryHash);
|
||||
}
|
||||
});
|
||||
return string;
|
||||
}
|
||||
|
||||
private void clean() {
|
||||
Reference<? extends String> purge;
|
||||
while ((purge = this.queue.poll()) != null) {
|
||||
final WeakStringCacheEntry entry = (WeakStringCacheEntry) purge;
|
||||
final Iterator<WeakStringCacheEntry> it = getWeakStringCacheEntries(entry.getStringLength()).iterator();
|
||||
while (it.hasNext()) {
|
||||
final WeakStringCacheEntry next = it.next();
|
||||
if (purge == next) {
|
||||
cacheSize = cacheSize - 1;
|
||||
//
|
||||
it.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package jd.controlling.linkcollector;
|
||||
import java.awt.Toolkit;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
@ -11,6 +12,7 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@ -81,12 +83,13 @@ import org.appwork.shutdown.ShutdownEvent;
|
||||
import org.appwork.shutdown.ShutdownRequest;
|
||||
import org.appwork.shutdown.ShutdownVetoException;
|
||||
import org.appwork.shutdown.ShutdownVetoListener;
|
||||
import org.appwork.storage.JSonStorage;
|
||||
import org.appwork.storage.SimpleMapper;
|
||||
import org.appwork.storage.TypeRef;
|
||||
import org.appwork.storage.config.JsonConfig;
|
||||
import org.appwork.storage.config.ValidationException;
|
||||
import org.appwork.storage.config.events.GenericConfigEventListener;
|
||||
import org.appwork.storage.config.handler.KeyHandler;
|
||||
import org.appwork.storage.simplejson.JSonFactory;
|
||||
import org.appwork.uio.UIOManager;
|
||||
import org.appwork.utils.Application;
|
||||
import org.appwork.utils.DebugMode;
|
||||
@ -2062,6 +2065,21 @@ public class LinkCollector extends PackageController<CrawledPackage, CrawledLink
|
||||
if (file != null && file.exists()) {
|
||||
FileInputStream fis = null;
|
||||
ZipInputStream zis = null;
|
||||
final SimpleMapper mapper = new SimpleMapper() {
|
||||
@Override
|
||||
protected JSonFactory newJsonFactory(String jsonString) {
|
||||
return new JSonFactory(jsonString) {
|
||||
@Override
|
||||
protected java.util.WeakHashMap<String, java.lang.ref.WeakReference<String>> getDedupeMap() {
|
||||
return null;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initMapper() {
|
||||
}
|
||||
};
|
||||
try {
|
||||
fis = new FileInputStream(file);
|
||||
zis = new ZipInputStream(new BufferedInputStream(fis, 1 * 1024 * 1024));
|
||||
@ -2116,6 +2134,13 @@ public class LinkCollector extends PackageController<CrawledPackage, CrawledLink
|
||||
};
|
||||
int entries = 0;
|
||||
final Pattern entryType = Pattern.compile("(\\d+)(?:_(\\d+))?|extraInfo", Pattern.CASE_INSENSITIVE);
|
||||
final ByteArrayOutputStream bos = new ByteArrayOutputStream() {
|
||||
@Override
|
||||
public synchronized byte[] toByteArray() {
|
||||
return buf;
|
||||
};
|
||||
};
|
||||
final Charset UTF8 = Charset.forName("UTF-8");
|
||||
while ((entry = zis.getNextEntry()) != null) {
|
||||
try {
|
||||
entries++;
|
||||
@ -2130,7 +2155,9 @@ public class LinkCollector extends PackageController<CrawledPackage, CrawledLink
|
||||
loadedPackage = new LoadedPackage();
|
||||
packageMap.put(packageIndex, loadedPackage);
|
||||
}
|
||||
final CrawledLinkStorable storable = JSonStorage.getMapper().inputStreamToObject(entryInputStream, crawledLinkStorable);
|
||||
bos.reset();
|
||||
IO.readStream((int) entry.getSize(), entryInputStream, bos);
|
||||
final CrawledLinkStorable storable = mapper.stringToObject(new String(bos.toByteArray(), 0, bos.size(), UTF8), crawledLinkStorable);
|
||||
if (storable != null) {
|
||||
loadedPackage.crawledLinks.put(childIndex, storable._getCrawledLink());
|
||||
} else {
|
||||
@ -2139,7 +2166,9 @@ public class LinkCollector extends PackageController<CrawledPackage, CrawledLink
|
||||
} else if (entryName.group(1) != null) {
|
||||
// \\d+ CrawledPackageStorable
|
||||
final Integer packageIndex = Integer.valueOf(entry.getName());
|
||||
final CrawledPackageStorable storable = JSonStorage.getMapper().inputStreamToObject(entryInputStream, crawledPackageStorable);
|
||||
bos.reset();
|
||||
IO.readStream((int) entry.getSize(), entryInputStream, bos);
|
||||
final CrawledPackageStorable storable = mapper.stringToObject(new String(bos.toByteArray(), 0, bos.size(), UTF8), crawledPackageStorable);
|
||||
if (storable != null) {
|
||||
LoadedPackage loadedPackage = packageMap.get(packageIndex);
|
||||
if (loadedPackage == null) {
|
||||
@ -2155,7 +2184,7 @@ public class LinkCollector extends PackageController<CrawledPackage, CrawledLink
|
||||
}
|
||||
} else {
|
||||
// extraInfo
|
||||
lcs = JSonStorage.getMapper().inputStreamToObject(entryInputStream, linkCollectorStorable);
|
||||
lcs = mapper.inputStreamToObject(entryInputStream, linkCollectorStorable);
|
||||
}
|
||||
}
|
||||
} catch (final Throwable e) {
|
||||
@ -2269,6 +2298,26 @@ public class LinkCollector extends PackageController<CrawledPackage, CrawledLink
|
||||
file = Application.getResource("cfg/linkcollector.zip");
|
||||
}
|
||||
}
|
||||
final SimpleMapper mapper = new SimpleMapper() {
|
||||
@Override
|
||||
protected JSonFactory newJsonFactory(String jsonString) {
|
||||
return new JSonFactory(jsonString) {
|
||||
@Override
|
||||
protected java.util.WeakHashMap<String, java.lang.ref.WeakReference<String>> getDedupeMap() {
|
||||
return null;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initMapper() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrettyPrintEnabled() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
boolean deleteFile = true;
|
||||
ZipOutputStream zos = null;
|
||||
FileOutputStream fos = null;
|
||||
@ -2357,8 +2406,10 @@ public class LinkCollector extends PackageController<CrawledPackage, CrawledLink
|
||||
}
|
||||
final ZipEntry packageEntry = new ZipEntry(packageEntryID);
|
||||
packageEntry.setMethod(ZipEntry.DEFLATED);
|
||||
final byte[] entryBytes = mapper.objectToByteArray(packageStorable);
|
||||
packageEntry.setSize(entryBytes.length);
|
||||
zos.putNextEntry(packageEntry);
|
||||
JSonStorage.getMapper().writeObject(entryOutputStream, packageStorable);
|
||||
entryOutputStream.write(entryBytes);
|
||||
zos.closeEntry();
|
||||
}
|
||||
final String childFormat;
|
||||
@ -2387,8 +2438,10 @@ public class LinkCollector extends PackageController<CrawledPackage, CrawledLink
|
||||
final String childEntryID = String.format(childFormat, childIndex++);
|
||||
final ZipEntry linkEntry = new ZipEntry(packageEntryID + "_" + childEntryID);
|
||||
linkEntry.setMethod(ZipEntry.DEFLATED);
|
||||
final byte[] entryBytes = mapper.objectToByteArray(linkStorable);
|
||||
linkEntry.setSize(entryBytes.length);
|
||||
zos.putNextEntry(linkEntry);
|
||||
JSonStorage.getMapper().writeObject(entryOutputStream, linkStorable);
|
||||
entryOutputStream.write(entryBytes);
|
||||
zos.closeEntry();
|
||||
}
|
||||
}
|
||||
@ -2409,7 +2462,7 @@ public class LinkCollector extends PackageController<CrawledPackage, CrawledLink
|
||||
final ZipEntry linkCollectorEntry = new ZipEntry("extraInfo");
|
||||
linkCollectorEntry.setMethod(ZipEntry.DEFLATED);
|
||||
zos.putNextEntry(linkCollectorEntry);
|
||||
JSonStorage.getMapper().writeObject(entryOutputStream, lcs);
|
||||
mapper.writeObject(entryOutputStream, lcs);
|
||||
zos.closeEntry();
|
||||
zos.close();
|
||||
zos = null;
|
||||
|
132
src/jd/controlling/linkcrawler/CrawlingCrawledLink.java
Normal file
132
src/jd/controlling/linkcrawler/CrawlingCrawledLink.java
Normal file
@ -0,0 +1,132 @@
|
||||
package jd.controlling.linkcrawler;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import jd.config.Property;
|
||||
import jd.controlling.linkcollector.LinkCollectingInformation;
|
||||
import jd.controlling.linkcollector.LinkCollectingJob;
|
||||
|
||||
import org.appwork.scheduler.DelayedRunnable;
|
||||
import org.jdownloader.controlling.filter.FilterRule;
|
||||
|
||||
public class CrawlingCrawledLink extends Property {
|
||||
private final static WeakHashMap<CrawledLink, CrawlingCrawledLink> MAP = new WeakHashMap<CrawledLink, CrawlingCrawledLink>();
|
||||
private final static DelayedRunnable CLEANUP = new DelayedRunnable(10 * 1000, 30 * 3000) {
|
||||
@Override
|
||||
public void delayedrun() {
|
||||
synchronized (MAP) {
|
||||
if (MAP.size() > 0) {
|
||||
CLEANUP.resetAndStart();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
protected static CrawlingCrawledLink get(final CrawledLink crawledLink, final boolean createIfNotExists) {
|
||||
synchronized (MAP) {
|
||||
CrawlingCrawledLink ret = MAP.get(crawledLink);
|
||||
if (ret == null && createIfNotExists) {
|
||||
ret = new CrawlingCrawledLink();
|
||||
MAP.put(crawledLink, ret);
|
||||
CLEANUP.resetAndStart();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public UnknownCrawledLinkHandler getUnknownHandler() {
|
||||
return (UnknownCrawledLinkHandler) getProperty(UnknownCrawledLinkHandler.class.getName());
|
||||
}
|
||||
|
||||
public void setUnknownHandler(UnknownCrawledLinkHandler unknownHandler) {
|
||||
setProperty(UnknownCrawledLinkHandler.class.getName(), unknownHandler);
|
||||
}
|
||||
|
||||
public CrawledLinkModifier getModifyHandler() {
|
||||
return (CrawledLinkModifier) getProperty(CrawledLinkModifier.class.getName());
|
||||
}
|
||||
|
||||
public void setModifyHandler(CrawledLinkModifier modifyHandler) {
|
||||
setProperty(CrawledLinkModifier.class.getName(), modifyHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setProperty(String key, Object value) {
|
||||
synchronized (MAP) {
|
||||
final boolean ret = super.setProperty(key, value);
|
||||
if (getPropertiesSize() == 0) {
|
||||
final Iterator<Entry<CrawledLink, CrawlingCrawledLink>> it = MAP.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
final Entry<CrawledLink, CrawlingCrawledLink> next = it.next();
|
||||
if (next.getValue() == this) {
|
||||
it.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public BrokenCrawlerHandler getBrokenCrawlerHandler() {
|
||||
return (BrokenCrawlerHandler) getProperty(BrokenCrawlerHandler.class.getName());
|
||||
}
|
||||
|
||||
public void setBrokenCrawlerHandler(BrokenCrawlerHandler brokenCrawlerHandler) {
|
||||
setProperty(BrokenCrawlerHandler.class.getName(), brokenCrawlerHandler);
|
||||
}
|
||||
|
||||
public PackageInfo getDesiredPackageInfo() {
|
||||
return (PackageInfo) getProperty(PackageInfo.class.getName());
|
||||
}
|
||||
|
||||
public void setDesiredPackageInfo(PackageInfo desiredPackageInfo) {
|
||||
setProperty(PackageInfo.class.getName(), desiredPackageInfo);
|
||||
}
|
||||
|
||||
public LinkCollectingInformation getCollectingInfo() {
|
||||
return (LinkCollectingInformation) getProperty(LinkCollectingInformation.class.getName());
|
||||
}
|
||||
|
||||
public void setCollectingInfo(LinkCollectingInformation collectingInfo) {
|
||||
setProperty(LinkCollectingInformation.class.getName(), collectingInfo);
|
||||
}
|
||||
|
||||
public FilterRule getMatchingFilter() {
|
||||
return (FilterRule) getProperty(FilterRule.class.getName());
|
||||
}
|
||||
|
||||
public void setMatchingFilter(FilterRule matchingFilter) {
|
||||
setProperty(FilterRule.class.getName(), matchingFilter);
|
||||
}
|
||||
|
||||
public CrawledLink getSourceLink() {
|
||||
return (CrawledLink) getProperty(CrawledLink.class.getName());
|
||||
}
|
||||
|
||||
public void setSourceLink(CrawledLink sourceLink) {
|
||||
setProperty(CrawledLink.class.getName(), sourceLink);
|
||||
}
|
||||
|
||||
public LinkCrawlerRule getMatchingRule() {
|
||||
return (LinkCrawlerRule) getProperty(LinkCrawlerRule.class.getName());
|
||||
}
|
||||
|
||||
public void setMatchingRule(LinkCrawlerRule matchingRule) {
|
||||
setProperty(LinkCrawlerRule.class.getName(), matchingRule);
|
||||
}
|
||||
|
||||
public static WeakHashMap<CrawledLink, CrawlingCrawledLink> getMap() {
|
||||
return MAP;
|
||||
}
|
||||
|
||||
public LinkCollectingJob getSourceJob() {
|
||||
return (LinkCollectingJob) getProperty(LinkCollectingJob.class.getName());
|
||||
}
|
||||
|
||||
public void setSourceJob(LinkCollectingJob sourceJob) {
|
||||
setProperty(LinkCollectingJob.class.getName(), sourceJob);
|
||||
}
|
||||
}
|
@ -32,6 +32,28 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import jd.controlling.linkcollector.LinkCollectingJob;
|
||||
import jd.controlling.linkcollector.LinkCollector.JobLinkCrawler;
|
||||
import jd.controlling.linkcollector.LinknameCleaner;
|
||||
import jd.controlling.linkcrawler.LinkCrawlerConfig.DirectHTTPPermission;
|
||||
import jd.http.Browser;
|
||||
import jd.http.Request;
|
||||
import jd.http.URLConnectionAdapter;
|
||||
import jd.http.requests.PostRequest;
|
||||
import jd.nutils.encoding.Encoding;
|
||||
import jd.parser.html.Form;
|
||||
import jd.parser.html.HTMLParser;
|
||||
import jd.parser.html.HTMLParser.HtmlParserCharSequence;
|
||||
import jd.parser.html.HTMLParser.HtmlParserResultSet;
|
||||
import jd.plugins.CryptedLink;
|
||||
import jd.plugins.DownloadLink;
|
||||
import jd.plugins.FilePackage;
|
||||
import jd.plugins.Plugin;
|
||||
import jd.plugins.PluginForDecrypt;
|
||||
import jd.plugins.PluginForHost;
|
||||
import jd.plugins.PluginsC;
|
||||
import jd.plugins.hoster.DirectHTTP;
|
||||
|
||||
import org.appwork.exceptions.WTFException;
|
||||
import org.appwork.net.protocol.http.HTTPConstants;
|
||||
import org.appwork.scheduler.DelayedRunnable;
|
||||
@ -67,28 +89,6 @@ import org.jdownloader.plugins.controller.host.HostPluginController;
|
||||
import org.jdownloader.plugins.controller.host.LazyHostPlugin;
|
||||
import org.jdownloader.settings.GeneralSettings;
|
||||
|
||||
import jd.controlling.linkcollector.LinkCollectingJob;
|
||||
import jd.controlling.linkcollector.LinkCollector.JobLinkCrawler;
|
||||
import jd.controlling.linkcollector.LinknameCleaner;
|
||||
import jd.controlling.linkcrawler.LinkCrawlerConfig.DirectHTTPPermission;
|
||||
import jd.http.Browser;
|
||||
import jd.http.Request;
|
||||
import jd.http.URLConnectionAdapter;
|
||||
import jd.http.requests.PostRequest;
|
||||
import jd.nutils.encoding.Encoding;
|
||||
import jd.parser.html.Form;
|
||||
import jd.parser.html.HTMLParser;
|
||||
import jd.parser.html.HTMLParser.HtmlParserCharSequence;
|
||||
import jd.parser.html.HTMLParser.HtmlParserResultSet;
|
||||
import jd.plugins.CryptedLink;
|
||||
import jd.plugins.DownloadLink;
|
||||
import jd.plugins.FilePackage;
|
||||
import jd.plugins.Plugin;
|
||||
import jd.plugins.PluginForDecrypt;
|
||||
import jd.plugins.PluginForHost;
|
||||
import jd.plugins.PluginsC;
|
||||
import jd.plugins.hoster.DirectHTTP;
|
||||
|
||||
public class LinkCrawler {
|
||||
private static enum DISTRIBUTE {
|
||||
STOP,
|
||||
@ -211,6 +211,31 @@ public class LinkCrawler {
|
||||
}
|
||||
}
|
||||
|
||||
protected static class CrawlerPluginLinkCrawlerLock extends LinkCrawlerLock {
|
||||
private final LazyCrawlerPlugin plugin;
|
||||
private final String pluginID;
|
||||
|
||||
protected CrawlerPluginLinkCrawlerLock(final LazyCrawlerPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
pluginID = getPluginID(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(LazyCrawlerPlugin plugin, CrawledLink crawledLink) {
|
||||
return StringUtils.equals(pluginID, getPluginID(plugin));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return pluginID + "|" + maxConcurrency();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int maxConcurrency() {
|
||||
return Math.max(1, plugin.getMaxConcurrentInstances());
|
||||
}
|
||||
}
|
||||
|
||||
protected LinkCrawlerLock getLinkCrawlerLock(final LazyCrawlerPlugin plugin, final CrawledLink crawledLink) {
|
||||
synchronized (LOCKS) {
|
||||
LinkCrawlerLock ret = null;
|
||||
@ -220,24 +245,7 @@ public class LinkCrawler {
|
||||
}
|
||||
}
|
||||
if (ret == null) {
|
||||
ret = new LinkCrawlerLock() {
|
||||
private final String pluginID = getPluginID(plugin);
|
||||
|
||||
@Override
|
||||
public boolean matches(LazyCrawlerPlugin plugin, CrawledLink crawledLink) {
|
||||
return StringUtils.equals(pluginID, getPluginID(plugin));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return pluginID + "|" + maxConcurrency();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int maxConcurrency() {
|
||||
return Math.max(1, plugin.getMaxConcurrentInstances());
|
||||
}
|
||||
};
|
||||
ret = new CrawlerPluginLinkCrawlerLock(plugin);
|
||||
LOCKS.put(getRoot(), ret);
|
||||
}
|
||||
return ret;
|
||||
|
@ -36,6 +36,7 @@ import org.appwork.uio.CloseReason;
|
||||
import org.appwork.uio.ConfirmDialogInterface;
|
||||
import org.appwork.uio.UIOManager;
|
||||
import org.appwork.utils.Application;
|
||||
import org.appwork.utils.DebugMode;
|
||||
import org.appwork.utils.Exceptions;
|
||||
import org.appwork.utils.IO;
|
||||
import org.appwork.utils.StringUtils;
|
||||
@ -206,8 +207,7 @@ public class ExtensionController implements MenuExtenderHandler {
|
||||
optionalExtensions.add(new OptionalExtension("folderwatch", IconKey.ICON_FOLDER_ADD, _GUI.T.ExtensionController_initUninstalledExtensions_FolderWatchExtension(), _GUI.T.ExtensionController_initUninstalledExtensions_FolderWatchExtension_description(), lazyExtensionsMap.get(getClassname("folderwatch"))));
|
||||
optionalExtensions.add(new OptionalExtension("scheduler", IconKey.ICON_WAIT, _GUI.T.ExtensionController_initUninstalledExtensions_SchedulerExtension(), _GUI.T.ExtensionController_initUninstalledExtensions_SchedulerExtension_description(), lazyExtensionsMap.get(getClassname("scheduler"))));
|
||||
optionalExtensions.add(new OptionalExtension("shutdown", IconKey.ICON_LOGOUT, _GUI.T.ExtensionController_initUninstalledExtensions_ShutdownExtension(), _GUI.T.ExtensionController_initUninstalledExtensions_ShutdownExtension_description(), lazyExtensionsMap.get(getClassname("shutdown"))));
|
||||
if (false && (CrossSystem.isWindows() || CrossSystem.isMac())) {
|
||||
// not finished yet
|
||||
if (CrossSystem.isWindows() || CrossSystem.isMac() || DebugMode.TRUE_IN_IDE_ELSE_FALSE) {
|
||||
optionalExtensions.add(new OptionalExtension("antishutdown", IconKey.ICON_SETTINGS, _GUI.T.ExtensionController_initUninstalledExtensions_AntiShutdownExtension(), _GUI.T.ExtensionController_initUninstalledExtensions_AntiShutdownExtension_description(), lazyExtensionsMap.get(getClassname("antishutdown"))));
|
||||
}
|
||||
if (!Application.isHeadless()) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.jdownloader.gui.notify.linkcrawler;
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
@ -23,7 +24,6 @@ import org.jdownloader.gui.translate._GUI;
|
||||
import org.jdownloader.settings.GraphicalUserInterfaceSettings;
|
||||
|
||||
public class LinkCrawlerBubble extends AbstractNotifyWindow<LinkCrawlerBubbleContent> {
|
||||
|
||||
@Override
|
||||
protected void onMouseClicked(MouseEvent m) {
|
||||
super.onMouseClicked(m);
|
||||
@ -38,15 +38,15 @@ public class LinkCrawlerBubble extends AbstractNotifyWindow<LinkCrawlerBubbleCon
|
||||
ConfigurationView.getInstance().setSelectedSubPanel(BubbleNotifyConfigPanel.class);
|
||||
}
|
||||
|
||||
private final JobLinkCrawler crawler;
|
||||
private final WeakReference<JobLinkCrawler> crawler;
|
||||
|
||||
public JobLinkCrawler getCrawler() {
|
||||
return crawler;
|
||||
private JobLinkCrawler getCrawler() {
|
||||
return crawler.get();
|
||||
}
|
||||
|
||||
public LinkCrawlerBubble(LinkCrawlerBubbleSupport linkCrawlerBubbleSupport, JobLinkCrawler crawler) {
|
||||
super(linkCrawlerBubbleSupport, _GUI.T.balloon_new_links(), new LinkCrawlerBubbleContent(crawler));
|
||||
this.crawler = crawler;
|
||||
this.crawler = new WeakReference<JobLinkCrawler>(crawler);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -59,17 +59,16 @@ public class LinkCrawlerBubble extends AbstractNotifyWindow<LinkCrawlerBubbleCon
|
||||
}
|
||||
|
||||
private final DelayedRunnable update = new DelayedRunnable(TaskQueue.TIMINGQUEUE, 500l, 1000l) {
|
||||
@Override
|
||||
public String getID() {
|
||||
return "LinkCrawlerBubble";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return "LinkCrawlerBubble";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delayedrun() {
|
||||
delayedUpdate();
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public void delayedrun() {
|
||||
delayedUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
private final void delayedUpdate() {
|
||||
final JobLinkCrawler jlc = getCrawler();
|
||||
@ -106,7 +105,6 @@ public class LinkCrawlerBubble extends AbstractNotifyWindow<LinkCrawlerBubbleCon
|
||||
}
|
||||
getContentComponent().update(jlc);
|
||||
new EDTRunner() {
|
||||
|
||||
@Override
|
||||
protected void runInEDT() {
|
||||
pack();
|
||||
|
@ -2,6 +2,7 @@ package org.jdownloader.gui.notify.linkcrawler;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.WeakHashMap;
|
||||
@ -28,7 +29,6 @@ import org.jdownloader.gui.notify.gui.CFG_BUBBLE;
|
||||
import org.jdownloader.gui.translate._GUI;
|
||||
|
||||
public class LinkCrawlerBubbleSupport extends AbstractBubbleSupport implements LinkCollectorListener {
|
||||
|
||||
private final ArrayList<Element> elements = new ArrayList<Element>();
|
||||
private final BubbleNotifyConfig.LINKGRABBER_BUBBLE_NOTIFY_ON notifyOn = JsonConfig.create(BubbleNotifyConfig.class).getBubbleNotifyOnNewLinkgrabberLinksOn();
|
||||
private final boolean registerOnPlugin = BubbleNotifyConfig.LINKGRABBER_BUBBLE_NOTIFY_ON.PLUGIN.equals(notifyOn);
|
||||
@ -40,25 +40,24 @@ public class LinkCrawlerBubbleSupport extends AbstractBubbleSupport implements L
|
||||
}
|
||||
|
||||
private class LinkCrawlerBubbleWrapper implements AbstractNotifyWindowFactory, LinkCollectorCrawlerListener {
|
||||
|
||||
private volatile JobLinkCrawler crawler = null;
|
||||
private volatile LinkCrawlerBubble bubble = null;
|
||||
private final AtomicBoolean registered = new AtomicBoolean(false);
|
||||
private final WeakReference<JobLinkCrawler> crawler;
|
||||
private volatile LinkCrawlerBubble bubble = null;
|
||||
private final AtomicBoolean registered = new AtomicBoolean(false);
|
||||
|
||||
private LinkCrawlerBubbleWrapper(JobLinkCrawler crawler) {
|
||||
this.crawler = crawler;
|
||||
this.crawler = new WeakReference<JobLinkCrawler>(crawler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNotifyWindow<?> buildAbstractNotifyWindow() {
|
||||
final JobLinkCrawler crawler = this.crawler.get();
|
||||
if (bubble == null && crawler != null) {
|
||||
final LinkCrawlerBubble finalBubble = new LinkCrawlerBubble(LinkCrawlerBubbleSupport.this, crawler);
|
||||
final Timer t = new Timer(1000, new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (finalBubble.isClosed() || finalBubble.isDisposed()) {
|
||||
crawler = null;
|
||||
LinkCrawlerBubbleWrapper.this.crawler.clear();
|
||||
bubble = null;
|
||||
finalBubble.getContentComponent().stop();
|
||||
((Timer) e.getSource()).stop();
|
||||
@ -66,8 +65,8 @@ public class LinkCrawlerBubbleSupport extends AbstractBubbleSupport implements L
|
||||
if (finalBubble.isVisible()) {
|
||||
finalBubble.requestUpdate();
|
||||
}
|
||||
if (finalBubble.getContentComponent().askForClose(finalBubble.getCrawler())) {
|
||||
crawler = null;
|
||||
if (finalBubble.getContentComponent().askForClose(crawler)) {
|
||||
LinkCrawlerBubbleWrapper.this.crawler.clear();
|
||||
bubble = null;
|
||||
finalBubble.getContentComponent().stop();
|
||||
((Timer) e.getSource()).stop();
|
||||
@ -75,7 +74,6 @@ public class LinkCrawlerBubbleSupport extends AbstractBubbleSupport implements L
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
t.setInitialDelay(0);
|
||||
t.setRepeats(true);
|
||||
@ -87,8 +85,11 @@ public class LinkCrawlerBubbleSupport extends AbstractBubbleSupport implements L
|
||||
|
||||
private void register() {
|
||||
if (registered.compareAndSet(false, true)) {
|
||||
crawler.getEventSender().removeListener(this);
|
||||
show(this);
|
||||
final JobLinkCrawler crawler = this.crawler.get();
|
||||
if (crawler != null) {
|
||||
crawler.getEventSender().removeListener(this);
|
||||
show(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,7 +111,6 @@ public class LinkCrawlerBubbleSupport extends AbstractBubbleSupport implements L
|
||||
register();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -137,7 +137,6 @@ public class LinkCrawlerBubbleSupport extends AbstractBubbleSupport implements L
|
||||
|
||||
@Override
|
||||
public void onLinkCrawlerStarted(LinkCollectorCrawler parameter) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -194,5 +193,4 @@ public class LinkCrawlerBubbleSupport extends AbstractBubbleSupport implements L
|
||||
@Override
|
||||
public void onLinkCrawlerFinished() {
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -98,6 +98,15 @@ public abstract class AbstractNodePropertiesPanel<E extends AbstractNodeProperti
|
||||
return abstractNodeProperties;
|
||||
}
|
||||
|
||||
public void removeAbstractNodeProperties() {
|
||||
new EDTRunner() {
|
||||
@Override
|
||||
protected void runInEDT() {
|
||||
abstractNodeProperties = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected void setAbstractNodeProperties(final E abstractNodeProperties) {
|
||||
new EDTRunner() {
|
||||
@Override
|
||||
@ -475,7 +484,7 @@ public abstract class AbstractNodePropertiesPanel<E extends AbstractNodeProperti
|
||||
}
|
||||
|
||||
protected void onHidden() {
|
||||
save();
|
||||
setAbstractNodeProperties(null);
|
||||
}
|
||||
|
||||
protected void onShowing() {
|
||||
@ -714,18 +723,8 @@ public abstract class AbstractNodePropertiesPanel<E extends AbstractNodeProperti
|
||||
if (checksum.getParent() != null) {
|
||||
String cs = checksum.getText();
|
||||
cs = cs.replaceAll("\\[.*?\\]", "").trim();
|
||||
final HashInfo hashInfo;
|
||||
if (cs.length() == 8) {
|
||||
hashInfo = HashInfo.newInstanceSafe(cs, HashInfo.TYPE.CRC32);
|
||||
} else if (cs.length() == 32) {
|
||||
hashInfo = HashInfo.newInstanceSafe(cs, HashInfo.TYPE.MD5);
|
||||
} else if (cs.length() == 40) {
|
||||
hashInfo = HashInfo.newInstanceSafe(cs, HashInfo.TYPE.SHA1);
|
||||
} else if (cs.length() == 64) {
|
||||
hashInfo = HashInfo.newInstanceSafe(cs, HashInfo.TYPE.SHA256);
|
||||
} else if (cs.length() == 128) {
|
||||
hashInfo = HashInfo.newInstanceSafe(cs, HashInfo.TYPE.SHA512);
|
||||
} else {
|
||||
HashInfo hashInfo = HashInfo.parse(cs, true, false);
|
||||
if (hashInfo == null) {
|
||||
hashInfo = new HashInfo("", HashInfo.TYPE.NONE, true, true);
|
||||
}
|
||||
abstractNodes.saveHashInfo(hashInfo);
|
||||
|
@ -4,17 +4,16 @@ import java.awt.Dimension;
|
||||
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import jd.controlling.packagecontroller.AbstractNode;
|
||||
import jd.plugins.DownloadLink;
|
||||
import jd.plugins.FilePackage;
|
||||
|
||||
import org.appwork.swing.MigPanel;
|
||||
import org.jdownloader.gui.views.downloads.table.DownloadsTable;
|
||||
import org.jdownloader.settings.staticreferences.CFG_GUI;
|
||||
import org.jdownloader.updatev2.gui.LAFOptions;
|
||||
|
||||
import jd.controlling.packagecontroller.AbstractNode;
|
||||
import jd.plugins.DownloadLink;
|
||||
import jd.plugins.FilePackage;
|
||||
|
||||
public class DownloadPropertiesBasePanel extends MigPanel {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -80,9 +79,13 @@ public class DownloadPropertiesBasePanel extends MigPanel {
|
||||
public void save() {
|
||||
if (linkPanel.isVisible()) {
|
||||
linkPanel.save();
|
||||
} else if (pkgPanel.isVisible()) {
|
||||
} else {
|
||||
linkPanel.removeAbstractNodeProperties();
|
||||
}
|
||||
if (pkgPanel.isVisible()) {
|
||||
pkgPanel.save();
|
||||
} else {
|
||||
pkgPanel.removeAbstractNodeProperties();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,17 +4,16 @@ import java.awt.Dimension;
|
||||
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import jd.controlling.linkcrawler.CrawledLink;
|
||||
import jd.controlling.linkcrawler.CrawledPackage;
|
||||
import jd.controlling.packagecontroller.AbstractNode;
|
||||
|
||||
import org.appwork.swing.MigPanel;
|
||||
import org.jdownloader.gui.views.linkgrabber.LinkGrabberTable;
|
||||
import org.jdownloader.settings.staticreferences.CFG_GUI;
|
||||
import org.jdownloader.updatev2.gui.LAFOptions;
|
||||
|
||||
import jd.controlling.linkcrawler.CrawledLink;
|
||||
import jd.controlling.linkcrawler.CrawledPackage;
|
||||
import jd.controlling.packagecontroller.AbstractNode;
|
||||
|
||||
public class LinkgrabberProperties extends MigPanel {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -64,8 +63,6 @@ public class LinkgrabberProperties extends MigPanel {
|
||||
linkPanel.setSelectedItem(null);
|
||||
pkgPanel.setSelectedItem(null);
|
||||
}
|
||||
// System.out.println("UPDATE");
|
||||
// new Exception().printStackTrace();
|
||||
}
|
||||
|
||||
public void fillPopup(JPopupMenu pu) {
|
||||
@ -84,9 +81,13 @@ public class LinkgrabberProperties extends MigPanel {
|
||||
public void save() {
|
||||
if (linkPanel.isVisible()) {
|
||||
linkPanel.save();
|
||||
} else if (pkgPanel.isVisible()) {
|
||||
} else {
|
||||
linkPanel.removeAbstractNodeProperties();
|
||||
}
|
||||
if (pkgPanel.isVisible()) {
|
||||
pkgPanel.save();
|
||||
} else {
|
||||
pkgPanel.removeAbstractNodeProperties();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user