use of com.biglybt.core.metasearch.impl.web.rss.RSSEngine in project BiglyBT by BiglySoftware.
the class SubscriptionManagerImpl method getSearchTemplateVuzeFile.
protected Object[] getSearchTemplateVuzeFile(SubscriptionImpl sub) {
try {
String subs_url_str = ((RSSEngine) sub.getEngine()).getSearchUrl(true);
URL subs_url = new URL(subs_url_str);
final byte[] vf_bytes = FileUtil.readInputStreamAsByteArray(subs_url.openConnection().getInputStream());
VuzeFile vf = VuzeFileHandler.getSingleton().loadVuzeFile(vf_bytes);
if (MetaSearchManagerFactory.getSingleton().isImportable(vf)) {
return (new Object[] { vf, vf_bytes });
}
} catch (Throwable e) {
Debug.out(e);
}
return (null);
}
use of com.biglybt.core.metasearch.impl.web.rss.RSSEngine in project BiglyBT by BiglySoftware.
the class SubscriptionManagerUI method checkSubscriptionForStuff.
private void checkSubscriptionForStuff(Subscription sub) {
if (sub.isSearchTemplate()) {
return;
}
if (sub.isSubscribed() && sub.getAddType() != Subscription.ADD_TYPE_IMPORT) {
return;
}
try {
Engine engine = sub.getEngine();
if (engine instanceof RSSEngine) {
RSSEngine re = (RSSEngine) engine;
String url_str = re.getSearchUrl(true);
URL url = new URL(url_str);
String prot = url.getProtocol();
if (prot.equals("azplug")) {
String q = url.getQuery();
Map<String, String> args = UrlUtils.decodeArgs(q);
String id = args.get("id");
if (id.equals("azbuddy")) {
String arg = args.get("arg");
String[] bits = arg.split(":", 2);
String chat_protocol = bits[0];
if (chat_protocol.startsWith("chat")) {
Map<String, String> chat_args = UrlUtils.decodeArgs(bits[1]);
String chat_key = chat_args.get("");
int pos = chat_key.toLowerCase(Locale.US).indexOf("website[pk=");
if (pos != -1) {
Map<String, String> cb_data = new HashMap<>();
cb_data.put("subname", sub.getName());
cb_data.put("subid", sub.getID());
LocalActivityManager.addLocalActivity("Website:" + sub.getID(), "rss", MessageText.getString("subs.activity.website.found", new String[] { sub.getName() }), new String[] { MessageText.getString("subscriptions.listwindow.subscribe") }, ActivityCallback.class, cb_data);
}
}
}
}
}
} catch (Throwable e) {
// ignore, nothing to see!
}
}
use of com.biglybt.core.metasearch.impl.web.rss.RSSEngine in project BiglyBT by BiglySoftware.
the class SubscriptionManagerImpl method isSearchTemplateImportable.
public boolean isSearchTemplateImportable(SubscriptionImpl sub) {
try {
String subs_url_str = ((RSSEngine) sub.getEngine()).getSearchUrl(true);
URL subs_url = new URL(subs_url_str);
final byte[] vf_bytes = FileUtil.readInputStreamAsByteArray(subs_url.openConnection().getInputStream());
VuzeFile vf = VuzeFileHandler.getSingleton().loadVuzeFile(vf_bytes);
return (MetaSearchManagerFactory.getSingleton().isImportable(vf));
} catch (Throwable e) {
Debug.out(e);
}
return (false);
}