Ejemplo n.º 1
0
  public String getMovieInfo(MediaFile mf) {

    String year = getMovieYear(mf.getName());
    DataObject info;
    TitleSearchOptions options;
    DataService service = new ImdbDataService(new ImdbServer(), new DataObjectConverterImpl());
    if (year != null) {
      options = new TitleSearchOptions(mf.getMediaName(), year);
    } else {
      options = new TitleSearchOptions(mf.getName());
    }
    //        options.setPlot("simple");
    info = service.getDataByTitle("http://imdbapi.org", options);
    if (info == null || info.getError() != null) {
      return "No Infromation Found for item [" + mf.getMediaName() + "] ";
    }
    return parseMovieInfo(info);
  }
Ejemplo n.º 2
0
  private Process openMediaFile_inWindos(MediaFile mf) {
    // System.out.println("is folder empty ? " + mf.isDirEmpty());
    String param =
        "C:/Program Files (x86)/VideoLan/VLC/vlc.exe"; // not work correctly and start downloading
                                                       // file instead
    String param2 = "C:/temp/VLC/vlc.exe";
    String param3 = System.getProperty("user.dir") + "/Tools/VLC/vlc.exe";
    if (mf.isMediaType(TypeX.VIDEO)) {

      // + pathCorrector(getVLCPath())+
      String[] cmd = {"cmd.exe", "/C", "start", param3, mf.getAbsoluteFilePath()};
      try {

        return rt.exec(cmd);

      } catch (Exception e) {
        System.out.println("Runtime error : " + e);
        return null;
      }
    }
    if (mf.isMediaType(TypeX.MEDIA_DIR)
        && mf.isDirContainsType(TypeX.VIDEO)) // open videos in queue
    {
      MediaFile[] medFold = mf.listMediaFiles();

      String[] cmd = {"cmd.exe", "/C", "start", param3};
      for (MediaFile f : medFold) {

        if (f.isMediaType(TypeX.VIDEO)) {
          String[] cmd2 = new String[cmd.length + 1];
          System.arraycopy(cmd, 0, cmd2, 0, cmd.length);
          cmd2[cmd2.length - 1] = f.getAbsoluteFilePath();
          cmd = cmd2;
        }
      }
      try {

        return rt.exec(cmd);

      } catch (Exception e) {
        System.out.println("Runtime error : " + e);
        return null;
      }
    }
    return null;
  }
Ejemplo n.º 3
0
  private Process openMediaFile_inLinux(MediaFile mf) {
    ProcessBuilder p;
    List<String> path = new ArrayList<String>();
    path.add("vlc");

    if (mf.isMediaType(TypeX.MEDIA_DIR)
        && mf.isDirContainsType(TypeX.VIDEO)) // open videos in queue
    {
      MediaFile[] medFold = mf.listMediaFiles();

      for (MediaFile f : medFold) {

        if (f.isMediaType(TypeX.VIDEO)) {
          path.add(f.getAbsoluteFilePath());
        }
      }
    } else if (mf.isMediaType(TypeX.VIDEO)) {
      path.add(mf.getAbsoluteFilePath());
    }

    if (mf.isMediaType(TypeX.MEDIA_DIR) && !mf.isDirContainsType(TypeX.VIDEO)) {
      System.out.println("******Can't open none video files****");
      for (MediaFile f : mf.listMediaFiles()) {

        System.out.println("" + f.getName());
      }
      return null;
    } else if (!mf.isMediaType(TypeX.MEDIA_DIR) && !mf.isMediaType(TypeX.VIDEO)) {
      System.out.println("******Can't open none video files****");
      System.out.println("" + mf.getName());
      return null;
    }

    p = new ProcessBuilder(path);

    try {

      return p.start();
    } catch (IOException e) {
      System.out.println("Runtime error : " + e);
      return null;
    }
  }