mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-03 15:26:34 +01:00
Moved the http server to it's own assembly. added comments and made other minor re-organizations.
This commit is contained in:
parent
6fbd5cf464
commit
80b3ad7bd2
39
MediaBrowser.Model/Entities/ApiBaseItem.cs
Normal file
39
MediaBrowser.Model/Entities/ApiBaseItem.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using MediaBrowser.Model.Users;
|
||||
|
||||
namespace MediaBrowser.Model.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a concrete class that the UI can use to deserialize
|
||||
/// It is flat in the sense that it will be used regardless of the type of BaseItem involved
|
||||
/// </summary>
|
||||
public class ApiBaseItem : BaseItem
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is the full return object when requesting an Item
|
||||
/// </summary>
|
||||
public class ApiBaseItemWrapper<T>
|
||||
where T : BaseItem
|
||||
{
|
||||
public T Item { get; set; }
|
||||
|
||||
public UserItemData UserItemData { get; set; }
|
||||
|
||||
public IEnumerable<ApiBaseItemWrapper<T>> Children { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public Type ItemType { get; set; }
|
||||
|
||||
public string Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return ItemType.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,70 +6,70 @@ namespace MediaBrowser.Model.Entities
|
||||
{
|
||||
public abstract class BaseItem
|
||||
{
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string SortName { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string SortName { get; set; }
|
||||
|
||||
public virtual Guid Id { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public virtual DateTime DateCreated { get; set; }
|
||||
public DateTime DateCreated { get; set; }
|
||||
|
||||
public virtual DateTime DateModified { get; set; }
|
||||
public DateTime DateModified { get; set; }
|
||||
|
||||
public virtual string Path { get; set; }
|
||||
/// <summary>
|
||||
/// When the item first debuted. For movies this could be premiere date, episodes would be first aired
|
||||
/// </summary>
|
||||
public DateTime? PremiereDate { get; set; }
|
||||
|
||||
public string Path { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public Folder Parent { get; set; }
|
||||
|
||||
public virtual string PrimaryImagePath { get; set; }
|
||||
public virtual string LogoImagePath { get; set; }
|
||||
public virtual string ArtImagePath { get; set; }
|
||||
public virtual string ThumbnailImagePath { get; set; }
|
||||
public virtual string BannerImagePath { 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 virtual IEnumerable<string> BackdropImagePaths { get; set; }
|
||||
public IEnumerable<string> BackdropImagePaths { get; set; }
|
||||
|
||||
public virtual string OfficialRating { get; set; }
|
||||
public string OfficialRating { get; set; }
|
||||
|
||||
public virtual string CustomRating { get; set; }
|
||||
public virtual string CustomPin { get; set; }
|
||||
public string CustomRating { get; set; }
|
||||
public string CustomPin { get; set; }
|
||||
|
||||
public virtual string Overview { get; set; }
|
||||
public virtual string Tagline { get; set; }
|
||||
public string Overview { get; set; }
|
||||
public string Tagline { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public virtual IEnumerable<PersonInfo> People { get; set; }
|
||||
public IEnumerable<PersonInfo> People { get; set; }
|
||||
|
||||
public virtual IEnumerable<string> Studios { get; set; }
|
||||
public IEnumerable<string> Studios { get; set; }
|
||||
|
||||
public virtual IEnumerable<string> Genres { get; set; }
|
||||
public IEnumerable<string> Genres { get; set; }
|
||||
|
||||
public virtual string DisplayMediaType { get; set; }
|
||||
public string DisplayMediaType { get; set; }
|
||||
|
||||
public virtual float? UserRating { get; set; }
|
||||
public virtual TimeSpan? RunTime { get; set; }
|
||||
public float? UserRating { get; set; }
|
||||
public TimeSpan? RunTime { get; set; }
|
||||
|
||||
public virtual string AspectRatio { get; set; }
|
||||
public virtual int? ProductionYear { get; set; }
|
||||
public string AspectRatio { get; set; }
|
||||
public int? ProductionYear { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the item is part of a series, this is it's number in the series.
|
||||
/// This could be episode number, album track number, etc.
|
||||
/// </summary>
|
||||
public int? IndexNumber { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public virtual IEnumerable<Video> LocalTrailers { get; set; }
|
||||
public IEnumerable<Video> LocalTrailers { get; set; }
|
||||
|
||||
public string TrailerUrl { get; set; }
|
||||
|
||||
public virtual string TrailerUrl { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is strictly to enhance json output, until I can find a way to customize service stack to add this without having to use a property
|
||||
/// </summary>
|
||||
public string Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetType().Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace MediaBrowser.Model.Entities
|
||||
@@ -21,9 +18,6 @@ namespace MediaBrowser.Model.Entities
|
||||
[IgnoreDataMember]
|
||||
public BaseItem[] Children { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public IEnumerable<Folder> FolderChildren { get { return Children.OfType<Folder>(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Finds an item by ID, recursively
|
||||
/// </summary>
|
||||
@@ -36,17 +30,18 @@ namespace MediaBrowser.Model.Entities
|
||||
|
||||
foreach (BaseItem item in Children)
|
||||
{
|
||||
if (item.Id == id)
|
||||
var folder = item as Folder;
|
||||
|
||||
if (folder != null)
|
||||
{
|
||||
return item;
|
||||
var foundItem = folder.FindById(id);
|
||||
|
||||
if (foundItem != null)
|
||||
{
|
||||
return foundItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Folder folder in FolderChildren)
|
||||
{
|
||||
BaseItem item = folder.FindById(id);
|
||||
|
||||
if (item != null)
|
||||
else if (item.Id == id)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
@@ -67,17 +62,18 @@ namespace MediaBrowser.Model.Entities
|
||||
|
||||
foreach (BaseItem item in Children)
|
||||
{
|
||||
if (item.Path.Equals(path, StringComparison.OrdinalIgnoreCase))
|
||||
var folder = item as Folder;
|
||||
|
||||
if (folder != null)
|
||||
{
|
||||
return item;
|
||||
var foundItem = folder.FindByPath(path);
|
||||
|
||||
if (foundItem != null)
|
||||
{
|
||||
return foundItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Folder folder in FolderChildren)
|
||||
{
|
||||
BaseItem item = folder.FindByPath(path);
|
||||
|
||||
if (item != null)
|
||||
else if (item.Path.Equals(path, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Configuration\Configuration.cs" />
|
||||
<Compile Include="Entities\ApiBaseItem.cs" />
|
||||
<Compile Include="Entities\Audio.cs" />
|
||||
<Compile Include="Entities\BaseItem.cs" />
|
||||
<Compile Include="Entities\CategoryInfo.cs" />
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace MediaBrowser.Model.Users
|
||||
{
|
||||
public class User : BaseItem
|
||||
{
|
||||
public string Password { get; set; }
|
||||
public string MaxParentalRating { get; set; }
|
||||
|
||||
private Dictionary<Guid, UserItemData> _ItemData = new Dictionary<Guid, UserItemData>();
|
||||
|
||||
Reference in New Issue
Block a user