Search in sources :

Example 11 with WebEngine

use of com.biglybt.core.metasearch.impl.web.WebEngine in project BiglyBT by BiglySoftware.

the class SubscriptionManagerUI method showProperties.

protected static void showProperties(Subscription subs) {
    SubscriptionHistory history = subs.getHistory();
    SimpleDateFormat df = new SimpleDateFormat();
    String last_error = history.getLastError();
    if (last_error == null) {
        last_error = "";
    }
    String engine_str;
    String auth_str = String.valueOf(false);
    try {
        Engine engine = subs.getEngine();
        engine_str = engine.getNameEx();
        if (engine instanceof WebEngine) {
            WebEngine web_engine = (WebEngine) engine;
            if (web_engine.isNeedsAuth()) {
                auth_str = String.valueOf(true) + ": cookies=" + toString(web_engine.getRequiredCookies());
            }
        }
        engine_str += ", eid=" + engine.getId();
    } catch (Throwable e) {
        engine_str = "Unknown";
        auth_str = "";
    }
    String[] keys = { "subs.prop.enabled", "subs.prop.is_public", "subs.prop.is_auto", "subs.prop.is_auto_ok", "subs.prop.is_dl_anon", "subs.prop.update_period", "subs.prop.last_scan", "subs.prop.last_result", "subs.prop.next_scan", "subs.prop.last_error", "subs.prop.num_read", "subs.prop.num_unread", "label.max.results", "subs.prop.assoc", "subs.prop.version", "subs.prop.high_version", "subscriptions.listwindow.popularity", "subs.prop.template", "subs.prop.auth", "TableColumn.header.category", "TableColumn.header.tag.name", "subs.prop.query" };
    String category_str;
    String category = subs.getCategory();
    if (category == null) {
        category_str = MessageText.getString("Categories.uncategorized");
    } else {
        category_str = category;
    }
    Tag tag = TagManagerFactory.getTagManager().lookupTagByUID(subs.getTagID());
    String tag_str = tag == null ? "" : tag.getTagName(true);
    int check_freq = history.getCheckFrequencyMins();
    long last_new_result = history.getLastNewResultTime();
    long next_scan = history.getNextScanTime();
    int max_results = history.getMaxNonDeletedResults();
    if (max_results < 0) {
        SubscriptionManager subs_man = SubscriptionManagerFactory.getSingleton();
        max_results = subs_man.getMaxNonDeletedResults();
    }
    String max_results_str = (max_results == 0 ? MessageText.getString("ConfigView.unlimited") : String.valueOf(max_results));
    String[] values = { String.valueOf(history.isEnabled()), String.valueOf(subs.isPublic()) + "/" + (!subs.isAnonymous()), String.valueOf(history.isAutoDownload()), String.valueOf(subs.isAutoDownloadSupported()), String.valueOf(history.getDownloadNetworks() != null), (check_freq == Integer.MAX_VALUE ? "" : (String.valueOf(history.getCheckFrequencyMins() + " " + MessageText.getString("ConfigView.text.minutes")))), df.format(new Date(history.getLastScanTime())), (last_new_result == 0 ? "" : df.format(new Date(last_new_result))), (next_scan == Long.MAX_VALUE ? "" : df.format(new Date(next_scan))), (last_error.length() == 0 ? MessageText.getString("label.none") : last_error), String.valueOf(history.getNumRead()), String.valueOf(history.getNumUnread()), max_results_str, String.valueOf(subs.getAssociationCount()), String.valueOf(subs.getVersion()), subs.getHighestVersion() > subs.getVersion() ? String.valueOf(subs.getHighestVersion()) : null, subs.getCachedPopularity() <= 1 ? "-" : String.valueOf(subs.getCachedPopularity()), engine_str + ", sid=" + subs.getID(), auth_str, category_str, tag_str, subs.getQueryKey() };
    final PropertiesWindow pw = new PropertiesWindow(subs.getName(), keys, values);
    try {
        // kick off a popularity update
        subs.getPopularity(new SubscriptionPopularityListener() {

            @Override
            public void gotPopularity(long popularity) {
                pw.updateProperty("subscriptions.listwindow.popularity", String.valueOf(popularity));
            }

            @Override
            public void failed(SubscriptionException error) {
            }
        });
    } catch (Throwable e) {
    }
}
Also used : WebEngine(com.biglybt.core.metasearch.impl.web.WebEngine) SimpleDateFormat(java.text.SimpleDateFormat) WebEngine(com.biglybt.core.metasearch.impl.web.WebEngine) Engine(com.biglybt.core.metasearch.Engine) RSSEngine(com.biglybt.core.metasearch.impl.web.rss.RSSEngine)

Aggregations

WebEngine (com.biglybt.core.metasearch.impl.web.WebEngine)11 Engine (com.biglybt.core.metasearch.Engine)8 Subscription (com.biglybt.core.subs.Subscription)5 URL (java.net.URL)4 RSSEngine (com.biglybt.core.metasearch.impl.web.rss.RSSEngine)2 SubscriptionDownloadListener (com.biglybt.core.subs.SubscriptionDownloadListener)2 SubscriptionException (com.biglybt.core.subs.SubscriptionException)2 SubscriptionResult (com.biglybt.core.subs.SubscriptionResult)2 VuzeFile (com.biglybt.core.vuzefile.VuzeFile)2 MenuItemFillListener (com.biglybt.pif.ui.menus.MenuItemFillListener)2 File (java.io.File)2 FileDialog (org.eclipse.swt.widgets.FileDialog)2 Shell (org.eclipse.swt.widgets.Shell)2 PluginEngine (com.biglybt.core.metasearch.impl.plugin.PluginEngine)1 PluginProxy (com.biglybt.core.proxy.AEProxyFactory.PluginProxy)1 SubscriptionHistory (com.biglybt.core.subs.SubscriptionHistory)1 TOTorrentException (com.biglybt.core.torrent.TOTorrentException)1 AERunnable (com.biglybt.core.util.AERunnable)1 VuzeFileComponent (com.biglybt.core.vuzefile.VuzeFileComponent)1 VuzeFileHandler (com.biglybt.core.vuzefile.VuzeFileHandler)1