Skip to content

Commit

Permalink
add dlna channel factory
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed Jul 18, 2014
1 parent ff4add0 commit ed692df
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 45 deletions.
3 changes: 0 additions & 3 deletions MediaBrowser.Api/Images/ImageService.cs
Expand Up @@ -535,9 +535,6 @@ public object GetImage(ImageRequest request, IHasImages item)
throw new ResourceNotFoundException(string.Format("{0} does not have an image of type {1}", item.Name, request.Type));
}

// See if we can avoid a file system lookup by looking for the file in ResolveArgs
var originalFileImageDateModified = imageInfo.DateModified;

var supportedImageEnhancers = request.EnableImageEnhancers ? _imageProcessor.ImageEnhancers.Where(i =>
{
try
Expand Down
6 changes: 0 additions & 6 deletions MediaBrowser.Controller/Channels/ChannelFolderItem.cs
Expand Up @@ -15,7 +15,6 @@ public class ChannelFolderItem : Folder, IChannelItem
public ChannelFolderType ChannelFolderType { get; set; }

public string OriginalImageUrl { get; set; }
public List<string> Tags { get; set; }

protected override bool GetBlockUnratedValue(UserConfiguration config)
{
Expand All @@ -31,11 +30,6 @@ public override bool SupportsLocalMetadata
}
}

public ChannelFolderItem()
{
Tags = new List<string>();
}

public override string GetUserDataKey()
{
return ExternalId;
Expand Down
9 changes: 1 addition & 8 deletions MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs
Expand Up @@ -11,15 +11,14 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <summary>
/// Class MusicAlbum
/// </summary>
public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasTags, IHasLookupInfo<AlbumInfo>
public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLookupInfo<AlbumInfo>
{
public List<Guid> SoundtrackIds { get; set; }

public MusicAlbum()
{
Artists = new List<string>();
SoundtrackIds = new List<Guid>();
Tags = new List<string>();
}

[IgnoreDataMember]
Expand Down Expand Up @@ -65,12 +64,6 @@ public List<string> AlbumArtists
}
}

/// <summary>
/// Gets or sets the tags.
/// </summary>
/// <value>The tags.</value>
public List<string> Tags { get; set; }

/// <summary>
/// Gets the tracks.
/// </summary>
Expand Down
10 changes: 1 addition & 9 deletions MediaBrowser.Controller/Entities/Audio/MusicArtist.cs
Expand Up @@ -13,16 +13,9 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <summary>
/// Class MusicArtist
/// </summary>
public class MusicArtist : Folder, IMetadataContainer, IItemByName, IHasMusicGenres, IHasDualAccess, IHasTags, IHasProductionLocations, IHasLookupInfo<ArtistInfo>
public class MusicArtist : Folder, IMetadataContainer, IItemByName, IHasMusicGenres, IHasDualAccess, IHasProductionLocations, IHasLookupInfo<ArtistInfo>
{
public bool IsAccessedByName { get; set; }

/// <summary>
/// Gets or sets the tags.
/// </summary>
/// <value>The tags.</value>
public List<string> Tags { get; set; }

public List<string> ProductionLocations { get; set; }

public override bool IsFolder
Expand Down Expand Up @@ -60,7 +53,6 @@ protected override Task ValidateChildrenInternal(IProgress<double> progress, Can

public MusicArtist()
{
Tags = new List<string>();
ProductionLocations = new List<string>();
}

Expand Down
4 changes: 1 addition & 3 deletions MediaBrowser.Controller/Entities/Movies/BoxSet.cs
Expand Up @@ -14,13 +14,12 @@ namespace MediaBrowser.Controller.Entities.Movies
/// <summary>
/// Class BoxSet
/// </summary>
public class BoxSet : Folder, IHasTrailers, IHasTags, IHasKeywords, IHasPreferredMetadataLanguage, IHasDisplayOrder, IHasLookupInfo<BoxSetInfo>, IMetadataContainer
public class BoxSet : Folder, IHasTrailers, IHasKeywords, IHasPreferredMetadataLanguage, IHasDisplayOrder, IHasLookupInfo<BoxSetInfo>, IMetadataContainer
{
public BoxSet()
{
RemoteTrailers = new List<MediaUrl>();
LocalTrailerIds = new List<Guid>();
Tags = new List<string>();

DisplayOrder = ItemSortBy.PremiereDate;
Keywords = new List<string>();
Expand All @@ -38,7 +37,6 @@ public BoxSet()
/// Gets or sets the tags.
/// </summary>
/// <value>The tags.</value>
public List<string> Tags { get; set; }
public List<string> Keywords { get; set; }

public string PreferredMetadataLanguage { get; set; }
Expand Down
9 changes: 1 addition & 8 deletions MediaBrowser.Controller/Entities/TV/Series.cs
Expand Up @@ -13,7 +13,7 @@ namespace MediaBrowser.Controller.Entities.TV
/// <summary>
/// Class Series
/// </summary>
public class Series : Folder, IHasSoundtracks, IHasTrailers, IHasTags, IHasPreferredMetadataLanguage, IHasDisplayOrder, IHasLookupInfo<SeriesInfo>
public class Series : Folder, IHasSoundtracks, IHasTrailers, IHasPreferredMetadataLanguage, IHasDisplayOrder, IHasLookupInfo<SeriesInfo>
{
public List<Guid> SpecialFeatureIds { get; set; }
public List<Guid> SoundtrackIds { get; set; }
Expand All @@ -36,7 +36,6 @@ public Series()
SoundtrackIds = new List<Guid>();
RemoteTrailers = new List<MediaUrl>();
LocalTrailerIds = new List<Guid>();
Tags = new List<string>();
DisplaySpecialsWithSeasons = true;
}

Expand All @@ -51,12 +50,6 @@ public Series()
/// </summary>
public string DisplayOrder { get; set; }

/// <summary>
/// Gets or sets the tags.
/// </summary>
/// <value>The tags.</value>
public List<string> Tags { get; set; }

/// <summary>
/// Gets or sets the status.
/// </summary>
Expand Down
88 changes: 88 additions & 0 deletions MediaBrowser.Dlna/Channels/DlnaChannelFactory.cs
@@ -0,0 +1,88 @@
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace MediaBrowser.Dlna.Channels
{
public class DlnaChannelFactory : IChannelFactory
{
public IEnumerable<IChannel> GetChannels()
{
// Check config here
// If user wants all channels separate, return them all
// If user wants one parent channel, return just that one

return new List<IChannel>()
{
//new DummyChannel("test 1"),
//new DummyChannel("test 2")
};
}
}

public class DummyChannel : IChannel
{
private readonly string _name;

public DummyChannel(string name)
{
_name = name;
}

public string Name
{
get { return _name; }
}

public string Description
{
get { return "Dummy Channel"; }
}

public string DataVersion
{
get { return "1"; }
}

public string HomePageUrl
{
get { return "http://www.google.com"; }
}

public ChannelParentalRating ParentalRating
{
get { return ChannelParentalRating.GeneralAudience; }
}

public InternalChannelFeatures GetChannelFeatures()
{
return new InternalChannelFeatures
{

};
}

public bool IsEnabledFor(string userId)
{
return true;
}

public Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
{
return Task.FromResult(new ChannelItemResult());
}

public Task<DynamicImageResponse> GetChannelImage(ImageType type, CancellationToken cancellationToken)
{
return Task.FromResult(new DynamicImageResponse());
}

public IEnumerable<ImageType> GetSupportedChannelImages()
{
return new List<ImageType>();
}
}
}
1 change: 1 addition & 0 deletions MediaBrowser.Dlna/MediaBrowser.Dlna.csproj
Expand Up @@ -51,6 +51,7 @@
<Compile Include="..\SharedVersion.cs">
<Link>Properties\SharedVersion.cs</Link>
</Compile>
<Compile Include="Channels\DlnaChannelFactory.cs" />
<Compile Include="ConfigurationExtension.cs" />
<Compile Include="ConnectionManager\ConnectionManager.cs" />
<Compile Include="ConnectionManager\ConnectionManagerXmlBuilder.cs" />
Expand Down
Expand Up @@ -542,7 +542,7 @@ public async Task<QueryResult<BaseItemDto>> GetLatestChannelItems(AllChannelMedi
throw new ArgumentException("User not found.");
}

var channels = _channels;
var channels = GetAllChannels();

if (query.ChannelIds.Length > 0)
{
Expand Down Expand Up @@ -696,7 +696,7 @@ public async Task<QueryResult<BaseItemDto>> GetAllMedia(AllChannelMediaQuery que
? null
: _userManager.GetUserById(new Guid(query.UserId));

var channels = _channels;
var channels = GetAllChannels();

if (query.ChannelIds.Length > 0)
{
Expand Down
Expand Up @@ -94,8 +94,9 @@ private IEnumerable<string> GetUserIds(NotificationRequest request, Notification
{
var config = GetConfiguration();

return _userManager.Users.Where(i => config.IsEnabledToSendToUser(request.NotificationType, i.Id.ToString("N"), i.Configuration))
.Select(i => i.Id.ToString("N"));
return _userManager.Users
.Where(i => config.IsEnabledToSendToUser(request.NotificationType, i.Id.ToString("N"), i.Configuration))
.Select(i => i.Id.ToString("N"));
}

return request.UserIds;
Expand Down
5 changes: 1 addition & 4 deletions MediaBrowser.WebDashboard/dashboard-ui/css/notifications.css
Expand Up @@ -3,7 +3,7 @@
}

.notificationsPanelModelOpen {
right: 250px!important;
right: 250px !important;
}

.btnNotifications {
Expand Down Expand Up @@ -80,9 +80,6 @@
border-bottom: 1px solid #eee;
}

.notificationName {
}

.notificationTime {
color: green;
}
Expand Down

0 comments on commit ed692df

Please sign in to comment.