/** * {@inheritDoc} * * @param e Action event */ @Override public void actionPerformed(final ActionEvent e) { try { final File file = File.createTempFile("dmdirc-addon", ".tmp"); file.deleteOnExit(); Downloader.downloadPage( "http://addons.dmdirc.com/addondownload/" + info.getStableDownload(), file.getAbsolutePath()); switch (info.getType()) { case TYPE_ACTION_PACK: ActionManager.installActionPack(file.getAbsolutePath()); break; case TYPE_PLUGIN: throw new UnsupportedOperationException("Not supported yet"); // break; case TYPE_THEME: throw new UnsupportedOperationException("Not supported yet"); // break; } } catch (IOException ex) { Logger.userError(ErrorLevel.MEDIUM, "Unable to download addon: " + ex.getMessage(), ex); } }
/** * Attempts to fetch information from VLC's web interface. * * @return True on success, false otherwise */ private boolean fetchInformation() { information.clear(); List<String> res; List<String> res2; try { res = Downloader.getPage( "http://" + IdentityManager.getGlobalConfig().getOption(getDomain(), "host") + "/old/info.html"); res2 = Downloader.getPage( "http://" + IdentityManager.getGlobalConfig().getOption(getDomain(), "host") + "/old/"); parseInformation(res, res2); return true; } catch (MalformedURLException ex) { return false; } catch (IOException ex) { return false; } }