public void SetFanartArtifact( Object mediaObject, File fanart, MediaType mediaType, String mediaTitle, MediaArtifactType artifactType, String artifactTitle, Map<String, String> metadata) { try { String central = (new File(GetFanartCentralFolder())).getCanonicalPath(); String file = fanart.getCanonicalPath(); if (!file.startsWith(central)) { throw new Exception( "You can only set a fanart artifact relative to the fanart folder. Folder: " + central + "; fanart: " + file); } String art = file.substring(central.length()); if (art.startsWith(File.separator)) { art = StringUtils.strip(art, File.separator); } String key = null; if (artifactType == MediaArtifactType.POSTER) { key = ISageCustomMetadataRW.FieldName.DEFAULT_POSTER; } else if (artifactType == MediaArtifactType.BACKGROUND) { key = ISageCustomMetadataRW.FieldName.DEFAULT_BACKGROUND; } else if (artifactType == MediaArtifactType.BANNER) { key = ISageCustomMetadataRW.FieldName.DEFAULT_BANNER; } if (key == null) throw new Exception( "Invalid Artifact Type: " + artifactType + "; Can't set default artifact."); MediaFileAPI.SetMediaFileMetadata(mediaObject, key, art); } catch (Exception e) { log.warn("Failed to set the default fanart artifact!", e); } }