Code cleanup

This commit is contained in:
0xb00bface 2021-12-19 17:55:57 +01:00
parent 923286ae51
commit f439d07229
1 changed files with 53 additions and 62 deletions

View File

@ -20,10 +20,10 @@ import ctbrec.sites.Site;
public interface Model extends Comparable<Model>, Serializable { public interface Model extends Comparable<Model>, Serializable {
public static final long RECORD_INDEFINITELY = 9000000000000000000l; long RECORD_INDEFINITELY = 9000000000000000000L;
public static final int MAX_PRIO = 10_000; int MAX_PRIO = 10_000;
public enum State { enum State {
ONLINE("online"), ONLINE("online"),
OFFLINE("offline"), OFFLINE("offline"),
AWAY("away"), AWAY("away"),
@ -31,7 +31,7 @@ public interface Model extends Comparable<Model>, Serializable {
GROUP("group"), GROUP("group"),
UNKNOWN("unknown"); UNKNOWN("unknown");
String display; final String display;
State(String display) { State(String display) {
this.display = display; this.display = display;
} }
@ -42,71 +42,62 @@ public interface Model extends Comparable<Model>, Serializable {
} }
} }
public String getUrl(); String getUrl();
public void setUrl(String url); void setUrl(String url);
public String getDisplayName(); String getDisplayName();
public void setDisplayName(String name); void setDisplayName(String name);
public String getName(); String getName();
public void setName(String name); void setName(String name);
/** /**
* Returns a name, which is safe to use with the filesystem * Returns a name, which is safe to use with the filesystem
*/ */
public String getSanitizedNamed(); String getSanitizedNamed();
public String getPreview(); String getPreview();
public void setPreview(String preview); void setPreview(String preview);
public List<String> getTags(); List<String> getTags();
public void setTags(List<String> tags); void setTags(List<String> tags);
public String getDescription(); String getDescription();
public void setDescription(String description); void setDescription(String description);
public int getStreamUrlIndex(); int getStreamUrlIndex();
public void setStreamUrlIndex(int streamUrlIndex); void setStreamUrlIndex(int streamUrlIndex);
public boolean isOnline() throws IOException, ExecutionException, InterruptedException; boolean isOnline() throws IOException, ExecutionException, InterruptedException;
/** boolean isOnline(boolean ignoreCache) throws IOException, ExecutionException, InterruptedException;
*
* @param failFast
* If set to true, the method returns immediately and might return false even if the model actually is online
* @return
* @throws IOException
* @throws ExecutionException
* @throws InterruptedException
*/
public boolean isOnline(boolean ignoreCache) throws IOException, ExecutionException, InterruptedException;
public State getOnlineState(boolean failFast) throws IOException, ExecutionException; State getOnlineState(boolean failFast) throws IOException, ExecutionException;
public List<StreamSource> getStreamSources() throws IOException, ExecutionException, ParseException, PlaylistException, JAXBException; List<StreamSource> getStreamSources() throws IOException, ExecutionException, ParseException, PlaylistException, JAXBException;
public void invalidateCacheEntries(); void invalidateCacheEntries();
public void receiveTip(Double tokens) throws IOException; void receiveTip(Double tokens) throws IOException;
public void setLastSeen(Instant timestamp); void setLastSeen(Instant timestamp);
public Instant getLastSeen(); Instant getLastSeen();
public void setLastRecorded(Instant timestamp); void setLastRecorded(Instant timestamp);
public Instant getLastRecorded(); Instant getLastRecorded();
public void setAddedTimestamp(Instant timestamp); void setAddedTimestamp(Instant timestamp);
public Instant getAddedTimestamp(); Instant getAddedTimestamp();
/** /**
* Determines the stream resolution for this model * Determines the stream resolution for this model
@ -118,48 +109,48 @@ public interface Model extends Comparable<Model>, Serializable {
* @return a tupel of width and height represented by an int[2] * @return a tupel of width and height represented by an int[2]
* @throws ExecutionException * @throws ExecutionException
*/ */
public int[] getStreamResolution(boolean failFast) throws ExecutionException; int[] getStreamResolution(boolean failFast) throws ExecutionException;
public boolean follow() throws IOException; boolean follow() throws IOException;
public boolean unfollow() throws IOException; boolean unfollow() throws IOException;
public void setSite(Site site); void setSite(Site site);
public Site getSite(); Site getSite();
public void writeSiteSpecificData(JsonWriter writer) throws IOException; void writeSiteSpecificData(JsonWriter writer) throws IOException;
public void readSiteSpecificData(JsonReader reader) throws IOException; void readSiteSpecificData(JsonReader reader) throws IOException;
public boolean isSuspended(); boolean isSuspended();
public void setSuspended(boolean suspended); void setSuspended(boolean suspended);
public boolean isMarkedForLaterRecording(); boolean isMarkedForLaterRecording();
public void setMarkedForLaterRecording(boolean marked); void setMarkedForLaterRecording(boolean marked);
public Download createDownload(); Download createDownload();
public void setPriority(int priority); void setPriority(int priority);
public int getPriority(); int getPriority();
public HttpHeaderFactory getHttpHeaderFactory(); HttpHeaderFactory getHttpHeaderFactory();
public boolean isRecordingTimeLimited(); boolean isRecordingTimeLimited();
public Instant getRecordUntil(); Instant getRecordUntil();
public void setRecordUntil(Instant instant); void setRecordUntil(Instant instant);
public SubsequentAction getRecordUntilSubsequentAction(); SubsequentAction getRecordUntilSubsequentAction();
public void setRecordUntilSubsequentAction(SubsequentAction action); void setRecordUntilSubsequentAction(SubsequentAction action);
/** /**
* Check, if this model account exists * Check, if this model account exists
* @return true, if it exists, false otherwise * @return true, if it exists, false otherwise
* @throws IOException * @throws IOException
*/ */
public boolean exists() throws IOException; boolean exists() throws IOException;
} }