monitor.setMessage(mLocalizer.msg("Progressmessage.30",
"Parsing channel list"));
}
int fileSize = con.getContentLength();
if (fileSize == 0) {
throw new TvBrowserException(SweDBTvDataService.class,
"errorEmptyChannelList",
"Channel list file for group \"{0}\" is empty: {1}.", group.getName(), url);
}
else {
DataHydraChannelContainer[] DataHydracontainers = DataHydraChannelParser.parse(IOUtilities.openSaveGZipInputStream(con.getInputStream()));
if (monitor != null) {
monitor.setMessage(mLocalizer.msg("Progressmessage.40", "Found {0} channels, downloading channel icons...", DataHydracontainers.length));
}
mLastGroupUpdate.put(hydraGroup, con.getLastModified());
con.disconnect();
ArrayList<Channel> loadedChannels = new ArrayList<Channel>();
for (DataHydraChannelContainer container : DataHydracontainers) {
initializeIconLoader(hydraGroup);
Channel ch = createTVBrowserChannel(hydraGroup, container);
closeIconLoader(hydraGroup);
mInternalChannels.put(ch, container);
loadedChannels.add(ch);
}
channels = loadedChannels.toArray(new Channel[loadedChannels.size()]);
if (monitor != null) {
monitor.setMessage(mLocalizer.msg("Progressmessage.50",
"All channels have been retrieved"));
}
/**
* Update Channel list of the data plugin
*/
// Remove all Channels of current Group
Channel[] chs = getAvailableChannels(hydraGroup);
for (Channel ch : chs) {
mChannels.remove(ch);
}
// Add all Channels for current Group
mChannels.addAll(loadedChannels);
}
} else if (responseCode == 304) {
channels = getAvailableChannels(hydraGroup);
} else {
throw new TvBrowserException(SweDBTvDataService.class,
"availableResponse",
"Unknown response during check for available channels in Swedb plugin: {0}", responseCode);
}
} catch (Exception e) {
e.printStackTrace();
throw new TvBrowserException(SweDBTvDataService.class,
"checkAvailableError",
"Error checking for available channels in Swedb plugin: {0}", e
.getLocalizedMessage());
}