use of com.biglybt.net.upnp.UPnPDevice in project BiglyBT by BiglySoftware.
the class DeviceInternetGatewayImpl method updateStatus.
@Override
protected void updateStatus(int tick_count) {
super.updateStatus(tick_count);
if (tick_count % CHECK_MAPPINGS_TICK_COUNT != 0) {
return;
}
mapper_enabled = upnp_plugin != null && upnp_plugin.isEnabled();
UPnPDevice device = getUPnPDevice();
if (mapper_enabled && device != null) {
current_services = upnp_plugin.getServices(device);
current_mappings = upnp_plugin.getMappings();
}
}
use of com.biglybt.net.upnp.UPnPDevice in project BiglyBT by BiglySoftware.
the class DeviceManagerImpl method applyUpdates.
protected void applyUpdates(DeviceImpl device) {
if (device.getType() == Device.DT_MEDIA_RENDERER) {
DeviceMediaRenderer renderer = (DeviceMediaRenderer) device;
if (renderer instanceof DeviceUPnPImpl) {
UPnPDevice upnp_device = ((DeviceUPnPImpl) renderer).getUPnPDevice();
if (upnp_device != null) {
String lc_manufacturer = getOptionalLC(upnp_device.getManufacturer());
String lc_model = getOptionalLC(upnp_device.getModelName());
String lc_fname = getOptionalLC(upnp_device.getFriendlyName());
if (lc_manufacturer.startsWith("samsung")) {
device.setPersistentStringProperty(DeviceImpl.PP_REND_CLASSIFICATION, "samsung.generic");
TranscodeProfile[] profiles = device.getTranscodeProfiles();
if (profiles.length == 0) {
device.setTranscodeRequirement(TranscodeTarget.TRANSCODE_NEVER);
} else {
device.setTranscodeRequirement(TranscodeTarget.TRANSCODE_WHEN_REQUIRED);
}
} else if (lc_manufacturer.startsWith("western digital")) {
device.setPersistentStringProperty(DeviceImpl.PP_REND_CLASSIFICATION, "western.digital.generic");
TranscodeProfile[] profiles = device.getTranscodeProfiles();
if (profiles.length == 0) {
device.setTranscodeRequirement(TranscodeTarget.TRANSCODE_NEVER);
} else {
device.setTranscodeRequirement(TranscodeTarget.TRANSCODE_WHEN_REQUIRED);
}
} else if (lc_manufacturer.startsWith("sony") && lc_fname.startsWith("bravia")) {
device.setPersistentStringProperty(DeviceImpl.PP_REND_CLASSIFICATION, "sony.bravia");
} else if (lc_model.equals("windows media player")) {
String model_number = upnp_device.getModelNumber();
if (model_number != null) {
try {
int num = Integer.parseInt(model_number);
if (num >= 12) {
device.setPersistentStringProperty(DeviceImpl.PP_REND_CLASSIFICATION, "ms_wmp.generic");
TranscodeProfile[] profiles = device.getTranscodeProfiles();
if (profiles.length == 0) {
device.setTranscodeRequirement(TranscodeTarget.TRANSCODE_NEVER);
} else {
device.setTranscodeRequirement(TranscodeTarget.TRANSCODE_WHEN_REQUIRED);
}
}
} catch (Throwable e) {
}
}
}
}
}
}
}
use of com.biglybt.net.upnp.UPnPDevice in project BiglyBT by BiglySoftware.
the class DeviceUPnPImpl method getDisplayProperties.
@Override
protected void getDisplayProperties(List<String[]> dp) {
super.getDisplayProperties(dp);
UPnPDevice device = device_may_be_null;
if (device != null) {
UPnPRootDevice root = device.getRootDevice();
URL location = root.getLocation();
addDP(dp, "dht.reseed.ip", location.getHost() + ":" + location.getPort());
String model_details = device.getModelName();
String model_url = device.getModelURL();
if (model_url != null && model_url.length() > 0) {
model_details += " (" + model_url + ")";
}
String manu_details = device.getManufacturer();
String manu_url = device.getManufacturerURL();
if (manu_url != null && manu_url.length() > 0) {
manu_details += " (" + manu_url + ")";
}
addDP(dp, "device.model.desc", device.getModelDescription());
addDP(dp, "device.model.name", model_details);
addDP(dp, "device.model.num", device.getModelNumber());
addDP(dp, "device.manu.desc", manu_details);
} else {
InetAddress ia = getAddress();
if (ia != null) {
addDP(dp, "dht.reseed.ip", ia.getHostAddress());
}
}
addDP(dp, "!Is Liveness Detectable!", isLivenessDetectable());
if (isManual()) {
addDP(dp, "azbuddy.ui.table.online", isAlive());
addDP(dp, "device.lastseen", getLastSeen() == 0 ? "" : new SimpleDateFormat().format(new Date(getLastSeen())));
}
}
use of com.biglybt.net.upnp.UPnPDevice in project BiglyBT by BiglySoftware.
the class DeviceUPnPImpl method getBrowseLocations.
@Override
public browseLocation[] getBrowseLocations() {
List<browseLocation> locs = new ArrayList<>();
UPnPDevice device = device_may_be_null;
if (device != null) {
URL presentation = getPresentationURL(device);
if (presentation != null) {
locs.add(new browseLocationImpl("device.upnp.present_url", presentation));
}
int userMode = COConfigurationManager.getIntParameter("User Mode");
if (userMode > 1) {
locs.add(new browseLocationImpl("device.upnp.desc_url", device.getRootDevice().getLocation()));
}
}
return (locs.toArray(new browseLocation[locs.size()]));
}
use of com.biglybt.net.upnp.UPnPDevice in project BiglyBT by BiglySoftware.
the class DeviceUPnPImpl method getDisplayName.
protected static String getDisplayName(UPnPDevice device) {
UPnPDevice root = device.getRootDevice().getDevice();
String fn = root.getFriendlyName();
if (fn == null || fn.length() == 0) {
fn = device.getFriendlyName();
}
String dn = root.getModelName();
if (dn == null || dn.length() == 0) {
dn = device.getModelName();
}
if (dn != null && dn.length() > 0) {
if (!fn.contains(dn)) {
fn += " (" + dn + ")";
}
}
return (fn);
}
Aggregations