All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.tidalwave.bluemarine2.model.MediaItem Maven / Gradle / Ivy

There is a newer version: 1.1-ALPHA-1
Show newest version
/*
 * #%L
 * *********************************************************************************************************************
 *
 * blueMarine2 - Semantic Media Center
 * http://bluemarine2.tidalwave.it - git clone https://[email protected]/tidalwave/bluemarine2-src.git
 * %%
 * Copyright (C) 2015 - 2016 Tidalwave s.a.s. (http://tidalwave.it)
 * %%
 *
 * *********************************************************************************************************************
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations under the License.
 *
 * *********************************************************************************************************************
 *
 * $Id$
 *
 * *********************************************************************************************************************
 * #L%
 */
package it.tidalwave.bluemarine2.model;

import javax.annotation.Nonnull;
import java.time.Duration;
import java.util.List;
import java.util.Optional;
import java.util.Map;
import java.util.Set;
import it.tidalwave.util.Id;
import it.tidalwave.util.Key;
import it.tidalwave.bluemarine2.model.role.AudioFileSupplier;

/***********************************************************************************************************************
 *
 * Represents a media item. It is usually associated with one or more files on a filesystem.
 *
 * @stereotype  Datum
 *
 * @author  Fabrizio Giudici
 * @version $Id$
 *
 **********************************************************************************************************************/
public interface MediaItem extends EntityWithPath, AudioFileSupplier
  {
    /*******************************************************************************************************************
     *
     * A container of metadata objects for a {@link MediaItem}.
     *
     ******************************************************************************************************************/
    public interface Metadata
      {
        public static final Key FILE_SIZE = new Key<>("file.size");

        public static final Key DURATION = new Key<>("mp3.duration");
        public static final Key BIT_RATE = new Key<>("mp3.bitRate");
        public static final Key SAMPLE_RATE = new Key<>("mp3.sampleRate");
        public static final Key ARTIST = new Key<>("mp3.artist");
        public static final Key COMPOSER = new Key<>("mp3.composer");
        public static final Key PUBLISHER = new Key<>("mp3.publisher");
        public static final Key TITLE = new Key<>("mp3.title");
        public static final Key YEAR = new Key<>("mp3.year");
        public static final Key ALBUM = new Key<>("mp3.album");
        public static final Key TRACK_NUMBER = new Key<>("mp3.trackNumber");
        public static final Key DISK_NUMBER = new Key<>("mp3.diskNumber");
        public static final Key DISK_COUNT = new Key<>("mp3.diskCount");
        public static final Key COMMENT = new Key<>("mp3.comment");
        public static final Key BITS_PER_SAMPLE = new Key<>("mp3.bitsPerSample");
        public static final Key FORMAT = new Key<>("mp3.format");
        public static final Key ENCODING_TYPE = new Key<>("mp3.encodingType");
        public static final Key CHANNELS = new Key<>("mp3.channels");

        public static final Key MBZ_TRACK_ID = new Key<>("mbz.trackId");
        public static final Key MBZ_WORK_ID = new Key<>("mbz.workId");
        public static final Key MBZ_DISC_ID = new Key<>("mbz.discId");
        public static final Key> MBZ_ARTIST_ID = new Key<>("mbz.artistId");

        /***************************************************************************************************************
         *
         *
         *
         **************************************************************************************************************/
        @Nonnull
        public  Optional get (@Nonnull Key key);

        /***************************************************************************************************************
         *
         *
         *
         **************************************************************************************************************/
        @Nonnull
        public  T getAll (@Nonnull Key key);

        /***************************************************************************************************************
         *
         *
         *
         **************************************************************************************************************/
        public boolean containsKey (@Nonnull Key key);

        /***************************************************************************************************************
         *
         *
         *
         **************************************************************************************************************/
        @Nonnull
        public Set> getKeys();

        /***************************************************************************************************************
         *
         *
         *
         **************************************************************************************************************/
        @Nonnull
        public Set, ?>> getEntries();

        /***************************************************************************************************************
         *
         * Returns a clone of this object with an additional value.
         *
         * @para             the value type
         * @param       key     the key
         * @param       value   the value
         * @return              the clone
         *
         **************************************************************************************************************/
        @Nonnull
        public  Metadata with (@Nonnull Key key, T value);

        /***************************************************************************************************************
         *
         * Returns a clone of this object with an additional optional value.
         *
         * @para             the value type
         * @param       key     the key
         * @param       value   the value
         * @return              the clone
         *
         **************************************************************************************************************/
        @Nonnull
        public  Metadata with (@Nonnull Key key, Optional value);
    }

    /*******************************************************************************************************************
     *
     * Returns the {@link Metadata} associated with this object.
     *
     * @return  the metadata
     *
     ******************************************************************************************************************/
    @Nonnull
    public Metadata getMetadata();
  }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy