forked from j62/ctbrec
1
0
Fork 0

Make sure to use lower case model names for Cam4

This commit is contained in:
0xb00bface 2021-01-02 13:04:53 +01:00
parent ebaf4c4c9f
commit 8251f41c50
3 changed files with 12 additions and 3 deletions

View File

@ -33,7 +33,7 @@ import okhttp3.Response;
public class Cam4UpdateService extends PaginatedScheduledService { public class Cam4UpdateService extends PaginatedScheduledService {
private static final transient Logger LOG = LoggerFactory.getLogger(Cam4UpdateService.class); private static final Logger LOG = LoggerFactory.getLogger(Cam4UpdateService.class);
private String url; private String url;
private Cam4 site; private Cam4 site;
private boolean loginRequired; private boolean loginRequired;
@ -86,6 +86,7 @@ public class Cam4UpdateService extends PaginatedScheduledService {
String slug = path.substring(1); String slug = path.substring(1);
Cam4Model model = site.createModel(slug); Cam4Model model = site.createModel(slug);
String playlistUrl = profileLink.attr("data-hls-preview-url"); String playlistUrl = profileLink.attr("data-hls-preview-url");
model.setDisplayName(HtmlParser.getText(boxHtml, "div.profileBoxTitle a").trim());
model.setPlaylistUrl(playlistUrl); model.setPlaylistUrl(playlistUrl);
model.setPreview("https://snapshots.xcdnpro.com/thumbnails/" + model.getName() + "?s=" + System.currentTimeMillis()); model.setPreview("https://snapshots.xcdnpro.com/thumbnails/" + model.getName() + "?s=" + System.currentTimeMillis());
model.setDescription(parseDesription(boxHtml)); model.setDescription(parseDesription(boxHtml));

View File

@ -174,6 +174,13 @@ public class Config {
iterator.remove(); iterator.remove();
} }
} }
// 3.11.0 make Cam4 model names lower case
settings.models.stream()
.filter(m -> m instanceof Cam4Model)
.forEach(m -> m.setName(m.getName().toLowerCase()));
settings.modelsIgnored.stream()
.filter(m -> m instanceof Cam4Model)
.forEach(m -> m.setName(m.getName().toLowerCase()));
} }
private void makeBackup(File source) { private void makeBackup(File source) {

View File

@ -47,8 +47,9 @@ public class Cam4 extends AbstractSite {
public Cam4Model createModel(String name) { public Cam4Model createModel(String name) {
Cam4Model m = new Cam4Model(); Cam4Model m = new Cam4Model();
m.setSite(this); m.setSite(this);
m.setName(name); m.setDisplayName(name);
m.setUrl(getBaseUrl() + '/' + name + '/'); m.setName(name.toLowerCase());
m.setUrl(getBaseUrl() + '/' + m.getName() + '/');
return m; return m;
} }