Don't try to log in twice
This commit is contained in:
parent
7f3bedd3a1
commit
c445e48d6d
|
@ -66,7 +66,10 @@ public class Cam4 extends AbstractSite {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getTokenBalance() throws IOException {
|
public Integer getTokenBalance() throws IOException {
|
||||||
return 0;
|
if (!credentialsAvailable()) {
|
||||||
|
throw new IOException("Not logged in");
|
||||||
|
}
|
||||||
|
return ((Cam4HttpClient)getHttpClient()).getTokenBalance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,7 +24,11 @@ public class Cam4HttpClient extends HttpClient {
|
||||||
private static final transient Logger LOG = LoggerFactory.getLogger(Cam4HttpClient.class);
|
private static final transient Logger LOG = LoggerFactory.getLogger(Cam4HttpClient.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean login() throws IOException {
|
public synchronized boolean login() throws IOException {
|
||||||
|
if(loggedIn) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
BlockingQueue<Boolean> queue = new LinkedBlockingQueue<>();
|
BlockingQueue<Boolean> queue = new LinkedBlockingQueue<>();
|
||||||
|
|
||||||
Runnable showDialog = () -> {
|
Runnable showDialog = () -> {
|
||||||
|
@ -94,4 +98,12 @@ public class Cam4HttpClient extends HttpClient {
|
||||||
}
|
}
|
||||||
cookieJar.saveFromResponse(origUrl, cookies);
|
cookieJar.saveFromResponse(origUrl, cookies);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected int getTokenBalance() throws IOException {
|
||||||
|
if(!loggedIn) {
|
||||||
|
login();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new RuntimeException("Not implemented, yet");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,14 +124,13 @@ public class Cam4Model extends AbstractModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidateCacheEntries() {
|
public void invalidateCacheEntries() {
|
||||||
// TODO Auto-generated method stub
|
resolution = null;
|
||||||
|
playlistUrl = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receiveTip(int tokens) throws IOException {
|
public void receiveTip(int tokens) throws IOException {
|
||||||
// TODO Auto-generated method stub
|
throw new RuntimeException("Not implemented for Cam4, yet");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue