forked from j62/ctbrec
1
0
Fork 0

Make sure, that the model ID is set

This commit is contained in:
0xboobface 2018-12-17 17:22:21 +01:00
parent 8a8327a2a5
commit eedb237923
2 changed files with 8 additions and 7 deletions

View File

@ -193,13 +193,7 @@ public class Streamate extends AbstractSite {
Matcher m = Pattern.compile("https?://.*?streamate.com/cam/([^/]*?)/?").matcher(url);
if (m.matches()) {
String modelName = m.group(1);
StreamateModel model = (StreamateModel) createModel(modelName);
try {
model.loadModelInfo();
} catch (IOException e) {
LOG.error("Couldn't load model info. This can cause problems with saving / loading the model");
}
return model;
return createModel(modelName);
} else {
return super.createModelFromUrl(url);
}

View File

@ -330,6 +330,13 @@ public class StreamateModel extends AbstractModel {
@Override
public void writeSiteSpecificData(JsonWriter writer) throws IOException {
if(id == null) {
try {
loadModelInfo();
} catch (IOException e) {
LOG.error("Couldn't load model ID for {}. This can cause problems with saving / loading the model", getName());
}
}
writer.name("id").value(id);
}
}