*Plugins: Fixes/Changes/Maintenance*

- ardmediathek: added missing check in Gebärdensprache/DGS skip condition
- HighWayCore: improved maxChunks handling: evaluate maxChunks property from Account instance too RE https://high-way.me/threads/probleme-mit-dem-usenet.193/page-41#post-80031

git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@49693 ebf7c1c2-ba36-0410-9fe8-c592906822b4

Former-commit-id: 5510a95a5723733db56ca49756390a87ab3f6961
This commit is contained in:
psp 2024-08-31 09:51:45 +00:00
parent 884964cd5a
commit 5bd140c029
2 changed files with 19 additions and 10 deletions

View File

@ -451,7 +451,7 @@ public class Ardmediathek extends PluginForDecrypt {
boolean skippedSignLanguage = false; boolean skippedSignLanguage = false;
for (final Map<String, Object> stream : streams) { for (final Map<String, Object> stream : streams) {
final boolean isSignLanguage = "DGS".equalsIgnoreCase(stream.get("kindName").toString()); final boolean isSignLanguage = "DGS".equalsIgnoreCase(stream.get("kindName").toString());
if (isSignLanguage && !this.cfg.isPreferAudioDescription() && !skippedSignLanguage) { if (isSignLanguage && !this.cfg.isPreferAudioDescription() && streams.size() > 1 && !skippedSignLanguage) {
logger.info("Skipping signLanguage"); logger.info("Skipping signLanguage");
skippedSignLanguage = true; skippedSignLanguage = true;
continue; continue;

View File

@ -375,7 +375,7 @@ public abstract class HighWayCore extends UseNet {
if (account != null) { if (account != null) {
this.login(account, false); this.login(account, false);
} }
dl = jd.plugins.BrowserAdapter.openDownload(br, link, link.getPluginPatternMatcher(), true, this.getMaxChunks(link)); dl = jd.plugins.BrowserAdapter.openDownload(br, link, link.getPluginPatternMatcher(), true, this.getMaxChunks(link, account));
if (!this.looksLikeDownloadableContent(dl.getConnection())) { if (!this.looksLikeDownloadableContent(dl.getConnection())) {
logger.warning("The final dllink seems not to be a file!"); logger.warning("The final dllink seems not to be a file!");
br.followConnection(true); br.followConnection(true);
@ -433,8 +433,8 @@ public abstract class HighWayCore extends UseNet {
} else { } else {
getMultiHosterManagement().runCheck(account, link); getMultiHosterManagement().runCheck(account, link);
boolean resume = account.getBooleanProperty(PROPERTY_ACCOUNT_RESUME, defaultRESUME); boolean resume = account.getBooleanProperty(PROPERTY_ACCOUNT_RESUME, defaultRESUME);
int maxChunks = this.getMaxChunks(link); int maxChunks = this.getMaxChunks(link, account);
/* Look for host specific max chunks limit */ /* Look for host specific connection limits. */
final String thishost = link.getHost(); final String thishost = link.getHost();
synchronized (getMapLock()) { synchronized (getMapLock()) {
final Map<String, Integer> hostMaxchunksMap = getMap(HighWayCore.hostMaxchunksMap); final Map<String, Integer> hostMaxchunksMap = getMap(HighWayCore.hostMaxchunksMap);
@ -708,7 +708,7 @@ public abstract class HighWayCore extends UseNet {
ai.setStatus(StringUtils.valueOfOrNull(accountInfo.get("type")) + " | Remaining today: " + SIZEUNIT.formatValue((SIZEUNIT) CFG_GUI.MAX_SIZE_UNIT.getValue(), trafficLeftToday)); ai.setStatus(StringUtils.valueOfOrNull(accountInfo.get("type")) + " | Remaining today: " + SIZEUNIT.formatValue((SIZEUNIT) CFG_GUI.MAX_SIZE_UNIT.getValue(), trafficLeftToday));
} }
final Map<String, Object> usenetLogins = (Map<String, Object>) accountInfo.get("usenet"); final Map<String, Object> usenetLogins = (Map<String, Object>) accountInfo.get("usenet");
if (this.useApikeyLogin()) { if (this.useApikeyLogin() && usenetLogins != null) {
/* Try to set unique username as user could enter anything in the username field in this case */ /* Try to set unique username as user could enter anything in the username field in this case */
final String uniqueUsername = (String) usenetLogins.get("username"); final String uniqueUsername = (String) usenetLogins.get("username");
if (!StringUtils.isEmpty(uniqueUsername)) { if (!StringUtils.isEmpty(uniqueUsername)) {
@ -780,7 +780,7 @@ public abstract class HighWayCore extends UseNet {
account.setProperty(PROPERTY_ACCOUNT_USENET_PASSWORD, usenetLogins.get("pass")); account.setProperty(PROPERTY_ACCOUNT_USENET_PASSWORD, usenetLogins.get("pass"));
account.setProperty(PROPERTY_ACCOUNT_MAX_DOWNLOADS_USENET, accountInfo.get("usenet_connection")); account.setProperty(PROPERTY_ACCOUNT_MAX_DOWNLOADS_USENET, accountInfo.get("usenet_connection"));
} else { } else {
supportedHosts.remove("Usenet"); supportedHosts.remove("usenet");
account.removeProperty(PROPERTY_ACCOUNT_USENET_USERNAME); account.removeProperty(PROPERTY_ACCOUNT_USENET_USERNAME);
account.removeProperty(PROPERTY_ACCOUNT_USENET_PASSWORD); account.removeProperty(PROPERTY_ACCOUNT_USENET_PASSWORD);
account.removeProperty(PROPERTY_ACCOUNT_MAX_DOWNLOADS_USENET); account.removeProperty(PROPERTY_ACCOUNT_MAX_DOWNLOADS_USENET);
@ -864,15 +864,24 @@ public abstract class HighWayCore extends UseNet {
protected abstract void exceptionAccountInvalid(final Account account) throws PluginException; protected abstract void exceptionAccountInvalid(final Account account) throws PluginException;
private int getMaxChunks(final DownloadLink link) { private int getMaxChunks(final DownloadLink link, final Account account) {
final int maxChunksStored = link.getIntegerProperty(PROPERTY_ACCOUNT_MAXCHUNKS, defaultMAXCHUNKS); /* First look for link specific chunk limit. */
return correctChunks(maxChunksStored); Number maxChunks = (Number) link.getProperty(PROPERTY_ACCOUNT_MAXCHUNKS);
if (maxChunks == null) {
/* Look for account specific chunk limit. */
maxChunks = (Number) account.getProperty(PROPERTY_ACCOUNT_MAXCHUNKS);
if (maxChunks == null) {
/* Fallback to default */
maxChunks = defaultMAXCHUNKS;
}
}
return correctChunks(maxChunks.intValue());
} }
/** Corrects input so that it fits what we use in our plugins. */ /** Corrects input so that it fits what we use in our plugins. */
private int correctChunks(final int maxchunks) { private int correctChunks(final int maxchunks) {
if (maxchunks > 1) { if (maxchunks > 1) {
/* Minus maxChunksStored -> Up to X chunks */ /* Negative number means "up to X chunks". */
return -maxchunks; return -maxchunks;
} else { } else {
return maxchunks; return maxchunks;