diff options
| author | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-07-12 02:55:27 -0400 |
|---|---|---|
| committer | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-07-12 02:55:27 -0400 |
| commit | b50f78e5da6f3fdfc59e577ca61b88771da7d211 (patch) | |
| tree | 644ba93dc04bb8837a19a9cd5c3dfa8c6d62a91d /MediaBrowser.Model/Entities | |
Initial check-in
Diffstat (limited to 'MediaBrowser.Model/Entities')
| -rw-r--r-- | MediaBrowser.Model/Entities/Audio.cs | 12 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/BaseItem.cs | 64 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/Folder.cs | 96 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/Person.cs | 22 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/PlaybackStatus.cs | 12 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/Video.cs | 42 |
6 files changed, 248 insertions, 0 deletions
diff --git a/MediaBrowser.Model/Entities/Audio.cs b/MediaBrowser.Model/Entities/Audio.cs new file mode 100644 index 000000000..b243411ad --- /dev/null +++ b/MediaBrowser.Model/Entities/Audio.cs @@ -0,0 +1,12 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Model.Entities
+{
+ public class Audio : BaseItem
+ {
+ }
+}
diff --git a/MediaBrowser.Model/Entities/BaseItem.cs b/MediaBrowser.Model/Entities/BaseItem.cs new file mode 100644 index 000000000..2eaf375d9 --- /dev/null +++ b/MediaBrowser.Model/Entities/BaseItem.cs @@ -0,0 +1,64 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Newtonsoft.Json;
+
+namespace MediaBrowser.Model.Entities
+{
+ public abstract class BaseItem
+ {
+ public string Name { get; set; }
+ public string SortName { get; set; }
+
+ public Guid Id { get; set; }
+
+ public DateTime DateCreated { get; set; }
+ public DateTime DateModified { get; set; }
+
+ public string Path { get; set; }
+
+ [JsonIgnore]
+ public Folder Parent { get; set; }
+
+ public string PrimaryImagePath { get; set; }
+ public string LogoImagePath { get; set; }
+ public string ArtImagePath { get; set; }
+ public string ThumbnailImagePath { get; set; }
+ public string BannerImagePath { get; set; }
+
+ public IEnumerable<string> BackdropImagePaths { get; set; }
+
+ public string OfficialRating { get; set; }
+
+ public string CustomRating { get; set; }
+ public string CustomPin { get; set; }
+
+ public string Overview { get; set; }
+ public string Tagline { get; set; }
+
+ public IEnumerable<Person> People { get; set; }
+
+ public IEnumerable<string> Studios { get; set; }
+
+ public IEnumerable<string> Genres { get; set; }
+
+ public string DisplayMediaType { get; set; }
+
+ public float? UserRating { get; set; }
+ public TimeSpan? RunTime { get; set; }
+
+ public string AspectRatio { get; set; }
+ public int? ProductionYear { get; set; }
+
+ public IEnumerable<Video> LocalTrailers { get; set; }
+
+ public string TrailerUrl { get; set; }
+
+ public override string ToString()
+ {
+ return Name;
+ }
+ }
+}
diff --git a/MediaBrowser.Model/Entities/Folder.cs b/MediaBrowser.Model/Entities/Folder.cs new file mode 100644 index 000000000..6af9bf259 --- /dev/null +++ b/MediaBrowser.Model/Entities/Folder.cs @@ -0,0 +1,96 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.IO;
+using Newtonsoft.Json;
+
+namespace MediaBrowser.Model.Entities
+{
+ public class Folder : BaseItem
+ {
+ public bool IsRoot { get; set; }
+
+ public bool IsVirtualFolder
+ {
+ get
+ {
+ return Parent != null && Parent.IsRoot;
+ }
+ }
+
+ [JsonIgnore]
+ public BaseItem[] Children { get; set; }
+
+ [JsonIgnore]
+ public IEnumerable<Folder> FolderChildren { get { return Children.OfType<Folder>(); } }
+
+ public Folder GetFolderByName(string name)
+ {
+ return FolderChildren.FirstOrDefault(f => System.IO.Path.GetFileName(f.Path).Equals(name, StringComparison.OrdinalIgnoreCase));
+ }
+
+ /// <summary>
+ /// Finds an item by ID, recursively
+ /// </summary>
+ public BaseItem FindById(Guid id)
+ {
+ if (Id == id)
+ {
+ return this;
+ }
+
+ foreach (BaseItem item in Children)
+ {
+ if (item.Id == id)
+ {
+ return item;
+ }
+ }
+
+ foreach (Folder folder in FolderChildren)
+ {
+ BaseItem item = folder.FindById(id);
+
+ if (item != null)
+ {
+ return item;
+ }
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// Finds an item by path, recursively
+ /// </summary>
+ public BaseItem FindByPath(string path)
+ {
+ if (Path.Equals(path, StringComparison.OrdinalIgnoreCase))
+ {
+ return this;
+ }
+
+ foreach (BaseItem item in Children)
+ {
+ if (item.Path.Equals(path, StringComparison.OrdinalIgnoreCase))
+ {
+ return item;
+ }
+ }
+
+ foreach (Folder folder in FolderChildren)
+ {
+ BaseItem item = folder.FindByPath(path);
+
+ if (item != null)
+ {
+ return item;
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/MediaBrowser.Model/Entities/Person.cs b/MediaBrowser.Model/Entities/Person.cs new file mode 100644 index 000000000..320491d02 --- /dev/null +++ b/MediaBrowser.Model/Entities/Person.cs @@ -0,0 +1,22 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Model.Entities
+{
+ public class Person
+ {
+ public string Name { get; set; }
+ public string Description { get; set; }
+ public PersonType PersonType { get; set; }
+ }
+
+ public enum PersonType
+ {
+ Actor = 1,
+ Director = 2,
+ Writer = 3
+ }
+}
diff --git a/MediaBrowser.Model/Entities/PlaybackStatus.cs b/MediaBrowser.Model/Entities/PlaybackStatus.cs new file mode 100644 index 000000000..042cfe098 --- /dev/null +++ b/MediaBrowser.Model/Entities/PlaybackStatus.cs @@ -0,0 +1,12 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Model.Entities
+{
+ public class PlaybackStatus
+ {
+ }
+}
diff --git a/MediaBrowser.Model/Entities/Video.cs b/MediaBrowser.Model/Entities/Video.cs new file mode 100644 index 000000000..8b27f47c8 --- /dev/null +++ b/MediaBrowser.Model/Entities/Video.cs @@ -0,0 +1,42 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Model.Entities
+{
+ public class Video : BaseItem
+ {
+ public VideoType VideoType { get; set; }
+
+ private IEnumerable<string> _Subtitles = new string[] { };
+ public IEnumerable<string> Subtitles { get { return _Subtitles; } set { _Subtitles = value; } }
+
+ private IEnumerable<AudioStream> _AudioStreams = new AudioStream[] { };
+ public IEnumerable<AudioStream> AudioStreams { get { return _AudioStreams; } set { _AudioStreams = value; } }
+
+ public int Height { get; set; }
+ public int Width { get; set; }
+ public string ScanType { get; set; }
+ public string FrameRate { get; set; }
+ public int VideoBitRate { get; set; }
+ public string VideoCodec { get; set; }
+ }
+
+ public class AudioStream
+ {
+ public string AudioFormat { get; set; }
+ public string AudioProfile { get; set; }
+ public string Language { get; set; }
+ public int BitRate { get; set; }
+ public int Channels { get; set; }
+ }
+
+ public enum VideoType
+ {
+ VideoFile = 1,
+ DVD = 2,
+ BluRay = 3
+ }
+}
|
