added convenience methods on Video to get MediaStreams

This commit is contained in:
Luke Pulverenti 2013-12-07 11:29:12 -05:00
parent 672f71d889
commit 841cf92923

View File

@ -1,4 +1,5 @@
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Model.Entities;
using System;
using System.Collections;
@ -271,5 +272,28 @@ namespace MediaBrowser.Controller.Entities
return base.GetDeletePaths();
}
public IEnumerable<MediaStream> GetMediaStreams()
{
return ItemRepository.GetMediaStreams(new MediaStreamQuery
{
ItemId = Id
});
}
public MediaStream GetDefaultVideoStream()
{
if (!DefaultVideoStreamIndex.HasValue)
{
return null;
}
return ItemRepository.GetMediaStreams(new MediaStreamQuery
{
ItemId = Id,
Index = DefaultVideoStreamIndex.Value
}).FirstOrDefault();
}
}
}