Search in sources :

Example 1 with NormalPreviewSet

use of com.hippo.ehviewer.client.data.NormalPreviewSet in project EhViewer by seven332.

the class GalleryDetailParser method parseNormalPreviewSet.

/**
 * Parse normal previews with regular expressions
 */
private static NormalPreviewSet parseNormalPreviewSet(String body) throws ParseException {
    Matcher m = PATTERN_NORMAL_PREVIEW.matcher(body);
    NormalPreviewSet normalPreviewSet = new NormalPreviewSet();
    while (m.find()) {
        normalPreviewSet.addItem(ParserUtils.parseInt(m.group(6)) - 1, ParserUtils.trim(m.group(3)), ParserUtils.parseInt((m.group(4))), 0, ParserUtils.parseInt(m.group(1)), ParserUtils.parseInt(m.group(2)), ParserUtils.trim(m.group(5)));
    }
    if (normalPreviewSet.size() == 0) {
        throw new ParseException("Can't parse normal preview", body);
    }
    return normalPreviewSet;
}
Also used : NormalPreviewSet(com.hippo.ehviewer.client.data.NormalPreviewSet) Matcher(java.util.regex.Matcher) ParseException(com.hippo.ehviewer.client.exception.ParseException)

Aggregations

NormalPreviewSet (com.hippo.ehviewer.client.data.NormalPreviewSet)1 ParseException (com.hippo.ehviewer.client.exception.ParseException)1 Matcher (java.util.regex.Matcher)1