aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/Audio
diff options
context:
space:
mode:
authorLukePulverenti <luke.pulverenti@gmail.com>2013-02-20 20:33:05 -0500
committerLukePulverenti <luke.pulverenti@gmail.com>2013-02-20 20:33:05 -0500
commit767cdc1f6f6a63ce997fc9476911e2c361f9d402 (patch)
tree49add55976f895441167c66cfa95e5c7688d18ce /MediaBrowser.Controller/Entities/Audio
parent845554722efaed872948a9e0f7202e3ef52f1b6e (diff)
Pushing missing changes
Diffstat (limited to 'MediaBrowser.Controller/Entities/Audio')
-rw-r--r--MediaBrowser.Controller/Entities/Audio/Audio.cs78
-rw-r--r--MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs133
-rw-r--r--MediaBrowser.Controller/Entities/Audio/MusicArtist.cs10
3 files changed, 221 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs
new file mode 100644
index 0000000000..511b589e53
--- /dev/null
+++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs
@@ -0,0 +1,78 @@
+using MediaBrowser.Model.Entities;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+
+namespace MediaBrowser.Controller.Entities.Audio
+{
+ /// <summary>
+ /// Class Audio
+ /// </summary>
+ public class Audio : BaseItem, IHasMediaStreams
+ {
+ /// <summary>
+ /// Gets or sets the media streams.
+ /// </summary>
+ /// <value>The media streams.</value>
+ public List<MediaStream> MediaStreams { get; set; }
+
+ /// <summary>
+ /// Override this to true if class should be grouped under a container in indicies
+ /// The container class should be defined via IndexContainer
+ /// </summary>
+ /// <value><c>true</c> if [group in index]; otherwise, <c>false</c>.</value>
+ [IgnoreDataMember]
+ public override bool GroupInIndex
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ /// <summary>
+ /// The unknown album
+ /// </summary>
+ private static readonly MusicAlbum UnknownAlbum = new MusicAlbum {Name = "<Unknown>"};
+ /// <summary>
+ /// Override this to return the folder that should be used to construct a container
+ /// for this item in an index. GroupInIndex should be true as well.
+ /// </summary>
+ /// <value>The index container.</value>
+ [IgnoreDataMember]
+ public override Folder IndexContainer
+ {
+ get
+ {
+ return Parent is MusicAlbum ? Parent : Album != null ? new MusicAlbum {Name = Album, PrimaryImagePath = PrimaryImagePath } : UnknownAlbum;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the artist.
+ /// </summary>
+ /// <value>The artist.</value>
+ public string Artist { get; set; }
+ /// <summary>
+ /// Gets or sets the album.
+ /// </summary>
+ /// <value>The album.</value>
+ public string Album { get; set; }
+ /// <summary>
+ /// Gets or sets the album artist.
+ /// </summary>
+ /// <value>The album artist.</value>
+ public string AlbumArtist { get; set; }
+
+ /// <summary>
+ /// Gets the type of the media.
+ /// </summary>
+ /// <value>The type of the media.</value>
+ public override string MediaType
+ {
+ get
+ {
+ return Model.Entities.MediaType.Audio;
+ }
+ }
+ }
+}
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs
new file mode 100644
index 0000000000..9e4e3c5424
--- /dev/null
+++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs
@@ -0,0 +1,133 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+
+namespace MediaBrowser.Controller.Entities.Audio
+{
+ /// <summary>
+ /// Class MusicAlbum
+ /// </summary>
+ public class MusicAlbum : Folder
+ {
+ /// <summary>
+ /// Songs will group into us so don't also include us in the index
+ /// </summary>
+ /// <value><c>true</c> if [include in index]; otherwise, <c>false</c>.</value>
+ [IgnoreDataMember]
+ public override bool IncludeInIndex
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Override this to true if class should be grouped under a container in indicies
+ /// The container class should be defined via IndexContainer
+ /// </summary>
+ /// <value><c>true</c> if [group in index]; otherwise, <c>false</c>.</value>
+ [IgnoreDataMember]
+ public override bool GroupInIndex
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ /// <summary>
+ /// The unknwon artist
+ /// </summary>
+ private static readonly MusicArtist UnknwonArtist = new MusicArtist {Name = "<Unknown>"};
+
+ /// <summary>
+ /// Override this to return the folder that should be used to construct a container
+ /// for this item in an index. GroupInIndex should be true as well.
+ /// </summary>
+ /// <value>The index container.</value>
+ [IgnoreDataMember]
+ public override Folder IndexContainer
+ {
+ get { return Parent as MusicArtist ?? UnknwonArtist; }
+ }
+
+ /// <summary>
+ /// Override to point to first child (song) if not explicitly defined
+ /// </summary>
+ /// <value>The primary image path.</value>
+ [IgnoreDataMember]
+ public override string PrimaryImagePath
+ {
+ get
+ {
+ if (base.PrimaryImagePath == null)
+ {
+ var child = Children.FirstOrDefault();
+
+ return child == null ? base.PrimaryImagePath : child.PrimaryImagePath;
+ }
+
+ return base.PrimaryImagePath;
+ }
+ set
+ {
+ base.PrimaryImagePath = value;
+ }
+ }
+
+ /// <summary>
+ /// Override to point to first child (song)
+ /// </summary>
+ /// <value>The production year.</value>
+ public override int? ProductionYear
+ {
+ get
+ {
+ var child = Children.FirstOrDefault();
+
+ return child == null ? base.ProductionYear : child.ProductionYear;
+ }
+ set
+ {
+ base.ProductionYear = value;
+ }
+ }
+
+ /// <summary>
+ /// Override to point to first child (song)
+ /// </summary>
+ /// <value>The genres.</value>
+ public override List<string> Genres
+ {
+ get
+ {
+ var child = Children.FirstOrDefault();
+
+ return child == null ? base.Genres : child.Genres;
+ }
+ set
+ {
+ base.Genres = value;
+ }
+ }
+
+ /// <summary>
+ /// Override to point to first child (song)
+ /// </summary>
+ /// <value>The studios.</value>
+ public override List<string> Studios
+ {
+ get
+ {
+ var child = Children.FirstOrDefault();
+
+ return child == null ? base.Studios : child.Studios;
+ }
+ set
+ {
+ base.Studios = value;
+ }
+ }
+ }
+}
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
new file mode 100644
index 0000000000..b2fc04873f
--- /dev/null
+++ b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
@@ -0,0 +1,10 @@
+
+namespace MediaBrowser.Controller.Entities.Audio
+{
+ /// <summary>
+ /// Class MusicArtist
+ /// </summary>
+ public class MusicArtist : Folder
+ {
+ }
+}