We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
To simplify usage of the libary or would be great to have a function to filter the xml for the service of interest. Currently I need to do that:
HttpURLConnection conn = (HttpURLConnection) new URL(sSiUrl).openConnection(); XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); XmlPullParser parser = factory.newPullParser(); InputStream inputStream = conn.getInputStream(); parser.setInput(inputStream, "UTF-8"); List<StationImage> listStationImages = new ArrayList<>(); boolean xmlFoundId = false; String xmlCurrentId = null; int eventType = parser.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { if ("service".equalsIgnoreCase(parser.getName())) { listStationImages.clear(); } else if ("bearer".equalsIgnoreCase(parser.getName())) { String id = parser.getAttributeValue(null, "id"); if (idToFind.equalsIgnoreCase(id)) xmlFoundId = true; } else if ("multimedia".equalsIgnoreCase(parser.getName())) { String mimeValueValue = parser.getAttributeValue(null, "mimeValue"); String typeValue = parser.getAttributeValue(null, "type"); String urlValue = parser.getAttributeValue(null, "url"); if (urlValue != null) { // && ((mimeValueValue != null && mimeValueValue.toLowerCase().contains("image")) // || (typeValue != null && typeValue.toLowerCase().contains("logo")))) { String widthValue = parser.getAttributeValue(null, "width"); String heightValue = parser.getAttributeValue(null, "height"); try { int iWidth = Integer.valueOf(widthValue); int iHeight = Integer.valueOf(heightValue); StationImage stationImage = new StationImage(idToFind, urlValue, iWidth, iHeight); listStationImages.add(stationImage); } catch (NumberFormatException ex1) { continue; } } } } else if (eventType == XmlPullParser.END_TAG) { if ("service".equalsIgnoreCase(parser.getName())) { if (xmlFoundId) break; } } eventType = parser.next(); } inputStream.close(); if (listStationImages.size() == 0) { Logger.d( String.format( "RadioDnsLogo: station image not found for id '%s' in '%s'", idToFind, sSiUrl)); return RETURN_IMAGE_NOT_FOUND; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
To simplify usage of the libary or would be great to have a function to filter the xml for the service of interest. Currently I need to do that:
The text was updated successfully, but these errors were encountered: