mirror of
https://github.com/mirror/jdownloader.git
synced 2024-11-26 21:40:38 +00:00
- BunkrAlbum: fixed wrong correction of any file extension when file extension is given and already is video file extension RE forum 91374
git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@49837 ebf7c1c2-ba36-0410-9fe8-c592906822b4 Former-commit-id: acdc3bc053a88acd594c88e5030b01c64f4a10e6
This commit is contained in:
parent
d72b353a4d
commit
601d63e20a
@ -29,6 +29,8 @@ import org.appwork.utils.Regex;
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.appwork.utils.formatter.SizeFormatter;
|
||||
import org.appwork.utils.net.URLHelper;
|
||||
import org.jdownloader.controlling.filter.CompiledFiletypeFilter;
|
||||
import org.jdownloader.controlling.filter.CompiledFiletypeFilter.CompiledFiletypeExtension;
|
||||
import org.jdownloader.plugins.controller.host.HostPluginController;
|
||||
import org.jdownloader.plugins.controller.host.LazyHostPlugin;
|
||||
import org.jdownloader.scripting.JavaScriptEngineFactory;
|
||||
@ -45,6 +47,7 @@ import jd.plugins.DecrypterRetryException.RetryReason;
|
||||
import jd.plugins.DownloadLink;
|
||||
import jd.plugins.FilePackage;
|
||||
import jd.plugins.LinkStatus;
|
||||
import jd.plugins.Plugin;
|
||||
import jd.plugins.PluginException;
|
||||
import jd.plugins.PluginForDecrypt;
|
||||
import jd.plugins.PluginForHost;
|
||||
@ -260,15 +263,23 @@ public class BunkrAlbum extends PluginForDecrypt {
|
||||
final String filenameFromURL = getFileNameFromURL(new URL(url));
|
||||
if (filename != null) {
|
||||
filename = Encoding.htmlDecode(filename).trim();
|
||||
final String fileExtensionNow = Plugin.getFileNameExtensionFromString(filename);
|
||||
/* Add file extension if it is missing */
|
||||
String betterFileExtension = null;
|
||||
if (filenameFromURL != null) {
|
||||
betterFileExtension = getFileNameExtensionFromString(filenameFromURL, null);
|
||||
}
|
||||
final boolean looksLikeVideoFile;
|
||||
if (betterFileExtension == null && url.matches("(?i)https?://[^/]+/v/.+")) {
|
||||
betterFileExtension = ".mp4";
|
||||
looksLikeVideoFile = true;
|
||||
} else {
|
||||
looksLikeVideoFile = false;
|
||||
}
|
||||
if (betterFileExtension != null) {
|
||||
/* Only correct file-type if none is given or type is substantially different (e.g. old is type audio, new is video). */
|
||||
final CompiledFiletypeExtension cfe_old = CompiledFiletypeFilter.getExtensionsFilterInterface(fileExtensionNow);
|
||||
final CompiledFiletypeExtension cfe_new = CompiledFiletypeFilter.getExtensionsFilterInterface(betterFileExtension);
|
||||
if (betterFileExtension != null && looksLikeVideoFile && (cfe_old == null || !cfe_old.isSameExtensionGroup(cfe_new))) {
|
||||
filename = this.correctOrApplyFileNameExtension(filename, betterFileExtension, null);
|
||||
}
|
||||
dl.setProperty(Bunkr.PROPERTY_FILENAME_FROM_ALBUM, filename);
|
||||
|
Loading…
Reference in New Issue
Block a user