Search in sources :

Example 1 with DownloadException

use of delta.downloads.DownloadException in project lotro-tools by dmorcellet.

the class MainTestDownloadQuestPage method main.

/**
 * Main method.
 * @param args Not used.
 */
public static void main(String[] args) {
    String url = "http://lorebook.lotro.com/wiki/Special:LotroResource?id=1879210718";
    Downloader d = new Downloader();
    File tmpDir = FileSystem.getTmpDir();
    File tmp = new File(tmpDir, "tmp.html");
    try {
        d.downloadToFile(url, tmp);
    } catch (DownloadException de) {
        _logger.error("Cannot download quest page!", de);
    }
}
Also used : DownloadException(delta.downloads.DownloadException) Downloader(delta.downloads.Downloader) File(java.io.File)

Example 2 with DownloadException

use of delta.downloads.DownloadException in project lotro-tools by dmorcellet.

the class ItemIconsDownloader method doIt.

private void doIt() {
    DownloadService downloader = DownloadService.getInstance();
    File toFile = new File("items.xml").getAbsoluteFile();
    _toDir.mkdirs();
    HashMap<Integer, Item> items = loadItemsFile(toFile);
    System.out.println(items.size());
    for (Integer id : items.keySet()) {
        System.out.println(id);
        String url = "http://lotro.fr/img/bdd/items/" + id + ".png";
        File to = new File(_toDir, id + ".png");
        try {
            downloader.downloadToFile(url, to);
        } catch (DownloadException de) {
            _logger.error("Cannot fetch icon [" + url + "]!", de);
        }
    }
}
Also used : Item(delta.games.lotro.lore.items.Item) DownloadException(delta.downloads.DownloadException) File(java.io.File) DownloadService(delta.games.lotro.utils.DownloadService)

Aggregations

DownloadException (delta.downloads.DownloadException)2 File (java.io.File)2 Downloader (delta.downloads.Downloader)1 Item (delta.games.lotro.lore.items.Item)1 DownloadService (delta.games.lotro.utils.DownloadService)1