public File GetFanartArtifactForTitle(
      Object mediaObject,
      MediaType mediaType,
      String mediaTitle,
      MediaArtifactType artifactType,
      String artifactTitle,
      Map<String, String> metadata,
      String centralFolder) {
    File art = null;

    art =
        FanartUtil.getCentralFanartArtifact(
            mediaType, mediaTitle, artifactType, artifactTitle, centralFolder, metadata);
    if (art == null || !art.exists()) {
      if (mediaType == MediaType.TV
          && metadata != null
          && metadata.get(FanartUtil.SEASON_NUMBER) != null) {
        // do a search without the season metadata
        art =
            FanartUtil.getCentralFanartArtifact(
                mediaType, mediaTitle, artifactType, artifactTitle, centralFolder, null);
      }
    }

    // if no matches, then find the first one
    if (art == null || !art.exists()) {
      File all[] =
          GetFanartArtifactsForTitle(
              mediaObject,
              mediaType,
              mediaTitle,
              artifactType,
              artifactTitle,
              metadata,
              centralFolder);
      if (!SageFanartUtil.isEmpty(all)) {
        art = all[0];
      }
    }

    if (log.isDebugEnabled()) {
      log.debug(
          "GetFanartArtifactForTitle: MediaType: "
              + mediaType
              + "; MediaTitle: "
              + mediaTitle
              + "; ArtifactType: "
              + artifactType
              + "; ArtifactTitle: "
              + artifactTitle
              + "; Artifact: "
              + art
              + "; Season: "
              + getSeason(metadata)
              + "; MediaFile: "
              + mediaObject);
    }
    return art;
  }
  public File GetFanartArtifactDir(
      Object mediaObject,
      MediaType mediaType,
      String mediaTitle,
      MediaArtifactType artifactType,
      String artifactTitle,
      Map<String, String> metadata,
      boolean create) {
    SimpleMediaFile mf = SageFanartUtil.GetSimpleMediaFile(mediaObject);
    mediaType = Utils.returnNonNull(mediaType, mf.getMediaType());
    mediaTitle = Utils.returnNonNull(mediaTitle, mf.getTitle());
    metadata = Utils.returnNonNull(metadata, getMetadata(mediaType, mediaObject));
    String fanartFolder = GetFanartCentralFolder();
    File f =
        FanartUtil.getCentralFanartDir(
            mediaType, mediaTitle, artifactType, artifactTitle, fanartFolder, metadata);

    if (create && f != null && !f.exists()) {
      sagex.phoenix.util.FileUtils.mkdirsQuietly(f);
      if (!f.exists()) {
        log.warn("Unable to create directory: " + f.getAbsolutePath() + "; Pemission issue?");
      }
    }

    return f;
  }
  public File[] GetFanartArtifactsForTitle(
      Object mediaObject,
      MediaType mediaType,
      String mediaTitle,
      MediaArtifactType artifactType,
      String artifactTitle,
      Map<String, String> metadata,
      String centralFolder) {
    File files[] = null;
    files =
        FanartUtil.getCentalFanartArtifacts(
            mediaType, mediaTitle, artifactType, artifactTitle, centralFolder, metadata);
    if (files == null || files.length == 0) {
      if (mediaType == MediaType.TV
          && metadata != null
          && metadata.get(FanartUtil.SEASON_NUMBER) != null) {
        // do a search without the season metadata
        files =
            FanartUtil.getCentalFanartArtifacts(
                mediaType, mediaTitle, artifactType, artifactTitle, centralFolder, null);
      }
    }

    if (log.isDebugEnabled()) {
      log.debug(
          "GetFanartArtifactsForTitle: MediaType: "
              + mediaType
              + "; MediaTitle: "
              + mediaTitle
              + "; ArtifactType: "
              + artifactType
              + "; ArtifactTitle: "
              + artifactTitle
              + "; Artifact Count: "
              + (files == null ? 0 : files.length)
              + "; MediaFile: "
              + mediaObject);
    }
    return files;
  }