Search in sources :

Example 1 with TranscodeVirtualFolder

use of net.pms.dlna.virtual.TranscodeVirtualFolder in project UniversalMediaServer by UniversalMediaServer.

the class DLNAResource method getTranscodeFolder.

/**
 * Return the transcode folder for this resource.
 * If UMS is configured to hide transcode folders, null is returned.
 * If no folder exists and the create argument is false, null is returned.
 * If no folder exists and the create argument is true, a new transcode folder is created.
 * This method is called on the parent folder each time a child is added to that parent
 * (via {@link addChild(DLNAResource)}.
 *
 * @param create
 * @return the transcode virtual folder
 */
// XXX package-private: used by MapFile; should be protected?
TranscodeVirtualFolder getTranscodeFolder(boolean create) {
    if (!isTranscodeFolderAvailable()) {
        return null;
    }
    if (!configuration.isShowTranscodeFolder()) {
        return null;
    }
    // search for transcode folder
    for (DLNAResource child : children) {
        if (child instanceof TranscodeVirtualFolder) {
            return (TranscodeVirtualFolder) child;
        }
    }
    if (create) {
        TranscodeVirtualFolder transcodeFolder = new TranscodeVirtualFolder(null, configuration);
        addChildInternal(transcodeFolder);
        return transcodeFolder;
    }
    return null;
}
Also used : TranscodeVirtualFolder(net.pms.dlna.virtual.TranscodeVirtualFolder)

Aggregations

TranscodeVirtualFolder (net.pms.dlna.virtual.TranscodeVirtualFolder)1