本文整理汇总了C#中WebMediaType类的典型用法代码示例。如果您正苦于以下问题:C# WebMediaType类的具体用法?C# WebMediaType怎么用?C# WebMediaType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebMediaType类属于命名空间,在下文中一共展示了WebMediaType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Download
public ActionResult Download(WebMediaType type, string item)
{
// Create URL to GetMediaItem
Log.Debug("User wants to download type={0}; item={1}", type, item);
var queryString = HttpUtility.ParseQueryString(String.Empty); // you can't instantiate that class manually for some reason
queryString["clientDescription"] = String.Format("WebMediaPortal download (user {0})", HttpContext.User.Identity.Name);
queryString["type"] = ((int)type).ToString();
queryString["itemId"] = item;
string address = type == WebMediaType.TV || type == WebMediaType.Recording ? Connections.Current.Addresses.TAS : Connections.Current.Addresses.MAS;
string fullUrl = String.Format("http://{0}/MPExtended/StreamingService/stream/GetMediaItem?{1}", address, queryString.ToString());
UriBuilder fullUri = new UriBuilder(fullUrl);
// If we connect to the services at localhost, actually give the extern IP address to users
if (NetworkInformation.IsLocalAddress(fullUri.Host, false))
fullUri.Host = NetworkInformation.GetIPAddress(false);
// Do the actual streaming
if (GetStreamMode() == StreamType.Proxied)
{
Log.Debug("Proxying download at {0}", fullUri.ToString());
GetStreamControl(type).AuthorizeStreaming();
ProxyStream(fullUri.ToString());
}
else if (GetStreamMode() == StreamType.Direct)
{
Log.Debug("Redirecting user to download at {0}", fullUri.ToString());
GetStreamControl(type).AuthorizeRemoteHostForStreaming(HttpContext.Request.UserHostAddress);
return Redirect(fullUri.ToString());
}
return new EmptyResult();
}
开发者ID:cpriebe,项目名称:MPExtended,代码行数:31,代码来源:StreamController.cs
示例2: ArtworkImplementation
private static string ArtworkImplementation(this UrlHelper helper, WebMediaType mediaType, string id, Func<string, string, RouteValueDictionary, string> actionMethod)
{
switch (mediaType)
{
case WebMediaType.Movie:
return actionMethod("Cover", "MovieLibrary", new RouteValueDictionary(new { movie = id }));
case WebMediaType.MusicAlbum:
return actionMethod("AlbumImage", "MusicLibrary", new RouteValueDictionary(new { album = id }));
case WebMediaType.MusicArtist:
return actionMethod("ArtistImage", "MusicLibrary", new RouteValueDictionary(new { artist = id }));
case WebMediaType.MusicTrack:
return actionMethod("TrackImage", "MusicLibrary", new RouteValueDictionary(new { track = id }));
case WebMediaType.Radio:
case WebMediaType.TV:
return actionMethod("ChannelLogo", "Television", new RouteValueDictionary(new { channelId = id }));
case WebMediaType.Recording:
// TODO: Make width configurable with a parameter (object attributes or something like it)
return actionMethod("PreviewImage", "Recording", new RouteValueDictionary(new { id = id, width = 640 }));
case WebMediaType.TVEpisode:
return actionMethod("EpisodeImage", "TVShowsLibrary", new RouteValueDictionary(new { episode = id }));
case WebMediaType.TVSeason:
return actionMethod("SeasonImage", "TVShowsLibrary", new RouteValueDictionary(new { season = id }));
case WebMediaType.TVShow:
return actionMethod("SeriesPoster", "TVShowsLibrary", new RouteValueDictionary(new { season = id }));
default:
return String.Empty;
}
}
开发者ID:puenktchen,项目名称:MPExtended,代码行数:28,代码来源:UrlHelperExtensionMethods.cs
示例3: GetMediaName
public static string GetMediaName(WebMediaType type, string id)
{
try
{
switch (type)
{
case WebMediaType.Movie:
return Connections.Current.MAS.GetMovieDetailedById(Settings.ActiveSettings.MovieProvider, id).Title;
case WebMediaType.MusicAlbum:
return Connections.Current.MAS.GetMusicAlbumBasicById(Settings.ActiveSettings.MusicProvider, id).Title;
case WebMediaType.MusicTrack:
return Connections.Current.MAS.GetMusicTrackDetailedById(Settings.ActiveSettings.MusicProvider, id).Title;
case WebMediaType.Recording:
return Connections.Current.TAS.GetRecordingById(Int32.Parse(id)).Title;
case WebMediaType.TV:
return Connections.Current.TAS.GetChannelDetailedById(Int32.Parse(id)).Title;
case WebMediaType.TVEpisode:
return Connections.Current.MAS.GetTVEpisodeDetailedById(Settings.ActiveSettings.TVShowProvider, id).Title;
case WebMediaType.TVShow:
return Connections.Current.MAS.GetTVShowDetailedById(Settings.ActiveSettings.TVShowProvider, id).Title;
case WebMediaType.TVSeason:
default:
return "";
}
}
catch (Exception ex)
{
Log.Warn("Could not load display name of media", ex);
}
return "";
}
开发者ID:puenktchen,项目名称:MPExtended,代码行数:31,代码来源:MediaName.cs
示例4: MediaSource
public MediaSource(WebMediaType type, int? provider, string id)
{
this.MediaType = (WebStreamMediaType)type;
this.Id = id;
this.Offset = 0;
this.Provider = provider;
}
开发者ID:Thorsten1982,项目名称:MPExtended,代码行数:7,代码来源:MediaSource.cs
示例5: GetExternalMediaInfo
public SerializableDictionary<string> GetExternalMediaInfo(WebMediaType type, string id)
{
return new SerializableDictionary<string>()
{
{ "Type", "file" },
{ "Path", GetFileBasic(id).Path.First() }
};
}
开发者ID:Thorsten1982,项目名称:MPExtended,代码行数:8,代码来源:ShareLibrary.cs
示例6: Download
//
// Streaming
public ActionResult Download(WebMediaType type, string item, string token = null)
{
// Check authentication
if (!IsUserAuthenticated())
{
string expectedData = String.Format("{0}_{1}_{2}", type, item, HttpContext.Application["randomToken"]);
byte[] expectedBytes = SHA256.Create().ComputeHash(Encoding.UTF8.GetBytes(expectedData));
string expectedToken = expectedBytes.ToHexString();
if (token == null || expectedToken != token)
{
Log.Error("Denying download type={0}, item={1}, token={2}, ip={3}: user is not logged in and token is invalid", type, item, token, Request.UserHostAddress);
return new HttpUnauthorizedResult();
}
}
// Create URL to GetMediaItem
Log.Debug("User wants to download type={0}; item={1}", type, item);
var queryString = HttpUtility.ParseQueryString(String.Empty); // you can't instantiate that class manually for some reason
var userDescription = !String.IsNullOrEmpty(HttpContext.User.Identity.Name) ? String.Format(" (user {0})", HttpContext.User.Identity) :
// TODO: also grab the user from the Authorization header here
!String.IsNullOrEmpty(token) ? " (token-based download)" : String.Empty;
queryString["clientDescription"] = "WebMediaPortal download" + userDescription;
queryString["type"] = ((int)type).ToString();
queryString["itemId"] = item;
string address = type == WebMediaType.TV || type == WebMediaType.Recording ? Connections.Current.Addresses.TAS : Connections.Current.Addresses.MAS;
string fullUrl = String.Format("http://{0}/MPExtended/StreamingService/stream/GetMediaItem?{1}", address, queryString.ToString());
UriBuilder fullUri = new UriBuilder(fullUrl);
// If we can access the file without any problems, let IIS stream it; that is a lot faster
if (NetworkInformation.IsLocalAddress(fullUri.Host) && type != WebMediaType.TV)
{
var path = type == WebMediaType.Recording ?
Connections.Current.TAS.GetRecordingFileInfo(Int32.Parse(item)).Path :
Connections.Current.MAS.GetMediaItem(GetProvider(type), type, item).Path[0];
if (System.IO.File.Exists(path))
return File(path, MIME.GetFromFilename(path, "application/octet-stream"), Path.GetFileName(path));
}
// If we connect to the services at localhost, actually give the extern IP address to users
if (NetworkInformation.IsLocalAddress(fullUri.Host))
fullUri.Host = NetworkInformation.GetIPAddressForUri();
// Do the actual streaming
if (GetStreamMode() == StreamType.Proxied)
{
Log.Debug("Proxying download at {0}", fullUri.ToString());
GetStreamControl(type).AuthorizeStreaming();
ProxyStream(fullUri.ToString());
}
else if (GetStreamMode() == StreamType.Direct)
{
Log.Debug("Redirecting user to download at {0}", fullUri.ToString());
GetStreamControl(type).AuthorizeRemoteHostForStreaming(HttpContext.Request.UserHostAddress);
return Redirect(fullUri.ToString());
}
return new EmptyResult();
}
开发者ID:Ollienator,项目名称:MPExtended,代码行数:59,代码来源:StreamController.cs
示例7: GetDownloadArguments
public object GetDownloadArguments(WebMediaType mediaType, string itemId)
{
return new
{
item = itemId,
type = mediaType,
token = GenerateDownloadToken(mediaType, itemId)
};
}
开发者ID:puenktchen,项目名称:MPExtended,代码行数:9,代码来源:SkinHelper.cs
示例8: GetExternalMediaInfo
public SerializableDictionary<string> GetExternalMediaInfo(WebMediaType type, string id)
{
string path = GetFileBasic(id).Path.First();
return new SerializableDictionary<string>()
{
{ "Type", File.Exists(path) ? "file" : "folder" },
{ "Path", path },
{ "Extensions", ".*" }
};
}
开发者ID:aredon,项目名称:MPExtended,代码行数:10,代码来源:LocalFileSystem.cs
示例9: AddPlaylistItems
public WebBoolResult AddPlaylistItems(int? provider, string playlistId, WebMediaType type, int? position, string ids)
{
IList<WebPlaylistItem> playlist = GetAllPlaylistItems(provider, playlistId).Finalize(provider, type);
int pos = position != null ? (int)position : playlist.Count - 1;
string[] splitIds = ids.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < splitIds.Length; i++)
{
AddPlaylistItemToPlaylist(provider, splitIds[i], pos + i, playlist);
}
return PlaylistLibraries[provider].SavePlaylist(playlistId, playlist);
}
开发者ID:Shukuyen,项目名称:MPExtended,代码行数:11,代码来源:MediaAccessService.cs
示例10: Download
public Stream Download(string clientDescription, WebMediaType type, int? provider, string itemId, long? position)
{
// validate source first
MediaSource source = new MediaSource(type, provider, itemId);
if (!source.Exists)
{
throw new FileNotFoundException();
}
// create context
DownloadContext context = new DownloadContext()
{
ClientDescription = clientDescription,
Source = source,
StartTime = DateTime.Now,
Stream = new ReadTrackingStreamWrapper(source.Retrieve()),
MediaInfo = MediaInfoHelper.LoadMediaInfoOrSurrogate(source) // for playerposition view
};
// seek to start position if wanted/needed
if (position != null && position > 0)
{
if (context.Stream.CanSeek)
{
context.Stream.Seek(position.Value, SeekOrigin.Begin);
}
else
{
Log.Warn("Download: Cannot seek on stream, failed to set start position to {0}", position);
}
}
// see comment in Streaming.cs:151
string realIp = WCFUtil.GetHeaderValue("forwardedFor", "X-Forwarded-For");
context.ClientIP = realIp == null ? WCFUtil.GetClientIPAddress() : String.Format("{0} (via {1})", realIp, WCFUtil.GetClientIPAddress());
// set headers for downloading
WCFUtil.AddHeader("Content-Disposition", "attachment; filename=\"" + source.GetFileInfo().Name + "\"");
if (source.MediaType != WebMediaType.TV)
WCFUtil.SetContentLength(source.GetFileInfo().Size);
// FIXME: there has to be a better way to do this
string mime = MIME.GetFromFilename(source.GetFileInfo().Name);
if (mime != null)
{
WCFUtil.SetContentType(mime);
}
// finally, save the context and return
runningDownloads.Add(context);
return context.Stream;
}
开发者ID:puenktchen,项目名称:MPExtended,代码行数:52,代码来源:Downloads.cs
示例11: AddPlaylistItem
public WebBoolResult AddPlaylistItem(int? provider, string playlistId, WebMediaType type, string id, int? position)
{
IList<WebPlaylistItem> playlist = GetAllPlaylistItems(provider, playlistId).Finalize(provider, type);
if (AddPlaylistItemToPlaylist(provider, id, position, playlist))
{
return PlaylistLibraries[provider].SavePlaylist(playlistId, playlist);
}
else
{
return false;
}
}
开发者ID:Shukuyen,项目名称:MPExtended,代码行数:13,代码来源:MediaAccessService.cs
示例12: MediaSource
public MediaSource(WebMediaType type, int? provider, string id, WebFileType filetype, int offset)
{
this.MediaType = type;
this.Id = id;
this.Provider = provider;
this.Offset = offset;
this.FileType = filetype;
if (!CheckArguments(type, filetype))
{
throw new ArgumentException("Invalid combination of mediatype and filetype");
}
}
开发者ID:jpykie,项目名称:MPExtended,代码行数:13,代码来源:MediaSource.cs
示例13: ReturnFromService
public static ActionResult ReturnFromService(WebMediaType mediaType, string id, WebFileType artworkType, int maxWidth, int maxHeight, string defaultFile = null)
{
IStreamingService service;
int? provider = null;
switch (mediaType)
{
case WebMediaType.Drive:
case WebMediaType.File:
case WebMediaType.Folder:
service = Connections.Current.MASStream;
provider = Settings.ActiveSettings.FileSystemProvider;
break;
case WebMediaType.Movie:
service = Connections.Current.MASStream;
provider = Settings.ActiveSettings.MovieProvider;
break;
case WebMediaType.MusicAlbum:
case WebMediaType.MusicArtist:
case WebMediaType.MusicTrack:
service = Connections.Current.MASStream;
provider = Settings.ActiveSettings.MusicProvider;
break;
case WebMediaType.Picture:
service = Connections.Current.MASStream;
provider = Settings.ActiveSettings.PicturesProvider;
break;
case WebMediaType.TVShow:
case WebMediaType.TVSeason:
case WebMediaType.TVEpisode:
service = Connections.Current.MASStream;
provider = Settings.ActiveSettings.TVShowProvider;
break;
case WebMediaType.TV:
service = Connections.Current.TASStream;
break;
case WebMediaType.Recording:
service = Connections.Current.TASStream;
return ReturnFromService(service, () => service.ExtractImageResized(mediaType, provider, id, 15, maxWidth, maxHeight), defaultFile);
default:
throw new ArgumentException("Tried to load image for unknown mediatype " + mediaType);
}
string etag = String.Format("{0}_{1}_{2}_{3}_{4}_{5}", mediaType, provider, id, artworkType, maxWidth, maxHeight);
return ReturnFromService(service, () => service.GetArtworkResized(mediaType, provider, id, artworkType, 0, maxWidth, maxHeight), defaultFile, etag);
}
开发者ID:brownard,项目名称:MPExtended,代码行数:46,代码来源:Images.cs
示例14: Download
public ActionResult Download(WebMediaType type, string item)
{
// Create URL to GetMediaItem
Log.Debug("User wants to download type={0}; item={1}", type, item);
var queryString = HttpUtility.ParseQueryString(String.Empty); // you can't instantiate that class manually for some reason
queryString["clientDescription"] = String.Format("WebMediaPortal download (user {0})", HttpContext.User.Identity.Name);
queryString["type"] = ((int)type).ToString();
queryString["itemId"] = item;
string address = type == WebMediaType.TV || type == WebMediaType.Recording ? Connections.Current.Addresses.TAS : Connections.Current.Addresses.MAS;
string fullUrl = String.Format("http://{0}/MPExtended/StreamingService/stream/GetMediaItem?{1}", address, queryString.ToString());
UriBuilder fullUri = new UriBuilder(fullUrl);
// If we can access the file without any problems, let IIS stream it; that is a lot faster
if (NetworkInformation.IsLocalAddress(fullUri.Host, false) && type != WebMediaType.TV)
{
var path = type == WebMediaType.Recording ?
Connections.Current.TAS.GetRecordingFileInfo(Int32.Parse(item)).Path :
Connections.Current.MAS.GetMediaItem(GetProvider(type), type, item).Path[0];
if (System.IO.File.Exists(path))
return File(path, MIME.GetFromFilename(path, "application/octet-stream"), Path.GetFileName(path));
}
// If we connect to the services at localhost, actually give the extern IP address to users
if (NetworkInformation.IsLocalAddress(fullUri.Host, false))
fullUri.Host = NetworkInformation.GetIPAddress(false);
// Do the actual streaming
if (GetStreamMode() == StreamType.Proxied)
{
Log.Debug("Proxying download at {0}", fullUri.ToString());
GetStreamControl(type).AuthorizeStreaming();
ProxyStream(fullUri.ToString());
}
else if (GetStreamMode() == StreamType.Direct)
{
Log.Debug("Redirecting user to download at {0}", fullUri.ToString());
GetStreamControl(type).AuthorizeRemoteHostForStreaming(HttpContext.Request.UserHostAddress);
return Redirect(fullUri.ToString());
}
return new EmptyResult();
}
开发者ID:jpykie,项目名称:MPExtended,代码行数:41,代码来源:StreamController.cs
示例15: IsLocalFile
public WebBoolResult IsLocalFile(int? provider, WebMediaType mediatype, WebFileType filetype, string id, int offset)
{
WebFileInfo info = GetFileInfo(provider, mediatype, filetype, id, offset);
return info.Exists && info.IsLocalFile;
}
开发者ID:Shukuyen,项目名称:MPExtended,代码行数:5,代码来源:MediaAccessService.cs
示例16: GetPathList
public IList<string> GetPathList(int? provider, WebMediaType mediatype, WebFileType filetype, string id)
{
if (mediatype == WebMediaType.File && filetype == WebFileType.Content)
return FileSystemLibraries[provider].GetFileBasic(id).Path;
else if (mediatype == WebMediaType.Movie && filetype == WebFileType.Content)
return MovieLibraries[provider].GetMovieDetailedById(id).Path;
else if (mediatype == WebMediaType.Movie && filetype == WebFileType.Backdrop)
return MovieLibraries[provider].GetMovieDetailedById(id).Artwork.Where(x => x.Type == WebFileType.Backdrop).Select(x => ((WebArtworkDetailed)x).Path).ToList();
else if (mediatype == WebMediaType.Movie && filetype == WebFileType.Cover)
return MovieLibraries[provider].GetMovieDetailedById(id).Artwork.Where(x => x.Type == WebFileType.Cover).Select(x => ((WebArtworkDetailed)x).Path).ToList();
else if (mediatype == WebMediaType.TVShow && filetype == WebFileType.Banner)
return TVShowLibraries[provider].GetTVShowDetailed(id).Artwork.Where(x => x.Type == WebFileType.Banner).Select(x => ((WebArtworkDetailed)x).Path).ToList();
else if (mediatype == WebMediaType.TVShow && filetype == WebFileType.Backdrop)
return TVShowLibraries[provider].GetTVShowDetailed(id).Artwork.Where(x => x.Type == WebFileType.Backdrop).Select(x => ((WebArtworkDetailed)x).Path).ToList();
else if (mediatype == WebMediaType.TVShow && filetype == WebFileType.Poster)
return TVShowLibraries[provider].GetTVShowDetailed(id).Artwork.Where(x => x.Type == WebFileType.Poster).Select(x => ((WebArtworkDetailed)x).Path).ToList();
else if (mediatype == WebMediaType.TVSeason && filetype == WebFileType.Backdrop)
return TVShowLibraries[provider].GetSeasonDetailed(id).Artwork.Where(x => x.Type == WebFileType.Backdrop).Select(x => ((WebArtworkDetailed)x).Path).ToList();
else if (mediatype == WebMediaType.TVSeason && filetype == WebFileType.Banner)
return TVShowLibraries[provider].GetSeasonDetailed(id).Artwork.Where(x => x.Type == WebFileType.Banner).Select(x => ((WebArtworkDetailed)x).Path).ToList();
else if (mediatype == WebMediaType.TVSeason && filetype == WebFileType.Poster)
return TVShowLibraries[provider].GetSeasonDetailed(id).Artwork.Where(x => x.Type == WebFileType.Poster).Select(x => ((WebArtworkDetailed)x).Path).ToList();
else if (mediatype == WebMediaType.TVEpisode && filetype == WebFileType.Content)
return TVShowLibraries[provider].GetEpisodeBasic(id).Path;
else if (mediatype == WebMediaType.TVEpisode && filetype == WebFileType.Banner)
return TVShowLibraries[provider].GetEpisodeDetailed(id).Artwork.Where(x => x.Type == WebFileType.Banner).Select(x => ((WebArtworkDetailed)x).Path).ToList();
else if (mediatype == WebMediaType.Picture && filetype == WebFileType.Content)
return PictureLibraries[provider].GetPictureDetailed(id).Path;
else if (mediatype == WebMediaType.MusicArtist && filetype == WebFileType.Cover)
return MusicLibraries[provider].GetArtistBasicById(id).Artwork.Where(x => x.Type == WebFileType.Cover).Select(x => ((WebArtworkDetailed)x).Path).ToList();
else if (mediatype == WebMediaType.MusicAlbum && filetype == WebFileType.Cover)
return MusicLibraries[provider].GetAlbumBasicById(id).Artwork.Where(x => x.Type == WebFileType.Cover).Select(x => ((WebArtworkDetailed)x).Path).ToList();
else if (mediatype == WebMediaType.MusicTrack && filetype == WebFileType.Cover)
return MusicLibraries[provider].GetTrackBasicById(id).Artwork.Where(x => x.Type == WebFileType.Cover).Select(x => ((WebArtworkDetailed)x).Path).ToList();
else if (mediatype == WebMediaType.MusicTrack && filetype == WebFileType.Content)
return MusicLibraries[provider].GetTrackBasicById(id).Path;
Log.Warn("Invalid combination of filetype {0} and mediatype {1} requested", filetype, mediatype);
return null;
}
开发者ID:Shukuyen,项目名称:MPExtended,代码行数:40,代码来源:MediaAccessService.cs
示例17: GetMediaItem
public WebMediaItem GetMediaItem(int? provider, WebMediaType type, string id)
{
switch (type)
{
case WebMediaType.Movie:
return GetMovieDetailedById(provider, id).Finalize(provider, ProviderType.Movie).ToWebMediaItem();
case WebMediaType.MusicTrack:
return GetMusicTrackDetailedById(provider, id).Finalize(provider, ProviderType.Music).ToWebMediaItem();
case WebMediaType.Picture:
return GetPictureDetailedById(provider, id).Finalize(provider, ProviderType.Picture).ToWebMediaItem();
case WebMediaType.TVEpisode:
return GetTVEpisodeDetailedById(provider, id).Finalize(provider, ProviderType.TVShow).ToWebMediaItem();
case WebMediaType.Drive:
return GetFileSystemDriveBasicById(provider, id).Finalize(provider, ProviderType.Filesystem).ToWebMediaItem();
case WebMediaType.Folder:
return GetFileSystemFolderBasicById(provider, id).Finalize(provider, ProviderType.Filesystem).ToWebMediaItem();
case WebMediaType.File:
return GetFileSystemFileBasicById(provider, id).Finalize(provider, ProviderType.Filesystem).ToWebMediaItem();
default:
throw new ArgumentException();
}
}
开发者ID:Shukuyen,项目名称:MPExtended,代码行数:22,代码来源:MediaAccessService.cs
示例18: GetFilterValuesCount
public WebIntResult GetFilterValuesCount(int? provider, WebMediaType mediaType, string filterField, string op = null, int? limit = null)
{
return GetFilterValues(provider, mediaType, filterField, op, limit).Count();
}
开发者ID:Shukuyen,项目名称:MPExtended,代码行数:4,代码来源:MediaAccessService.cs
示例19: GetFilterValuesByRange
public IList<string> GetFilterValuesByRange(int? provider, int start, int end, WebMediaType mediaType, string filterField, string op = null, int? limit = null, WebSortOrder? order = WebSortOrder.Asc)
{
return GetFilterValues(provider, mediaType, filterField, op, limit, order).TakeRange(start, end).ToList();
}
开发者ID:Shukuyen,项目名称:MPExtended,代码行数:4,代码来源:MediaAccessService.cs
示例20: GetFilterValues
/// <summary>
/// Get all available values for a given field
/// </summary>
public IList<string> GetFilterValues(int? provider, WebMediaType mediaType, string filterField, string op, int? limit, WebSortOrder? order = WebSortOrder.Asc)
{
switch (mediaType)
{
case WebMediaType.Drive:
return AutoSuggestion.GetValuesForField(filterField, GetFileSystemDrives(provider), op, limit).OrderBy(x => x, order).ToList();
case WebMediaType.Movie:
return AutoSuggestion.GetValuesForField(filterField, GetMoviesDetailed(provider), op, limit).OrderBy(x => x, order).ToList();
case WebMediaType.MusicAlbum:
return AutoSuggestion.GetValuesForField(filterField, GetMusicAlbumsBasic(provider), op, limit).OrderBy(x => x, order).ToList();
case WebMediaType.MusicArtist:
return AutoSuggestion.GetValuesForField(filterField, GetMusicArtistsDetailed(provider), op, limit).OrderBy(x => x, order).ToList();
case WebMediaType.MusicTrack:
return AutoSuggestion.GetValuesForField(filterField, GetMusicTracksDetailed(provider), op, limit).OrderBy(x => x, order).ToList();
case WebMediaType.Picture:
return AutoSuggestion.GetValuesForField(filterField, GetPicturesDetailed(provider), op, limit).OrderBy(x => x, order).ToList();
case WebMediaType.Playlist:
return AutoSuggestion.GetValuesForField(filterField, GetPlaylists(provider), op, limit).OrderBy(x => x, order).ToList();
case WebMediaType.TVEpisode:
return AutoSuggestion.GetValuesForField(filterField, GetTVEpisodesDetailed(provider), op, limit).OrderBy(x => x, order).ToList();
case WebMediaType.TVShow:
return AutoSuggestion.GetValuesForField(filterField, GetTVShowsDetailed(provider), op, limit).OrderBy(x => x, order).ToList();
default:
Log.Info("GetFilterValues() called with unsupported mediaType='{0}' filterField='{1}' op='{2}' limit='{3}'", mediaType, filterField, op, limit);
throw new ArgumentException("Unsupported MediaType for GetFilterValues()");
}
}
开发者ID:Shukuyen,项目名称:MPExtended,代码行数:30,代码来源:MediaAccessService.cs
注:本文中的WebMediaType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论