ctbrec-5.3.2-experimental/client/src/main/java/ctbrec/ui/sites/stripchat/StripchatTabProvider.java

60 lines
2.2 KiB
Java

package ctbrec.ui.sites.stripchat;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import ctbrec.recorder.Recorder;
import ctbrec.sites.stripchat.Stripchat;
import ctbrec.ui.tabs.TabProvider;
import ctbrec.ui.tabs.ThumbOverviewTab;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
public class StripchatTabProvider extends TabProvider {
private String urlTemplate;
private Stripchat stripchat;
private Recorder recorder;
StripchatFollowedTab followedTab;
public StripchatTabProvider(Stripchat stripchat) {
this.stripchat = stripchat;
this.recorder = stripchat.getRecorder();
followedTab = new StripchatFollowedTab("Followed", stripchat);
urlTemplate = stripchat.getBaseUrl() + "/api/front/models?primaryTag={0}&sortBy=viewersRating&withMixedTags=true&parentTag=";
}
@Override
public List<Tab> getTabs(Scene scene) {
List<Tab> tabs = new ArrayList<>();
tabs.add(createTab("Girls", MessageFormat.format(urlTemplate, "girls")));
tabs.add(createTab("Girls HD", stripchat.getBaseUrl() + "/api/front/models?primaryTag=girls&filterGroupTags=%5B%5B%22autoTagHd%22%5D%5D&parentTag=autoTagHd"));
tabs.add(createTab("New Girls", stripchat.getBaseUrl() +"/api/front/models?primaryTag=girls&filterGroupTags=%5B%5B%22autoTagNew%22%5D%5D&parentTag=autoTagNew"));
tabs.add(createTab("Couples", MessageFormat.format(urlTemplate, "couples")));
tabs.add(createTab("Boys", MessageFormat.format(urlTemplate, "men")));
tabs.add(createTab("Trans", MessageFormat.format(urlTemplate, "trans")));
followedTab.setRecorder(recorder);
followedTab.setScene(scene);
followedTab.setImageAspectRatio(9.0 / 16.0);
tabs.add(followedTab);
return tabs;
}
@Override
public Tab getFollowedTab() {
return followedTab;
}
private Tab createTab(String title, String url) {
StripchatUpdateService updateService = new StripchatUpdateService(url, false, stripchat);
ThumbOverviewTab tab = new ThumbOverviewTab(title, updateService, stripchat);
tab.setRecorder(recorder);
tab.setImageAspectRatio(9.0 / 16.0);
return tab;
}
}