Exemple #1
0
  public void setDefaultTranscodeProfile(TranscodeProfile profile) {
    if (profile == null) {

      removePersistentProperty(PP_REND_DEF_TRANS_PROF);

    } else {

      setPersistentStringProperty(PP_REND_DEF_TRANS_PROF, profile.getUID());
    }
  }
  protected DeviceTivo foundTiVo(
      InetAddress address, String uid, String classification, String machine) {
    uid = "tivo:" + uid;

    DeviceImpl[] devices = device_manager.getDevices();

    String server_name = device_manager.getLocalServiceName();

    for (DeviceImpl device : devices) {

      if (device instanceof DeviceTivo) {

        DeviceTivo tivo = (DeviceTivo) device;

        if (device.getID().equals(uid)) {

          if (classification != null) {

            String existing_classification = device.getClassification();

            if (!classification.equals(existing_classification)) {

              device.setPersistentStringProperty(DeviceImpl.PP_REND_CLASSIFICATION, classification);
            }
          }

          tivo.found(this, address, server_name, machine);

          return (tivo);
        }
      }
    }

    // unfortunately we can't deduce the series from the browse request so start off with a series 3
    // this will be corrected later if we receive a beacon which *does* contain the series details

    if (classification == null) {

      classification = "tivo.series3";
    }

    DeviceTivo new_device = new DeviceTivo(device_manager, uid, classification);

    DeviceTivo result = (DeviceTivo) device_manager.addDevice(new_device);

    // possible race here so handle case where device already present

    if (result == new_device) {

      new_device.found(this, address, server_name, machine);
    }

    return (result);
  }
Exemple #3
0
  public File getWorkingDirectory(boolean persist) {
    String result = getPersistentStringProperty(PP_REND_WORK_DIR);

    if (result.length() == 0) {

      File f = manager.getDefaultWorkingDirectory(persist);

      if (persist) {

        f.mkdirs();
      }

      String name = FileUtil.convertOSSpecificChars(getName(), true);

      for (int i = 0; i < 1024; i++) {

        String test_name = name + (i == 0 ? "" : ("_" + i));

        File test_file = new File(f, test_name);

        if (!test_file.exists()) {

          f = test_file;

          break;
        }
      }

      result = f.getAbsolutePath();

      if (persist) {

        setPersistentStringProperty(PP_REND_WORK_DIR, result);
      }
    }

    File f_result = new File(result);

    if (!f_result.exists()) {

      if (persist) {

        f_result.mkdirs();
      }
    }

    return (f_result);
  }
Exemple #4
0
 public void setPersistentIntProperty(String prop, int value) {
   setPersistentStringProperty(prop, String.valueOf(value));
 }
Exemple #5
0
 public void setPersistentLongProperty(String prop, long value) {
   setPersistentStringProperty(prop, String.valueOf(value));
 }
Exemple #6
0
 public void setPersistentBooleanProperty(String prop, boolean value) {
   setPersistentStringProperty(prop, value ? "true" : "false");
 }
Exemple #7
0
 protected void resetWorkingDirectory() {
   setPersistentStringProperty(PP_REND_WORK_DIR, "");
 }
Exemple #8
0
 public void setWorkingDirectory(File directory) {
   setPersistentStringProperty(PP_REND_WORK_DIR, directory.getAbsolutePath());
 }