use of com.biglybt.pif.PluginInterface in project BiglyBT by BiglySoftware.
the class UIManagerImpl method initialisationComplete.
public static void initialisationComplete() {
SelectedContentManager.addCurrentlySelectedContentListener(new SelectedContentListener() {
@Override
public void currentlySelectedContentChanged(ISelectedContent[] currentContent, String viewID) {
triggerDataSourceListeners(SelectedContentManager.convertSelectedContentToObject(null));
}
});
List<Object[]> to_fire = new ArrayList<>();
try {
class_mon.enter();
initialisation_complete = true;
for (int j = 0; j < ui_factories.size(); j++) {
UIInstanceFactory factory = (UIInstanceFactory) ui_factories.get(j);
Iterator<Object[]> it = ui_listeners.iterator();
while (it.hasNext()) {
Object[] entry = it.next();
List<UIInstanceFactory> fired = (List<UIInstanceFactory>) entry[2];
if (!fired.contains(factory)) {
fired.add(factory);
to_fire.add(new Object[] { entry[0], factory.getInstance((PluginInterface) entry[1]) });
}
}
}
} finally {
class_mon.exit();
}
for (Object[] entry : to_fire) {
try {
((UIManagerListener) entry[0]).UIAttached((UIInstance) entry[1]);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
for (Object[] entry : to_fire) {
try {
if (entry[0] instanceof UIManagerListener2) {
((UIManagerListener2) entry[0]).UIAttachedComplete((UIInstance) entry[1]);
}
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
}
use of com.biglybt.pif.PluginInterface in project BiglyBT by BiglySoftware.
the class TorrentImpl method setPluginStringProperty.
@Override
public void setPluginStringProperty(String name, String value) {
PluginInterface p = pi;
if (p == null) {
p = UtilitiesImpl.getPluginThreadContext();
}
if (p == null) {
name = "<internal>." + name;
} else {
name = p.getPluginID() + "." + name;
}
TorrentUtils.setPluginStringProperty(torrent, name, value);
}
use of com.biglybt.pif.PluginInterface in project BiglyBT by BiglySoftware.
the class InitialisationFunctions method hookDownloadAddition.
protected static void hookDownloadAddition() {
PluginInterface pi = PluginInitializer.getDefaultInterface();
DownloadManager dm = pi.getDownloadManager();
// need to get in early to ensure property present on initial announce
dm.addDownloadWillBeAddedListener(new DownloadWillBeAddedListener() {
@Override
public void initialised(Download download) {
// unfortunately the has-been-opened state is updated by the client when a user opens content
// but is also preserved across torrent export/import (e.g. when downloaded via magnet
// URL. So reset it here if it is found to be set
com.biglybt.core.download.DownloadManager dm = PluginCoreUtils.unwrap(download);
if (PlatformTorrentUtils.getHasBeenOpened(dm)) {
PlatformTorrentUtils.setHasBeenOpened(dm, false);
}
}
});
}
use of com.biglybt.pif.PluginInterface in project BiglyBT by BiglySoftware.
the class PlayUtils method getMediaServerContentURL.
public static URL getMediaServerContentURL(DiskManagerFileInfo file) {
// TorrentListViewsUtils.debugDCAD("enter - getMediaServerContentURL");
PluginManager pm = CoreFactory.getSingleton().getPluginManager();
PluginInterface pi = pm.getPluginInterfaceByID("azupnpav", false);
if (pi == null) {
Logger.log(new LogEvent(LogIDs.UI3, "Media server plugin not found"));
return null;
}
if (!pi.getPluginState().isOperational()) {
Logger.log(new LogEvent(LogIDs.UI3, "Media server plugin not operational"));
return null;
}
try {
if (hasQuickTime == null) {
UIFunctions uif = UIFunctionsManager.getUIFunctions();
if (uif != null) {
hasQuickTime = uif.isProgramInstalled(".qtl", "Quicktime");
try {
pi.getIPC().invoke("setQuickTimeAvailable", new Object[] { hasQuickTime });
} catch (Throwable e) {
Logger.log(new LogEvent(LogIDs.UI3, LogEvent.LT_WARNING, "IPC to media server plugin failed", e));
}
}
}
boolean use_peek = tls_non_block_indicator.get()[0] > 0;
Object url;
if (use_peek && pi.getIPC().canInvoke("peekContentURL", new Object[] { file })) {
url = pi.getIPC().invoke("peekContentURL", new Object[] { file });
} else {
url = pi.getIPC().invoke("getContentURL", new Object[] { file });
}
if (url instanceof String) {
return new URL((String) url);
}
} catch (Throwable e) {
Logger.log(new LogEvent(LogIDs.UI3, LogEvent.LT_WARNING, "IPC to media server plugin failed", e));
}
return null;
}
use of com.biglybt.pif.PluginInterface in project BiglyBT by BiglySoftware.
the class CorePatchChecker method complete.
@Override
public void complete(final UpdateCheckInstance instance) {
Update my_update = my_updates.remove(instance);
if (my_update != null) {
my_update.complete(true);
}
Update[] updates = instance.getUpdates();
final PluginInterface updater_plugin = plugin_interface.getPluginManager().getPluginInterfaceByClass(UpdaterUpdateChecker.class);
for (int i = 0; i < updates.length; i++) {
final Update update = updates[i];
Object user_object = update.getUserObject();
if (user_object != null && user_object == updater_plugin) {
if (Logger.isEnabled())
Logger.log(new LogEvent(LOGID, "Core Patcher: updater update found"));
update.setRestartRequired(Update.RESTART_REQUIRED_MAYBE);
update.addListener(new UpdateListener() {
@Override
public void complete(Update update) {
if (Logger.isEnabled())
Logger.log(new LogEvent(LOGID, "Core Patcher: updater update complete"));
patch(instance, update, updater_plugin);
}
@Override
public void cancelled(Update update) {
}
});
}
}
}
Aggregations