Example #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);
  }
Example #2
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;
    }
  }