Renames variables

This commit is contained in:
Somethingweirdhere 2018-06-05 18:12:18 +02:00
parent 4b134a3b23
commit ee5fcfc412
3 changed files with 32 additions and 17 deletions

View File

@ -29,6 +29,19 @@ subprojects {
}
}
task deleteJar(type: Delete) {
delete 'libs/jars/logmanagementlib.jar'
}
task createJar(type: Copy) {
from('build/intermediates/bundles/release/')
into('libs/jars/')
include('classes.jar')
rename('classes.jar', 'logmanagementlib.jar')
}
createJar.dependsOn(deleteJar, build)
// https://discuss.gradle.org/t/best-approach-gradle-multi-module-project-generate-just-one-global-javadoc/18657/21
task aggregatedJavadocs(type: Javadoc, group: 'Documentation') {
destinationDir = file("$buildDir/docs/javadoc")

View File

@ -8,4 +8,4 @@ dependencies {
implementation 'org.nibor.autolink:autolink:0.8.0'
testImplementation 'junit:junit:4.12'
}
}

View File

@ -159,32 +159,34 @@ public class YoutubeStreamExtractor extends StreamExtractor {
}
private String fixDescriptionLinks(String description) throws ParsingException, UnsupportedEncodingException {
boolean everythingIsFine = true;
boolean continueToNextLink = true;
String descriptionE = java.net.URLDecoder.decode(description, "UTF-8");
Parser.getLinksFromString(descriptionE);
int endlessloop = 0;
while(everythingIsFine) {
int exceptionsThrown = 0;
while(continueToNextLink) {
try {
String[] FirstCut = description.split("<a href=\"",2);
if(FirstCut.length==1) {
everythingIsFine = false;
String[] firstCut = description.split("<a href=\"",2);
if(firstCut.length==1) {
continueToNextLink = false;
}
String Beginning = FirstCut[0];
String[] SecondCut = FirstCut[1].split("\"",2);
String End = SecondCut[1];
if(SecondCut[0].contains("q=")) {
String LinkToBeFixed = SecondCut[0].split("q=")[1].split("&amp")[0];
String Link = java.net.URLDecoder.decode(LinkToBeFixed, "UTF-8");
String beginning = firstCut[0];
String[] secondCut = firstCut[1].split("\"",2);
String end = secondCut[1];
if(secondCut[0].contains("q=")) {
String linkToBeFixed = secondCut[0].split("q=")[1].split("&amp")[0];
String link = java.net.URLDecoder.decode(linkToBeFixed, "UTF-8");
description = Beginning + "<a href=\"" + Link + "\"" + End; //I'm inserting a double space between "<a" and "href" here so the next cut doesn't cut here.
description = beginning + "<a href=\"" + link + "\"" + end; //I'm inserting a double space between "<a" and "href" here so the next cut doesn't cut here.
} else { //Timestamps and other links to youtube videos are processed here
description = Beginning + "<a href=\"" + SecondCut[0] + "\"" + End;
description = beginning + "<a href=\"" + secondCut[0] + "\"" + end;
}
} catch (ArrayIndexOutOfBoundsException | UnsupportedEncodingException end) {
//this means we have run out of Links because there are no more <a href=" to split the text in so the Array has only one Element or that something else went wrong.
endlessloop = endlessloop + 1;
if (endlessloop > 20) everythingIsFine = false;
exceptionsThrown++;
if (exceptionsThrown > 20) continueToNextLink = false;
}
}
return description;