aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Api/ApiService.cs71
-rw-r--r--MediaBrowser.Api/HttpHandlers/AudioHandler.cs2
-rw-r--r--MediaBrowser.Api/HttpHandlers/BaseMediaHandler.cs28
-rw-r--r--MediaBrowser.Api/HttpHandlers/FavoriteStatusHandler.cs7
-rw-r--r--MediaBrowser.Api/HttpHandlers/GenreHandler.cs14
-rw-r--r--MediaBrowser.Api/HttpHandlers/GenresHandler.cs18
-rw-r--r--MediaBrowser.Api/HttpHandlers/ImageHandler.cs35
-rw-r--r--MediaBrowser.Api/HttpHandlers/ItemHandler.cs6
-rw-r--r--MediaBrowser.Api/HttpHandlers/ItemListHandler.cs25
-rw-r--r--MediaBrowser.Api/HttpHandlers/MovieSpecialFeaturesHandler.cs13
-rw-r--r--MediaBrowser.Api/HttpHandlers/PersonHandler.cs14
-rw-r--r--MediaBrowser.Api/HttpHandlers/PlayedStatusHandler.cs7
-rw-r--r--MediaBrowser.Api/HttpHandlers/PluginAssemblyHandler.cs2
-rw-r--r--MediaBrowser.Api/HttpHandlers/PluginConfigurationHandler.cs10
-rw-r--r--MediaBrowser.Api/HttpHandlers/PluginsHandler.cs21
-rw-r--r--MediaBrowser.Api/HttpHandlers/ServerConfigurationHandler.cs2
-rw-r--r--MediaBrowser.Api/HttpHandlers/StudioHandler.cs14
-rw-r--r--MediaBrowser.Api/HttpHandlers/StudiosHandler.cs20
-rw-r--r--MediaBrowser.Api/HttpHandlers/UserHandler.cs12
-rw-r--r--MediaBrowser.Api/HttpHandlers/UserItemRatingHandler.cs7
-rw-r--r--MediaBrowser.Api/HttpHandlers/UsersHandler.cs6
-rw-r--r--MediaBrowser.Api/HttpHandlers/VideoHandler.cs37
-rw-r--r--MediaBrowser.Api/HttpHandlers/YearHandler.cs14
-rw-r--r--MediaBrowser.Api/HttpHandlers/YearsHandler.cs18
-rw-r--r--MediaBrowser.Api/ImageProcessor.cs6
-rw-r--r--MediaBrowser.Api/Plugin.cs2
-rw-r--r--MediaBrowser.Api/Properties/AssemblyInfo.cs1
-rw-r--r--MediaBrowser.ApiInteraction.Metro/DataSerializer.cs2
-rw-r--r--MediaBrowser.ApiInteraction.Portable/ApiClient.cs585
-rw-r--r--MediaBrowser.ApiInteraction.Portable/MediaBrowser.ApiInteraction.Portable.csproj72
-rw-r--r--MediaBrowser.ApiInteraction.Portable/Properties/AssemblyInfo.cs30
-rw-r--r--MediaBrowser.ApiInteraction.sln6
-rw-r--r--MediaBrowser.ApiInteraction/ApiClient.cs2
-rw-r--r--MediaBrowser.ApiInteraction/BaseApiClient.cs22
-rw-r--r--MediaBrowser.ApiInteraction/BaseHttpApiClient.cs102
-rw-r--r--MediaBrowser.ApiInteraction/DataSerializer.cs16
-rw-r--r--MediaBrowser.ApiInteraction/MediaBrowser.ApiInteraction.csproj5
-rw-r--r--MediaBrowser.ApiInteraction/Properties/AssemblyInfo.cs1
-rw-r--r--MediaBrowser.ApiInteraction/packages.config2
-rw-r--r--MediaBrowser.Common/Kernel/BaseApplicationPaths.cs3
-rw-r--r--MediaBrowser.Common/Kernel/BaseKernel.cs94
-rw-r--r--MediaBrowser.Common/Kernel/KernelContext.cs2
-rw-r--r--MediaBrowser.Common/Logging/BaseLogger.cs4
-rw-r--r--MediaBrowser.Common/Logging/LogRow.cs4
-rw-r--r--MediaBrowser.Common/Logging/StreamLogger.cs12
-rw-r--r--MediaBrowser.Common/Logging/ThreadedLogger.cs73
-rw-r--r--MediaBrowser.Common/MediaBrowser.Common.csproj11
-rw-r--r--MediaBrowser.Common/Net/Handlers/BaseEmbeddedResourceHandler.cs4
-rw-r--r--MediaBrowser.Common/Net/Handlers/BaseHandler.cs37
-rw-r--r--MediaBrowser.Common/Net/Handlers/BaseSerializationHandler.cs35
-rw-r--r--MediaBrowser.Common/Net/Handlers/StaticFileHandler.cs48
-rw-r--r--MediaBrowser.Common/Net/HttpServer.cs18
-rw-r--r--MediaBrowser.Common/Net/MimeTypes.cs64
-rw-r--r--MediaBrowser.Common/Plugins/BasePlugin.cs85
-rw-r--r--MediaBrowser.Common/Plugins/BaseTheme.cs14
-rw-r--r--MediaBrowser.Common/Properties/AssemblyInfo.cs1
-rw-r--r--MediaBrowser.Common/Resources/Images/Icon.icobin32038 -> 146168 bytes
-rw-r--r--MediaBrowser.Common/Resources/Images/spinner.gifbin0 -> 673 bytes
-rw-r--r--MediaBrowser.Common/Serialization/JsonSerializer.cs10
-rw-r--r--MediaBrowser.Common/Serialization/JsvSerializer.cs4
-rw-r--r--MediaBrowser.Common/Serialization/ProtobufSerializer.cs4
-rw-r--r--MediaBrowser.Common/Serialization/XmlSerializer.cs6
-rw-r--r--MediaBrowser.Common/UI/BaseApplication.cs117
-rw-r--r--MediaBrowser.Common/UI/SingleInstance.cs19
-rw-r--r--MediaBrowser.Common/UI/Splash.xaml7
-rw-r--r--MediaBrowser.Common/UI/Splash.xaml.cs24
-rw-r--r--MediaBrowser.Common/packages.config2
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs87
-rw-r--r--MediaBrowser.Controller/Entities/UserItemData.cs8
-rw-r--r--MediaBrowser.Controller/FFMpeg/FFProbe.cs14
-rw-r--r--MediaBrowser.Controller/FFMpeg/ffmpeg.exe.REMOVED.git-id2
-rw-r--r--MediaBrowser.Controller/FFMpeg/ffprobe.exe.REMOVED.git-id2
-rw-r--r--MediaBrowser.Controller/IO/DirectoryWatchers.cs15
-rw-r--r--MediaBrowser.Controller/IO/FileData.cs2
-rw-r--r--MediaBrowser.Controller/IO/Shortcut.cs6
-rw-r--r--MediaBrowser.Controller/Kernel.cs77
-rw-r--r--MediaBrowser.Controller/Library/ItemController.cs16
-rw-r--r--MediaBrowser.Controller/Properties/AssemblyInfo.cs1
-rw-r--r--MediaBrowser.Controller/Providers/AudioInfoProvider.cs11
-rw-r--r--MediaBrowser.Controller/Providers/BaseItemXmlParser.cs14
-rw-r--r--MediaBrowser.Controller/Providers/FolderProviderFromXml.cs2
-rw-r--r--MediaBrowser.Controller/Providers/ImageFromMediaLocationProvider.cs10
-rw-r--r--MediaBrowser.Controller/Providers/LocalTrailerProvider.cs4
-rw-r--r--MediaBrowser.Controller/Providers/Movies/MovieProviderFromXml.cs2
-rw-r--r--MediaBrowser.Controller/Providers/Movies/MovieSpecialFeaturesProvider.cs4
-rw-r--r--MediaBrowser.Controller/Providers/TV/EpisodeImageFromMediaLocationProvider.cs6
-rw-r--r--MediaBrowser.Controller/Providers/TV/EpisodeProviderFromXml.cs2
-rw-r--r--MediaBrowser.Controller/Providers/TV/EpisodeXmlParser.cs4
-rw-r--r--MediaBrowser.Controller/Providers/TV/SeriesProviderFromXml.cs2
-rw-r--r--MediaBrowser.Controller/Providers/VideoInfoProvider.cs6
-rw-r--r--MediaBrowser.Controller/Resolvers/Movies/MovieResolver.cs5
-rw-r--r--MediaBrowser.Controller/Resolvers/TV/SeasonResolver.cs11
-rw-r--r--MediaBrowser.Controller/Resolvers/TV/SeriesResolver.cs4
-rw-r--r--MediaBrowser.Controller/Resolvers/TV/TVUtils.cs14
-rw-r--r--MediaBrowser.Controller/Resolvers/VideoResolver.cs8
-rw-r--r--MediaBrowser.Controller/ServerApplicationPaths.cs12
-rw-r--r--MediaBrowser.Controller/Weather/WeatherClient.cs27
-rw-r--r--MediaBrowser.Controller/Xml/XmlExtensions.cs2
-rw-r--r--MediaBrowser.Model/DTO/DTOBaseItem.cs8
-rw-r--r--MediaBrowser.Model/DTO/DTOUser.cs5
-rw-r--r--MediaBrowser.Model/DTO/DTOUserItemData.cs2
-rw-r--r--MediaBrowser.Model/DTO/IBNItem.cs2
-rw-r--r--MediaBrowser.Model/DTO/VideoOutputFormats.cs4
-rw-r--r--MediaBrowser.Model/Entities/IHasProviderIds.cs2
-rw-r--r--MediaBrowser.Model/Entities/VideoType.cs2
-rw-r--r--MediaBrowser.Model/MediaBrowser.Model.csproj8
-rw-r--r--MediaBrowser.Model/Plugins/BasePluginConfiguration.cs4
-rw-r--r--MediaBrowser.Model/Progress/TaskProgress.cs8
-rw-r--r--MediaBrowser.Model/Properties/AssemblyInfo.cs6
-rw-r--r--MediaBrowser.Plugins.DefaultTheme/MediaBrowser.Plugins.DefaultTheme.csproj (renamed from MediaBrowser.TV/MediaBrowser.TV.csproj)59
-rw-r--r--MediaBrowser.Plugins.DefaultTheme/Plugin.cs19
-rw-r--r--MediaBrowser.Plugins.DefaultTheme/Properties/AssemblyInfo.cs55
-rw-r--r--MediaBrowser.Plugins.DefaultTheme/Properties/Resources.Designer.cs62
-rw-r--r--MediaBrowser.Plugins.DefaultTheme/Properties/Resources.resx117
-rw-r--r--MediaBrowser.Plugins.DefaultTheme/Properties/Settings.Designer.cs30
-rw-r--r--MediaBrowser.Plugins.DefaultTheme/Properties/Settings.settings7
-rw-r--r--MediaBrowser.Plugins.sln50
-rw-r--r--MediaBrowser.ServerApplication/App.xaml.cs57
-rw-r--r--MediaBrowser.ServerApplication/MainWindow.xaml25
-rw-r--r--MediaBrowser.ServerApplication/MainWindow.xaml.cs69
-rw-r--r--MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj14
-rw-r--r--MediaBrowser.ServerApplication/Properties/AssemblyInfo.cs2
-rw-r--r--MediaBrowser.ServerApplication/Resources/Images/Icon.icobin32038 -> 146168 bytes
-rw-r--r--MediaBrowser.ServerApplication/Resources/Images/loadingIcon1.icobin0 -> 179144 bytes
-rw-r--r--MediaBrowser.ServerApplication/Resources/Images/loadingIcon2.icobin0 -> 176716 bytes
-rw-r--r--MediaBrowser.ServerApplication/Resources/Images/loadingIcon3.icobin0 -> 175427 bytes
-rw-r--r--MediaBrowser.ServerApplication/Resources/Images/loadingIcon4.icobin0 -> 176666 bytes
-rw-r--r--MediaBrowser.TV/Plugin.cs41
-rw-r--r--MediaBrowser.TV/Properties/AssemblyInfo.cs36
-rw-r--r--MediaBrowser.WebDashboard/Plugin.cs2
-rw-r--r--MediaBrowser.WebDashboard/Properties/AssemblyInfo.cs1
-rw-r--r--UpgradeLog.XMLbin1660 -> 0 bytes
-rw-r--r--UpgradeLog.htmbin13778 -> 0 bytes
-rw-r--r--_UpgradeReport_Files/UpgradeReport.css118
-rw-r--r--_UpgradeReport_Files/UpgradeReport.xslt538
-rw-r--r--_UpgradeReport_Files/UpgradeReport_Error.pngbin338 -> 0 bytes
-rw-r--r--_UpgradeReport_Files/UpgradeReport_Information.pngbin306 -> 0 bytes
-rw-r--r--_UpgradeReport_Files/UpgradeReport_Success.pngbin381 -> 0 bytes
-rw-r--r--_UpgradeReport_Files/UpgradeReport_Warning.pngbin292 -> 0 bytes
139 files changed, 1401 insertions, 2291 deletions
diff --git a/MediaBrowser.Api/ApiService.cs b/MediaBrowser.Api/ApiService.cs
index ee76b5de0..104ae7660 100644
--- a/MediaBrowser.Api/ApiService.cs
+++ b/MediaBrowser.Api/ApiService.cs
@@ -3,7 +3,6 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Model.DTO;
-using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -33,9 +32,9 @@ namespace MediaBrowser.Api
/// <param name="logActivity">Whether or not to update the user's LastActivityDate</param>
public static User GetUserById(string id, bool logActivity)
{
- Guid guid = new Guid(id);
+ var guid = new Guid(id);
- User user = Kernel.Instance.Users.FirstOrDefault(u => u.Id == guid);
+ var user = Kernel.Instance.Users.FirstOrDefault(u => u.Id == guid);
if (logActivity)
{
@@ -73,13 +72,13 @@ namespace MediaBrowser.Api
/// <summary>
/// Converts a BaseItem to a DTOBaseItem
/// </summary>
- public async static Task<DTOBaseItem> GetDTOBaseItem(BaseItem item, User user,
+ public async static Task<DtoBaseItem> GetDtoBaseItem(BaseItem item, User user,
bool includeChildren = true,
bool includePeople = true)
{
- DTOBaseItem dto = new DTOBaseItem();
+ var dto = new DtoBaseItem();
- List<Task> tasks = new List<Task>();
+ var tasks = new List<Task>();
tasks.Add(AttachStudios(dto, item));
@@ -108,7 +107,7 @@ namespace MediaBrowser.Api
/// <summary>
/// Sets simple property values on a DTOBaseItem
/// </summary>
- private static void AttachBasicFields(DTOBaseItem dto, BaseItem item, User user)
+ private static void AttachBasicFields(DtoBaseItem dto, BaseItem item, User user)
{
dto.AspectRatio = item.AspectRatio;
dto.BackdropCount = item.BackdropImagePaths == null ? 0 : item.BackdropImagePaths.Count();
@@ -135,7 +134,7 @@ namespace MediaBrowser.Api
dto.OfficialRating = item.OfficialRating;
dto.Overview = item.Overview;
- // If there are no backdrops, indicate what parent has them in case the UI wants to allow inheritance
+ // If there are no backdrops, indicate what parent has them in case the Ui wants to allow inheritance
if (dto.BackdropCount == 0)
{
int backdropCount;
@@ -150,7 +149,7 @@ namespace MediaBrowser.Api
dto.ParentIndexNumber = item.ParentIndexNumber;
- // If there is no logo, indicate what parent has one in case the UI wants to allow inheritance
+ // If there is no logo, indicate what parent has one in case the Ui wants to allow inheritance
if (!dto.HasLogo)
{
dto.ParentLogoItemId = GetParentLogoItemId(item);
@@ -173,9 +172,9 @@ namespace MediaBrowser.Api
dto.Type = item.GetType().Name;
dto.UserRating = item.UserRating;
- dto.UserData = GetDTOUserItemData(item.GetUserData(user, false));
+ dto.UserData = GetDtoUserItemData(item.GetUserData(user, false));
- Folder folder = item as Folder;
+ var folder = item as Folder;
if (folder != null)
{
@@ -186,11 +185,11 @@ namespace MediaBrowser.Api
}
// Add AudioInfo
- Audio audio = item as Audio;
+ var audio = item as Audio;
if (audio != null)
{
- dto.AudioInfo = new AudioInfo()
+ dto.AudioInfo = new AudioInfo
{
Album = audio.Album,
AlbumArtist = audio.AlbumArtist,
@@ -201,11 +200,11 @@ namespace MediaBrowser.Api
}
// Add VideoInfo
- Video video = item as Video;
+ var video = item as Video;
if (video != null)
{
- dto.VideoInfo = new VideoInfo()
+ dto.VideoInfo = new VideoInfo
{
Height = video.Height,
Width = video.Width,
@@ -226,13 +225,13 @@ namespace MediaBrowser.Api
}
// Add SeriesInfo
- Series series = item as Series;
+ var series = item as Series;
if (series != null)
{
- DayOfWeek[] airDays = series.AirDays == null ? new DayOfWeek[] { } : series.AirDays.ToArray(); ;
+ DayOfWeek[] airDays = series.AirDays == null ? new DayOfWeek[] { } : series.AirDays.ToArray();
- dto.SeriesInfo = new SeriesInfo()
+ dto.SeriesInfo = new SeriesInfo
{
AirDays = airDays,
AirTime = series.AirTime,
@@ -241,13 +240,13 @@ namespace MediaBrowser.Api
}
// Add MovieInfo
- Movie movie = item as Movie;
+ var movie = item as Movie;
if (movie != null)
{
int specialFeatureCount = movie.SpecialFeatures == null ? 0 : movie.SpecialFeatures.Count();
- dto.MovieInfo = new MovieInfo()
+ dto.MovieInfo = new MovieInfo
{
SpecialFeatureCount = specialFeatureCount
};
@@ -257,19 +256,19 @@ namespace MediaBrowser.Api
/// <summary>
/// Attaches Studio DTO's to a DTOBaseItem
/// </summary>
- private static async Task AttachStudios(DTOBaseItem dto, BaseItem item)
+ private static async Task AttachStudios(DtoBaseItem dto, BaseItem item)
{
// Attach Studios by transforming them into BaseItemStudio (DTO)
if (item.Studios != null)
{
- Studio[] entities = await Task.WhenAll<Studio>(item.Studios.Select(c => Kernel.Instance.ItemController.GetStudio(c))).ConfigureAwait(false);
+ Studio[] entities = await Task.WhenAll(item.Studios.Select(c => Kernel.Instance.ItemController.GetStudio(c))).ConfigureAwait(false);
dto.Studios = new BaseItemStudio[entities.Length];
for (int i = 0; i < entities.Length; i++)
{
Studio entity = entities[i];
- BaseItemStudio baseItemStudio = new BaseItemStudio();
+ var baseItemStudio = new BaseItemStudio{};
baseItemStudio.Name = entity.Name;
@@ -283,7 +282,7 @@ namespace MediaBrowser.Api
/// <summary>
/// Attaches child DTO's to a DTOBaseItem
/// </summary>
- private static async Task AttachChildren(DTOBaseItem dto, BaseItem item, User user)
+ private static async Task AttachChildren(DtoBaseItem dto, BaseItem item, User user)
{
var folder = item as Folder;
@@ -291,34 +290,34 @@ namespace MediaBrowser.Api
{
IEnumerable<BaseItem> children = folder.GetChildren(user);
- dto.Children = await Task.WhenAll<DTOBaseItem>(children.Select(c => GetDTOBaseItem(c, user, false, false))).ConfigureAwait(false);
+ dto.Children = await Task.WhenAll(children.Select(c => GetDtoBaseItem(c, user, false, false))).ConfigureAwait(false);
}
}
/// <summary>
/// Attaches trailer DTO's to a DTOBaseItem
/// </summary>
- private static async Task AttachLocalTrailers(DTOBaseItem dto, BaseItem item, User user)
+ private static async Task AttachLocalTrailers(DtoBaseItem dto, BaseItem item, User user)
{
if (item.LocalTrailers != null && item.LocalTrailers.Any())
{
- dto.LocalTrailers = await Task.WhenAll<DTOBaseItem>(item.LocalTrailers.Select(c => GetDTOBaseItem(c, user, false, false))).ConfigureAwait(false);
+ dto.LocalTrailers = await Task.WhenAll(item.LocalTrailers.Select(c => GetDtoBaseItem(c, user, false, false))).ConfigureAwait(false);
}
}
/// <summary>
/// Attaches People DTO's to a DTOBaseItem
/// </summary>
- private static async Task AttachPeople(DTOBaseItem dto, BaseItem item)
+ private static async Task AttachPeople(DtoBaseItem dto, BaseItem item)
{
// Attach People by transforming them into BaseItemPerson (DTO)
if (item.People != null)
{
- IEnumerable<Person> entities = await Task.WhenAll<Person>(item.People.Select(c => Kernel.Instance.ItemController.GetPerson(c.Key))).ConfigureAwait(false);
+ IEnumerable<Person> entities = await Task.WhenAll(item.People.Select(c => Kernel.Instance.ItemController.GetPerson(c.Key))).ConfigureAwait(false);
dto.People = item.People.Select(p =>
{
- BaseItemPerson baseItemPerson = new BaseItemPerson();
+ var baseItemPerson = new BaseItemPerson{};
baseItemPerson.Name = p.Key;
baseItemPerson.Overview = p.Value.Overview;
@@ -382,9 +381,9 @@ namespace MediaBrowser.Api
/// <summary>
/// Gets an ImagesByName entity along with the number of items containing it
/// </summary>
- public static IBNItem GetIBNItem(BaseEntity entity, int itemCount)
+ public static IbnItem GetIbnItem(BaseEntity entity, int itemCount)
{
- return new IBNItem()
+ return new IbnItem
{
Id = entity.Id,
BaseItemCount = itemCount,
@@ -396,9 +395,9 @@ namespace MediaBrowser.Api
/// <summary>
/// Converts a User to a DTOUser
/// </summary>
- public static DTOUser GetDTOUser(User user)
+ public static DtoUser GetDtoUser(User user)
{
- return new DTOUser()
+ return new DtoUser
{
Id = user.Id,
Name = user.Name,
@@ -412,14 +411,14 @@ namespace MediaBrowser.Api
/// <summary>
/// Converts a UserItemData to a DTOUserItemData
/// </summary>
- public static DTOUserItemData GetDTOUserItemData(UserItemData data)
+ public static DtoUserItemData GetDtoUserItemData(UserItemData data)
{
if (data == null)
{
return null;
}
- return new DTOUserItemData()
+ return new DtoUserItemData
{
IsFavorite = data.IsFavorite,
Likes = data.Likes,
diff --git a/MediaBrowser.Api/HttpHandlers/AudioHandler.cs b/MediaBrowser.Api/HttpHandlers/AudioHandler.cs
index 3d17a3d6a..9c16acd2e 100644
--- a/MediaBrowser.Api/HttpHandlers/AudioHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/AudioHandler.cs
@@ -86,7 +86,7 @@ namespace MediaBrowser.Api.HttpHandlers
/// </summary>
protected override string GetCommandLineArguments()
{
- List<string> audioTranscodeParams = new List<string>();
+ var audioTranscodeParams = new List<string>();
AudioOutputFormats outputFormat = GetConversionOutputFormat();
diff --git a/MediaBrowser.Api/HttpHandlers/BaseMediaHandler.cs b/MediaBrowser.Api/HttpHandlers/BaseMediaHandler.cs
index e87af76ea..7ad0ed8aa 100644
--- a/MediaBrowser.Api/HttpHandlers/BaseMediaHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/BaseMediaHandler.cs
@@ -38,7 +38,7 @@ namespace MediaBrowser.Api.HttpHandlers
}
}
- private TBaseItemType _LibraryItem;
+ private TBaseItemType _libraryItem;
/// <summary>
/// Gets the library item that will be played, if any
/// </summary>
@@ -46,17 +46,17 @@ namespace MediaBrowser.Api.HttpHandlers
{
get
{
- if (_LibraryItem == null)
+ if (_libraryItem == null)
{
string id = QueryString["id"];
if (!string.IsNullOrEmpty(id))
{
- _LibraryItem = Kernel.Instance.GetItemById(Guid.Parse(id)) as TBaseItemType;
+ _libraryItem = Kernel.Instance.GetItemById(Guid.Parse(id)) as TBaseItemType;
}
}
- return _LibraryItem;
+ return _libraryItem;
}
}
@@ -92,7 +92,7 @@ namespace MediaBrowser.Api.HttpHandlers
public override Task<string> GetContentType()
{
- return Task.FromResult<string>(MimeTypes.GetMimeType("." + GetConversionOutputFormat()));
+ return Task.FromResult(MimeTypes.GetMimeType("." + GetConversionOutputFormat()));
}
public override bool ShouldCompressResponse(string contentType)
@@ -106,12 +106,10 @@ namespace MediaBrowser.Api.HttpHandlers
if (!RequiresConversion())
{
- return new StaticFileHandler() { Path = LibraryItem.Path }.ProcessRequest(ctx);
- }
- else
- {
- return base.ProcessRequest(ctx);
+ return new StaticFileHandler { Path = LibraryItem.Path }.ProcessRequest(ctx);
}
+
+ return base.ProcessRequest(ctx);
}
protected abstract string GetCommandLineArguments();
@@ -149,7 +147,7 @@ namespace MediaBrowser.Api.HttpHandlers
protected async override Task WriteResponseToOutputStream(Stream stream)
{
- ProcessStartInfo startInfo = new ProcessStartInfo();
+ var startInfo = new ProcessStartInfo{};
startInfo.CreateNoWindow = true;
@@ -165,7 +163,7 @@ namespace MediaBrowser.Api.HttpHandlers
Logger.LogInfo(startInfo.FileName + " " + startInfo.Arguments);
- Process process = new Process();
+ var process = new Process{};
process.StartInfo = startInfo;
// FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
@@ -173,7 +171,7 @@ namespace MediaBrowser.Api.HttpHandlers
process.EnableRaisingEvents = true;
- process.Exited += process_Exited;
+ process.Exited += ProcessExited;
try
{
@@ -203,14 +201,14 @@ namespace MediaBrowser.Api.HttpHandlers
}
}
- void process_Exited(object sender, EventArgs e)
+ void ProcessExited(object sender, EventArgs e)
{
if (LogFileStream != null)
{
LogFileStream.Dispose();
}
- Process process = sender as Process;
+ var process = sender as Process;
Logger.LogInfo("FFMpeg exited with code " + process.ExitCode);
diff --git a/MediaBrowser.Api/HttpHandlers/FavoriteStatusHandler.cs b/MediaBrowser.Api/HttpHandlers/FavoriteStatusHandler.cs
index 4125b940f..19c175d8b 100644
--- a/MediaBrowser.Api/HttpHandlers/FavoriteStatusHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/FavoriteStatusHandler.cs
@@ -1,7 +1,6 @@
using MediaBrowser.Common.Net.Handlers;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.DTO;
-using MediaBrowser.Model.Entities;
using System.ComponentModel.Composition;
using System.Net;
using System.Threading.Tasks;
@@ -12,14 +11,14 @@ namespace MediaBrowser.Api.HttpHandlers
/// Provides a handler to set user favorite status for an item
/// </summary>
[Export(typeof(BaseHandler))]
- public class FavoriteStatusHandler : BaseSerializationHandler<DTOUserItemData>
+ public class FavoriteStatusHandler : BaseSerializationHandler<DtoUserItemData>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("FavoriteStatus", request);
}
- protected override Task<DTOUserItemData> GetObjectToSerialize()
+ protected override Task<DtoUserItemData> GetObjectToSerialize()
{
// Get the item
BaseItem item = ApiService.GetItemById(QueryString["id"]);
@@ -33,7 +32,7 @@ namespace MediaBrowser.Api.HttpHandlers
// Set favorite status
data.IsFavorite = QueryString["isfavorite"] == "1";
- return Task.FromResult<DTOUserItemData>(ApiService.GetDTOUserItemData(data));
+ return Task.FromResult(ApiService.GetDtoUserItemData(data));
}
}
} \ No newline at end of file
diff --git a/MediaBrowser.Api/HttpHandlers/GenreHandler.cs b/MediaBrowser.Api/HttpHandlers/GenreHandler.cs
index 424d34476..7cca2aea7 100644
--- a/MediaBrowser.Api/HttpHandlers/GenreHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/GenreHandler.cs
@@ -15,17 +15,17 @@ namespace MediaBrowser.Api.HttpHandlers
/// Gets a single genre
/// </summary>
[Export(typeof(BaseHandler))]
- public class GenreHandler : BaseSerializationHandler<IBNItem>
+ public class GenreHandler : BaseSerializationHandler<IbnItem>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("genre", request);
}
-
- protected override Task<IBNItem> GetObjectToSerialize()
+
+ protected override Task<IbnItem> GetObjectToSerialize()
{
- Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
- User user = ApiService.GetUserById(QueryString["userid"], true);
+ var parent = ApiService.GetItemById(QueryString["id"]) as Folder;
+ var user = ApiService.GetUserById(QueryString["userid"], true);
string name = QueryString["name"];
@@ -35,7 +35,7 @@ namespace MediaBrowser.Api.HttpHandlers
/// <summary>
/// Gets a Genre
/// </summary>
- private async Task<IBNItem> GetGenre(Folder parent, User user, string name)
+ private async Task<IbnItem> GetGenre(Folder parent, User user, string name)
{
int count = 0;
@@ -51,7 +51,7 @@ namespace MediaBrowser.Api.HttpHandlers
}
// Get the original entity so that we can also supply the PrimaryImagePath
- return ApiService.GetIBNItem(await Kernel.Instance.ItemController.GetGenre(name).ConfigureAwait(false), count);
+ return ApiService.GetIbnItem(await Kernel.Instance.ItemController.GetGenre(name).ConfigureAwait(false), count);
}
}
}
diff --git a/MediaBrowser.Api/HttpHandlers/GenresHandler.cs b/MediaBrowser.Api/HttpHandlers/GenresHandler.cs
index 341f8a483..4c5a9f4b7 100644
--- a/MediaBrowser.Api/HttpHandlers/GenresHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/GenresHandler.cs
@@ -11,16 +11,16 @@ using System.Threading.Tasks;
namespace MediaBrowser.Api.HttpHandlers
{
[Export(typeof(BaseHandler))]
- public class GenresHandler : BaseSerializationHandler<IBNItem[]>
+ public class GenresHandler : BaseSerializationHandler<IbnItem[]>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("genres", request);
}
-
- protected override Task<IBNItem[]> GetObjectToSerialize()
+
+ protected override Task<IbnItem[]> GetObjectToSerialize()
{
- Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
+ var parent = ApiService.GetItemById(QueryString["id"]) as Folder;
User user = ApiService.GetUserById(QueryString["userid"], true);
return GetAllGenres(parent, user);
@@ -30,9 +30,9 @@ namespace MediaBrowser.Api.HttpHandlers
/// Gets all genres from all recursive children of a folder
/// The CategoryInfo class is used to keep track of the number of times each genres appears
/// </summary>
- private async Task<IBNItem[]> GetAllGenres(Folder parent, User user)
+ private async Task<IbnItem[]> GetAllGenres(Folder parent, User user)
{
- Dictionary<string, int> data = new Dictionary<string, int>();
+ var data = new Dictionary<string, int>();
// Get all the allowed recursive children
IEnumerable<BaseItem> allItems = parent.GetRecursiveChildren(user);
@@ -60,16 +60,16 @@ namespace MediaBrowser.Api.HttpHandlers
}
// Get the Genre objects
- Genre[] entities = await Task.WhenAll<Genre>(data.Keys.Select(key => { return Kernel.Instance.ItemController.GetGenre(key); })).ConfigureAwait(false);
+ Genre[] entities = await Task.WhenAll(data.Keys.Select(key => Kernel.Instance.ItemController.GetGenre(key))).ConfigureAwait(false);
// Convert to an array of IBNItem
- IBNItem[] items = new IBNItem[entities.Length];
+ var items = new IbnItem[entities.Length];
for (int i = 0; i < entities.Length; i++)
{
Genre e = entities[i];
- items[i] = ApiService.GetIBNItem(e, data[e.Name]);
+ items[i] = ApiService.GetIbnItem(e, data[e.Name]);
}
return items;
diff --git a/MediaBrowser.Api/HttpHandlers/ImageHandler.cs b/MediaBrowser.Api/HttpHandlers/ImageHandler.cs
index c5949122f..f73f783af 100644
--- a/MediaBrowser.Api/HttpHandlers/ImageHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/ImageHandler.cs
@@ -21,15 +21,12 @@ namespace MediaBrowser.Api.HttpHandlers
return ApiService.IsApiUrlMatch("image", request);
}
- private string _ImagePath = null;
+ private string _imagePath;
private async Task<string> GetImagePath()
{
- if (_ImagePath == null)
- {
- _ImagePath = await DiscoverImagePath();
- }
+ _imagePath = _imagePath ?? await DiscoverImagePath();
- return _ImagePath;
+ return _imagePath;
}
private async Task<string> DiscoverImagePath()
@@ -77,21 +74,21 @@ namespace MediaBrowser.Api.HttpHandlers
return GetImagePathFromTypes(item, ImageType, index);
}
- private Stream _SourceStream = null;
+ private Stream _sourceStream;
private async Task<Stream> GetSourceStream()
{
await EnsureSourceStream().ConfigureAwait(false);
- return _SourceStream;
+ return _sourceStream;
}
- private bool _SourceStreamEnsured = false;
+ private bool _sourceStreamEnsured;
private async Task EnsureSourceStream()
{
- if (!_SourceStreamEnsured)
+ if (!_sourceStreamEnsured)
{
try
{
- _SourceStream = File.OpenRead(await GetImagePath().ConfigureAwait(false));
+ _sourceStream = File.OpenRead(await GetImagePath().ConfigureAwait(false));
}
catch (FileNotFoundException ex)
{
@@ -110,7 +107,7 @@ namespace MediaBrowser.Api.HttpHandlers
}
finally
{
- _SourceStreamEnsured = true;
+ _sourceStreamEnsured = true;
}
}
}
@@ -248,26 +245,24 @@ namespace MediaBrowser.Api.HttpHandlers
{
return item.LogoImagePath;
}
- else if (imageType == ImageType.Backdrop)
+ if (imageType == ImageType.Backdrop)
{
return item.BackdropImagePaths.ElementAt(imageIndex);
}
- else if (imageType == ImageType.Banner)
+ if (imageType == ImageType.Banner)
{
return item.BannerImagePath;
}
- else if (imageType == ImageType.Art)
+ if (imageType == ImageType.Art)
{
return item.ArtImagePath;
}
- else if (imageType == ImageType.Thumbnail)
+ if (imageType == ImageType.Thumbnail)
{
return item.ThumbnailImagePath;
}
- else
- {
- return item.PrimaryImagePath;
- }
+
+ return item.PrimaryImagePath;
}
}
}
diff --git a/MediaBrowser.Api/HttpHandlers/ItemHandler.cs b/MediaBrowser.Api/HttpHandlers/ItemHandler.cs
index 491f45446..60b328d1a 100644
--- a/MediaBrowser.Api/HttpHandlers/ItemHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/ItemHandler.cs
@@ -11,14 +11,14 @@ namespace MediaBrowser.Api.HttpHandlers
/// Provides a handler to retrieve a single item
/// </summary>
[Export(typeof(BaseHandler))]
- public class ItemHandler : BaseSerializationHandler<DTOBaseItem>
+ public class ItemHandler : BaseSerializationHandler<DtoBaseItem>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("item", request);
}
- protected override Task<DTOBaseItem> GetObjectToSerialize()
+ protected override Task<DtoBaseItem> GetObjectToSerialize()
{
User user = ApiService.GetUserById(QueryString["userid"], true);
@@ -29,7 +29,7 @@ namespace MediaBrowser.Api.HttpHandlers
return null;
}
- return ApiService.GetDTOBaseItem(item, user);
+ return ApiService.GetDtoBaseItem(item, user);
}
}
}
diff --git a/MediaBrowser.Api/HttpHandlers/ItemListHandler.cs b/MediaBrowser.Api/HttpHandlers/ItemListHandler.cs
index bce018d3e..d236e546b 100644
--- a/MediaBrowser.Api/HttpHandlers/ItemListHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/ItemListHandler.cs
@@ -11,56 +11,53 @@ using System.Threading.Tasks;
namespace MediaBrowser.Api.HttpHandlers
{
[Export(typeof(BaseHandler))]
- public class ItemListHandler : BaseSerializationHandler<DTOBaseItem[]>
+ public class ItemListHandler : BaseSerializationHandler<DtoBaseItem[]>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("itemlist", request);
}
- protected override Task<DTOBaseItem[]> GetObjectToSerialize()
+ protected override Task<DtoBaseItem[]> GetObjectToSerialize()
{
User user = ApiService.GetUserById(QueryString["userid"], true);
- return Task.WhenAll<DTOBaseItem>(GetItemsToSerialize(user).Select(i =>
- {
- return ApiService.GetDTOBaseItem(i, user, includeChildren: false, includePeople: false);
- }));
+ return Task.WhenAll(GetItemsToSerialize(user).Select(i => ApiService.GetDtoBaseItem(i, user, includeChildren: false, includePeople: false)));
}
private IEnumerable<BaseItem> GetItemsToSerialize(User user)
{
- Folder parent = ApiService.GetItemById(ItemId) as Folder;
+ var parent = ApiService.GetItemById(ItemId) as Folder;
if (ListType.Equals("inprogressitems", StringComparison.OrdinalIgnoreCase))
{
return parent.GetInProgressItems(user);
}
- else if (ListType.Equals("recentlyaddeditems", StringComparison.OrdinalIgnoreCase))
+ if (ListType.Equals("recentlyaddeditems", StringComparison.OrdinalIgnoreCase))
{
return parent.GetRecentlyAddedItems(user);
}
- else if (ListType.Equals("recentlyaddedunplayeditems", StringComparison.OrdinalIgnoreCase))
+ if (ListType.Equals("recentlyaddedunplayeditems", StringComparison.OrdinalIgnoreCase))
{
return parent.GetRecentlyAddedUnplayedItems(user);
}
- else if (ListType.Equals("itemswithgenre", StringComparison.OrdinalIgnoreCase))
+ if (ListType.Equals("itemswithgenre", StringComparison.OrdinalIgnoreCase))
{
return parent.GetItemsWithGenre(QueryString["name"], user);
}
- else if (ListType.Equals("itemswithyear", StringComparison.OrdinalIgnoreCase))
+ if (ListType.Equals("itemswithyear", StringComparison.OrdinalIgnoreCase))
{
return parent.GetItemsWithYear(int.Parse(QueryString["year"]), user);
}
- else if (ListType.Equals("itemswithstudio", StringComparison.OrdinalIgnoreCase))
+ if (ListType.Equals("itemswithstudio", StringComparison.OrdinalIgnoreCase))
{
return parent.GetItemsWithStudio(QueryString["name"], user);
}
- else if (ListType.Equals("itemswithperson", StringComparison.OrdinalIgnoreCase))
+ if (ListType.Equals("itemswithperson", StringComparison.OrdinalIgnoreCase))
{
return parent.GetItemsWithPerson(QueryString["name"], null, user);
}
- else if (ListType.Equals("favorites", StringComparison.OrdinalIgnoreCase))
+ if (ListType.Equals("favorites", StringComparison.OrdinalIgnoreCase))
{
return parent.GetFavoriteItems(user);
}
diff --git a/MediaBrowser.Api/HttpHandlers/MovieSpecialFeaturesHandler.cs b/MediaBrowser.Api/HttpHandlers/MovieSpecialFeaturesHandler.cs
index 63426be47..3ab78ee8d 100644
--- a/MediaBrowser.Api/HttpHandlers/MovieSpecialFeaturesHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/MovieSpecialFeaturesHandler.cs
@@ -13,29 +13,26 @@ namespace MediaBrowser.Api.HttpHandlers
/// This handler retrieves special features for movies
/// </summary>
[Export(typeof(BaseHandler))]
- public class MovieSpecialFeaturesHandler : BaseSerializationHandler<DTOBaseItem[]>
+ public class MovieSpecialFeaturesHandler : BaseSerializationHandler<DtoBaseItem[]>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("MovieSpecialFeatures", request);
}
- protected override Task<DTOBaseItem[]> GetObjectToSerialize()
+ protected override Task<DtoBaseItem[]> GetObjectToSerialize()
{
User user = ApiService.GetUserById(QueryString["userid"], true);
- Movie movie = ApiService.GetItemById(ItemId) as Movie;
+ var movie = ApiService.GetItemById(ItemId) as Movie;
// If none
if (movie.SpecialFeatures == null)
{
- return Task.FromResult<DTOBaseItem[]>(new DTOBaseItem[] { });
+ return Task.FromResult(new DtoBaseItem[] { });
}
- return Task.WhenAll<DTOBaseItem>(movie.SpecialFeatures.Select(i =>
- {
- return ApiService.GetDTOBaseItem(i, user, includeChildren: false, includePeople: true);
- }));
+ return Task.WhenAll(movie.SpecialFeatures.Select(i => ApiService.GetDtoBaseItem(i, user, includeChildren: false)));
}
protected string ItemId
diff --git a/MediaBrowser.Api/HttpHandlers/PersonHandler.cs b/MediaBrowser.Api/HttpHandlers/PersonHandler.cs
index 1663cffb1..fbbd88a11 100644
--- a/MediaBrowser.Api/HttpHandlers/PersonHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/PersonHandler.cs
@@ -13,17 +13,17 @@ namespace MediaBrowser.Api.HttpHandlers
/// Gets a single Person
/// </summary>
[Export(typeof(BaseHandler))]
- public class PersonHandler : BaseSerializationHandler<IBNItem>
+ public class PersonHandler : BaseSerializationHandler<IbnItem>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("person", request);
}
-
- protected override Task<IBNItem> GetObjectToSerialize()
+
+ protected override Task<IbnItem> GetObjectToSerialize()
{
- Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
- User user = ApiService.GetUserById(QueryString["userid"], true);
+ var parent = ApiService.GetItemById(QueryString["id"]) as Folder;
+ var user = ApiService.GetUserById(QueryString["userid"], true);
string name = QueryString["name"];
@@ -33,7 +33,7 @@ namespace MediaBrowser.Api.HttpHandlers
/// <summary>
/// Gets a Person
/// </summary>
- private async Task<IBNItem> GetPerson(Folder parent, User user, string name)
+ private async Task<IbnItem> GetPerson(Folder parent, User user, string name)
{
int count = 0;
@@ -49,7 +49,7 @@ namespace MediaBrowser.Api.HttpHandlers
}
// Get the original entity so that we can also supply the PrimaryImagePath
- return ApiService.GetIBNItem(await Kernel.Instance.ItemController.GetPerson(name).ConfigureAwait(false), count);
+ return ApiService.GetIbnItem(await Kernel.Instance.ItemController.GetPerson(name).ConfigureAwait(false), count);
}
}
}
diff --git a/MediaBrowser.Api/HttpHandlers/PlayedStatusHandler.cs b/MediaBrowser.Api/HttpHandlers/PlayedStatusHandler.cs
index 4fe790c80..c010bcb02 100644
--- a/MediaBrowser.Api/HttpHandlers/PlayedStatusHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/PlayedStatusHandler.cs
@@ -1,7 +1,6 @@
using MediaBrowser.Common.Net.Handlers;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.DTO;
-using MediaBrowser.Model.Entities;
using System.ComponentModel.Composition;
using System.Net;
using System.Threading.Tasks;
@@ -12,14 +11,14 @@ namespace MediaBrowser.Api.HttpHandlers
/// Provides a handler to set played status for an item
/// </summary>
[Export(typeof(BaseHandler))]
- public class PlayedStatusHandler : BaseSerializationHandler<DTOUserItemData>
+ public class PlayedStatusHandler : BaseSerializationHandler<DtoUserItemData>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("PlayedStatus", request);
}
- protected override Task<DTOUserItemData> GetObjectToSerialize()
+ protected override Task<DtoUserItemData> GetObjectToSerialize()
{
// Get the item
BaseItem item = ApiService.GetItemById(QueryString["id"]);
@@ -33,7 +32,7 @@ namespace MediaBrowser.Api.HttpHandlers
UserItemData data = item.GetUserData(user, true);
- return Task.FromResult<DTOUserItemData>(ApiService.GetDTOUserItemData(data));
+ return Task.FromResult(ApiService.GetDtoUserItemData(data));
}
}
} \ No newline at end of file
diff --git a/MediaBrowser.Api/HttpHandlers/PluginAssemblyHandler.cs b/MediaBrowser.Api/HttpHandlers/PluginAssemblyHandler.cs
index 07e6115a5..88161c114 100644
--- a/MediaBrowser.Api/HttpHandlers/PluginAssemblyHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/PluginAssemblyHandler.cs
@@ -32,7 +32,7 @@ namespace MediaBrowser.Api.HttpHandlers
string path = Path.Combine(Kernel.Instance.ApplicationPaths.PluginsPath, filename);
- return new StaticFileHandler() { Path = path }.ProcessRequest(ctx);
+ return new StaticFileHandler { Path = path }.ProcessRequest(ctx);
}
}
}
diff --git a/MediaBrowser.Api/HttpHandlers/PluginConfigurationHandler.cs b/MediaBrowser.Api/HttpHandlers/PluginConfigurationHandler.cs
index 6dafd4170..95af9a344 100644
--- a/MediaBrowser.Api/HttpHandlers/PluginConfigurationHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/PluginConfigurationHandler.cs
@@ -18,25 +18,25 @@ namespace MediaBrowser.Api.HttpHandlers
return ApiService.IsApiUrlMatch("pluginconfiguration", request);
}
- private BasePlugin _Plugin = null;
+ private BasePlugin _plugin;
private BasePlugin Plugin
{
get
{
- if (_Plugin == null)
+ if (_plugin == null)
{
string name = QueryString["assemblyfilename"];
- _Plugin = Kernel.Instance.Plugins.First(p => p.AssemblyFileName.Equals(name, StringComparison.OrdinalIgnoreCase));
+ _plugin = Kernel.Instance.Plugins.First(p => p.AssemblyFileName.Equals(name, StringComparison.OrdinalIgnoreCase));
}
- return _Plugin;
+ return _plugin;
}
}
protected override Task<BasePluginConfiguration> GetObjectToSerialize()
{
- return Task.FromResult<BasePluginConfiguration>(Plugin.Configuration);
+ return Task.FromResult(Plugin.Configuration);
}
public override TimeSpan CacheDuration
diff --git a/MediaBrowser.Api/HttpHandlers/PluginsHandler.cs b/MediaBrowser.Api/HttpHandlers/PluginsHandler.cs
index e90f32239..a1b37ecab 100644
--- a/MediaBrowser.Api/HttpHandlers/PluginsHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/PluginsHandler.cs
@@ -19,23 +19,20 @@ namespace MediaBrowser.Api.HttpHandlers
{
return ApiService.IsApiUrlMatch("plugins", request);
}
-
+
protected override Task<IEnumerable<PluginInfo>> GetObjectToSerialize()
{
- var plugins = Kernel.Instance.Plugins.Select(p =>
+ var plugins = Kernel.Instance.Plugins.Select(p => new PluginInfo
{
- return new PluginInfo()
- {
- Name = p.Name,
- Enabled = p.Enabled,
- DownloadToUI = p.DownloadToUI,
- Version = p.Version.ToString(),
- AssemblyFileName = p.AssemblyFileName,
- ConfigurationDateLastModified = p.ConfigurationDateLastModified
- };
+ Name = p.Name,
+ Enabled = p.Enabled,
+ DownloadToUI = p.DownloadToUi,
+ Version = p.Version.ToString(),
+ AssemblyFileName = p.AssemblyFileName,
+ ConfigurationDateLastModified = p.ConfigurationDateLastModified
});
- return Task.FromResult<IEnumerable<PluginInfo>>(plugins);
+ return Task.FromResult(plugins);
}
}
}
diff --git a/MediaBrowser.Api/HttpHandlers/ServerConfigurationHandler.cs b/MediaBrowser.Api/HttpHandlers/ServerConfigurationHandler.cs
index bbda31dc6..64ba44ec2 100644
--- a/MediaBrowser.Api/HttpHandlers/ServerConfigurationHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/ServerConfigurationHandler.cs
@@ -19,7 +19,7 @@ namespace MediaBrowser.Api.HttpHandlers
protected override Task<ServerConfiguration> GetObjectToSerialize()
{
- return Task.FromResult<ServerConfiguration>(Kernel.Instance.Configuration);
+ return Task.FromResult(Kernel.Instance.Configuration);
}
public override TimeSpan CacheDuration
diff --git a/MediaBrowser.Api/HttpHandlers/StudioHandler.cs b/MediaBrowser.Api/HttpHandlers/StudioHandler.cs
index 79f057810..6576e2cfe 100644
--- a/MediaBrowser.Api/HttpHandlers/StudioHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/StudioHandler.cs
@@ -15,17 +15,17 @@ namespace MediaBrowser.Api.HttpHandlers
/// Gets a single studio
/// </summary>
[Export(typeof(BaseHandler))]
- public class StudioHandler : BaseSerializationHandler<IBNItem>
+ public class StudioHandler : BaseSerializationHandler<IbnItem>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("studio", request);
}
-
- protected override Task<IBNItem> GetObjectToSerialize()
+
+ protected override Task<IbnItem> GetObjectToSerialize()
{
- Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
- User user = ApiService.GetUserById(QueryString["userid"], true);
+ var parent = ApiService.GetItemById(QueryString["id"]) as Folder;
+ var user = ApiService.GetUserById(QueryString["userid"], true);
string name = QueryString["name"];
@@ -35,7 +35,7 @@ namespace MediaBrowser.Api.HttpHandlers
/// <summary>
/// Gets a Studio
/// </summary>
- private async Task<IBNItem> GetStudio(Folder parent, User user, string name)
+ private async Task<IbnItem> GetStudio(Folder parent, User user, string name)
{
int count = 0;
@@ -51,7 +51,7 @@ namespace MediaBrowser.Api.HttpHandlers
}
// Get the original entity so that we can also supply the PrimaryImagePath
- return ApiService.GetIBNItem(await Kernel.Instance.ItemController.GetStudio(name).ConfigureAwait(false), count);
+ return ApiService.GetIbnItem(await Kernel.Instance.ItemController.GetStudio(name).ConfigureAwait(false), count);
}
}
}
diff --git a/MediaBrowser.Api/HttpHandlers/StudiosHandler.cs b/MediaBrowser.Api/HttpHandlers/StudiosHandler.cs
index 96d6e40a3..4377a0f43 100644
--- a/MediaBrowser.Api/HttpHandlers/StudiosHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/StudiosHandler.cs
@@ -11,17 +11,17 @@ using System.Threading.Tasks;
namespace MediaBrowser.Api.HttpHandlers
{
[Export(typeof(BaseHandler))]
- public class StudiosHandler : BaseSerializationHandler<IBNItem[]>
+ public class StudiosHandler : BaseSerializationHandler<IbnItem[]>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("studios", request);
}
-
- protected override Task<IBNItem[]> GetObjectToSerialize()
+
+ protected override Task<IbnItem[]> GetObjectToSerialize()
{
- Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
- User user = ApiService.GetUserById(QueryString["userid"], true);
+ var parent = ApiService.GetItemById(QueryString["id"]) as Folder;
+ var user = ApiService.GetUserById(QueryString["userid"], true);
return GetAllStudios(parent, user);
}
@@ -30,9 +30,9 @@ namespace MediaBrowser.Api.HttpHandlers
/// Gets all studios from all recursive children of a folder
/// The CategoryInfo class is used to keep track of the number of times each studio appears
/// </summary>
- private async Task<IBNItem[]> GetAllStudios(Folder parent, User user)
+ private async Task<IbnItem[]> GetAllStudios(Folder parent, User user)
{
- Dictionary<string, int> data = new Dictionary<string, int>();
+ var data = new Dictionary<string, int>();
// Get all the allowed recursive children
IEnumerable<BaseItem> allItems = parent.GetRecursiveChildren(user);
@@ -60,16 +60,16 @@ namespace MediaBrowser.Api.HttpHandlers
}
// Get the Studio objects
- Studio[] entities = await Task.WhenAll<Studio>(data.Keys.Select(key => { return Kernel.Instance.ItemController.GetStudio(key); })).ConfigureAwait(false);
+ Studio[] entities = await Task.WhenAll(data.Keys.Select(key => Kernel.Instance.ItemController.GetStudio(key))).ConfigureAwait(false);
// Convert to an array of IBNItem
- IBNItem[] items = new IBNItem[entities.Length];
+ var items = new IbnItem[entities.Length];
for (int i = 0; i < entities.Length; i++)
{
Studio e = entities[i];
- items[i] = ApiService.GetIBNItem(e, data[e.Name]);
+ items[i] = ApiService.GetIbnItem(e, data[e.Name]);
}
return items;
diff --git a/MediaBrowser.Api/HttpHandlers/UserHandler.cs b/MediaBrowser.Api/HttpHandlers/UserHandler.cs
index 5ccf3bb61..bc9286204 100644
--- a/MediaBrowser.Api/HttpHandlers/UserHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/UserHandler.cs
@@ -8,22 +8,22 @@ using System.Threading.Tasks;
namespace MediaBrowser.Api.HttpHandlers
{
[Export(typeof(BaseHandler))]
- class UserHandler : BaseSerializationHandler<DTOUser>
+ class UserHandler : BaseSerializationHandler<DtoUser>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("user", request);
}
-
- protected override Task<DTOUser> GetObjectToSerialize()
+
+ protected override Task<DtoUser> GetObjectToSerialize()
{
string id = QueryString["id"];
- User user = string.IsNullOrEmpty(id) ? ApiService.GetDefaultUser(false) : ApiService.GetUserById(id, false); ;
+ User user = string.IsNullOrEmpty(id) ? ApiService.GetDefaultUser(false) : ApiService.GetUserById(id, false);
- DTOUser dto = ApiService.GetDTOUser(user);
+ DtoUser dto = ApiService.GetDtoUser(user);
- return Task.FromResult<DTOUser>(dto);
+ return Task.FromResult(dto);
}
}
}
diff --git a/MediaBrowser.Api/HttpHandlers/UserItemRatingHandler.cs b/MediaBrowser.Api/HttpHandlers/UserItemRatingHandler.cs
index d04041408..aed0804b6 100644
--- a/MediaBrowser.Api/HttpHandlers/UserItemRatingHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/UserItemRatingHandler.cs
@@ -1,7 +1,6 @@
using MediaBrowser.Common.Net.Handlers;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.DTO;
-using MediaBrowser.Model.Entities;
using System.ComponentModel.Composition;
using System.Net;
using System.Threading.Tasks;
@@ -12,14 +11,14 @@ namespace MediaBrowser.Api.HttpHandlers
/// Provides a handler to set a user's rating for an item
/// </summary>
[Export(typeof(BaseHandler))]
- public class UserItemRatingHandler : BaseSerializationHandler<DTOUserItemData>
+ public class UserItemRatingHandler : BaseSerializationHandler<DtoUserItemData>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("UserItemRating", request);
}
- protected override Task<DTOUserItemData> GetObjectToSerialize()
+ protected override Task<DtoUserItemData> GetObjectToSerialize()
{
// Get the item
BaseItem item = ApiService.GetItemById(QueryString["id"]);
@@ -41,7 +40,7 @@ namespace MediaBrowser.Api.HttpHandlers
data.Likes = QueryString["likes"] == "1";
}
- return Task.FromResult<DTOUserItemData>(ApiService.GetDTOUserItemData(data));
+ return Task.FromResult(ApiService.GetDtoUserItemData(data));
}
}
} \ No newline at end of file
diff --git a/MediaBrowser.Api/HttpHandlers/UsersHandler.cs b/MediaBrowser.Api/HttpHandlers/UsersHandler.cs
index 1451216bc..3fc3a7d58 100644
--- a/MediaBrowser.Api/HttpHandlers/UsersHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/UsersHandler.cs
@@ -10,16 +10,16 @@ using System.Threading.Tasks;
namespace MediaBrowser.Api.HttpHandlers
{
[Export(typeof(BaseHandler))]
- class UsersHandler : BaseSerializationHandler<IEnumerable<DTOUser>>
+ class UsersHandler : BaseSerializationHandler<IEnumerable<DtoUser>>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("users", request);
}
- protected override Task<IEnumerable<DTOUser>> GetObjectToSerialize()
+ protected override Task<IEnumerable<DtoUser>> GetObjectToSerialize()
{
- return Task.FromResult<IEnumerable<DTOUser>>(Kernel.Instance.Users.Select(u => ApiService.GetDTOUser(u)));
+ return Task.FromResult(Kernel.Instance.Users.Select(u => ApiService.GetDtoUser(u)));
}
}
}
diff --git a/MediaBrowser.Api/HttpHandlers/VideoHandler.cs b/MediaBrowser.Api/HttpHandlers/VideoHandler.cs
index 4f8621ce7..9d52136f0 100644
--- a/MediaBrowser.Api/HttpHandlers/VideoHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/VideoHandler.cs
@@ -34,7 +34,7 @@ namespace MediaBrowser.Api.HttpHandlers
// mp4, 3gp, mov - muxer does not support non-seekable output
// avi, mov, mkv, m4v - can't stream these when encoding. the player will try to download them completely before starting playback.
// wmv - can't seem to figure out the output format name
- return new VideoOutputFormats[] { VideoOutputFormats.Mp4, VideoOutputFormats.ThreeGP, VideoOutputFormats.M4v, VideoOutputFormats.Mkv, VideoOutputFormats.Avi, VideoOutputFormats.Mov, VideoOutputFormats.Wmv };
+ return new VideoOutputFormats[] { VideoOutputFormats.Mp4, VideoOutputFormats.ThreeGp, VideoOutputFormats.M4V, VideoOutputFormats.Mkv, VideoOutputFormats.Avi, VideoOutputFormats.Mov, VideoOutputFormats.Wmv };
}
}
@@ -43,15 +43,6 @@ namespace MediaBrowser.Api.HttpHandlers
/// </summary>
protected override bool RequiresConversion()
{
- string currentFormat = Path.GetExtension(LibraryItem.Path).Replace(".", string.Empty);
-
- // For now we won't allow these to pass through.
- // Later we'll add some intelligence to allow it when possible
- if (currentFormat.Equals("mp4", StringComparison.OrdinalIgnoreCase) || currentFormat.Equals("mkv", StringComparison.OrdinalIgnoreCase) || currentFormat.Equals("m4v", StringComparison.OrdinalIgnoreCase))
- {
- return true;
- }
-
if (base.RequiresConversion())
{
return true;
@@ -81,17 +72,17 @@ namespace MediaBrowser.Api.HttpHandlers
/// <summary>
/// Translates the output file extension to the format param that follows "-f" on the ffmpeg command line
/// </summary>
- private string GetFFMpegOutputFormat(VideoOutputFormats outputFormat)
+ private string GetFfMpegOutputFormat(VideoOutputFormats outputFormat)
{
if (outputFormat == VideoOutputFormats.Mkv)
{
return "matroska";
}
- else if (outputFormat == VideoOutputFormats.Ts)
+ if (outputFormat == VideoOutputFormats.Ts)
{
return "mpegts";
}
- else if (outputFormat == VideoOutputFormats.Ogv)
+ if (outputFormat == VideoOutputFormats.Ogv)
{
return "ogg";
}
@@ -104,15 +95,13 @@ namespace MediaBrowser.Api.HttpHandlers
/// </summary>
protected override string GetCommandLineArguments()
{
- List<string> audioTranscodeParams = new List<string>();
-
VideoOutputFormats outputFormat = GetConversionOutputFormat();
return string.Format("-i \"{0}\" -threads 0 {1} {2} -f {3} -",
LibraryItem.Path,
GetVideoArguments(outputFormat),
GetAudioArguments(outputFormat),
- GetFFMpegOutputFormat(outputFormat)
+ GetFfMpegOutputFormat(outputFormat)
);
}
@@ -195,15 +184,15 @@ namespace MediaBrowser.Api.HttpHandlers
// Per webm specification, it must be vpx
return "libvpx";
}
- else if (outputFormat == VideoOutputFormats.Asf)
+ if (outputFormat == VideoOutputFormats.Asf)
{
return "wmv2";
}
- else if (outputFormat == VideoOutputFormats.Wmv)
+ if (outputFormat == VideoOutputFormats.Wmv)
{
return "wmv2";
}
- else if (outputFormat == VideoOutputFormats.Ogv)
+ if (outputFormat == VideoOutputFormats.Ogv)
{
return "libtheora";
}
@@ -223,21 +212,21 @@ namespace MediaBrowser.Api.HttpHandlers
private string GetAudioCodec(AudioStream audioStream, VideoOutputFormats outputFormat)
{
// Some output containers require specific codecs
-
+
if (outputFormat == VideoOutputFormats.Webm)
{
// Per webm specification, it must be vorbis
return "libvorbis";
}
- else if (outputFormat == VideoOutputFormats.Asf)
+ if (outputFormat == VideoOutputFormats.Asf)
{
return "wmav2";
}
- else if (outputFormat == VideoOutputFormats.Wmv)
+ if (outputFormat == VideoOutputFormats.Wmv)
{
return "wmav2";
}
- else if (outputFormat == VideoOutputFormats.Ogv)
+ if (outputFormat == VideoOutputFormats.Ogv)
{
return "libvorbis";
}
@@ -263,7 +252,7 @@ namespace MediaBrowser.Api.HttpHandlers
// libvo_aacenc currently only supports two channel output
return 2;
}
- else if (audioCodec.Equals("wmav2"))
+ if (audioCodec.Equals("wmav2"))
{
// wmav2 currently only supports two channel output
return 2;
diff --git a/MediaBrowser.Api/HttpHandlers/YearHandler.cs b/MediaBrowser.Api/HttpHandlers/YearHandler.cs
index 8390fcbc2..dbd1d25be 100644
--- a/MediaBrowser.Api/HttpHandlers/YearHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/YearHandler.cs
@@ -13,17 +13,17 @@ namespace MediaBrowser.Api.HttpHandlers
/// Gets a single year
/// </summary>
[Export(typeof(BaseHandler))]
- public class YearHandler : BaseSerializationHandler<IBNItem>
+ public class YearHandler : BaseSerializationHandler<IbnItem>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("year", request);
}
-
- protected override Task<IBNItem> GetObjectToSerialize()
+
+ protected override Task<IbnItem> GetObjectToSerialize()
{
- Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
- User user = ApiService.GetUserById(QueryString["userid"], true);
+ var parent = ApiService.GetItemById(QueryString["id"]) as Folder;
+ var user = ApiService.GetUserById(QueryString["userid"], true);
string year = QueryString["year"];
@@ -33,7 +33,7 @@ namespace MediaBrowser.Api.HttpHandlers
/// <summary>
/// Gets a Year
/// </summary>
- private async Task<IBNItem> GetYear(Folder parent, User user, int year)
+ private async Task<IbnItem> GetYear(Folder parent, User user, int year)
{
int count = 0;
@@ -49,7 +49,7 @@ namespace MediaBrowser.Api.HttpHandlers
}
// Get the original entity so that we can also supply the PrimaryImagePath
- return ApiService.GetIBNItem(await Kernel.Instance.ItemController.GetYear(year).ConfigureAwait(false), count);
+ return ApiService.GetIbnItem(await Kernel.Instance.ItemController.GetYear(year).ConfigureAwait(false), count);
}
}
}
diff --git a/MediaBrowser.Api/HttpHandlers/YearsHandler.cs b/MediaBrowser.Api/HttpHandlers/YearsHandler.cs
index 496821fb8..7c90768e8 100644
--- a/MediaBrowser.Api/HttpHandlers/YearsHandler.cs
+++ b/MediaBrowser.Api/HttpHandlers/YearsHandler.cs
@@ -11,16 +11,16 @@ using System.Threading.Tasks;
namespace MediaBrowser.Api.HttpHandlers
{
[Export(typeof(BaseHandler))]
- public class YearsHandler : BaseSerializationHandler<IBNItem[]>
+ public class YearsHandler : BaseSerializationHandler<IbnItem[]>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("years", request);
}
-
- protected override Task<IBNItem[]> GetObjectToSerialize()
+
+ protected override Task<IbnItem[]> GetObjectToSerialize()
{
- Folder parent = ApiService.GetItemById(QueryString["id"]) as Folder;
+ var parent = ApiService.GetItemById(QueryString["id"]) as Folder;
User user = ApiService.GetUserById(QueryString["userid"], true);
return GetAllYears(parent, user);
@@ -30,9 +30,9 @@ namespace MediaBrowser.Api.HttpHandlers
/// Gets all years from all recursive children of a folder
/// The CategoryInfo class is used to keep track of the number of times each year appears
/// </summary>
- private async Task<IBNItem[]> GetAllYears(Folder parent, User user)
+ private async Task<IbnItem[]> GetAllYears(Folder parent, User user)
{
- Dictionary<int, int> data = new Dictionary<int, int>();
+ var data = new Dictionary<int, int>();
// Get all the allowed recursive children
IEnumerable<BaseItem> allItems = parent.GetRecursiveChildren(user);
@@ -57,16 +57,16 @@ namespace MediaBrowser.Api.HttpHandlers
}
// Get the Year objects
- Year[] entities = await Task.WhenAll<Year>(data.Keys.Select(key => { return Kernel.Instance.ItemController.GetYear(key); })).ConfigureAwait(false);
+ Year[] entities = await Task.WhenAll(data.Keys.Select(key => Kernel.Instance.ItemController.GetYear(key))).ConfigureAwait(false);
// Convert to an array of IBNItem
- IBNItem[] items = new IBNItem[entities.Length];
+ var items = new IbnItem[entities.Length];
for (int i = 0; i < entities.Length; i++)
{
Year e = entities[i];
- items[i] = ApiService.GetIBNItem(e, data[int.Parse(e.Name)]);
+ items[i] = ApiService.GetIbnItem(e, data[int.Parse(e.Name)]);
}
return items;
diff --git a/MediaBrowser.Api/ImageProcessor.cs b/MediaBrowser.Api/ImageProcessor.cs
index 10fa73daa..f02b90c22 100644
--- a/MediaBrowser.Api/ImageProcessor.cs
+++ b/MediaBrowser.Api/ImageProcessor.cs
@@ -1,9 +1,9 @@
-using System;
+using MediaBrowser.Common.Drawing;
+using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
-using MediaBrowser.Common.Drawing;
namespace MediaBrowser.Api
{
@@ -79,7 +79,7 @@ namespace MediaBrowser.Api
quality = 90;
}
- using (EncoderParameters encoderParameters = new EncoderParameters(1))
+ using (var encoderParameters = new EncoderParameters(1))
{
encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, quality.Value);
newImage.Save(target, GetImageCodeInfo("image/jpeg"), encoderParameters);
diff --git a/MediaBrowser.Api/Plugin.cs b/MediaBrowser.Api/Plugin.cs
index 5694b84a8..b2bcefd1f 100644
--- a/MediaBrowser.Api/Plugin.cs
+++ b/MediaBrowser.Api/Plugin.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.Composition;
namespace MediaBrowser.Api
{
[Export(typeof(BasePlugin))]
- public class Plugin : BaseGenericPlugin<BasePluginConfiguration>
+ public class Plugin : BasePlugin
{
public override string Name
{
diff --git a/MediaBrowser.Api/Properties/AssemblyInfo.cs b/MediaBrowser.Api/Properties/AssemblyInfo.cs
index bd747ea7d..c92346bac 100644
--- a/MediaBrowser.Api/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.Api/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
diff --git a/MediaBrowser.ApiInteraction.Metro/DataSerializer.cs b/MediaBrowser.ApiInteraction.Metro/DataSerializer.cs
index d63e3f021..92e3f7c2b 100644
--- a/MediaBrowser.ApiInteraction.Metro/DataSerializer.cs
+++ b/MediaBrowser.ApiInteraction.Metro/DataSerializer.cs
@@ -12,7 +12,7 @@ namespace MediaBrowser.ApiInteraction
/// This means that this class can currently only handle types within the Model project.
/// If we need to, we can always add a param indicating whether or not the model serializer should be used.
/// </summary>
- private static ProtobufModelSerializer ProtobufModelSerializer = new ProtobufModelSerializer();
+ private static readonly ProtobufModelSerializer ProtobufModelSerializer = new ProtobufModelSerializer();
public static T DeserializeFromStream<T>(Stream stream, SerializationFormats format)
where T : class
diff --git a/MediaBrowser.ApiInteraction.Portable/ApiClient.cs b/MediaBrowser.ApiInteraction.Portable/ApiClient.cs
deleted file mode 100644
index b41572cd3..000000000
--- a/MediaBrowser.ApiInteraction.Portable/ApiClient.cs
+++ /dev/null
@@ -1,585 +0,0 @@
-using MediaBrowser.Model.Authentication;
-using MediaBrowser.Model.Configuration;
-using MediaBrowser.Model.DTO;
-using MediaBrowser.Model.Weather;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Text;
-
-namespace MediaBrowser.ApiInteraction.Portable
-{
- public class ApiClient : BaseApiClient
- {
- private HttpWebRequest GetNewRequest(string url)
- {
- return HttpWebRequest.CreateHttp(url);
- }
-
- /// <summary>
- /// Gets an image stream based on a url
- /// </summary>
- public void GetImageStreamAsync(string url, Action<Stream> callback)
- {
- GetStreamAsync(url, callback);
- }
-
- /// <summary>
- /// Gets an image stream based on a url
- /// </summary>
- private void GetStreamAsync(string url, Action<Stream> callback)
- {
- HttpWebRequest request = GetNewRequest(url);
-
- request.BeginGetResponse(new AsyncCallback(result =>
- {
- using (WebResponse response = (result.AsyncState as HttpWebRequest).EndGetResponse(result))
- {
- Stream stream = response.GetResponseStream();
- callback(stream);
- }
-
- }), request);
- }
-
- /// <summary>
- /// Gets a BaseItem
- /// </summary>
- public void GetItemAsync(Guid id, Guid userId, Action<DTOBaseItem> callback)
- {
- string url = ApiUrl + "/item?userId=" + userId.ToString();
-
- if (id != Guid.Empty)
- {
- url += "&id=" + id.ToString();
- }
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets all users
- /// </summary>
- public void GetAllUsersAsync(Action<DTOUser[]> callback)
- {
- string url = ApiUrl + "/users";
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets all Genres
- /// </summary>
- public void GetAllGenresAsync(Guid userId, Action<IBNItem[]> callback)
- {
- string url = ApiUrl + "/genres?userId=" + userId.ToString();
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets in-progress items
- /// </summary>
- /// <param name="userId">The user id.</param>
- /// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
- public void GetInProgressItemsItemsAsync(Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
- {
- string url = ApiUrl + "/itemlist?listtype=inprogressitems&userId=" + userId.ToString();
-
- if (folderId.HasValue)
- {
- url += "&id=" + folderId.ToString();
- }
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets recently added items
- /// </summary>
- /// <param name="userId">The user id.</param>
- /// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
- public void GetRecentlyAddedItemsAsync(Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
- {
- string url = ApiUrl + "/itemlist?listtype=recentlyaddeditems&userId=" + userId.ToString();
-
- if (folderId.HasValue)
- {
- url += "&id=" + folderId.ToString();
- }
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets favorite items
- /// </summary>
- /// <param name="userId">The user id.</param>
- /// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
- public void GetFavoriteItemsAsync(Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
- {
- string url = ApiUrl + "/itemlist?listtype=favorites&userId=" + userId.ToString();
-
- if (folderId.HasValue)
- {
- url += "&id=" + folderId.ToString();
- }
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets recently added items that are unplayed.
- /// </summary>
- /// <param name="userId">The user id.</param>
- /// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
- public void GetRecentlyAddedUnplayedItemsAsync(Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
- {
- string url = ApiUrl + "/itemlist?listtype=recentlyaddedunplayeditems&userId=" + userId.ToString();
-
- if (folderId.HasValue)
- {
- url += "&id=" + folderId.ToString();
- }
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets all Years
- /// </summary>
- public void GetAllYearsAsync(Guid userId, Action<IBNItem[]> callback)
- {
- string url = ApiUrl + "/years?userId=" + userId.ToString();
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets all items that contain a given Year
- /// </summary>
- public void GetItemsWithYearAsync(string name, Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
- {
- string url = ApiUrl + "/itemlist?listtype=itemswithyear&userId=" + userId.ToString() + "&name=" + name;
-
- if (folderId.HasValue)
- {
- url += "&id=" + folderId.ToString();
- }
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets all items that contain a given Genre
- /// </summary>
- public void GetItemsWithGenreAsync(string name, Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
- {
- string url = ApiUrl + "/itemlist?listtype=itemswithgenre&userId=" + userId.ToString() + "&name=" + name;
-
- if (folderId.HasValue)
- {
- url += "&id=" + folderId.ToString();
- }
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets all items that contain a given Person
- /// </summary>
- public void GetItemsWithPersonAsync(string name, Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
- {
- string url = ApiUrl + "/itemlist?listtype=itemswithperson&userId=" + userId.ToString() + "&name=" + name;
-
- if (folderId.HasValue)
- {
- url += "&id=" + folderId.ToString();
- }
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets all items that contain a given Person
- /// </summary>
- public void GetItemsWithPersonAsync(string name, string personType, Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
- {
- string url = ApiUrl + "/itemlist?listtype=itemswithperson&userId=" + userId.ToString() + "&name=" + name;
-
- if (folderId.HasValue)
- {
- url += "&id=" + folderId.ToString();
- }
-
- url += "&persontype=" + personType;
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets all studious
- /// </summary>
- public void GetAllStudiosAsync(Guid userId, Action<IBNItem[]> callback)
- {
- string url = ApiUrl + "/studios?userId=" + userId.ToString();
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets all items that contain a given Studio
- /// </summary>
- public void GetItemsWithStudioAsync(string name, Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
- {
- string url = ApiUrl + "/itemlist?listtype=itemswithstudio&userId=" + userId.ToString() + "&name=" + name;
-
- if (folderId.HasValue)
- {
- url += "&id=" + folderId.ToString();
- }
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets a studio
- /// </summary>
- public void GetStudioAsync(Guid userId, string name, Action<IBNItem> callback)
- {
- string url = ApiUrl + "/studio?userId=" + userId.ToString() + "&name=" + name;
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets a genre
- /// </summary>
- public void GetGenreAsync(Guid userId, string name, Action<IBNItem> callback)
- {
- string url = ApiUrl + "/genre?userId=" + userId.ToString() + "&name=" + name;
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets a person
- /// </summary>
- public void GetPersonAsync(Guid userId, string name, Action<IBNItem> callback)
- {
- string url = ApiUrl + "/person?userId=" + userId.ToString() + "&name=" + name;
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets a year
- /// </summary>
- public void GetYearAsync(Guid userId, int year, Action<IBNItem> callback)
- {
- string url = ApiUrl + "/year?userId=" + userId.ToString() + "&year=" + year;
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets a list of plugins installed on the server
- /// </summary>
- public void GetInstalledPluginsAsync(Action<PluginInfo[]> callback)
- {
- string url = ApiUrl + "/plugins";
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets a list of plugins installed on the server
- /// </summary>
- public void GetPluginAssemblyAsync(PluginInfo plugin, Action<Stream> callback)
- {
- string url = ApiUrl + "/pluginassembly?assemblyfilename=" + plugin.AssemblyFileName;
-
- GetStreamAsync(url, callback);
- }
-
- /// <summary>
- /// Gets the current server configuration
- /// </summary>
- public void GetServerConfigurationAsync(Action<ServerConfiguration> callback)
- {
- string url = ApiUrl + "/ServerConfiguration";
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets weather information for the default location as set in configuration
- /// </summary>
- public void GetPluginConfigurationAsync(PluginInfo plugin, Type configurationType, Action<object> callback)
- {
- string url = ApiUrl + "/PluginConfiguration?assemblyfilename=" + plugin.AssemblyFileName;
-
- // At the moment this can't be retrieved in protobuf format
- SerializationFormats format = DataSerializer.CanDeSerializeJsv ? SerializationFormats.Jsv : SerializationFormats.Json;
-
- GetDataAsync(url, callback, configurationType, format);
- }
-
- /// <summary>
- /// Gets the default user
- /// </summary>
- public void GetDefaultUserAsync(Action<DTOUser> callback)
- {
- string url = ApiUrl + "/user";
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets a user by id
- /// </summary>
- public void GetUserAsync(Guid id, Action<DTOUser> callback)
- {
- string url = ApiUrl + "/user?id=" + id.ToString();
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets weather information for the default location as set in configuration
- /// </summary>
- public void GetWeatherInfoAsync(Action<WeatherInfo> callback)
- {
- string url = ApiUrl + "/weather";
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets weather information for a specific zip code
- /// </summary>
- public void GetWeatherInfoAsync(string zipCode, Action<WeatherInfo> callback)
- {
- string url = ApiUrl + "/weather?zipcode=" + zipCode;
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Gets special features for a Movie
- /// </summary>
- public void GetMovieSpecialFeaturesAsync(Guid itemId, Guid userId, Action<DTOBaseItem[]> callback)
- {
- string url = ApiUrl + "/MovieSpecialFeatures?id=" + itemId;
- url += "&userid=" + userId;
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Authenticates a user and returns the result
- /// </summary>
- public void AuthenticateUserAsync(Guid userId, string password, Action<AuthenticationResult> callback)
- {
- string url = ApiUrl + "/UserAuthentication?dataformat=" + SerializationFormat.ToString();
-
- Dictionary<string, string> formValues = new Dictionary<string, string>();
-
- formValues["userid"] = userId.ToString();
-
- if (!string.IsNullOrEmpty(password))
- {
- formValues["password"] = password;
- }
-
- PostDataAsync(url, formValues, callback, SerializationFormat);
- }
-
- /// <summary>
- /// Updates a user's favorite status for an item and returns the updated UserItemData object.
- /// </summary>
- public void UpdateFavoriteStatusAsync(Guid itemId, Guid userId, bool isFavorite, Action<DTOUserItemData> callback)
- {
- string url = ApiUrl + "/favoritestatus?id=" + itemId;
-
- url += "&userid=" + userId;
- url += "&isfavorite=" + (isFavorite ? "1" : "0");
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Updates played status for an item
- /// </summary>
- public void UpdatePlayedStatusAsync(Guid itemId, Guid userId, bool wasPlayed, Action<DTOUserItemData> callback)
- {
- string url = ApiUrl + "/PlayedStatus?id=" + itemId;
-
- url += "&userid=" + userId;
- url += "&played=" + (wasPlayed ? "1" : "0");
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Clears a user's rating for an item
- /// </summary>
- public void ClearUserItemRatingAsync(Guid itemId, Guid userId, Action<DTOUserItemData> callback)
- {
- string url = ApiUrl + "/UserItemRating?id=" + itemId;
-
- url += "&userid=" + userId;
- url += "&clear=1";
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Updates a user's rating for an item, based on likes or dislikes
- /// </summary>
- public void UpdateUserItemRatingAsync(Guid itemId, Guid userId, bool likes, Action<DTOUserItemData> callback)
- {
- string url = ApiUrl + "/UserItemRating?id=" + itemId;
-
- url += "&userid=" + userId;
- url += "&likes=" + (likes ? "1" : "0");
-
- GetDataAsync(url, callback);
- }
-
- /// <summary>
- /// Performs a GET request, and deserializes the response stream to an object of Type T
- /// </summary>
- private void GetDataAsync<T>(string url, Action<T> callback)
- where T : class
- {
- GetDataAsync<T>(url, callback, SerializationFormat);
- }
-
- /// <summary>
- /// Performs a GET request, and deserializes the response stream to an object of Type T
- /// </summary>
- private void GetDataAsync<T>(string url, Action<T> callback, SerializationFormats serializationFormat)
- where T : class
- {
- if (url.IndexOf('?') == -1)
- {
- url += "?dataformat=" + serializationFormat.ToString();
- }
- else
- {
- url += "&dataformat=" + serializationFormat.ToString();
- }
-
- HttpWebRequest request = GetNewRequest(url);
-
- request.BeginGetResponse(new AsyncCallback(result =>
- {
- T value;
-
- using (WebResponse response = (result.AsyncState as HttpWebRequest).EndGetResponse(result))
- {
- using (Stream stream = response.GetResponseStream())
- {
- value = DeserializeFromStream<T>(stream);
- }
- }
-
- callback(value);
-
- }), request);
- }
-
- /// <summary>
- /// Performs a GET request, and deserializes the response stream to an object of Type T
- /// </summary>
- private void GetDataAsync(string url, Action<object> callback, Type type, SerializationFormats serializationFormat)
- {
- if (url.IndexOf('?') == -1)
- {
- url += "?dataformat=" + serializationFormat.ToString();
- }
- else
- {
- url += "&dataformat=" + serializationFormat.ToString();
- }
-
- HttpWebRequest request = GetNewRequest(url);
-
- request.BeginGetResponse(new AsyncCallback(result =>
- {
- object value;
-
- using (WebResponse response = (result.AsyncState as HttpWebRequest).EndGetResponse(result))
- {
- using (Stream stream = response.GetResponseStream())
- {
- value = DataSerializer.DeserializeFromStream(stream, serializationFormat, type);
- }
- }
-
- callback(value);
-
- }), request);
- }
-
- /// <summary>
- /// Performs a POST request, and deserializes the response stream to an object of Type T
- /// </summary>
- private void PostDataAsync<T>(string url, Dictionary<string, string> formValues, Action<T> callback, SerializationFormats serializationFormat)
- where T : class
- {
- if (url.IndexOf('?') == -1)
- {
- url += "?dataformat=" + serializationFormat.ToString();
- }
- else
- {
- url += "&dataformat=" + serializationFormat.ToString();
- }
-
- HttpWebRequest request = GetNewRequest(url);
-
- request.Method = "POST";
- request.ContentType = "application/x-www-form-urlencoded";
-
- // Begin getting request stream
- request.BeginGetRequestStream(new AsyncCallback(beginGetRequestStreamResult =>
- {
- // Once we have the request stream, write the post data
- using (Stream requestStream = request.EndGetRequestStream(beginGetRequestStreamResult))
- {
- // Construct the body
- string postBody = string.Join("&", formValues.Keys.Select(s => string.Format("{0}={1}", s, formValues[s])).ToArray());
-
- // Convert the string into a byte array.
- byte[] byteArray = Encoding.UTF8.GetBytes(postBody);
-
- // Write to the request stream.
- requestStream.Write(byteArray, 0, byteArray.Length);
- }
-
- // Begin getting response stream
- request.BeginGetResponse(new AsyncCallback(result =>
- {
- // Once we have it, deserialize the data and execute the callback
- T value;
-
- using (WebResponse response = request.EndGetResponse(result))
- {
- using (Stream responseStream = response.GetResponseStream())
- {
- value = DeserializeFromStream<T>(responseStream);
- }
- }
-
- callback(value);
-
- }), null);
-
- }), null);
- }
- }
-}
diff --git a/MediaBrowser.ApiInteraction.Portable/MediaBrowser.ApiInteraction.Portable.csproj b/MediaBrowser.ApiInteraction.Portable/MediaBrowser.ApiInteraction.Portable.csproj
deleted file mode 100644
index b46505e9d..000000000
--- a/MediaBrowser.ApiInteraction.Portable/MediaBrowser.ApiInteraction.Portable.csproj
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{756B93D2-5FFA-4B8D-BDCA-127476F1E6FB}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>MediaBrowser.ApiInteraction.Portable</RootNamespace>
- <AssemblyName>MediaBrowser.ApiInteraction.Portable</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <TargetFrameworkProfile>Profile4</TargetFrameworkProfile>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="..\MediaBrowser.ApiInteraction\BaseApiClient.cs">
- <Link>BaseApiClient.cs</Link>
- </Compile>
- <Compile Include="..\MediaBrowser.ApiInteraction.Metro\DataSerializer.cs">
- <Link>DataSerializer.cs</Link>
- </Compile>
- <Compile Include="..\MediaBrowser.ApiInteraction\SerializationFormats.cs">
- <Link>SerializationFormats.cs</Link>
- </Compile>
- <Compile Include="ApiClient.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\Json.Net\Portable\Newtonsoft.Json.dll</HintPath>
- </Reference>
- <Reference Include="protobuf-net">
- <HintPath>..\protobuf-net\Full\portable\protobuf-net.dll</HintPath>
- </Reference>
- <Reference Include="ProtobufModelSerializer">
- <HintPath>..\MediaBrowser.Model\bin\ProtobufModelSerializer.dll</HintPath>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
- <Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
- <Name>MediaBrowser.Model</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project> \ No newline at end of file
diff --git a/MediaBrowser.ApiInteraction.Portable/Properties/AssemblyInfo.cs b/MediaBrowser.ApiInteraction.Portable/Properties/AssemblyInfo.cs
deleted file mode 100644
index c7628135d..000000000
--- a/MediaBrowser.ApiInteraction.Portable/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System.Resources;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("MediaBrowser.ApiInteraction.Portable")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("MediaBrowser.ApiInteraction.Portable")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-[assembly: NeutralResourcesLanguage("en")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/MediaBrowser.ApiInteraction.sln b/MediaBrowser.ApiInteraction.sln
index b5bcc1cdd..4484801a2 100644
--- a/MediaBrowser.ApiInteraction.sln
+++ b/MediaBrowser.ApiInteraction.sln
@@ -12,18 +12,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{F0E0E6
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.ApiInteraction.Metro", "MediaBrowser.ApiInteraction.Metro\MediaBrowser.ApiInteraction.Metro.csproj", "{94CEA07A-307C-4663-AA43-7BD852808574}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.ApiInteraction.Portable", "MediaBrowser.ApiInteraction.Portable\MediaBrowser.ApiInteraction.Portable.csproj", "{756B93D2-5FFA-4B8D-BDCA-127476F1E6FB}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {756B93D2-5FFA-4B8D-BDCA-127476F1E6FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {756B93D2-5FFA-4B8D-BDCA-127476F1E6FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {756B93D2-5FFA-4B8D-BDCA-127476F1E6FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {756B93D2-5FFA-4B8D-BDCA-127476F1E6FB}.Release|Any CPU.Build.0 = Release|Any CPU
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/MediaBrowser.ApiInteraction/ApiClient.cs b/MediaBrowser.ApiInteraction/ApiClient.cs
index 14326ba40..3d5ecde22 100644
--- a/MediaBrowser.ApiInteraction/ApiClient.cs
+++ b/MediaBrowser.ApiInteraction/ApiClient.cs
@@ -11,7 +11,7 @@ namespace MediaBrowser.ApiInteraction
}
public ApiClient()
- : this(new WebRequestHandler() { CachePolicy = new RequestCachePolicy(RequestCacheLevel.Revalidate) })
+ : this(new WebRequestHandler { CachePolicy = new RequestCachePolicy(RequestCacheLevel.Revalidate) })
{
}
}
diff --git a/MediaBrowser.ApiInteraction/BaseApiClient.cs b/MediaBrowser.ApiInteraction/BaseApiClient.cs
index 7952129cf..466869c76 100644
--- a/MediaBrowser.ApiInteraction/BaseApiClient.cs
+++ b/MediaBrowser.ApiInteraction/BaseApiClient.cs
@@ -12,7 +12,7 @@ namespace MediaBrowser.ApiInteraction
/// </summary>
public abstract class BaseApiClient : IDisposable
{
- public BaseApiClient()
+ protected BaseApiClient()
{
DataSerializer.Configure();
}
@@ -45,7 +45,7 @@ namespace MediaBrowser.ApiInteraction
{
get
{
- return ApiInteraction.SerializationFormats.Protobuf;
+ return SerializationFormats.Protobuf;
}
}
@@ -299,10 +299,10 @@ namespace MediaBrowser.ApiInteraction
/// <param name="maxWidth">Use if a max width is required. Aspect ratio will be preserved.</param>
/// <param name="maxHeight">Use if a max height is required. Aspect ratio will be preserved.</param>
/// <param name="quality">Quality level, from 0-100. Currently only applies to JPG. The default value should suffice.</param>
- public string[] GetBackdropImageUrls(DTOBaseItem item, int? width = null, int? height = null, int? maxWidth = null, int? maxHeight = null, int? quality = null)
+ public string[] GetBackdropImageUrls(DtoBaseItem item, int? width = null, int? height = null, int? maxWidth = null, int? maxHeight = null, int? quality = null)
{
- Guid? backdropItemId = null;
- int backdropCount = 0;
+ Guid? backdropItemId;
+ int backdropCount;
if (item.BackdropCount == 0)
{
@@ -320,7 +320,7 @@ namespace MediaBrowser.ApiInteraction
return new string[] { };
}
- string[] files = new string[backdropCount];
+ var files = new string[backdropCount];
for (int i = 0; i < backdropCount; i++)
{
@@ -339,7 +339,7 @@ namespace MediaBrowser.ApiInteraction
/// <param name="maxWidth">Use if a max width is required. Aspect ratio will be preserved.</param>
/// <param name="maxHeight">Use if a max height is required. Aspect ratio will be preserved.</param>
/// <param name="quality">Quality level, from 0-100. Currently only applies to JPG. The default value should suffice.</param>
- public string GetLogoImageUrl(DTOBaseItem item, int? width = null, int? height = null, int? maxWidth = null, int? maxHeight = null, int? quality = null)
+ public string GetLogoImageUrl(DtoBaseItem item, int? width = null, int? height = null, int? maxWidth = null, int? maxHeight = null, int? quality = null)
{
Guid? logoItemId = item.HasLogo ? item.Id : item.ParentLogoItemId;
@@ -360,9 +360,9 @@ namespace MediaBrowser.ApiInteraction
/// <param name="maxAudioSampleRate">The maximum sample rate that the device can play. This should generally be omitted. The server will default this to 44100, so only override if a different max is needed.</param>
public string GetAudioStreamUrl(Guid itemId, IEnumerable<AudioOutputFormats> supportedOutputFormats, int? maxAudioChannels = null, int? maxAudioSampleRate = null)
{
- string url = ApiUrl + "/audio";
+ string url = ApiUrl + "/audio?id=" + itemId;
- url += "?outputformats=" + string.Join(",", supportedOutputFormats.Select(s => s.ToString()).ToArray());
+ url += "&outputformats=" + string.Join(",", supportedOutputFormats.Select(s => s.ToString()).ToArray());
if (maxAudioChannels.HasValue)
{
@@ -397,9 +397,9 @@ namespace MediaBrowser.ApiInteraction
int? maxWidth = null,
int? maxHeight = null)
{
- string url = ApiUrl + "/video";
+ string url = ApiUrl + "/video?id=" + itemId;
- url += "?outputformats=" + string.Join(",", supportedOutputFormats.Select(s => s.ToString()).ToArray());
+ url += "&outputformats=" + string.Join(",", supportedOutputFormats.Select(s => s.ToString()).ToArray());
if (maxAudioChannels.HasValue)
{
diff --git a/MediaBrowser.ApiInteraction/BaseHttpApiClient.cs b/MediaBrowser.ApiInteraction/BaseHttpApiClient.cs
index 0b87ef4cd..8c6c1c297 100644
--- a/MediaBrowser.ApiInteraction/BaseHttpApiClient.cs
+++ b/MediaBrowser.ApiInteraction/BaseHttpApiClient.cs
@@ -28,7 +28,7 @@ namespace MediaBrowser.ApiInteraction
private WebClient HttpClient { get; set; }
#else
- public BaseHttpApiClient(HttpClientHandler handler)
+ protected BaseHttpApiClient(HttpClientHandler handler)
: base()
{
handler.AutomaticDecompression = DecompressionMethods.Deflate;
@@ -50,7 +50,7 @@ namespace MediaBrowser.ApiInteraction
/// <summary>
/// Gets a BaseItem
/// </summary>
- public async Task<DTOBaseItem> GetItemAsync(Guid id, Guid userId)
+ public async Task<DtoBaseItem> GetItemAsync(Guid id, Guid userId)
{
string url = ApiUrl + "/item?userId=" + userId.ToString();
@@ -61,33 +61,33 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOBaseItem>(stream);
+ return DeserializeFromStream<DtoBaseItem>(stream);
}
}
/// <summary>
/// Gets all Users
/// </summary>
- public async Task<DTOUser[]> GetAllUsersAsync()
+ public async Task<DtoUser[]> GetAllUsersAsync()
{
string url = ApiUrl + "/users";
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOUser[]>(stream);
+ return DeserializeFromStream<DtoUser[]>(stream);
}
}
/// <summary>
/// Gets all Genres
/// </summary>
- public async Task<IBNItem[]> GetAllGenresAsync(Guid userId)
+ public async Task<IbnItem[]> GetAllGenresAsync(Guid userId)
{
string url = ApiUrl + "/genres?userId=" + userId.ToString();
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<IBNItem[]>(stream);
+ return DeserializeFromStream<IbnItem[]>(stream);
}
}
@@ -96,7 +96,7 @@ namespace MediaBrowser.ApiInteraction
/// </summary>
/// <param name="userId">The user id.</param>
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
- public async Task<DTOBaseItem[]> GetInProgressItemsItemsAsync(Guid userId, Guid? folderId = null)
+ public async Task<DtoBaseItem[]> GetInProgressItemsItemsAsync(Guid userId, Guid? folderId = null)
{
string url = ApiUrl + "/itemlist?listtype=inprogressitems&userId=" + userId.ToString();
@@ -107,7 +107,7 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOBaseItem[]>(stream);
+ return DeserializeFromStream<DtoBaseItem[]>(stream);
}
}
@@ -116,7 +116,7 @@ namespace MediaBrowser.ApiInteraction
/// </summary>
/// <param name="userId">The user id.</param>
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
- public async Task<DTOBaseItem[]> GetRecentlyAddedItemsAsync(Guid userId, Guid? folderId = null)
+ public async Task<DtoBaseItem[]> GetRecentlyAddedItemsAsync(Guid userId, Guid? folderId = null)
{
string url = ApiUrl + "/itemlist?listtype=recentlyaddeditems&userId=" + userId.ToString();
@@ -127,7 +127,7 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOBaseItem[]>(stream);
+ return DeserializeFromStream<DtoBaseItem[]>(stream);
}
}
@@ -136,7 +136,7 @@ namespace MediaBrowser.ApiInteraction
/// </summary>
/// <param name="userId">The user id.</param>
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
- public async Task<DTOBaseItem[]> GetFavoriteItemsAsync(Guid userId, Guid? folderId = null)
+ public async Task<DtoBaseItem[]> GetFavoriteItemsAsync(Guid userId, Guid? folderId = null)
{
string url = ApiUrl + "/itemlist?listtype=favorites&userId=" + userId.ToString();
@@ -147,7 +147,7 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOBaseItem[]>(stream);
+ return DeserializeFromStream<DtoBaseItem[]>(stream);
}
}
@@ -156,7 +156,7 @@ namespace MediaBrowser.ApiInteraction
/// </summary>
/// <param name="userId">The user id.</param>
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
- public async Task<DTOBaseItem[]> GetRecentlyAddedUnplayedItemsAsync(Guid userId, Guid? folderId = null)
+ public async Task<DtoBaseItem[]> GetRecentlyAddedUnplayedItemsAsync(Guid userId, Guid? folderId = null)
{
string url = ApiUrl + "/itemlist?listtype=recentlyaddedunplayeditems&userId=" + userId.ToString();
@@ -167,20 +167,20 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOBaseItem[]>(stream);
+ return DeserializeFromStream<DtoBaseItem[]>(stream);
}
}
/// <summary>
/// Gets all Years
/// </summary>
- public async Task<IBNItem[]> GetAllYearsAsync(Guid userId)
+ public async Task<IbnItem[]> GetAllYearsAsync(Guid userId)
{
string url = ApiUrl + "/years?userId=" + userId.ToString();
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<IBNItem[]>(stream);
+ return DeserializeFromStream<IbnItem[]>(stream);
}
}
@@ -188,7 +188,7 @@ namespace MediaBrowser.ApiInteraction
/// Gets all items that contain a given Year
/// </summary>
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
- public async Task<DTOBaseItem[]> GetItemsWithYearAsync(string name, Guid userId, Guid? folderId = null)
+ public async Task<DtoBaseItem[]> GetItemsWithYearAsync(string name, Guid userId, Guid? folderId = null)
{
string url = ApiUrl + "/itemlist?listtype=itemswithyear&userId=" + userId.ToString() + "&name=" + name;
@@ -199,7 +199,7 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOBaseItem[]>(stream);
+ return DeserializeFromStream<DtoBaseItem[]>(stream);
}
}
@@ -207,7 +207,7 @@ namespace MediaBrowser.ApiInteraction
/// Gets all items that contain a given Genre
/// </summary>
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
- public async Task<DTOBaseItem[]> GetItemsWithGenreAsync(string name, Guid userId, Guid? folderId = null)
+ public async Task<DtoBaseItem[]> GetItemsWithGenreAsync(string name, Guid userId, Guid? folderId = null)
{
string url = ApiUrl + "/itemlist?listtype=itemswithgenre&userId=" + userId.ToString() + "&name=" + name;
@@ -218,7 +218,7 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOBaseItem[]>(stream);
+ return DeserializeFromStream<DtoBaseItem[]>(stream);
}
}
@@ -226,7 +226,7 @@ namespace MediaBrowser.ApiInteraction
/// Gets all items that contain a given Person
/// </summary>
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
- public async Task<DTOBaseItem[]> GetItemsWithPersonAsync(string name, Guid userId, Guid? folderId = null)
+ public async Task<DtoBaseItem[]> GetItemsWithPersonAsync(string name, Guid userId, Guid? folderId = null)
{
string url = ApiUrl + "/itemlist?listtype=itemswithperson&userId=" + userId.ToString() + "&name=" + name;
@@ -237,7 +237,7 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOBaseItem[]>(stream);
+ return DeserializeFromStream<DtoBaseItem[]>(stream);
}
}
@@ -245,7 +245,7 @@ namespace MediaBrowser.ApiInteraction
/// Gets all items that contain a given Person
/// </summary>
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
- public async Task<DTOBaseItem[]> GetItemsWithPersonAsync(string name, string personType, Guid userId, Guid? folderId = null)
+ public async Task<DtoBaseItem[]> GetItemsWithPersonAsync(string name, string personType, Guid userId, Guid? folderId = null)
{
string url = ApiUrl + "/itemlist?listtype=itemswithperson&userId=" + userId.ToString() + "&name=" + name;
@@ -258,20 +258,20 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOBaseItem[]>(stream);
+ return DeserializeFromStream<DtoBaseItem[]>(stream);
}
}
/// <summary>
/// Gets all studious
/// </summary>
- public async Task<IBNItem[]> GetAllStudiosAsync(Guid userId)
+ public async Task<IbnItem[]> GetAllStudiosAsync(Guid userId)
{
string url = ApiUrl + "/studios?userId=" + userId.ToString();
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<IBNItem[]>(stream);
+ return DeserializeFromStream<IbnItem[]>(stream);
}
}
@@ -279,7 +279,7 @@ namespace MediaBrowser.ApiInteraction
/// Gets all items that contain a given Studio
/// </summary>
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
- public async Task<DTOBaseItem[]> GetItemsWithStudioAsync(string name, Guid userId, Guid? folderId = null)
+ public async Task<DtoBaseItem[]> GetItemsWithStudioAsync(string name, Guid userId, Guid? folderId = null)
{
string url = ApiUrl + "/itemlist?listtype=itemswithstudio&userId=" + userId.ToString() + "&name=" + name;
@@ -290,59 +290,59 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOBaseItem[]>(stream);
+ return DeserializeFromStream<DtoBaseItem[]>(stream);
}
}
/// <summary>
/// Gets a studio
/// </summary>
- public async Task<IBNItem> GetStudioAsync(Guid userId, string name)
+ public async Task<IbnItem> GetStudioAsync(Guid userId, string name)
{
string url = ApiUrl + "/studio?userId=" + userId.ToString() + "&name=" + name;
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<IBNItem>(stream);
+ return DeserializeFromStream<IbnItem>(stream);
}
}
/// <summary>
/// Gets a genre
/// </summary>
- public async Task<IBNItem> GetGenreAsync(Guid userId, string name)
+ public async Task<IbnItem> GetGenreAsync(Guid userId, string name)
{
string url = ApiUrl + "/genre?userId=" + userId.ToString() + "&name=" + name;
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<IBNItem>(stream);
+ return DeserializeFromStream<IbnItem>(stream);
}
}
/// <summary>
/// Gets a person
/// </summary>
- public async Task<IBNItem> GetPersonAsync(Guid userId, string name)
+ public async Task<IbnItem> GetPersonAsync(Guid userId, string name)
{
string url = ApiUrl + "/person?userId=" + userId.ToString() + "&name=" + name;
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<IBNItem>(stream);
+ return DeserializeFromStream<IbnItem>(stream);
}
}
/// <summary>
/// Gets a year
/// </summary>
- public async Task<IBNItem> GetYearAsync(Guid userId, int year)
+ public async Task<IbnItem> GetYearAsync(Guid userId, int year)
{
string url = ApiUrl + "/year?userId=" + userId.ToString() + "&year=" + year;
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<IBNItem>(stream);
+ return DeserializeFromStream<IbnItem>(stream);
}
}
@@ -401,26 +401,26 @@ namespace MediaBrowser.ApiInteraction
/// <summary>
/// Gets the default user
/// </summary>
- public async Task<DTOUser> GetDefaultUserAsync()
+ public async Task<DtoUser> GetDefaultUserAsync()
{
string url = ApiUrl + "/user";
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOUser>(stream);
+ return DeserializeFromStream<DtoUser>(stream);
}
}
/// <summary>
/// Gets a user by id
/// </summary>
- public async Task<DTOUser> GetUserAsync(Guid id)
+ public async Task<DtoUser> GetUserAsync(Guid id)
{
string url = ApiUrl + "/user?id=" + id.ToString();
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOUser>(stream);
+ return DeserializeFromStream<DtoUser>(stream);
}
}
@@ -453,21 +453,21 @@ namespace MediaBrowser.ApiInteraction
/// <summary>
/// Gets special features for a Movie
/// </summary>
- public async Task<DTOBaseItem[]> GetMovieSpecialFeaturesAsync(Guid itemId, Guid userId)
+ public async Task<DtoBaseItem[]> GetMovieSpecialFeaturesAsync(Guid itemId, Guid userId)
{
string url = ApiUrl + "/MovieSpecialFeatures?id=" + itemId;
url += "&userid=" + userId;
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOBaseItem[]>(stream);
+ return DeserializeFromStream<DtoBaseItem[]>(stream);
}
}
/// <summary>
/// Updates played status for an item
/// </summary>
- public async Task<DTOUserItemData> UpdatePlayedStatusAsync(Guid itemId, Guid userId, bool wasPlayed)
+ public async Task<DtoUserItemData> UpdatePlayedStatusAsync(Guid itemId, Guid userId, bool wasPlayed)
{
string url = ApiUrl + "/PlayedStatus?id=" + itemId;
@@ -476,14 +476,14 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOUserItemData>(stream);
+ return DeserializeFromStream<DtoUserItemData>(stream);
}
}
/// <summary>
/// Updates a user's favorite status for an item and returns the updated UserItemData object.
/// </summary>
- public async Task<DTOUserItemData> UpdateFavoriteStatusAsync(Guid itemId, Guid userId, bool isFavorite)
+ public async Task<DtoUserItemData> UpdateFavoriteStatusAsync(Guid itemId, Guid userId, bool isFavorite)
{
string url = ApiUrl + "/favoritestatus?id=" + itemId;
@@ -492,14 +492,14 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOUserItemData>(stream);
+ return DeserializeFromStream<DtoUserItemData>(stream);
}
}
/// <summary>
/// Clears a user's rating for an item
/// </summary>
- public async Task<DTOUserItemData> ClearUserItemRatingAsync(Guid itemId, Guid userId)
+ public async Task<DtoUserItemData> ClearUserItemRatingAsync(Guid itemId, Guid userId)
{
string url = ApiUrl + "/UserItemRating?id=" + itemId;
@@ -508,14 +508,14 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOUserItemData>(stream);
+ return DeserializeFromStream<DtoUserItemData>(stream);
}
}
/// <summary>
/// Updates a user's rating for an item, based on likes or dislikes
/// </summary>
- public async Task<DTOUserItemData> UpdateUserItemRatingAsync(Guid itemId, Guid userId, bool likes)
+ public async Task<DtoUserItemData> UpdateUserItemRatingAsync(Guid itemId, Guid userId, bool likes)
{
string url = ApiUrl + "/UserItemRating?id=" + itemId;
@@ -524,7 +524,7 @@ namespace MediaBrowser.ApiInteraction
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
{
- return DeserializeFromStream<DTOUserItemData>(stream);
+ return DeserializeFromStream<DtoUserItemData>(stream);
}
}
diff --git a/MediaBrowser.ApiInteraction/DataSerializer.cs b/MediaBrowser.ApiInteraction/DataSerializer.cs
index ae3a72e62..3c3f8fae2 100644
--- a/MediaBrowser.ApiInteraction/DataSerializer.cs
+++ b/MediaBrowser.ApiInteraction/DataSerializer.cs
@@ -12,7 +12,7 @@ namespace MediaBrowser.ApiInteraction
/// This means that this class can currently only handle types within the Model project.
/// If we need to, we can always add a param indicating whether or not the model serializer should be used.
/// </summary>
- private static ProtobufModelSerializer ProtobufModelSerializer = new ProtobufModelSerializer();
+ private static readonly ProtobufModelSerializer ProtobufModelSerializer = new ProtobufModelSerializer();
/// <summary>
/// Deserializes an object using generics
@@ -20,16 +20,16 @@ namespace MediaBrowser.ApiInteraction
public static T DeserializeFromStream<T>(Stream stream, SerializationFormats format)
where T : class
{
- if (format == ApiInteraction.SerializationFormats.Protobuf)
+ if (format == SerializationFormats.Protobuf)
{
//return Serializer.Deserialize<T>(stream);
return ProtobufModelSerializer.Deserialize(stream, null, typeof(T)) as T;
}
- else if (format == ApiInteraction.SerializationFormats.Jsv)
+ if (format == SerializationFormats.Jsv)
{
return TypeSerializer.DeserializeFromStream<T>(stream);
}
- else if (format == ApiInteraction.SerializationFormats.Json)
+ if (format == SerializationFormats.Json)
{
return JsonSerializer.DeserializeFromStream<T>(stream);
}
@@ -42,16 +42,16 @@ namespace MediaBrowser.ApiInteraction
/// </summary>
public static object DeserializeFromStream(Stream stream, SerializationFormats format, Type type)
{
- if (format == ApiInteraction.SerializationFormats.Protobuf)
+ if (format == SerializationFormats.Protobuf)
{
//throw new NotImplementedException();
return ProtobufModelSerializer.Deserialize(stream, null, type);
}
- else if (format == ApiInteraction.SerializationFormats.Jsv)
+ if (format == SerializationFormats.Jsv)
{
return TypeSerializer.DeserializeFromStream(type, stream);
}
- else if (format == ApiInteraction.SerializationFormats.Json)
+ if (format == SerializationFormats.Json)
{
return JsonSerializer.DeserializeFromStream(type, stream);
}
@@ -61,7 +61,7 @@ namespace MediaBrowser.ApiInteraction
public static void Configure()
{
- JsConfig.DateHandler = ServiceStack.Text.JsonDateHandler.ISO8601;
+ JsConfig.DateHandler = JsonDateHandler.ISO8601;
JsConfig.ExcludeTypeInfo = true;
JsConfig.IncludeNullValues = false;
}
diff --git a/MediaBrowser.ApiInteraction/MediaBrowser.ApiInteraction.csproj b/MediaBrowser.ApiInteraction/MediaBrowser.ApiInteraction.csproj
index a1c5f5175..d38a25a07 100644
--- a/MediaBrowser.ApiInteraction/MediaBrowser.ApiInteraction.csproj
+++ b/MediaBrowser.ApiInteraction/MediaBrowser.ApiInteraction.csproj
@@ -36,8 +36,9 @@
<Reference Include="ProtobufModelSerializer">
<HintPath>..\MediaBrowser.Model\bin\ProtobufModelSerializer.dll</HintPath>
</Reference>
- <Reference Include="ServiceStack.Text">
- <HintPath>..\packages\ServiceStack.Text.3.9.5\lib\net35\ServiceStack.Text.dll</HintPath>
+ <Reference Include="ServiceStack.Text, Version=3.9.9.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\packages\ServiceStack.Text.3.9.9\lib\net35\ServiceStack.Text.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
diff --git a/MediaBrowser.ApiInteraction/Properties/AssemblyInfo.cs b/MediaBrowser.ApiInteraction/Properties/AssemblyInfo.cs
index 5dd263f0a..74742759f 100644
--- a/MediaBrowser.ApiInteraction/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.ApiInteraction/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
diff --git a/MediaBrowser.ApiInteraction/packages.config b/MediaBrowser.ApiInteraction/packages.config
index c9218be3c..05294421d 100644
--- a/MediaBrowser.ApiInteraction/packages.config
+++ b/MediaBrowser.ApiInteraction/packages.config
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="ServiceStack.Text" version="3.9.5" targetFramework="net45" />
+ <package id="ServiceStack.Text" version="3.9.9" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/MediaBrowser.Common/Kernel/BaseApplicationPaths.cs b/MediaBrowser.Common/Kernel/BaseApplicationPaths.cs
index 798115ffa..fefbd354a 100644
--- a/MediaBrowser.Common/Kernel/BaseApplicationPaths.cs
+++ b/MediaBrowser.Common/Kernel/BaseApplicationPaths.cs
@@ -5,7 +5,7 @@ using System.Reflection;
namespace MediaBrowser.Common.Kernel
{
/// <summary>
- /// Provides a base class to hold common application paths used by both the UI and Server.
+ /// Provides a base class to hold common application paths used by both the Ui and Server.
/// This can be subclassed to add application-specific paths.
/// </summary>
public abstract class BaseApplicationPaths
@@ -22,6 +22,7 @@ namespace MediaBrowser.Common.Kernel
{
_programDataPath = GetProgramDataPath();
}
+
return _programDataPath;
}
}
diff --git a/MediaBrowser.Common/Kernel/BaseKernel.cs b/MediaBrowser.Common/Kernel/BaseKernel.cs
index 3c8fff212..1fdc597ea 100644
--- a/MediaBrowser.Common/Kernel/BaseKernel.cs
+++ b/MediaBrowser.Common/Kernel/BaseKernel.cs
@@ -18,7 +18,7 @@ using System.Threading.Tasks;
namespace MediaBrowser.Common.Kernel
{
/// <summary>
- /// Represents a shared base kernel for both the UI and server apps
+ /// Represents a shared base kernel for both the Ui and server apps
/// </summary>
public abstract class BaseKernel<TConfigurationType, TApplicationPathsType> : IDisposable, IKernel
where TConfigurationType : BaseApplicationConfiguration, new()
@@ -44,8 +44,8 @@ namespace MediaBrowser.Common.Kernel
private IEnumerable<BaseHandler> HttpHandlers { get; set; }
/// <summary>
- /// Both the UI and server will have a built-in HttpServer.
- /// People will inevitably want remote control apps so it's needed in the UI too.
+ /// Both the Ui and server will have a built-in HttpServer.
+ /// People will inevitably want remote control apps so it's needed in the Ui too.
/// </summary>
public HttpServer HttpServer { get; private set; }
@@ -67,25 +67,52 @@ namespace MediaBrowser.Common.Kernel
/// </summary>
public abstract KernelContext KernelContext { get; }
- public BaseKernel()
+ /// <summary>
+ /// Initializes the Kernel
+ /// </summary>
+ public async Task Init(IProgress<TaskProgress> progress)
{
- ApplicationPaths = new TApplicationPathsType();
+ // Performs initializations that only occur once
+ InitializeInternal(progress);
+
+ // Performs initializations that can be reloaded at anytime
+ await Reload(progress).ConfigureAwait(false);
+
+ progress.Report(new TaskProgress { Description = "Loading Complete" });
}
- public virtual async Task Init(IProgress<TaskProgress> progress)
+ /// <summary>
+ /// Performs initializations that only occur once
+ /// </summary>
+ protected virtual void InitializeInternal(IProgress<TaskProgress> progress)
{
+ ApplicationPaths = new TApplicationPathsType();
+
ReloadLogger();
- progress.Report(new TaskProgress() { Description = "Loading configuration", PercentComplete = 0 });
+ progress.Report(new TaskProgress { Description = "Loading configuration" });
ReloadConfiguration();
- progress.Report(new TaskProgress() { Description = "Starting Http server", PercentComplete = 5 });
+ progress.Report(new TaskProgress { Description = "Starting Http server" });
ReloadHttpServer();
-
- progress.Report(new TaskProgress() { Description = "Loading Plugins", PercentComplete = 10 });
- await ReloadComposableParts().ConfigureAwait(false);
}
+ /// <summary>
+ /// Performs initializations that can be reloaded at anytime
+ /// </summary>
+ public virtual async Task Reload(IProgress<TaskProgress> progress)
+ {
+ await Task.Run(() =>
+ {
+ progress.Report(new TaskProgress { Description = "Loading Plugins" });
+ ReloadComposableParts();
+
+ }).ConfigureAwait(false);
+ }
+
+ /// <summary>
+ /// Disposes the current logger and creates a new one
+ /// </summary>
private void ReloadLogger()
{
DisposeLogger();
@@ -104,23 +131,23 @@ namespace MediaBrowser.Common.Kernel
/// Uses MEF to locate plugins
/// Subclasses can use this to locate types within plugins
/// </summary>
- protected virtual Task ReloadComposableParts()
+ private void ReloadComposableParts()
{
- return Task.Run(() =>
- {
- DisposeComposableParts();
+ DisposeComposableParts();
- var container = GetCompositionContainer(includeCurrentAssembly: true);
+ var container = GetCompositionContainer(includeCurrentAssembly: true);
- container.ComposeParts(this);
+ container.ComposeParts(this);
- OnComposablePartsLoaded();
+ OnComposablePartsLoaded();
- container.Catalog.Dispose();
- container.Dispose();
- });
+ container.Catalog.Dispose();
+ container.Dispose();
}
+ /// <summary>
+ /// Constructs an MEF CompositionContainer based on the current running assembly and all plugin assemblies
+ /// </summary>
public CompositionContainer GetCompositionContainer(bool includeCurrentAssembly = false)
{
// Gets all plugin assemblies by first reading all bytes of the .dll and calling Assembly.Load against that
@@ -147,25 +174,17 @@ namespace MediaBrowser.Common.Kernel
/// </summary>
protected virtual void OnComposablePartsLoaded()
{
- StartPlugins();
- }
-
- /// <summary>
- /// Initializes all plugins
- /// </summary>
- private void StartPlugins()
- {
+ // Start-up each plugin
foreach (BasePlugin plugin in Plugins)
{
plugin.Initialize(this);
}
}
-
/// <summary>
/// Reloads application configuration from the config file
/// </summary>
- protected virtual void ReloadConfiguration()
+ private void ReloadConfiguration()
{
//Configuration information for anything other than server-specific configuration will have to come via the API... -ebr
@@ -192,7 +211,7 @@ namespace MediaBrowser.Common.Kernel
HttpServer = new HttpServer(HttpServerUrlPrefix);
- HttpListener = HttpServer.Subscribe((ctx) =>
+ HttpListener = HttpServer.Subscribe(ctx =>
{
BaseHandler handler = HttpHandlers.FirstOrDefault(h => h.HandlesRequest(ctx.Request));
@@ -213,8 +232,12 @@ namespace MediaBrowser.Common.Kernel
/// </summary>
public virtual void Dispose()
{
+ Logger.LogInfo("Beginning Kernel.Dispose");
+
DisposeComposableParts();
+
DisposeHttpServer();
+
DisposeLogger();
}
@@ -233,6 +256,8 @@ namespace MediaBrowser.Common.Kernel
{
if (Plugins != null)
{
+ Logger.LogInfo("Disposing Plugins");
+
foreach (BasePlugin plugin in Plugins)
{
plugin.Dispose();
@@ -247,6 +272,8 @@ namespace MediaBrowser.Common.Kernel
{
if (HttpServer != null)
{
+ Logger.LogInfo("Disposing Http Server");
+
HttpServer.Dispose();
}
@@ -265,6 +292,8 @@ namespace MediaBrowser.Common.Kernel
if (Logger.LoggerInstance != null)
{
+ Logger.LogInfo("Disposing Logger");
+
Logger.LoggerInstance.Dispose();
}
}
@@ -292,6 +321,7 @@ namespace MediaBrowser.Common.Kernel
KernelContext KernelContext { get; }
Task Init(IProgress<TaskProgress> progress);
+ Task Reload(IProgress<TaskProgress> progress);
void Dispose();
}
}
diff --git a/MediaBrowser.Common/Kernel/KernelContext.cs b/MediaBrowser.Common/Kernel/KernelContext.cs
index 6aa1e83bd..4d13ebb7b 100644
--- a/MediaBrowser.Common/Kernel/KernelContext.cs
+++ b/MediaBrowser.Common/Kernel/KernelContext.cs
@@ -4,6 +4,6 @@ namespace MediaBrowser.Common.Kernel
public enum KernelContext
{
Server,
- UI
+ Ui
}
}
diff --git a/MediaBrowser.Common/Logging/BaseLogger.cs b/MediaBrowser.Common/Logging/BaseLogger.cs
index 16eb96e20..572ce36b2 100644
--- a/MediaBrowser.Common/Logging/BaseLogger.cs
+++ b/MediaBrowser.Common/Logging/BaseLogger.cs
@@ -25,7 +25,7 @@ namespace MediaBrowser.Common.Logging
public void LogException(string message, Exception exception, params object[] paramList)
{
- StringBuilder builder = new StringBuilder();
+ var builder = new StringBuilder();
if (exception != null)
{
@@ -67,7 +67,7 @@ namespace MediaBrowser.Common.Logging
Thread currentThread = Thread.CurrentThread;
- LogRow row = new LogRow()
+ var row = new LogRow
{
Severity = severity,
Message = message,
diff --git a/MediaBrowser.Common/Logging/LogRow.cs b/MediaBrowser.Common/Logging/LogRow.cs
index 052f6062a..6fecef59c 100644
--- a/MediaBrowser.Common/Logging/LogRow.cs
+++ b/MediaBrowser.Common/Logging/LogRow.cs
@@ -1,7 +1,5 @@
using System;
-using System.Text;
using System.Collections.Generic;
-using System.Linq;
namespace MediaBrowser.Common.Logging
{
@@ -17,7 +15,7 @@ namespace MediaBrowser.Common.Logging
public override string ToString()
{
- List<string> data = new List<string>();
+ var data = new List<string>();
data.Add(Time.ToString(TimePattern));
diff --git a/MediaBrowser.Common/Logging/StreamLogger.cs b/MediaBrowser.Common/Logging/StreamLogger.cs
index caeb803bd..03b9bd6d2 100644
--- a/MediaBrowser.Common/Logging/StreamLogger.cs
+++ b/MediaBrowser.Common/Logging/StreamLogger.cs
@@ -7,7 +7,7 @@ namespace MediaBrowser.Common.Logging
/// <summary>
/// Provides a Logger that can write to any Stream
/// </summary>
- public class StreamLogger : ThreadedLogger
+ public class StreamLogger : BaseLogger
{
private Stream Stream { get; set; }
@@ -17,11 +17,15 @@ namespace MediaBrowser.Common.Logging
Stream = stream;
}
- protected override void AsyncLogMessage(LogRow row)
+ protected override void LogEntry(LogRow row)
{
byte[] bytes = new UTF8Encoding().GetBytes(row.ToString() + Environment.NewLine);
- Stream.Write(bytes, 0, bytes.Length);
- Stream.Flush();
+
+ lock (Stream)
+ {
+ Stream.Write(bytes, 0, bytes.Length);
+ Stream.Flush();
+ }
}
public override void Dispose()
diff --git a/MediaBrowser.Common/Logging/ThreadedLogger.cs b/MediaBrowser.Common/Logging/ThreadedLogger.cs
deleted file mode 100644
index f53b3d426..000000000
--- a/MediaBrowser.Common/Logging/ThreadedLogger.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading;
-
-namespace MediaBrowser.Common.Logging
-{
- public abstract class ThreadedLogger : BaseLogger
- {
- Thread loggingThread;
- Queue<Action> queue = new Queue<Action>();
- AutoResetEvent hasNewItems = new AutoResetEvent(false);
- volatile bool terminate = false;
- bool waiting = false;
-
- public ThreadedLogger()
- : base()
- {
- loggingThread = new Thread(new ThreadStart(ProcessQueue));
- loggingThread.IsBackground = true;
- loggingThread.Start();
- }
-
-
- void ProcessQueue()
- {
- while (!terminate)
- {
- waiting = true;
- hasNewItems.WaitOne(10000, true);
- waiting = false;
-
- Queue<Action> queueCopy;
- lock (queue)
- {
- queueCopy = new Queue<Action>(queue);
- queue.Clear();
- }
-
- foreach (var log in queueCopy)
- {
- log();
- }
- }
- }
-
- protected override void LogEntry(LogRow row)
- {
- lock (queue)
- {
- queue.Enqueue(() => AsyncLogMessage(row));
- }
- hasNewItems.Set();
- }
-
- protected abstract void AsyncLogMessage(LogRow row);
-
- protected override void Flush()
- {
- while (!waiting)
- {
- Thread.Sleep(1);
- }
- }
-
- public override void Dispose()
- {
- Flush();
- terminate = true;
- hasNewItems.Set();
- base.Dispose();
- }
- }
-}
diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj
index df404b9ea..198d78b09 100644
--- a/MediaBrowser.Common/MediaBrowser.Common.csproj
+++ b/MediaBrowser.Common/MediaBrowser.Common.csproj
@@ -45,9 +45,9 @@
<Reference Include="ProtobufModelSerializer">
<HintPath>..\MediaBrowser.Model\bin\ProtobufModelSerializer.dll</HintPath>
</Reference>
- <Reference Include="ServiceStack.Text, Version=3.9.5.0, Culture=neutral, processorArchitecture=MSIL">
+ <Reference Include="ServiceStack.Text, Version=3.9.9.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\ServiceStack.Text.3.9.5\lib\net35\ServiceStack.Text.dll</HintPath>
+ <HintPath>..\packages\ServiceStack.Text.3.9.9\lib\net35\ServiceStack.Text.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
@@ -69,7 +69,7 @@
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Web" />
- <Reference Include="System.Windows.Interactivity">
+ <Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.0.9.0.0\lib\net40\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xaml" />
@@ -84,10 +84,10 @@
<Compile Include="Extensions\BaseExtensions.cs" />
<Compile Include="Kernel\BaseApplicationPaths.cs" />
<Compile Include="Drawing\DrawingUtils.cs" />
- <Compile Include="Logging\ThreadedLogger.cs" />
<Compile Include="Logging\TraceLogger.cs" />
<Compile Include="Net\Handlers\StaticFileHandler.cs" />
<Compile Include="Net\MimeTypes.cs" />
+ <Compile Include="Plugins\BaseTheme.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -149,6 +149,9 @@
<ItemGroup>
<Resource Include="Resources\Images\mblogowhite.png" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Resources\Images\spinner.gif" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/MediaBrowser.Common/Net/Handlers/BaseEmbeddedResourceHandler.cs b/MediaBrowser.Common/Net/Handlers/BaseEmbeddedResourceHandler.cs
index 9d9e2a0e0..3ce85a688 100644
--- a/MediaBrowser.Common/Net/Handlers/BaseEmbeddedResourceHandler.cs
+++ b/MediaBrowser.Common/Net/Handlers/BaseEmbeddedResourceHandler.cs
@@ -5,7 +5,7 @@ namespace MediaBrowser.Common.Net.Handlers
{
public abstract class BaseEmbeddedResourceHandler : BaseHandler
{
- public BaseEmbeddedResourceHandler(string resourcePath)
+ protected BaseEmbeddedResourceHandler(string resourcePath)
: base()
{
ResourcePath = resourcePath;
@@ -15,7 +15,7 @@ namespace MediaBrowser.Common.Net.Handlers
public override Task<string> GetContentType()
{
- return Task.FromResult<string>(MimeTypes.GetMimeType(ResourcePath));
+ return Task.FromResult(MimeTypes.GetMimeType(ResourcePath));
}
protected override Task WriteResponseToOutputStream(Stream stream)
diff --git a/MediaBrowser.Common/Net/Handlers/BaseHandler.cs b/MediaBrowser.Common/Net/Handlers/BaseHandler.cs
index ecc58b316..1a014395a 100644
--- a/MediaBrowser.Common/Net/Handlers/BaseHandler.cs
+++ b/MediaBrowser.Common/Net/Handlers/BaseHandler.cs
@@ -25,18 +25,19 @@ namespace MediaBrowser.Common.Net.Handlers
}
}
- private bool _TotalContentLengthDiscovered = false;
- private long? _TotalContentLength = null;
+ private bool _totalContentLengthDiscovered;
+ private long? _totalContentLength;
public long? TotalContentLength
{
get
{
- if (!_TotalContentLengthDiscovered)
+ if (!_totalContentLengthDiscovered)
{
- _TotalContentLength = GetTotalContentLength();
+ _totalContentLength = GetTotalContentLength();
+ _totalContentLengthDiscovered = true;
}
- return _TotalContentLength;
+ return _totalContentLength;
}
}
@@ -64,14 +65,14 @@ namespace MediaBrowser.Common.Net.Handlers
}
}
- protected List<KeyValuePair<long, long?>> _RequestedRanges = null;
+ private List<KeyValuePair<long, long?>> _requestedRanges;
protected IEnumerable<KeyValuePair<long, long?>> RequestedRanges
{
get
{
- if (_RequestedRanges == null)
+ if (_requestedRanges == null)
{
- _RequestedRanges = new List<KeyValuePair<long, long?>>();
+ _requestedRanges = new List<KeyValuePair<long, long?>>();
if (IsRangeRequest)
{
@@ -94,12 +95,12 @@ namespace MediaBrowser.Common.Net.Handlers
end = long.Parse(vals[1]);
}
- _RequestedRanges.Add(new KeyValuePair<long, long?>(start, end));
+ _requestedRanges.Add(new KeyValuePair<long, long?>(start, end));
}
}
}
- return _RequestedRanges;
+ return _requestedRanges;
}
}
@@ -367,7 +368,7 @@ namespace MediaBrowser.Common.Net.Handlers
{
DateTime? value = null;
- return Task.FromResult<DateTime?>(value);
+ return Task.FromResult(value);
}
private bool IsResponseValid
@@ -378,21 +379,21 @@ namespace MediaBrowser.Common.Net.Handlers
}
}
- private Hashtable _FormValues = null;
+ private Hashtable _formValues;
/// <summary>
/// Gets a value from form POST data
/// </summary>
protected async Task<string> GetFormValue(string name)
{
- if (_FormValues == null)
+ if (_formValues == null)
{
- _FormValues = await GetFormValues(HttpListenerContext.Request).ConfigureAwait(false);
+ _formValues = await GetFormValues(HttpListenerContext.Request).ConfigureAwait(false);
}
- if (_FormValues.ContainsKey(name))
+ if (_formValues.ContainsKey(name))
{
- return _FormValues[name].ToString();
+ return _formValues[name].ToString();
}
return null;
@@ -403,7 +404,7 @@ namespace MediaBrowser.Common.Net.Handlers
/// </summary>
private async Task<Hashtable> GetFormValues(HttpListenerRequest request)
{
- Hashtable formVars = new Hashtable();
+ var formVars = new Hashtable();
if (request.HasEntityBody)
{
@@ -411,7 +412,7 @@ namespace MediaBrowser.Common.Net.Handlers
{
using (Stream requestBody = request.InputStream)
{
- using (StreamReader reader = new StreamReader(requestBody, request.ContentEncoding))
+ using (var reader = new StreamReader(requestBody, request.ContentEncoding))
{
string s = await reader.ReadToEndAsync().ConfigureAwait(false);
diff --git a/MediaBrowser.Common/Net/Handlers/BaseSerializationHandler.cs b/MediaBrowser.Common/Net/Handlers/BaseSerializationHandler.cs
index dd3020e03..d60a9ae1f 100644
--- a/MediaBrowser.Common/Net/Handlers/BaseSerializationHandler.cs
+++ b/MediaBrowser.Common/Net/Handlers/BaseSerializationHandler.cs
@@ -6,6 +6,7 @@ using MediaBrowser.Common.Serialization;
namespace MediaBrowser.Common.Net.Handlers
{
public abstract class BaseSerializationHandler<T> : BaseHandler
+ where T : class
{
public SerializationFormat SerializationFormat
{
@@ -15,7 +16,7 @@ namespace MediaBrowser.Common.Net.Handlers
if (string.IsNullOrEmpty(format))
{
- return Handlers.SerializationFormat.Json;
+ return SerializationFormat.Json;
}
return (SerializationFormat)Enum.Parse(typeof(SerializationFormat), format, true);
@@ -26,30 +27,30 @@ namespace MediaBrowser.Common.Net.Handlers
{
switch (SerializationFormat)
{
- case Handlers.SerializationFormat.Jsv:
- return Task.FromResult<string>("text/plain");
- case Handlers.SerializationFormat.Protobuf:
- return Task.FromResult<string>("application/x-protobuf");
+ case SerializationFormat.Jsv:
+ return Task.FromResult("text/plain");
+ case SerializationFormat.Protobuf:
+ return Task.FromResult("application/x-protobuf");
default:
- return Task.FromResult<string>(MimeTypes.JsonMimeType);
+ return Task.FromResult(MimeTypes.JsonMimeType);
}
}
- private bool _ObjectToSerializeEnsured = false;
- private T _ObjectToSerialize;
+ private bool _objectToSerializeEnsured;
+ private T _objectToSerialize;
private async Task EnsureObjectToSerialize()
{
- if (!_ObjectToSerializeEnsured)
+ if (!_objectToSerializeEnsured)
{
- _ObjectToSerialize = await GetObjectToSerialize().ConfigureAwait(false);
+ _objectToSerialize = await GetObjectToSerialize().ConfigureAwait(false);
- if (_ObjectToSerialize == null)
+ if (_objectToSerialize == null)
{
StatusCode = 404;
}
- _ObjectToSerializeEnsured = true;
+ _objectToSerializeEnsured = true;
}
}
@@ -66,14 +67,14 @@ namespace MediaBrowser.Common.Net.Handlers
switch (SerializationFormat)
{
- case Handlers.SerializationFormat.Jsv:
- JsvSerializer.SerializeToStream<T>(_ObjectToSerialize, stream);
+ case SerializationFormat.Jsv:
+ JsvSerializer.SerializeToStream(_objectToSerialize, stream);
break;
- case Handlers.SerializationFormat.Protobuf:
- ProtobufSerializer.SerializeToStream<T>(_ObjectToSerialize, stream);
+ case SerializationFormat.Protobuf:
+ ProtobufSerializer.SerializeToStream(_objectToSerialize, stream);
break;
default:
- JsonSerializer.SerializeToStream<T>(_ObjectToSerialize, stream);
+ JsonSerializer.SerializeToStream(_objectToSerialize, stream);
break;
}
}
diff --git a/MediaBrowser.Common/Net/Handlers/StaticFileHandler.cs b/MediaBrowser.Common/Net/Handlers/StaticFileHandler.cs
index bc367403b..741d2d6c1 100644
--- a/MediaBrowser.Common/Net/Handlers/StaticFileHandler.cs
+++ b/MediaBrowser.Common/Net/Handlers/StaticFileHandler.cs
@@ -15,42 +15,42 @@ namespace MediaBrowser.Common.Net.Handlers
return false;
}
- private string _Path;
+ private string _path;
public virtual string Path
{
get
{
- if (!string.IsNullOrWhiteSpace(_Path))
+ if (!string.IsNullOrWhiteSpace(_path))
{
- return _Path;
+ return _path;
}
return QueryString["path"];
}
set
{
- _Path = value;
+ _path = value;
}
}
- private bool _SourceStreamEnsured = false;
- private Stream _SourceStream = null;
+ private bool _sourceStreamEnsured;
+ private Stream _sourceStream;
private Stream SourceStream
{
get
{
EnsureSourceStream();
- return _SourceStream;
+ return _sourceStream;
}
}
private void EnsureSourceStream()
{
- if (!_SourceStreamEnsured)
+ if (!_sourceStreamEnsured)
{
try
{
- _SourceStream = File.OpenRead(Path);
+ _sourceStream = File.OpenRead(Path);
}
catch (FileNotFoundException ex)
{
@@ -69,7 +69,7 @@ namespace MediaBrowser.Common.Net.Handlers
}
finally
{
- _SourceStreamEnsured = true;
+ _sourceStreamEnsured = true;
}
}
}
@@ -116,12 +116,12 @@ namespace MediaBrowser.Common.Net.Handlers
value = File.GetLastWriteTimeUtc(Path);
}
- return Task.FromResult<DateTime?>(value);
+ return Task.FromResult(value);
}
public override Task<string> GetContentType()
{
- return Task.FromResult<string>(MimeTypes.GetMimeType(Path));
+ return Task.FromResult(MimeTypes.GetMimeType(Path));
}
protected override Task PrepareResponse()
@@ -141,21 +141,17 @@ namespace MediaBrowser.Common.Net.Handlers
{
return ServeCompleteRangeRequest(requestedRange, stream);
}
- else if (TotalContentLength.HasValue)
+ if (TotalContentLength.HasValue)
{
// This will have to buffer a portion of the content into memory
return ServePartialRangeRequestWithKnownTotalContentLength(requestedRange, stream);
}
- else
- {
- // This will have to buffer the entire content into memory
- return ServePartialRangeRequestWithUnknownTotalContentLength(requestedRange, stream);
- }
- }
- else
- {
- return SourceStream.CopyToAsync(stream);
+
+ // This will have to buffer the entire content into memory
+ return ServePartialRangeRequestWithUnknownTotalContentLength(requestedRange, stream);
}
+
+ return SourceStream.CopyToAsync(stream);
}
protected override void DisposeResponseStream()
@@ -249,9 +245,9 @@ namespace MediaBrowser.Common.Net.Handlers
if (count == null)
{
- byte[] buffer = new byte[16 * 1024];
+ var buffer = new byte[16 * 1024];
- using (MemoryStream ms = new MemoryStream())
+ using (var ms = new MemoryStream())
{
int read;
while ((read = await input.ReadAsync(buffer, 0, buffer.Length).ConfigureAwait(false)) > 0)
@@ -263,9 +259,9 @@ namespace MediaBrowser.Common.Net.Handlers
}
else
{
- byte[] buffer = new byte[count.Value];
+ var buffer = new byte[count.Value];
- using (MemoryStream ms = new MemoryStream())
+ using (var ms = new MemoryStream())
{
int read = await input.ReadAsync(buffer, 0, buffer.Length).ConfigureAwait(false);
diff --git a/MediaBrowser.Common/Net/HttpServer.cs b/MediaBrowser.Common/Net/HttpServer.cs
index 69ded6f81..276e14eb3 100644
--- a/MediaBrowser.Common/Net/HttpServer.cs
+++ b/MediaBrowser.Common/Net/HttpServer.cs
@@ -6,21 +6,21 @@ namespace MediaBrowser.Common.Net
{
public class HttpServer : IObservable<HttpListenerContext>, IDisposable
{
- private readonly HttpListener listener;
- private readonly IObservable<HttpListenerContext> stream;
+ private readonly HttpListener _listener;
+ private readonly IObservable<HttpListenerContext> _stream;
public HttpServer(string url)
{
- listener = new HttpListener();
- listener.Prefixes.Add(url);
- listener.Start();
- stream = ObservableHttpContext();
+ _listener = new HttpListener();
+ _listener.Prefixes.Add(url);
+ _listener.Start();
+ _stream = ObservableHttpContext();
}
private IObservable<HttpListenerContext> ObservableHttpContext()
{
return Observable.Create<HttpListenerContext>(obs =>
- Observable.FromAsync<HttpListenerContext>(() => listener.GetContextAsync())
+ Observable.FromAsync(() => _listener.GetContextAsync())
.Subscribe(obs))
.Repeat()
.Retry()
@@ -29,12 +29,12 @@ namespace MediaBrowser.Common.Net
}
public void Dispose()
{
- listener.Stop();
+ _listener.Stop();
}
public IDisposable Subscribe(IObserver<HttpListenerContext> observer)
{
- return stream.Subscribe(observer);
+ return _stream.Subscribe(observer);
}
}
} \ No newline at end of file
diff --git a/MediaBrowser.Common/Net/MimeTypes.cs b/MediaBrowser.Common/Net/MimeTypes.cs
index 3ec13ce83..fb85b0f2a 100644
--- a/MediaBrowser.Common/Net/MimeTypes.cs
+++ b/MediaBrowser.Common/Net/MimeTypes.cs
@@ -9,7 +9,7 @@ namespace MediaBrowser.Common.Net
public static string GetMimeType(string path)
{
- string ext = Path.GetExtension(path);
+ var ext = Path.GetExtension(path);
// http://en.wikipedia.org/wiki/Internet_media_type
// Add more as needed
@@ -19,137 +19,137 @@ namespace MediaBrowser.Common.Net
{
return "video/mpeg";
}
- else if (ext.EndsWith("mp4", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("mp4", StringComparison.OrdinalIgnoreCase))
{
return "video/mp4";
}
- else if (ext.EndsWith("ogv", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("ogv", StringComparison.OrdinalIgnoreCase))
{
return "video/ogg";
}
- else if (ext.EndsWith("mov", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("mov", StringComparison.OrdinalIgnoreCase))
{
return "video/quicktime";
}
- else if (ext.EndsWith("webm", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("webm", StringComparison.OrdinalIgnoreCase))
{
return "video/webm";
}
- else if (ext.EndsWith("mkv", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("mkv", StringComparison.OrdinalIgnoreCase))
{
return "video/x-matroska";
}
- else if (ext.EndsWith("wmv", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("wmv", StringComparison.OrdinalIgnoreCase))
{
return "video/x-ms-wmv";
}
- else if (ext.EndsWith("flv", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("flv", StringComparison.OrdinalIgnoreCase))
{
return "video/x-flv";
}
- else if (ext.EndsWith("avi", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("avi", StringComparison.OrdinalIgnoreCase))
{
return "video/avi";
}
- else if (ext.EndsWith("m4v", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("m4v", StringComparison.OrdinalIgnoreCase))
{
return "video/x-m4v";
}
- else if (ext.EndsWith("asf", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("asf", StringComparison.OrdinalIgnoreCase))
{
return "video/x-ms-asf";
}
- else if (ext.EndsWith("3gp", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("3gp", StringComparison.OrdinalIgnoreCase))
{
return "video/3gpp";
}
- else if (ext.EndsWith("3g2", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("3g2", StringComparison.OrdinalIgnoreCase))
{
return "video/3gpp2";
}
- else if (ext.EndsWith("ts", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("ts", StringComparison.OrdinalIgnoreCase))
{
return "video/mp2t";
}
// Type text
- else if (ext.EndsWith("css", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("css", StringComparison.OrdinalIgnoreCase))
{
return "text/css";
}
- else if (ext.EndsWith("csv", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("csv", StringComparison.OrdinalIgnoreCase))
{
return "text/csv";
}
- else if (ext.EndsWith("html", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("html", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("html", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("html", StringComparison.OrdinalIgnoreCase))
{
return "text/html";
}
- else if (ext.EndsWith("txt", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("txt", StringComparison.OrdinalIgnoreCase))
{
return "text/plain";
}
// Type image
- else if (ext.EndsWith("gif", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("gif", StringComparison.OrdinalIgnoreCase))
{
return "image/gif";
}
- else if (ext.EndsWith("jpg", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("jpeg", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("jpg", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("jpeg", StringComparison.OrdinalIgnoreCase))
{
return "image/jpeg";
}
- else if (ext.EndsWith("png", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("png", StringComparison.OrdinalIgnoreCase))
{
return "image/png";
}
- else if (ext.EndsWith("ico", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("ico", StringComparison.OrdinalIgnoreCase))
{
return "image/vnd.microsoft.icon";
}
// Type audio
- else if (ext.EndsWith("mp3", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("mp3", StringComparison.OrdinalIgnoreCase))
{
return "audio/mpeg";
}
- else if (ext.EndsWith("m4a", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("aac", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("m4a", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("aac", StringComparison.OrdinalIgnoreCase))
{
return "audio/mp4";
}
- else if (ext.EndsWith("webma", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("webma", StringComparison.OrdinalIgnoreCase))
{
return "audio/webm";
}
- else if (ext.EndsWith("wav", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("wav", StringComparison.OrdinalIgnoreCase))
{
return "audio/wav";
}
- else if (ext.EndsWith("wma", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("wma", StringComparison.OrdinalIgnoreCase))
{
return "audio/x-ms-wma";
}
- else if (ext.EndsWith("flac", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("flac", StringComparison.OrdinalIgnoreCase))
{
return "audio/flac";
}
- else if (ext.EndsWith("aac", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("aac", StringComparison.OrdinalIgnoreCase))
{
return "audio/x-aac";
}
- else if (ext.EndsWith("ogg", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("oga", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("ogg", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("oga", StringComparison.OrdinalIgnoreCase))
{
return "audio/ogg";
}
// Playlists
- else if (ext.EndsWith("m3u8", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("m3u8", StringComparison.OrdinalIgnoreCase))
{
return "application/x-mpegURL";
}
// Misc
- else if (ext.EndsWith("dll", StringComparison.OrdinalIgnoreCase))
+ if (ext.EndsWith("dll", StringComparison.OrdinalIgnoreCase))
{
return "application/x-msdownload";
}
diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs
index 705e15f17..23825db04 100644
--- a/MediaBrowser.Common/Plugins/BasePlugin.cs
+++ b/MediaBrowser.Common/Plugins/BasePlugin.cs
@@ -1,36 +1,12 @@
-using System;
-using System.IO;
-using MediaBrowser.Common.Kernel;
+using MediaBrowser.Common.Kernel;
using MediaBrowser.Common.Serialization;
using MediaBrowser.Model.Plugins;
+using System;
+using System.IO;
namespace MediaBrowser.Common.Plugins
{
/// <summary>
- /// Provides a BasePlugin with generics, allowing for strongly typed configuration access.
- /// </summary>
- public abstract class BaseGenericPlugin<TConfigurationType> : BasePlugin
- where TConfigurationType : BasePluginConfiguration, new()
- {
- public new TConfigurationType Configuration
- {
- get
- {
- return base.Configuration as TConfigurationType;
- }
- set
- {
- base.Configuration = value;
- }
- }
-
- public override Type ConfigurationType
- {
- get { return typeof(TConfigurationType); }
- }
- }
-
- /// <summary>
/// Provides a common base class for all plugins
/// </summary>
public abstract class BasePlugin : IDisposable
@@ -50,7 +26,10 @@ namespace MediaBrowser.Common.Plugins
/// <summary>
/// Gets the type of configuration this plugin uses
/// </summary>
- public abstract Type ConfigurationType { get; }
+ public virtual Type ConfigurationType
+ {
+ get { return typeof (BasePluginConfiguration); }
+ }
/// <summary>
/// Gets the plugin version
@@ -74,20 +53,20 @@ namespace MediaBrowser.Common.Plugins
}
}
- private DateTime? _ConfigurationDateLastModified = null;
+ private DateTime? _configurationDateLastModified;
public DateTime ConfigurationDateLastModified
{
get
{
- if (_ConfigurationDateLastModified == null)
+ if (_configurationDateLastModified == null)
{
if (File.Exists(ConfigurationFilePath))
{
- _ConfigurationDateLastModified = File.GetLastWriteTimeUtc(ConfigurationFilePath);
+ _configurationDateLastModified = File.GetLastWriteTimeUtc(ConfigurationFilePath);
}
}
- return _ConfigurationDateLastModified ?? DateTime.MinValue;
+ return _configurationDateLastModified ?? DateTime.MinValue;
}
}
@@ -110,7 +89,13 @@ namespace MediaBrowser.Common.Plugins
/// <summary>
/// Gets the name of the configuration file. Subclasses should override
/// </summary>
- public virtual string ConfigurationFileName { get { return Name + ".xml"; } }
+ public virtual string ConfigurationFileName
+ {
+ get
+ {
+ return Name.Replace(" ", string.Empty) + ".xml";
+ }
+ }
/// <summary>
/// Gets the full path to the configuration file
@@ -123,7 +108,7 @@ namespace MediaBrowser.Common.Plugins
}
}
- private string _DataFolderPath = null;
+ private string _dataFolderPath;
/// <summary>
/// Gets the full path to the data folder, where the plugin can store any miscellaneous files needed
/// </summary>
@@ -131,19 +116,19 @@ namespace MediaBrowser.Common.Plugins
{
get
{
- if (_DataFolderPath == null)
+ if (_dataFolderPath == null)
{
// Give the folder name the same name as the config file name
// We can always make this configurable if/when needed
- _DataFolderPath = Path.Combine(Kernel.ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(ConfigurationFileName));
+ _dataFolderPath = Path.Combine(Kernel.ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(ConfigurationFileName));
- if (!Directory.Exists(_DataFolderPath))
+ if (!Directory.Exists(_dataFolderPath))
{
- Directory.CreateDirectory(_DataFolderPath);
+ Directory.CreateDirectory(_dataFolderPath);
}
}
- return _DataFolderPath;
+ return _dataFolderPath;
}
}
@@ -156,9 +141,9 @@ namespace MediaBrowser.Common.Plugins
}
/// <summary>
- /// Returns true or false indicating if the plugin should be downloaded and run within the UI.
+ /// Returns true or false indicating if the plugin should be downloaded and run within the Ui.
/// </summary>
- public virtual bool DownloadToUI
+ public virtual bool DownloadToUi
{
get
{
@@ -188,9 +173,9 @@ namespace MediaBrowser.Common.Plugins
{
InitializeOnServer();
}
- else if (kernel.KernelContext == KernelContext.UI)
+ else if (kernel.KernelContext == KernelContext.Ui)
{
- InitializeInUI();
+ InitializeInUi();
}
}
}
@@ -204,9 +189,9 @@ namespace MediaBrowser.Common.Plugins
}
/// <summary>
- /// Starts the plugin in the UI
+ /// Starts the plugin in the Ui
/// </summary>
- protected virtual void InitializeInUI()
+ protected virtual void InitializeInUi()
{
}
@@ -219,9 +204,9 @@ namespace MediaBrowser.Common.Plugins
{
DisposeOnServer();
}
- else if (Context == KernelContext.UI)
+ else if (Context == KernelContext.Ui)
{
- InitializeInUI();
+ InitializeInUi();
}
}
@@ -233,9 +218,9 @@ namespace MediaBrowser.Common.Plugins
}
/// <summary>
- /// Disposes the plugin in the UI
+ /// Disposes the plugin in the Ui
/// </summary>
- protected virtual void DisposeInUI()
+ protected virtual void DisposeInUi()
{
}
@@ -252,7 +237,7 @@ namespace MediaBrowser.Common.Plugins
}
// Reset this so it will be loaded again next time it's accessed
- _ConfigurationDateLastModified = null;
+ _configurationDateLastModified = null;
}
}
}
diff --git a/MediaBrowser.Common/Plugins/BaseTheme.cs b/MediaBrowser.Common/Plugins/BaseTheme.cs
new file mode 100644
index 000000000..f06825262
--- /dev/null
+++ b/MediaBrowser.Common/Plugins/BaseTheme.cs
@@ -0,0 +1,14 @@
+
+namespace MediaBrowser.Common.Plugins
+{
+ public abstract class BaseTheme : BasePlugin
+ {
+ public sealed override bool DownloadToUi
+ {
+ get
+ {
+ return true;
+ }
+ }
+ }
+}
diff --git a/MediaBrowser.Common/Properties/AssemblyInfo.cs b/MediaBrowser.Common/Properties/AssemblyInfo.cs
index 53e9df0f6..ff70e8db7 100644
--- a/MediaBrowser.Common/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.Common/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
diff --git a/MediaBrowser.Common/Resources/Images/Icon.ico b/MediaBrowser.Common/Resources/Images/Icon.ico
index f8accfab2..1541dabdc 100644
--- a/MediaBrowser.Common/Resources/Images/Icon.ico
+++ b/MediaBrowser.Common/Resources/Images/Icon.ico
Binary files differ
diff --git a/MediaBrowser.Common/Resources/Images/spinner.gif b/MediaBrowser.Common/Resources/Images/spinner.gif
new file mode 100644
index 000000000..d0bce1542
--- /dev/null
+++ b/MediaBrowser.Common/Resources/Images/spinner.gif
Binary files differ
diff --git a/MediaBrowser.Common/Serialization/JsonSerializer.cs b/MediaBrowser.Common/Serialization/JsonSerializer.cs
index bfca014a9..f5d2abe33 100644
--- a/MediaBrowser.Common/Serialization/JsonSerializer.cs
+++ b/MediaBrowser.Common/Serialization/JsonSerializer.cs
@@ -12,7 +12,7 @@ namespace MediaBrowser.Common.Serialization
{
Configure();
- ServiceStack.Text.JsonSerializer.SerializeToStream<T>(obj, stream);
+ ServiceStack.Text.JsonSerializer.SerializeToStream(obj, stream);
}
public static void SerializeToFile<T>(T obj, string file)
@@ -21,7 +21,7 @@ namespace MediaBrowser.Common.Serialization
using (Stream stream = File.Open(file, FileMode.Create))
{
- ServiceStack.Text.JsonSerializer.SerializeToStream<T>(obj, stream);
+ ServiceStack.Text.JsonSerializer.SerializeToStream(obj, stream);
}
}
@@ -59,15 +59,15 @@ namespace MediaBrowser.Common.Serialization
return ServiceStack.Text.JsonSerializer.DeserializeFromStream(type, stream);
}
- private static bool IsConfigured = false;
+ private static bool _isConfigured;
private static void Configure()
{
- if (!IsConfigured)
+ if (!_isConfigured)
{
ServiceStack.Text.JsConfig.DateHandler = ServiceStack.Text.JsonDateHandler.ISO8601;
ServiceStack.Text.JsConfig.ExcludeTypeInfo = true;
ServiceStack.Text.JsConfig.IncludeNullValues = false;
- IsConfigured = true;
+ _isConfigured = true;
}
}
}
diff --git a/MediaBrowser.Common/Serialization/JsvSerializer.cs b/MediaBrowser.Common/Serialization/JsvSerializer.cs
index d482348af..41e5ea800 100644
--- a/MediaBrowser.Common/Serialization/JsvSerializer.cs
+++ b/MediaBrowser.Common/Serialization/JsvSerializer.cs
@@ -12,7 +12,7 @@ namespace MediaBrowser.Common.Serialization
{
public static void SerializeToStream<T>(T obj, Stream stream)
{
- ServiceStack.Text.TypeSerializer.SerializeToStream<T>(obj, stream);
+ ServiceStack.Text.TypeSerializer.SerializeToStream(obj, stream);
}
public static T DeserializeFromStream<T>(Stream stream)
@@ -29,7 +29,7 @@ namespace MediaBrowser.Common.Serialization
{
using (Stream stream = File.Open(file, FileMode.Create))
{
- SerializeToStream<T>(obj, stream);
+ SerializeToStream(obj, stream);
}
}
diff --git a/MediaBrowser.Common/Serialization/ProtobufSerializer.cs b/MediaBrowser.Common/Serialization/ProtobufSerializer.cs
index 7c8a5f96e..1c79a272d 100644
--- a/MediaBrowser.Common/Serialization/ProtobufSerializer.cs
+++ b/MediaBrowser.Common/Serialization/ProtobufSerializer.cs
@@ -15,7 +15,7 @@ namespace MediaBrowser.Common.Serialization
/// This means that this class can currently only handle types within the Model project.
/// If we need to, we can always add a param indicating whether or not the model serializer should be used.
/// </summary>
- private static ProtobufModelSerializer ProtobufModelSerializer = new ProtobufModelSerializer();
+ private static readonly ProtobufModelSerializer ProtobufModelSerializer = new ProtobufModelSerializer();
public static void SerializeToStream<T>(T obj, Stream stream)
{
@@ -37,7 +37,7 @@ namespace MediaBrowser.Common.Serialization
{
using (Stream stream = File.Open(file, FileMode.Create))
{
- SerializeToStream<T>(obj, stream);
+ SerializeToStream(obj, stream);
}
}
diff --git a/MediaBrowser.Common/Serialization/XmlSerializer.cs b/MediaBrowser.Common/Serialization/XmlSerializer.cs
index b881591dd..11ef17c3d 100644
--- a/MediaBrowser.Common/Serialization/XmlSerializer.cs
+++ b/MediaBrowser.Common/Serialization/XmlSerializer.cs
@@ -25,9 +25,9 @@ namespace MediaBrowser.Common.Serialization
public static void SerializeToFile<T>(T obj, string file)
{
- using (FileStream stream = new FileStream(file, FileMode.Create))
+ using (var stream = new FileStream(file, FileMode.Create))
{
- SerializeToStream<T>(obj, stream);
+ SerializeToStream(obj, stream);
}
}
@@ -41,7 +41,7 @@ namespace MediaBrowser.Common.Serialization
public static void SerializeToFile(object obj, string file)
{
- using (FileStream stream = new FileStream(file, FileMode.Create))
+ using (var stream = new FileStream(file, FileMode.Create))
{
ServiceStack.Text.XmlSerializer.SerializeToStream(obj, stream);
}
diff --git a/MediaBrowser.Common/UI/BaseApplication.cs b/MediaBrowser.Common/UI/BaseApplication.cs
index 4cbc57c0d..e22eed158 100644
--- a/MediaBrowser.Common/UI/BaseApplication.cs
+++ b/MediaBrowser.Common/UI/BaseApplication.cs
@@ -1,25 +1,39 @@
-using System;
-using System.Windows;
-using MediaBrowser.Common.Kernel;
+using MediaBrowser.Common.Kernel;
using MediaBrowser.Common.Logging;
using MediaBrowser.Model.Progress;
+using Microsoft.Shell;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Threading.Tasks;
+using System.Windows;
namespace MediaBrowser.Common.UI
{
/// <summary>
/// Serves as a base Application class for both the UI and Server apps.
/// </summary>
- public abstract class BaseApplication : Application
+ public abstract class BaseApplication : Application, INotifyPropertyChanged, ISingleInstanceApp
{
private IKernel Kernel { get; set; }
protected abstract IKernel InstantiateKernel();
protected abstract Window InstantiateMainWindow();
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ public void OnPropertyChanged(String info)
+ {
+ if (PropertyChanged != null)
+ {
+ PropertyChanged(this, new PropertyChangedEventArgs(info));
+ }
+ }
+
protected override void OnStartup(StartupEventArgs e)
{
// Without this the app will shutdown after the splash screen closes
- this.ShutdownMode = ShutdownMode.OnExplicitShutdown;
+ ShutdownMode = ShutdownMode.OnExplicitShutdown;
LoadKernel();
}
@@ -28,8 +42,11 @@ namespace MediaBrowser.Common.UI
{
Kernel = InstantiateKernel();
- Progress<TaskProgress> progress = new Progress<TaskProgress>();
- Splash splash = new Splash(progress);
+ var progress = new Progress<TaskProgress>();
+
+ progress.ProgressChanged += progress_ProgressChanged;
+
+ var splash = new Splash(progress);
splash.Show();
@@ -39,14 +56,21 @@ namespace MediaBrowser.Common.UI
await Kernel.Init(progress);
+ progress.ProgressChanged -= progress_ProgressChanged;
+
Logger.LogInfo("Kernel.Init completed in {0} seconds.", (DateTime.UtcNow - now).TotalSeconds);
splash.Close();
- this.ShutdownMode = System.Windows.ShutdownMode.OnLastWindowClose;
- InstantiateMainWindow().ShowDialog();
+ ShutdownMode = System.Windows.ShutdownMode.OnLastWindowClose;
+
+ OnKernelLoaded();
+
+ InstantiateMainWindow().Show();
}
catch (Exception ex)
{
+ progress.ProgressChanged -= progress_ProgressChanged;
+
if (Logger.LoggerInstance != null)
{
Logger.LogException(ex);
@@ -60,11 +84,86 @@ namespace MediaBrowser.Common.UI
}
}
+ public async Task ReloadKernel()
+ {
+ var progress = new Progress<TaskProgress>();
+
+ progress.ProgressChanged += progress_ProgressChanged;
+
+ try
+ {
+ DateTime now = DateTime.UtcNow;
+
+ await Kernel.Reload(progress);
+
+ progress.ProgressChanged -= progress_ProgressChanged;
+
+ Logger.LogInfo("Kernel.Reload completed in {0} seconds.", (DateTime.UtcNow - now).TotalSeconds);
+ }
+ catch (Exception ex)
+ {
+ progress.ProgressChanged -= progress_ProgressChanged;
+
+ Logger.LogException(ex);
+
+ // Shutdown the app with an error code
+ Shutdown(1);
+ }
+ }
+
+ void progress_ProgressChanged(object sender, TaskProgress e)
+ {
+ if (Logger.LoggerInstance != null)
+ {
+ Logger.LogInfo(e.Description);
+ }
+ }
+
+ protected virtual void OnKernelLoaded()
+ {
+
+ }
+
protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
Kernel.Dispose();
}
+
+ public bool SignalExternalCommandLineArgs(IList<string> args)
+ {
+ OnSecondInstanceLaunched(args);
+
+ return true;
+ }
+
+ protected virtual void OnSecondInstanceLaunched(IList<string> args)
+ {
+ if (this.MainWindow.WindowState == WindowState.Minimized)
+ {
+ this.MainWindow.WindowState = WindowState.Maximized;
+ }
+ }
+
+ public static void RunApplication<TApplicationType>(string uniqueKey)
+ where TApplicationType : BaseApplication, IApplication, new()
+ {
+ if (SingleInstance<TApplicationType>.InitializeAsFirstInstance(uniqueKey))
+ {
+ var application = new TApplicationType();
+ application.InitializeComponent();
+
+ application.Run();
+
+ // Allow single instance code to perform cleanup operations
+ SingleInstance<TApplicationType>.Cleanup();
+ }
+ }
+ }
+
+ public interface IApplication
+ {
+ void InitializeComponent();
}
}
diff --git a/MediaBrowser.Common/UI/SingleInstance.cs b/MediaBrowser.Common/UI/SingleInstance.cs
index 837d3bb57..3fc85a74e 100644
--- a/MediaBrowser.Common/UI/SingleInstance.cs
+++ b/MediaBrowser.Common/UI/SingleInstance.cs
@@ -13,18 +13,17 @@ namespace Microsoft.Shell
using System;
using System.Collections;
using System.Collections.Generic;
+ using System.ComponentModel;
using System.IO;
+ using System.Runtime.InteropServices;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Ipc;
using System.Runtime.Serialization.Formatters;
+ using System.Security;
using System.Threading;
using System.Windows;
using System.Windows.Threading;
- using System.Xml.Serialization;
- using System.Security;
- using System.Runtime.InteropServices;
- using System.ComponentModel;
internal enum WM
{
@@ -184,7 +183,7 @@ namespace Microsoft.Shell
finally
{
- IntPtr p = _LocalFree(argv);
+ _LocalFree(argv);
// Otherwise LocalFree failed.
// Assert.AreEqual(IntPtr.Zero, p);
}
@@ -369,7 +368,7 @@ namespace Microsoft.Shell
/// <param name="channelName">Application's IPC channel name.</param>
private static void CreateRemoteService(string channelName)
{
- BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
+ var serverProvider = new BinaryServerFormatterSinkProvider { };
serverProvider.TypeFilterLevel = TypeFilterLevel.Full;
IDictionary props = new Dictionary<string, string>();
@@ -384,7 +383,7 @@ namespace Microsoft.Shell
ChannelServices.RegisterChannel(channel, true);
// Expose the remote service with the REMOTE_SERVICE_NAME
- IPCRemoteService remoteService = new IPCRemoteService();
+ var remoteService = new IPCRemoteService();
RemotingServices.Marshal(remoteService, RemoteServiceName);
}
@@ -399,13 +398,13 @@ namespace Microsoft.Shell
/// </param>
private static void SignalFirstInstance(string channelName, IList<string> args)
{
- IpcClientChannel secondInstanceChannel = new IpcClientChannel();
+ var secondInstanceChannel = new IpcClientChannel();
ChannelServices.RegisterChannel(secondInstanceChannel, true);
string remotingServiceUrl = IpcProtocol + channelName + "/" + RemoteServiceName;
// Obtain a reference to the remoting service exposed by the server i.e the first instance of the application
- IPCRemoteService firstInstanceRemoteServiceReference = (IPCRemoteService)RemotingServices.Connect(typeof(IPCRemoteService), remotingServiceUrl);
+ var firstInstanceRemoteServiceReference = (IPCRemoteService)RemotingServices.Connect(typeof(IPCRemoteService), remotingServiceUrl);
// Check that the remote service exists, in some cases the first instance may not yet have created one, in which case
// the second instance should just exit
@@ -425,7 +424,7 @@ namespace Microsoft.Shell
private static object ActivateFirstInstanceCallback(object arg)
{
// Get command line args to be passed to first instance
- IList<string> args = arg as IList<string>;
+ var args = arg as IList<string>;
ActivateFirstInstance(args);
return null;
}
diff --git a/MediaBrowser.Common/UI/Splash.xaml b/MediaBrowser.Common/UI/Splash.xaml
index 79085682a..7781841b2 100644
--- a/MediaBrowser.Common/UI/Splash.xaml
+++ b/MediaBrowser.Common/UI/Splash.xaml
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
Title="MediaBrowser"
- Height="280"
+ Height="230"
Width="520"
ShowInTaskbar="True"
ResizeMode="NoResize"
@@ -26,7 +26,8 @@
</Window.Background>
<Grid Name="splashGrid">
<Image x:Name="imgLogo" HorizontalAlignment="Left" VerticalAlignment="Top" Stretch="Uniform" Grid.Row="0" Margin="10 10 10 10" Source="../Resources/Images/mblogoblack.png"/>
- <ProgressBar Name="pbProgress" Minimum="0" Maximum="100" HorizontalAlignment="Left" Height="24" Margin="30,110,30,0" Width="460" Grid.Row="1"/>
- <Label Name="lblProgress" Content="Label" Margin="0,190,10,0" VerticalContentAlignment="Center" HorizontalAlignment="Center" Grid.Row="2"/>
+ <StackPanel Margin="0,130,10,0" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="2" Orientation="Horizontal">
+ <TextBlock Name="lblProgress" FontSize="18" Foreground="Black" Text="Label"></TextBlock>
+ </StackPanel>
</Grid>
</Controls:MetroWindow>
diff --git a/MediaBrowser.Common/UI/Splash.xaml.cs b/MediaBrowser.Common/UI/Splash.xaml.cs
index f66f9ec8f..b9764c05f 100644
--- a/MediaBrowser.Common/UI/Splash.xaml.cs
+++ b/MediaBrowser.Common/UI/Splash.xaml.cs
@@ -1,8 +1,7 @@
-using System;
-using System.Windows;
-using MahApps.Metro.Controls;
-using MediaBrowser.Common.Logging;
+using MahApps.Metro.Controls;
using MediaBrowser.Model.Progress;
+using System;
+using System.Windows;
namespace MediaBrowser.Common.UI
{
@@ -15,23 +14,16 @@ namespace MediaBrowser.Common.UI
{
InitializeComponent();
- progress.ProgressChanged += progress_ProgressChanged;
- Loaded+=Splash_Loaded;
+ progress.ProgressChanged += ProgressChanged;
+ Loaded+=SplashLoaded;
}
- void progress_ProgressChanged(object sender, TaskProgress e)
+ void ProgressChanged(object sender, TaskProgress e)
{
- // If logging has loaded, put a message in the log.
- if (Logger.LoggerInstance != null)
- {
- Logger.LogInfo(e.Description);
- }
-
- this.lblProgress.Content = e.Description;
- this.pbProgress.Value = (double)e.PercentComplete;
+ lblProgress.Text = e.Description + "...";
}
- private void Splash_Loaded(object sender, RoutedEventArgs e)
+ private void SplashLoaded(object sender, RoutedEventArgs e)
{
// Setting this in markup throws an exception at runtime
ShowTitleBar = false;
diff --git a/MediaBrowser.Common/packages.config b/MediaBrowser.Common/packages.config
index bb1c2f20a..d3043e27a 100644
--- a/MediaBrowser.Common/packages.config
+++ b/MediaBrowser.Common/packages.config
@@ -4,5 +4,5 @@
<package id="Rx-Core" version="2.0.20823" targetFramework="net45" />
<package id="Rx-Interfaces" version="2.0.20823" targetFramework="net45" />
<package id="Rx-Linq" version="2.0.20823" targetFramework="net45" />
- <package id="ServiceStack.Text" version="3.9.5" targetFramework="net45" />
+ <package id="ServiceStack.Text" version="3.9.9" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 694ec1ca2..1cad13f22 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -331,13 +331,15 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
public ItemSpecialCounts GetSpecialCounts(User user)
{
- ItemSpecialCounts counts = new ItemSpecialCounts();
+ var counts = new ItemSpecialCounts();
IEnumerable<BaseItem> recursiveChildren = GetRecursiveChildren(user);
- counts.RecentlyAddedItemCount = GetRecentlyAddedItems(recursiveChildren, user).Count();
- counts.RecentlyAddedUnPlayedItemCount = GetRecentlyAddedUnplayedItems(recursiveChildren, user).Count();
- counts.InProgressItemCount = GetInProgressItems(recursiveChildren, user).Count();
+ var recentlyAddedItems = GetRecentlyAddedItems(recursiveChildren, user);
+
+ counts.RecentlyAddedItemCount = recentlyAddedItems.Count;
+ counts.RecentlyAddedUnPlayedItemCount = GetRecentlyAddedUnplayedItems(recentlyAddedItems, user).Count;
+ counts.InProgressItemCount = GetInProgressItems(recursiveChildren, user).Count;
counts.PlayedPercentage = GetPlayedPercentage(recursiveChildren, user);
return counts;
@@ -421,7 +423,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Gets all recently added items (recursive) within a folder, based on configuration and parental settings
/// </summary>
- public IEnumerable<BaseItem> GetRecentlyAddedItems(User user)
+ public List<BaseItem> GetRecentlyAddedItems(User user)
{
return GetRecentlyAddedItems(GetRecursiveChildren(user), user);
}
@@ -429,7 +431,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Gets all recently added unplayed items (recursive) within a folder, based on configuration and parental settings
/// </summary>
- public IEnumerable<BaseItem> GetRecentlyAddedUnplayedItems(User user)
+ public List<BaseItem> GetRecentlyAddedUnplayedItems(User user)
{
return GetRecentlyAddedUnplayedItems(GetRecursiveChildren(user), user);
}
@@ -437,7 +439,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Gets all in-progress items (recursive) within a folder
/// </summary>
- public IEnumerable<BaseItem> GetInProgressItems(User user)
+ public List<BaseItem> GetInProgressItems(User user)
{
return GetInProgressItems(GetRecursiveChildren(user), user);
}
@@ -445,40 +447,65 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Takes a list of items and returns the ones that are recently added
/// </summary>
- private static IEnumerable<BaseItem> GetRecentlyAddedItems(IEnumerable<BaseItem> itemSet, User user)
+ private static List<BaseItem> GetRecentlyAddedItems(IEnumerable<BaseItem> itemSet, User user)
{
- return itemSet.Where(i => !(i.IsFolder) && i.IsRecentlyAdded(user));
+ var list = new List<BaseItem>();
+
+ foreach (var item in itemSet)
+ {
+ if (!item.IsFolder && item.IsRecentlyAdded(user))
+ {
+ list.Add(item);
+ }
+ }
+
+ return list;
}
/// <summary>
/// Takes a list of items and returns the ones that are recently added and unplayed
/// </summary>
- private static IEnumerable<BaseItem> GetRecentlyAddedUnplayedItems(IEnumerable<BaseItem> itemSet, User user)
+ private static List<BaseItem> GetRecentlyAddedUnplayedItems(IEnumerable<BaseItem> itemSet, User user)
{
- return GetRecentlyAddedItems(itemSet, user).Where(i =>
+ var list = new List<BaseItem>();
+
+ foreach (var item in itemSet)
{
- var userdata = i.GetUserData(user, false);
+ if (!item.IsFolder && item.IsRecentlyAdded(user))
+ {
+ var userdata = item.GetUserData(user, false);
- return userdata == null || userdata.PlayCount == 0;
- });
+ if (userdata == null || userdata.PlayCount == 0)
+ {
+ list.Add(item);
+ }
+ }
+ }
+
+ return list;
}
/// <summary>
/// Takes a list of items and returns the ones that are in progress
/// </summary>
- private static IEnumerable<BaseItem> GetInProgressItems(IEnumerable<BaseItem> itemSet, User user)
+ private static List<BaseItem> GetInProgressItems(IEnumerable<BaseItem> itemSet, User user)
{
- return itemSet.Where(i =>
+ var list = new List<BaseItem>();
+
+ foreach (var item in itemSet)
{
- if (i.IsFolder)
+ if (!item.IsFolder)
{
- return false;
- }
+ var userdata = item.GetUserData(user, false);
- var userdata = i.GetUserData(user, false);
+ if (userdata != null && userdata.PlaybackPositionTicks > 0)
+ {
+ list.Add(item);
+ }
+ }
+ }
- return userdata != null && userdata.PlaybackPositionTicks > 0;
- });
+ return list;
}
/// <summary>
@@ -488,15 +515,14 @@ namespace MediaBrowser.Controller.Entities
{
itemSet = itemSet.Where(i => !(i.IsFolder));
- if (!itemSet.Any())
- {
- return 0;
- }
-
decimal totalPercent = 0;
+ int count = 0;
+
foreach (BaseItem item in itemSet)
{
+ count++;
+
UserItemData data = item.GetUserData(user, false);
if (data == null)
@@ -516,7 +542,12 @@ namespace MediaBrowser.Controller.Entities
}
}
- return totalPercent / itemSet.Count();
+ if (count == 0)
+ {
+ return 0;
+ }
+
+ return totalPercent / count;
}
/// <summary>
diff --git a/MediaBrowser.Controller/Entities/UserItemData.cs b/MediaBrowser.Controller/Entities/UserItemData.cs
index b342b9583..bb4950046 100644
--- a/MediaBrowser.Controller/Entities/UserItemData.cs
+++ b/MediaBrowser.Controller/Entities/UserItemData.cs
@@ -1,11 +1,11 @@
using System;
using System.Runtime.Serialization;
-namespace MediaBrowser.Model.Entities
+namespace MediaBrowser.Controller.Entities
{
public class UserItemData
{
- private float? _Rating = null;
+ private float? _rating;
/// <summary>
/// Gets or sets the users 0-10 rating
/// </summary>
@@ -13,7 +13,7 @@ namespace MediaBrowser.Model.Entities
{
get
{
- return _Rating;
+ return _rating;
}
set
{
@@ -25,7 +25,7 @@ namespace MediaBrowser.Model.Entities
}
}
- _Rating = value;
+ _rating = value;
}
}
diff --git a/MediaBrowser.Controller/FFMpeg/FFProbe.cs b/MediaBrowser.Controller/FFMpeg/FFProbe.cs
index d4c07f07b..f16f0142d 100644
--- a/MediaBrowser.Controller/FFMpeg/FFProbe.cs
+++ b/MediaBrowser.Controller/FFMpeg/FFProbe.cs
@@ -18,7 +18,7 @@ namespace MediaBrowser.Controller.FFMpeg
/// </summary>
public static FFProbeResult Run(BaseItem item, string cacheDirectory)
{
- string cachePath = GetFFProbeCachePath(item, cacheDirectory);
+ string cachePath = GetFfProbeCachePath(item, cacheDirectory);
// Use try catch to avoid having to use File.Exists
try
@@ -61,7 +61,7 @@ namespace MediaBrowser.Controller.FFMpeg
{
try
{
- ProtobufSerializer.SerializeToFile<FFProbeResult>(result, outputCachePath);
+ ProtobufSerializer.SerializeToFile(result, outputCachePath);
}
catch (Exception ex)
{
@@ -72,7 +72,7 @@ namespace MediaBrowser.Controller.FFMpeg
private static FFProbeResult Run(string input)
{
- ProcessStartInfo startInfo = new ProcessStartInfo();
+ var startInfo = new ProcessStartInfo { };
startInfo.CreateNoWindow = true;
@@ -88,12 +88,12 @@ namespace MediaBrowser.Controller.FFMpeg
//Logger.LogInfo(startInfo.FileName + " " + startInfo.Arguments);
- Process process = new Process();
+ var process = new Process { };
process.StartInfo = startInfo;
process.EnableRaisingEvents = true;
- process.Exited += process_Exited;
+ process.Exited += ProcessExited;
try
{
@@ -122,12 +122,12 @@ namespace MediaBrowser.Controller.FFMpeg
}
}
- static void process_Exited(object sender, EventArgs e)
+ static void ProcessExited(object sender, EventArgs e)
{
(sender as Process).Dispose();
}
- private static string GetFFProbeCachePath(BaseItem item, string cacheDirectory)
+ private static string GetFfProbeCachePath(BaseItem item, string cacheDirectory)
{
string outputDirectory = Path.Combine(cacheDirectory, item.Id.ToString().Substring(0, 1));
diff --git a/MediaBrowser.Controller/FFMpeg/ffmpeg.exe.REMOVED.git-id b/MediaBrowser.Controller/FFMpeg/ffmpeg.exe.REMOVED.git-id
index 6e2fea16f..73a37bd55 100644
--- a/MediaBrowser.Controller/FFMpeg/ffmpeg.exe.REMOVED.git-id
+++ b/MediaBrowser.Controller/FFMpeg/ffmpeg.exe.REMOVED.git-id
@@ -1 +1 @@
-342d82560ddbf5e8008ec6ded3370dedc44c834d \ No newline at end of file
+84ac1c51e84cfbfb20e7b96c9f1a4442a8cfadf2 \ No newline at end of file
diff --git a/MediaBrowser.Controller/FFMpeg/ffprobe.exe.REMOVED.git-id b/MediaBrowser.Controller/FFMpeg/ffprobe.exe.REMOVED.git-id
index 5d40f2482..682ead74d 100644
--- a/MediaBrowser.Controller/FFMpeg/ffprobe.exe.REMOVED.git-id
+++ b/MediaBrowser.Controller/FFMpeg/ffprobe.exe.REMOVED.git-id
@@ -1 +1 @@
-621430cd658e6258827ff3c526b8b7ca02d82389 \ No newline at end of file
+331e241e29f1b015e303b301c17c37883e39f39d \ No newline at end of file
diff --git a/MediaBrowser.Controller/IO/DirectoryWatchers.cs b/MediaBrowser.Controller/IO/DirectoryWatchers.cs
index 8b1b8f6a9..5d5381d9e 100644
--- a/MediaBrowser.Controller/IO/DirectoryWatchers.cs
+++ b/MediaBrowser.Controller/IO/DirectoryWatchers.cs
@@ -12,15 +12,15 @@ namespace MediaBrowser.Controller.IO
{
public class DirectoryWatchers
{
- private List<FileSystemWatcher> FileSystemWatchers = new List<FileSystemWatcher>();
- private Timer updateTimer = null;
+ private readonly List<FileSystemWatcher> FileSystemWatchers = new List<FileSystemWatcher>();
+ private Timer updateTimer;
private List<string> affectedPaths = new List<string>();
private const int TimerDelayInSeconds = 5;
public void Start()
{
- List<string> pathsToWatch = new List<string>();
+ var pathsToWatch = new List<string>();
var rootFolder = Kernel.Instance.RootFolder;
@@ -40,7 +40,6 @@ namespace MediaBrowser.Controller.IO
foreach (string path in pathsToWatch)
{
Logger.LogInfo("Watching directory " + path + " for changes.");
- FileSystemWatcher watcher = new FileSystemWatcher(path, "*");
watcher.IncludeSubdirectories = true;
@@ -86,7 +85,7 @@ namespace MediaBrowser.Controller.IO
private Task ProcessPathChanges(IEnumerable<string> paths)
{
- List<BaseItem> itemsToRefresh = new List<BaseItem>();
+ var itemsToRefresh = new List<BaseItem>();
foreach (BaseItem item in paths.Select(p => GetAffectedBaseItem(p)))
{
@@ -105,10 +104,8 @@ namespace MediaBrowser.Controller.IO
{
return Kernel.Instance.ReloadRoot();
}
- else
- {
- return Task.WhenAll(itemsToRefresh.Select(i => Kernel.Instance.ReloadItem(i)));
- }
+
+ return Task.WhenAll(itemsToRefresh.Select(i => Kernel.Instance.ReloadItem(i)));
}
private BaseItem GetAffectedBaseItem(string path)
diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs
index b7a6579da..4ae2ee72f 100644
--- a/MediaBrowser.Controller/IO/FileData.cs
+++ b/MediaBrowser.Controller/IO/FileData.cs
@@ -149,7 +149,7 @@ namespace MediaBrowser.Controller.IO
private static extern bool FindClose(IntPtr hFindFile);
private const char SpaceChar = ' ';
- private static char[] InvalidFileNameChars = Path.GetInvalidFileNameChars();
+ private static readonly char[] InvalidFileNameChars = Path.GetInvalidFileNameChars();
/// <summary>
/// Takes a filename and removes invalid characters
diff --git a/MediaBrowser.Controller/IO/Shortcut.cs b/MediaBrowser.Controller/IO/Shortcut.cs
index 92505e9b7..e9ea21f17 100644
--- a/MediaBrowser.Controller/IO/Shortcut.cs
+++ b/MediaBrowser.Controller/IO/Shortcut.cs
@@ -167,12 +167,12 @@ namespace MediaBrowser.Controller.IO
public static string ResolveShortcut(string filename)
{
- ShellLink link = new ShellLink();
+ var link = new ShellLink();
((IPersistFile)link).Load(filename, STGM_READ);
// TODO: if I can get hold of the hwnd call resolve first. This handles moved and renamed files.
// ((IShellLinkW)link).Resolve(hwnd, 0)
- StringBuilder sb = new StringBuilder(MAX_PATH);
- WIN32_FIND_DATAW data = new WIN32_FIND_DATAW();
+ var sb = new StringBuilder(MAX_PATH);
+ var data = new WIN32_FIND_DATAW();
((IShellLinkW)link).GetPath(sb, sb.Capacity, out data, 0);
return sb.ToString();
}
diff --git a/MediaBrowser.Controller/Kernel.cs b/MediaBrowser.Controller/Kernel.cs
index cf4450aec..2ea6a44cf 100644
--- a/MediaBrowser.Controller/Kernel.cs
+++ b/MediaBrowser.Controller/Kernel.cs
@@ -94,30 +94,51 @@ namespace MediaBrowser.Controller
: base()
{
Instance = this;
+ }
+ /// <summary>
+ /// Performs initializations that only occur once
+ /// </summary>
+ protected override void InitializeInternal(IProgress<TaskProgress> progress)
+ {
ItemController = new ItemController();
DirectoryWatchers = new DirectoryWatchers();
- WeatherClient = new WeatherClient();
+
+ base.InitializeInternal(progress);
}
- public async override Task Init(IProgress<TaskProgress> progress)
+ /// <summary>
+ /// Performs initializations that can be reloaded at anytime
+ /// </summary>
+ public override async Task Reload(IProgress<TaskProgress> progress)
{
- ExtractFFMpeg();
+ await base.Reload(progress).ConfigureAwait(false);
- await base.Init(progress).ConfigureAwait(false);
+ ReloadWeatherClient();
- progress.Report(new TaskProgress() { Description = "Loading Users", PercentComplete = 15 });
+ ExtractFFMpeg();
+
+ progress.Report(new TaskProgress { Description = "Loading Users" });
ReloadUsers();
- progress.Report(new TaskProgress() { Description = "Loading Media Library", PercentComplete = 25 });
+ progress.Report(new TaskProgress { Description = "Loading Media Library" });
await ReloadRoot(allowInternetProviders: false).ConfigureAwait(false);
+ }
+
+ /// <summary>
+ /// Completely disposes the Kernel
+ /// </summary>
+ public override void Dispose()
+ {
+ base.Dispose();
- progress.Report(new TaskProgress() { Description = "Loading Complete", PercentComplete = 100 });
+ DirectoryWatchers.Stop();
- //watch the root folder children for changes
- RootFolder.ChildrenChanged += RootFolder_ChildrenChanged;
+ DisposeWeatherClient();
+ ItemController.PreBeginResolvePath -= ItemController_PreBeginResolvePath;
+ ItemController.BeginResolvePath -= ItemController_BeginResolvePath;
}
protected override void OnComposablePartsLoaded()
@@ -204,7 +225,7 @@ namespace MediaBrowser.Controller
/// </summary>
public AuthenticationResult AuthenticateUser(User user, string password)
{
- AuthenticationResult result = new AuthenticationResult();
+ var result = new AuthenticationResult();
// When EnableUserProfiles is false, only the default User can login
if (!Configuration.EnableUserProfiles)
@@ -233,7 +254,7 @@ namespace MediaBrowser.Controller
public async Task ReloadItem(BaseItem item)
{
- Folder folder = item as Folder;
+ var folder = item as Folder;
if (folder != null && folder.IsRoot)
{
@@ -279,16 +300,17 @@ namespace MediaBrowser.Controller
/// </summary>
private IEnumerable<User> GetAllUsers()
{
- List<User> list = new List<User>();
+ var list = new List<User>();
// Return a dummy user for now since all calls to get items requre a userId
- User user = new User();
+ var user = new User { };
user.Name = "Default User";
user.Id = Guid.Parse("5d1cf7fce25943b790d140095457a42b");
+ user.PrimaryImagePath = "D:\\Video\\TV\\Archer (2009)\\backdrop.jpg";
list.Add(user);
- user = new User();
+ user = new User { };
user.Name = "Abobader";
user.Id = Guid.NewGuid();
user.LastLoginDate = DateTime.UtcNow.AddDays(-1);
@@ -296,12 +318,12 @@ namespace MediaBrowser.Controller
user.Password = ("1234").GetMD5().ToString();
list.Add(user);
- user = new User();
+ user = new User { };
user.Name = "Scottisafool";
user.Id = Guid.NewGuid();
list.Add(user);
- user = new User();
+ user = new User { };
user.Name = "Redshirt";
user.Id = Guid.NewGuid();
list.Add(user);
@@ -377,11 +399,32 @@ namespace MediaBrowser.Controller
// Extract exe
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MediaBrowser.Controller.FFMpeg." + Path.GetFileName(exe)))
{
- using (FileStream fileStream = new FileStream(exe, FileMode.Create))
+ using (var fileStream = new FileStream(exe, FileMode.Create))
{
stream.CopyTo(fileStream);
}
}
}
+
+ /// <summary>
+ /// Disposes the current WeatherClient
+ /// </summary>
+ private void DisposeWeatherClient()
+ {
+ if (WeatherClient != null)
+ {
+ WeatherClient.Dispose();
+ }
+ }
+
+ /// <summary>
+ /// Disposes the current WeatherClient and creates a new one
+ /// </summary>
+ private void ReloadWeatherClient()
+ {
+ DisposeWeatherClient();
+
+ WeatherClient = new WeatherClient();
+ }
}
}
diff --git a/MediaBrowser.Controller/Library/ItemController.cs b/MediaBrowser.Controller/Library/ItemController.cs
index dd08c193e..c98e22ba1 100644
--- a/MediaBrowser.Controller/Library/ItemController.cs
+++ b/MediaBrowser.Controller/Library/ItemController.cs
@@ -34,7 +34,7 @@ namespace MediaBrowser.Controller.Library
/// </summary>
public async Task<BaseItem> GetItem(string path, Folder parent = null, WIN32_FIND_DATA? fileInfo = null, bool allowInternetProviders = true)
{
- ItemResolveEventArgs args = new ItemResolveEventArgs()
+ var args = new ItemResolveEventArgs
{
FileInfo = fileInfo ?? FileData.GetFileData(path),
Parent = parent,
@@ -173,7 +173,7 @@ namespace MediaBrowser.Controller.Library
return GetImagesByNameItem<Year>(Kernel.Instance.ApplicationPaths.YearPath, value.ToString());
}
- private ConcurrentDictionary<string, object> ImagesByNameItemCache = new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase);
+ private readonly ConcurrentDictionary<string, object> ImagesByNameItemCache = new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Generically retrieves an IBN item
@@ -183,15 +183,15 @@ namespace MediaBrowser.Controller.Library
{
name = FileData.GetValidFilename(name);
- string key = Path.Combine(path, name);
+ path = Path.Combine(path, name);
// Look for it in the cache, if it's not there, create it
- if (!ImagesByNameItemCache.ContainsKey(key))
+ if (!ImagesByNameItemCache.ContainsKey(path))
{
- ImagesByNameItemCache[key] = CreateImagesByNameItem<T>(path, name);
+ ImagesByNameItemCache[path] = CreateImagesByNameItem<T>(path, name);
}
- return ImagesByNameItemCache[key] as Task<T>;
+ return ImagesByNameItemCache[path] as Task<T>;
}
/// <summary>
@@ -200,7 +200,7 @@ namespace MediaBrowser.Controller.Library
private async Task<T> CreateImagesByNameItem<T>(string path, string name)
where T : BaseEntity, new()
{
- T item = new T();
+ var item = new T { };
item.Name = name;
item.Id = path.GetMD5();
@@ -213,7 +213,7 @@ namespace MediaBrowser.Controller.Library
item.DateCreated = Directory.GetCreationTimeUtc(path);
item.DateModified = Directory.GetLastWriteTimeUtc(path);
- ItemResolveEventArgs args = new ItemResolveEventArgs();
+ var args = new ItemResolveEventArgs { };
args.FileInfo = FileData.GetFileData(path);
args.FileSystemChildren = FileData.GetFileSystemEntries(path, "*").ToArray();
diff --git a/MediaBrowser.Controller/Properties/AssemblyInfo.cs b/MediaBrowser.Controller/Properties/AssemblyInfo.cs
index 350165b1c..63cc65d7a 100644
--- a/MediaBrowser.Controller/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.Controller/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
diff --git a/MediaBrowser.Controller/Providers/AudioInfoProvider.cs b/MediaBrowser.Controller/Providers/AudioInfoProvider.cs
index 09cd80a21..302902646 100644
--- a/MediaBrowser.Controller/Providers/AudioInfoProvider.cs
+++ b/MediaBrowser.Controller/Providers/AudioInfoProvider.cs
@@ -26,9 +26,6 @@ namespace MediaBrowser.Controller.Providers
{
MediaStream stream = data.streams.First(s => s.codec_type.Equals("audio", StringComparison.OrdinalIgnoreCase));
- string bitrate = null;
- string duration = null;
-
audio.Channels = stream.channels;
if (!string.IsNullOrEmpty(stream.sample_rate))
@@ -36,8 +33,8 @@ namespace MediaBrowser.Controller.Providers
audio.SampleRate = int.Parse(stream.sample_rate);
}
- bitrate = stream.bit_rate;
- duration = stream.duration;
+ string bitrate = stream.bit_rate;
+ string duration = stream.duration;
if (string.IsNullOrEmpty(bitrate))
{
@@ -78,7 +75,7 @@ namespace MediaBrowser.Controller.Providers
if (!string.IsNullOrEmpty(composer))
{
- audio.AddPerson(new PersonInfo() { Name = composer, Type = "Composer" });
+ audio.AddPerson(new PersonInfo { Name = composer, Type = "Composer" });
}
audio.Album = GetDictionaryValue(tags, "album");
@@ -252,7 +249,7 @@ namespace MediaBrowser.Controller.Providers
private Dictionary<string, string> ConvertDictionaryToCaseInSensitive(Dictionary<string, string> dict)
{
- Dictionary<string, string> newDict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
+ var newDict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
foreach (string key in dict.Keys)
{
diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
index a3b0d2c60..1cb2e2af3 100644
--- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
+++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
@@ -62,7 +62,7 @@ namespace MediaBrowser.Controller.Providers
item.DisplayMediaType = VideoType.BluRay.ToString();
break;
case "dvd":
- item.DisplayMediaType = VideoType.DVD.ToString();
+ item.DisplayMediaType = VideoType.Dvd.ToString();
break;
case "":
item.DisplayMediaType = null;
@@ -163,7 +163,7 @@ namespace MediaBrowser.Controller.Providers
case "Director":
{
- foreach (PersonInfo p in GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo() { Name = v, Type = "Director" }))
+ foreach (PersonInfo p in GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo { Name = v, Type = "Director" }))
{
item.AddPerson(p);
}
@@ -171,7 +171,7 @@ namespace MediaBrowser.Controller.Providers
}
case "Writer":
{
- foreach (PersonInfo p in GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo() { Name = v, Type = "Writer" }))
+ foreach (PersonInfo p in GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo { Name = v, Type = "Writer" }))
{
item.AddPerson(p);
}
@@ -181,7 +181,7 @@ namespace MediaBrowser.Controller.Providers
case "Actors":
case "GuestStars":
{
- foreach (PersonInfo p in GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo() { Name = v, Type = "Actor" }))
+ foreach (PersonInfo p in GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo { Name = v, Type = "Actor" }))
{
item.AddPerson(p);
}
@@ -347,7 +347,7 @@ namespace MediaBrowser.Controller.Providers
private AudioStream FetchMediaInfoAudio(XmlReader reader)
{
- AudioStream stream = new AudioStream();
+ var stream = new AudioStream();
reader.MoveToContent();
@@ -466,7 +466,7 @@ namespace MediaBrowser.Controller.Providers
private SubtitleStream FetchMediaInfoSubtitles(XmlReader reader)
{
- SubtitleStream stream = new SubtitleStream();
+ var stream = new SubtitleStream();
reader.MoveToContent();
@@ -681,7 +681,7 @@ namespace MediaBrowser.Controller.Providers
private PersonInfo GetPersonFromXmlNode(XmlReader reader)
{
- PersonInfo person = new PersonInfo();
+ var person = new PersonInfo();
reader.MoveToContent();
diff --git a/MediaBrowser.Controller/Providers/FolderProviderFromXml.cs b/MediaBrowser.Controller/Providers/FolderProviderFromXml.cs
index 0f655cf0b..b7d9b7189 100644
--- a/MediaBrowser.Controller/Providers/FolderProviderFromXml.cs
+++ b/MediaBrowser.Controller/Providers/FolderProviderFromXml.cs
@@ -26,7 +26,7 @@ namespace MediaBrowser.Controller.Providers
{
if (args.ContainsFile("folder.xml"))
{
- await Task.Run(() => { Fetch(item, args); }).ConfigureAwait(false);
+ await Task.Run(() => Fetch(item, args)).ConfigureAwait(false);
}
}
diff --git a/MediaBrowser.Controller/Providers/ImageFromMediaLocationProvider.cs b/MediaBrowser.Controller/Providers/ImageFromMediaLocationProvider.cs
index 6ccb6df7c..d6fd26d1c 100644
--- a/MediaBrowser.Controller/Providers/ImageFromMediaLocationProvider.cs
+++ b/MediaBrowser.Controller/Providers/ImageFromMediaLocationProvider.cs
@@ -32,12 +32,10 @@ namespace MediaBrowser.Controller.Providers
if (baseItem != null)
{
- return Task.Run(() => { PopulateBaseItemImages(baseItem, args); });
- }
- else
- {
- return Task.Run(() => { PopulateImages(item, args); });
+ return Task.Run(() => PopulateBaseItemImages(baseItem, args));
}
+
+ return Task.Run(() => PopulateImages(item, args));
}
return Task.FromResult<object>(null);
@@ -76,7 +74,7 @@ namespace MediaBrowser.Controller.Providers
/// </summary>
private void PopulateBaseItemImages(BaseItem item, ItemResolveEventArgs args)
{
- List<string> backdropFiles = new List<string>();
+ var backdropFiles = new List<string>();
for (int i = 0; i < args.FileSystemChildren.Length; i++)
{
diff --git a/MediaBrowser.Controller/Providers/LocalTrailerProvider.cs b/MediaBrowser.Controller/Providers/LocalTrailerProvider.cs
index 4e6bcdef8..8823da691 100644
--- a/MediaBrowser.Controller/Providers/LocalTrailerProvider.cs
+++ b/MediaBrowser.Controller/Providers/LocalTrailerProvider.cs
@@ -28,11 +28,11 @@ namespace MediaBrowser.Controller.Providers
{
if (args.ContainsFolder("trailers"))
{
- List<Video> items = new List<Video>();
+ var items = new List<Video>();
foreach (WIN32_FIND_DATA file in FileData.GetFileSystemEntries(Path.Combine(args.Path, "trailers"), "*"))
{
- Video video = await Kernel.Instance.ItemController.GetItem(file.Path, fileInfo: file).ConfigureAwait(false) as Video;
+ var video = await Kernel.Instance.ItemController.GetItem(file.Path, fileInfo: file).ConfigureAwait(false) as Video;
if (video != null)
{
diff --git a/MediaBrowser.Controller/Providers/Movies/MovieProviderFromXml.cs b/MediaBrowser.Controller/Providers/Movies/MovieProviderFromXml.cs
index 4f18cd5f9..f1d625aeb 100644
--- a/MediaBrowser.Controller/Providers/Movies/MovieProviderFromXml.cs
+++ b/MediaBrowser.Controller/Providers/Movies/MovieProviderFromXml.cs
@@ -22,7 +22,7 @@ namespace MediaBrowser.Controller.Providers.Movies
public override async Task FetchAsync(BaseEntity item, ItemResolveEventArgs args)
{
- await Task.Run(() => { Fetch(item, args); }).ConfigureAwait(false);
+ await Task.Run(() => Fetch(item, args)).ConfigureAwait(false);
}
private void Fetch(BaseEntity item, ItemResolveEventArgs args)
diff --git a/MediaBrowser.Controller/Providers/Movies/MovieSpecialFeaturesProvider.cs b/MediaBrowser.Controller/Providers/Movies/MovieSpecialFeaturesProvider.cs
index 2fb5caf8e..b6b856d29 100644
--- a/MediaBrowser.Controller/Providers/Movies/MovieSpecialFeaturesProvider.cs
+++ b/MediaBrowser.Controller/Providers/Movies/MovieSpecialFeaturesProvider.cs
@@ -26,11 +26,11 @@ namespace MediaBrowser.Controller.Providers.Movies
{
if (args.ContainsFolder("specials"))
{
- List<Video> items = new List<Video>();
+ var items = new List<Video>();
foreach (WIN32_FIND_DATA file in FileData.GetFileSystemEntries(Path.Combine(args.Path, "specials"), "*"))
{
- Video video = await Kernel.Instance.ItemController.GetItem(file.Path, fileInfo: file).ConfigureAwait(false) as Video;
+ var video = await Kernel.Instance.ItemController.GetItem(file.Path, fileInfo: file).ConfigureAwait(false) as Video;
if (video != null)
{
diff --git a/MediaBrowser.Controller/Providers/TV/EpisodeImageFromMediaLocationProvider.cs b/MediaBrowser.Controller/Providers/TV/EpisodeImageFromMediaLocationProvider.cs
index 8533d19d9..0b9cf85eb 100644
--- a/MediaBrowser.Controller/Providers/TV/EpisodeImageFromMediaLocationProvider.cs
+++ b/MediaBrowser.Controller/Providers/TV/EpisodeImageFromMediaLocationProvider.cs
@@ -25,13 +25,13 @@ namespace MediaBrowser.Controller.Providers.TV
{
return Task.Run(() =>
{
- Episode episode = item as Episode;
+ var episode = item as Episode;
string metadataFolder = Path.Combine(args.Parent.Path, "metadata");
string episodeFileName = Path.GetFileName(episode.Path);
- Season season = args.Parent as Season;
+ var season = args.Parent as Season;
SetPrimaryImagePath(episode, season, metadataFolder, episodeFileName);
});
@@ -40,7 +40,7 @@ namespace MediaBrowser.Controller.Providers.TV
private void SetPrimaryImagePath(Episode item, Season season, string metadataFolder, string episodeFileName)
{
// Look for the image file in the metadata folder, and if found, set PrimaryImagePath
- string[] imageFiles = new string[] {
+ var imageFiles = new string[] {
Path.Combine(metadataFolder, Path.ChangeExtension(episodeFileName, ".jpg")),
Path.Combine(metadataFolder, Path.ChangeExtension(episodeFileName, ".png"))
};
diff --git a/MediaBrowser.Controller/Providers/TV/EpisodeProviderFromXml.cs b/MediaBrowser.Controller/Providers/TV/EpisodeProviderFromXml.cs
index 953eb1ec4..f3c19a704 100644
--- a/MediaBrowser.Controller/Providers/TV/EpisodeProviderFromXml.cs
+++ b/MediaBrowser.Controller/Providers/TV/EpisodeProviderFromXml.cs
@@ -22,7 +22,7 @@ namespace MediaBrowser.Controller.Providers.TV
public override async Task FetchAsync(BaseEntity item, ItemResolveEventArgs args)
{
- await Task.Run(() => { Fetch(item, args); }).ConfigureAwait(false);
+ await Task.Run(() => Fetch(item, args)).ConfigureAwait(false);
}
private void Fetch(BaseEntity item, ItemResolveEventArgs args)
diff --git a/MediaBrowser.Controller/Providers/TV/EpisodeXmlParser.cs b/MediaBrowser.Controller/Providers/TV/EpisodeXmlParser.cs
index fad1a04b4..1cb604a51 100644
--- a/MediaBrowser.Controller/Providers/TV/EpisodeXmlParser.cs
+++ b/MediaBrowser.Controller/Providers/TV/EpisodeXmlParser.cs
@@ -16,6 +16,10 @@ namespace MediaBrowser.Controller.Providers.TV
if (!string.IsNullOrWhiteSpace(filename))
{
+ // Strip off everything but the filename. Some metadata tools like MetaBrowser v1.0 will have an 'episodes' prefix
+ // even though it's actually using the metadata folder.
+ filename = Path.GetFileName(filename);
+
string seasonFolder = Path.GetDirectoryName(item.Path);
item.PrimaryImagePath = Path.Combine(seasonFolder, "metadata", filename);
}
diff --git a/MediaBrowser.Controller/Providers/TV/SeriesProviderFromXml.cs b/MediaBrowser.Controller/Providers/TV/SeriesProviderFromXml.cs
index 95f4f9adc..76d7e7ac1 100644
--- a/MediaBrowser.Controller/Providers/TV/SeriesProviderFromXml.cs
+++ b/MediaBrowser.Controller/Providers/TV/SeriesProviderFromXml.cs
@@ -22,7 +22,7 @@ namespace MediaBrowser.Controller.Providers.TV
public override async Task FetchAsync(BaseEntity item, ItemResolveEventArgs args)
{
- await Task.Run(() => { Fetch(item, args); }).ConfigureAwait(false);
+ await Task.Run(() => Fetch(item, args)).ConfigureAwait(false);
}
private void Fetch(BaseEntity item, ItemResolveEventArgs args)
diff --git a/MediaBrowser.Controller/Providers/VideoInfoProvider.cs b/MediaBrowser.Controller/Providers/VideoInfoProvider.cs
index 640d1b27f..264825fe0 100644
--- a/MediaBrowser.Controller/Providers/VideoInfoProvider.cs
+++ b/MediaBrowser.Controller/Providers/VideoInfoProvider.cs
@@ -87,7 +87,7 @@ namespace MediaBrowser.Controller.Providers
private void FetchFromAudioStream(Video video, MediaStream stream)
{
- AudioStream audio = new AudioStream();
+ var audio = new AudioStream{};
audio.Codec = stream.codec_name;
@@ -112,7 +112,7 @@ namespace MediaBrowser.Controller.Providers
private void FetchFromSubtitleStream(Video video, MediaStream stream)
{
- SubtitleStream subtitle = new SubtitleStream();
+ var subtitle = new SubtitleStream{};
subtitle.Language = GetDictionaryValue(stream.tags, "language");
@@ -157,7 +157,7 @@ namespace MediaBrowser.Controller.Providers
return false;
}
- if (video.FrameRate == 0 || video.Height == 0 || video.Width == 0 || video.BitRate == 0)
+ if (Convert.ToInt32(video.FrameRate) == 0 || video.Height == 0 || video.Width == 0 || video.BitRate == 0)
{
return false;
}
diff --git a/MediaBrowser.Controller/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Controller/Resolvers/Movies/MovieResolver.cs
index 85d9996aa..8ac80f898 100644
--- a/MediaBrowser.Controller/Resolvers/Movies/MovieResolver.cs
+++ b/MediaBrowser.Controller/Resolvers/Movies/MovieResolver.cs
@@ -47,7 +47,7 @@ namespace MediaBrowser.Controller.Resolvers.Movies
private void SetProviderIdFromPath(Movie item)
{
- string srch = "[tmdbid=";
+ const string srch = "[tmdbid=";
int index = item.Path.IndexOf(srch, System.StringComparison.OrdinalIgnoreCase);
if (index != -1)
@@ -83,7 +83,6 @@ namespace MediaBrowser.Controller.Resolvers.Movies
// Loop through each child file/folder and see if we find a video
foreach (var child in args.FileSystemChildren)
{
- ItemResolveEventArgs childArgs = new ItemResolveEventArgs()
{
FileInfo = child,
FileSystemChildren = new WIN32_FIND_DATA[] { },
@@ -94,7 +93,7 @@ namespace MediaBrowser.Controller.Resolvers.Movies
if (item != null)
{
- return new Movie()
+ return new Movie
{
Path = item.Path,
VideoType = item.VideoType
diff --git a/MediaBrowser.Controller/Resolvers/TV/SeasonResolver.cs b/MediaBrowser.Controller/Resolvers/TV/SeasonResolver.cs
index 3b54a1aff..528a55ae4 100644
--- a/MediaBrowser.Controller/Resolvers/TV/SeasonResolver.cs
+++ b/MediaBrowser.Controller/Resolvers/TV/SeasonResolver.cs
@@ -12,19 +12,12 @@ namespace MediaBrowser.Controller.Resolvers.TV
{
if (args.Parent is Series && args.IsDirectory)
{
- Season season = new Season();
+ var season = new Season { };
season.IndexNumber = TVUtils.GetSeasonNumberFromPath(args.Path);
// Gather these now so that the episode provider classes can utilize them instead of having to make their own file system calls
- if (args.ContainsFolder("metadata"))
- {
- season.MetadataFiles = Directory.GetFiles(Path.Combine(args.Path, "metadata"), "*", SearchOption.TopDirectoryOnly);
- }
- else
- {
- season.MetadataFiles = new string[] { };
- }
+ season.MetadataFiles = args.ContainsFolder("metadata") ? Directory.GetFiles(Path.Combine(args.Path, "metadata"), "*", SearchOption.TopDirectoryOnly) : new string[] { };
return season;
}
diff --git a/MediaBrowser.Controller/Resolvers/TV/SeriesResolver.cs b/MediaBrowser.Controller/Resolvers/TV/SeriesResolver.cs
index 3c43e460c..b8ff2c37b 100644
--- a/MediaBrowser.Controller/Resolvers/TV/SeriesResolver.cs
+++ b/MediaBrowser.Controller/Resolvers/TV/SeriesResolver.cs
@@ -48,8 +48,8 @@ namespace MediaBrowser.Controller.Resolvers.TV
private void SetProviderIdFromPath(Series item)
{
- string srch = "[tvdbid=";
- int index = item.Path.IndexOf(srch, System.StringComparison.OrdinalIgnoreCase);
+ const string srch = "[tvdbid=";
+ int index = item.Path.IndexOf(srch, StringComparison.OrdinalIgnoreCase);
if (index != -1)
{
diff --git a/MediaBrowser.Controller/Resolvers/TV/TVUtils.cs b/MediaBrowser.Controller/Resolvers/TV/TVUtils.cs
index ebfcda602..c40f3fa63 100644
--- a/MediaBrowser.Controller/Resolvers/TV/TVUtils.cs
+++ b/MediaBrowser.Controller/Resolvers/TV/TVUtils.cs
@@ -9,7 +9,7 @@ namespace MediaBrowser.Controller.Resolvers.TV
/// <summary>
/// A season folder must contain one of these somewhere in the name
/// </summary>
- private static string[] SeasonFolderNames = new string[] {
+ private static readonly string[] SeasonFolderNames = new string[] {
"season",
"sæson",
"temporada",
@@ -118,14 +118,12 @@ namespace MediaBrowser.Controller.Resolvers.TV
{
return true;
}
- else
- {
- nonSeriesFolders++;
- if (nonSeriesFolders >= 3)
- {
- return false;
- }
+ nonSeriesFolders++;
+
+ if (nonSeriesFolders >= 3)
+ {
+ return false;
}
}
else
diff --git a/MediaBrowser.Controller/Resolvers/VideoResolver.cs b/MediaBrowser.Controller/Resolvers/VideoResolver.cs
index 316c7798a..e162fa509 100644
--- a/MediaBrowser.Controller/Resolvers/VideoResolver.cs
+++ b/MediaBrowser.Controller/Resolvers/VideoResolver.cs
@@ -33,7 +33,7 @@ namespace MediaBrowser.Controller.Resolvers
{
VideoType type = Path.GetExtension(args.Path).EndsWith("iso", System.StringComparison.OrdinalIgnoreCase) ? VideoType.Iso : VideoType.VideoFile;
- return new T()
+ return new T
{
VideoType = type,
Path = args.Path
@@ -77,15 +77,15 @@ namespace MediaBrowser.Controller.Resolvers
{
if (folder.IndexOf("video_ts", System.StringComparison.OrdinalIgnoreCase) != -1)
{
- return new T()
+ return new T
{
- VideoType = VideoType.DVD,
+ VideoType = VideoType.Dvd,
Path = Path.GetDirectoryName(folder)
};
}
if (folder.IndexOf("bdmv", System.StringComparison.OrdinalIgnoreCase) != -1)
{
- return new T()
+ return new T
{
VideoType = VideoType.BluRay,
Path = Path.GetDirectoryName(folder)
diff --git a/MediaBrowser.Controller/ServerApplicationPaths.cs b/MediaBrowser.Controller/ServerApplicationPaths.cs
index 0f4932fd0..f657ee259 100644
--- a/MediaBrowser.Controller/ServerApplicationPaths.cs
+++ b/MediaBrowser.Controller/ServerApplicationPaths.cs
@@ -153,7 +153,7 @@ namespace MediaBrowser.Controller
}
}
- private string _CacheDirectory = null;
+ private string _CacheDirectory;
/// <summary>
/// Gets the folder path to the cache directory
/// </summary>
@@ -175,7 +175,7 @@ namespace MediaBrowser.Controller
}
}
- private string _FFProbeAudioCacheDirectory = null;
+ private string _FFProbeAudioCacheDirectory;
/// <summary>
/// Gets the folder path to the ffprobe audio cache directory
/// </summary>
@@ -197,7 +197,7 @@ namespace MediaBrowser.Controller
}
}
- private string _FFProbeVideoCacheDirectory = null;
+ private string _FFProbeVideoCacheDirectory;
/// <summary>
/// Gets the folder path to the ffprobe video cache directory
/// </summary>
@@ -219,7 +219,7 @@ namespace MediaBrowser.Controller
}
}
- private string _FFMpegDirectory = null;
+ private string _FFMpegDirectory;
/// <summary>
/// Gets the folder path to ffmpeg
/// </summary>
@@ -241,7 +241,7 @@ namespace MediaBrowser.Controller
}
}
- private string _FFMpegPath = null;
+ private string _FFMpegPath;
/// <summary>
/// Gets the path to ffmpeg.exe
/// </summary>
@@ -258,7 +258,7 @@ namespace MediaBrowser.Controller
}
}
- private string _FFProbePath = null;
+ private string _FFProbePath;
/// <summary>
/// Gets the path to ffprobe.exe
/// </summary>
diff --git a/MediaBrowser.Controller/Weather/WeatherClient.cs b/MediaBrowser.Controller/Weather/WeatherClient.cs
index c4abdc171..7226dccf0 100644
--- a/MediaBrowser.Controller/Weather/WeatherClient.cs
+++ b/MediaBrowser.Controller/Weather/WeatherClient.cs
@@ -1,13 +1,13 @@
-using System;
+using MediaBrowser.Common.Logging;
+using MediaBrowser.Common.Serialization;
+using MediaBrowser.Model.Weather;
+using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Cache;
using System.Net.Http;
using System.Threading.Tasks;
-using MediaBrowser.Common.Logging;
-using MediaBrowser.Common.Serialization;
-using MediaBrowser.Model.Weather;
namespace MediaBrowser.Controller.Weather
{
@@ -15,13 +15,13 @@ namespace MediaBrowser.Controller.Weather
/// Based on http://www.worldweatheronline.com/free-weather-feed.aspx
/// The classes in this file are a reproduction of the json output, which will then be converted to our weather model classes
/// </summary>
- public class WeatherClient
+ public class WeatherClient : IDisposable
{
private HttpClient HttpClient { get; set; }
public WeatherClient()
{
- WebRequestHandler handler = new WebRequestHandler();
+ var handler = new WebRequestHandler { };
handler.AutomaticDecompression = DecompressionMethods.Deflate;
handler.CachePolicy = new RequestCachePolicy(RequestCacheLevel.Revalidate);
@@ -36,8 +36,8 @@ namespace MediaBrowser.Controller.Weather
return null;
}
- int numDays = 5;
- string apiKey = "24902f60f1231941120109";
+ const int numDays = 5;
+ const string apiKey = "24902f60f1231941120109";
string url = "http://free.worldweatheronline.com/feed/weather.ashx?q=" + zipCode + "&format=json&num_of_days=" + numDays + "&key=" + apiKey;
@@ -56,7 +56,7 @@ namespace MediaBrowser.Controller.Weather
/// </summary>
private WeatherInfo GetWeatherInfo(WeatherData data)
{
- WeatherInfo info = new WeatherInfo();
+ var info = new WeatherInfo();
if (data.current_condition != null)
{
@@ -73,6 +73,11 @@ namespace MediaBrowser.Controller.Weather
return info;
}
+
+ public void Dispose()
+ {
+ HttpClient.Dispose();
+ }
}
class WeatherResult
@@ -95,7 +100,7 @@ namespace MediaBrowser.Controller.Weather
public WeatherStatus ToWeatherStatus()
{
- return new WeatherStatus()
+ return new WeatherStatus
{
TemperatureCelsius = int.Parse(temp_C),
TemperatureFahrenheit = int.Parse(temp_F),
@@ -122,7 +127,7 @@ namespace MediaBrowser.Controller.Weather
public WeatherForecast ToWeatherForecast()
{
- return new WeatherForecast()
+ return new WeatherForecast
{
Date = DateTime.Parse(date),
HighTemperatureCelsius = int.Parse(tempMaxC),
diff --git a/MediaBrowser.Controller/Xml/XmlExtensions.cs b/MediaBrowser.Controller/Xml/XmlExtensions.cs
index e706baa61..d2e8e1983 100644
--- a/MediaBrowser.Controller/Xml/XmlExtensions.cs
+++ b/MediaBrowser.Controller/Xml/XmlExtensions.cs
@@ -5,7 +5,7 @@ namespace MediaBrowser.Controller.Xml
{
public static class XmlExtensions
{
- private static CultureInfo _usCulture = new CultureInfo("en-US");
+ private static readonly CultureInfo _usCulture = new CultureInfo("en-US");
/// <summary>
/// Reads a float from the current element of an XmlReader
diff --git a/MediaBrowser.Model/DTO/DTOBaseItem.cs b/MediaBrowser.Model/DTO/DTOBaseItem.cs
index 8d2cadd87..66049d3fd 100644
--- a/MediaBrowser.Model/DTO/DTOBaseItem.cs
+++ b/MediaBrowser.Model/DTO/DTOBaseItem.cs
@@ -10,7 +10,7 @@ namespace MediaBrowser.Model.DTO
/// This holds information about a BaseItem in a format that is convenient for the client.
/// </summary>
[ProtoContract]
- public class DTOBaseItem : IHasProviderIds
+ public class DtoBaseItem : IHasProviderIds
{
[ProtoMember(1)]
public string Name { get; set; }
@@ -91,7 +91,7 @@ namespace MediaBrowser.Model.DTO
public int BackdropCount { get; set; }
[ProtoMember(27)]
- public DTOBaseItem[] Children { get; set; }
+ public DtoBaseItem[] Children { get; set; }
[ProtoMember(28)]
public bool IsFolder { get; set; }
@@ -136,7 +136,7 @@ namespace MediaBrowser.Model.DTO
public int? ParentBackdropCount { get; set; }
[ProtoMember(38)]
- public DTOBaseItem[] LocalTrailers { get; set; }
+ public DtoBaseItem[] LocalTrailers { get; set; }
[ProtoMember(39)]
public int LocalTrailerCount { get; set; }
@@ -145,7 +145,7 @@ namespace MediaBrowser.Model.DTO
/// User data for this item based on the user it's being requested for
/// </summary>
[ProtoMember(40)]
- public DTOUserItemData UserData { get; set; }
+ public DtoUserItemData UserData { get; set; }
[ProtoMember(41)]
public ItemSpecialCounts SpecialCounts { get; set; }
diff --git a/MediaBrowser.Model/DTO/DTOUser.cs b/MediaBrowser.Model/DTO/DTOUser.cs
index be13825f0..766cd741e 100644
--- a/MediaBrowser.Model/DTO/DTOUser.cs
+++ b/MediaBrowser.Model/DTO/DTOUser.cs
@@ -1,11 +1,10 @@
-using MediaBrowser.Model.Entities;
-using ProtoBuf;
+using ProtoBuf;
using System;
namespace MediaBrowser.Model.DTO
{
[ProtoContract]
- public class DTOUser
+ public class DtoUser
{
[ProtoMember(1)]
public string Name { get; set; }
diff --git a/MediaBrowser.Model/DTO/DTOUserItemData.cs b/MediaBrowser.Model/DTO/DTOUserItemData.cs
index 33ff797af..ce258f16f 100644
--- a/MediaBrowser.Model/DTO/DTOUserItemData.cs
+++ b/MediaBrowser.Model/DTO/DTOUserItemData.cs
@@ -3,7 +3,7 @@
namespace MediaBrowser.Model.DTO
{
[ProtoContract]
- public class DTOUserItemData
+ public class DtoUserItemData
{
[ProtoMember(1)]
public float? Rating { get; set; }
diff --git a/MediaBrowser.Model/DTO/IBNItem.cs b/MediaBrowser.Model/DTO/IBNItem.cs
index 588fe26d6..507a37272 100644
--- a/MediaBrowser.Model/DTO/IBNItem.cs
+++ b/MediaBrowser.Model/DTO/IBNItem.cs
@@ -7,7 +7,7 @@ namespace MediaBrowser.Model.DTO
/// This is a stub class used by the api to get IBN types along with their item counts
/// </summary>
[ProtoContract]
- public class IBNItem
+ public class IbnItem
{
/// <summary>
/// The name of the person, genre, etc
diff --git a/MediaBrowser.Model/DTO/VideoOutputFormats.cs b/MediaBrowser.Model/DTO/VideoOutputFormats.cs
index 3059f6aca..c3840bff6 100644
--- a/MediaBrowser.Model/DTO/VideoOutputFormats.cs
+++ b/MediaBrowser.Model/DTO/VideoOutputFormats.cs
@@ -9,12 +9,12 @@ namespace MediaBrowser.Model.DTO
{
Avi,
Asf,
- M4v,
+ M4V,
Mkv,
Mov,
Mp4,
Ogv,
- ThreeGP,
+ ThreeGp,
Ts,
Webm,
Wmv
diff --git a/MediaBrowser.Model/Entities/IHasProviderIds.cs b/MediaBrowser.Model/Entities/IHasProviderIds.cs
index 8b9852dda..96eb78f24 100644
--- a/MediaBrowser.Model/Entities/IHasProviderIds.cs
+++ b/MediaBrowser.Model/Entities/IHasProviderIds.cs
@@ -10,7 +10,7 @@ namespace MediaBrowser.Model.Entities
Dictionary<string, string> ProviderIds { get; set; }
}
- public static class IProviderIdsExtensions
+ public static class ProviderIdsExtensions
{
/// <summary>
/// Gets a provider id
diff --git a/MediaBrowser.Model/Entities/VideoType.cs b/MediaBrowser.Model/Entities/VideoType.cs
index 56308426e..b30b14690 100644
--- a/MediaBrowser.Model/Entities/VideoType.cs
+++ b/MediaBrowser.Model/Entities/VideoType.cs
@@ -5,7 +5,7 @@ namespace MediaBrowser.Model.Entities
{
VideoFile,
Iso,
- DVD,
+ Dvd,
BluRay
}
}
diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj
index 67d6dfd76..f7bd3a3ba 100644
--- a/MediaBrowser.Model/MediaBrowser.Model.csproj
+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj
@@ -36,15 +36,15 @@
<Compile Include="Configuration\ServerConfiguration.cs" />
<Compile Include="DTO\AudioInfo.cs" />
<Compile Include="DTO\AudioOutputFormats.cs" />
- <Compile Include="DTO\DTOUserItemData.cs" />
+ <Compile Include="DTO\DtoUserItemData.cs" />
<Compile Include="DTO\MovieInfo.cs" />
<Compile Include="DTO\SeriesInfo.cs" />
<Compile Include="Authentication\AuthenticationResult.cs" />
- <Compile Include="DTO\DTOBaseItem.cs" />
- <Compile Include="DTO\DTOUser.cs" />
+ <Compile Include="DTO\DtoBaseItem.cs" />
+ <Compile Include="DTO\DtoUser.cs" />
<Compile Include="DTO\VideoInfo.cs" />
<Compile Include="DTO\VideoOutputFormats.cs" />
- <Compile Include="DTO\IBNItem.cs" />
+ <Compile Include="DTO\IbnItem.cs" />
<Compile Include="Entities\AudioStream.cs" />
<Compile Include="Entities\ImageType.cs" />
<Compile Include="Entities\IHasProviderIds.cs" />
diff --git a/MediaBrowser.Model/Plugins/BasePluginConfiguration.cs b/MediaBrowser.Model/Plugins/BasePluginConfiguration.cs
index 55c5133a8..e33ebcce7 100644
--- a/MediaBrowser.Model/Plugins/BasePluginConfiguration.cs
+++ b/MediaBrowser.Model/Plugins/BasePluginConfiguration.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Runtime.Serialization;
-
+
namespace MediaBrowser.Model.Plugins
{
public class BasePluginConfiguration
diff --git a/MediaBrowser.Model/Progress/TaskProgress.cs b/MediaBrowser.Model/Progress/TaskProgress.cs
index 1bf135029..211875fff 100644
--- a/MediaBrowser.Model/Progress/TaskProgress.cs
+++ b/MediaBrowser.Model/Progress/TaskProgress.cs
@@ -7,13 +7,13 @@ namespace MediaBrowser.Model.Progress
public class TaskProgress
{
/// <summary>
- /// Gets or sets the current completion percentage
+ /// Gets or sets a description of the actions currently executing
/// </summary>
- public decimal PercentComplete { get; set; }
+ public string Description { get; set; }
/// <summary>
- /// Gets or sets a description of the actions currently executing
+ /// Gets or sets the current completion percentage
/// </summary>
- public string Description { get; set; }
+ public decimal? PercentComplete { get; set; }
}
}
diff --git a/MediaBrowser.Model/Properties/AssemblyInfo.cs b/MediaBrowser.Model/Properties/AssemblyInfo.cs
index 6c64a5de6..a67dc993f 100644
--- a/MediaBrowser.Model/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.Model/Properties/AssemblyInfo.cs
@@ -1,7 +1,5 @@
-using System.Resources;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
+using System.Reflection;
+using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
diff --git a/MediaBrowser.TV/MediaBrowser.TV.csproj b/MediaBrowser.Plugins.DefaultTheme/MediaBrowser.Plugins.DefaultTheme.csproj
index ccece21fe..b15a31cc5 100644
--- a/MediaBrowser.TV/MediaBrowser.TV.csproj
+++ b/MediaBrowser.Plugins.DefaultTheme/MediaBrowser.Plugins.DefaultTheme.csproj
@@ -4,13 +4,15 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{32DFC600-CD2F-4B2D-B39A-3B4C6C32F9B4}</ProjectGuid>
- <OutputType>Library</OutputType>
+ <ProjectGuid>{6E892999-711D-4E24-8BAC-DACF5BFA783A}</ProjectGuid>
+ <OutputType>library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>MediaBrowser.TV</RootNamespace>
- <AssemblyName>MediaBrowser.TV</AssemblyName>
+ <RootNamespace>MediaBrowser.Plugins.DefaultTheme</RootNamespace>
+ <AssemblyName>MediaBrowser.Plugins.DefaultTheme</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -29,37 +31,64 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
- <PropertyGroup>
- <RunPostBuildEvent>Always</RunPostBuildEvent>
- </PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
- <Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
+ <Reference Include="System.Xaml">
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="WindowsBase" />
+ <Reference Include="PresentationCore" />
+ <Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<Compile Include="Plugin.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ <AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
+ <ProjectReference Include="..\..\MediaBrowserServer\MediaBrowser.Common\MediaBrowser.Common.csproj">
<Project>{9142eefa-7570-41e1-bfcc-468bb571af2f}</Project>
<Name>MediaBrowser.Common</Name>
</ProjectReference>
- <ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj">
+ <ProjectReference Include="..\..\MediaBrowserServer\MediaBrowser.Controller\MediaBrowser.Controller.csproj">
<Project>{17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2}</Project>
<Name>MediaBrowser.Controller</Name>
</ProjectReference>
- <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
+ <ProjectReference Include="..\..\MediaBrowserServer\MediaBrowser.Model\MediaBrowser.Model.csproj">
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
<Name>MediaBrowser.Model</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\MediaBrowserUI\MediaBrowser.UI\MediaBrowser.UI.csproj">
+ <Project>{b5ece1fb-618e-420b-9a99-8e972d76920a}</Project>
+ <Name>MediaBrowser.UI</Name>
+ </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
diff --git a/MediaBrowser.Plugins.DefaultTheme/Plugin.cs b/MediaBrowser.Plugins.DefaultTheme/Plugin.cs
new file mode 100644
index 000000000..9dd33f363
--- /dev/null
+++ b/MediaBrowser.Plugins.DefaultTheme/Plugin.cs
@@ -0,0 +1,19 @@
+using MediaBrowser.Common.Plugins;
+using System.ComponentModel.Composition;
+
+namespace MediaBrowser.Plugins.DefaultTheme
+{
+ [Export(typeof(BasePlugin))]
+ public class Plugin : BaseTheme
+ {
+ public override string Name
+ {
+ get { return "Default Theme"; }
+ }
+
+ protected override void InitializeInUi()
+ {
+ base.InitializeInUi();
+ }
+ }
+}
diff --git a/MediaBrowser.Plugins.DefaultTheme/Properties/AssemblyInfo.cs b/MediaBrowser.Plugins.DefaultTheme/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..3d92517da
--- /dev/null
+++ b/MediaBrowser.Plugins.DefaultTheme/Properties/AssemblyInfo.cs
@@ -0,0 +1,55 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("MediaBrowser.Plugins.DefaultTheme")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("MediaBrowser.Plugins.DefaultTheme")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+//In order to begin building localizable applications, set
+//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
+//inside a <PropertyGroup>. For example, if you are using US english
+//in your source files, set the <UICulture> to en-US. Then uncomment
+//the NeutralResourceLanguage attribute below. Update the "en-US" in
+//the line below to match the UICulture setting in the project file.
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly:ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
+
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/MediaBrowser.Plugins.DefaultTheme/Properties/Resources.Designer.cs b/MediaBrowser.Plugins.DefaultTheme/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..da735391a
--- /dev/null
+++ b/MediaBrowser.Plugins.DefaultTheme/Properties/Resources.Designer.cs
@@ -0,0 +1,62 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.17929
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace MediaBrowser.Plugins.DefaultTheme.Properties {
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if ((resourceMan == null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediaBrowser.Plugins.DefaultTheme.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/MediaBrowser.Plugins.DefaultTheme/Properties/Resources.resx b/MediaBrowser.Plugins.DefaultTheme/Properties/Resources.resx
new file mode 100644
index 000000000..ffecec851
--- /dev/null
+++ b/MediaBrowser.Plugins.DefaultTheme/Properties/Resources.resx
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/MediaBrowser.Plugins.DefaultTheme/Properties/Settings.Designer.cs b/MediaBrowser.Plugins.DefaultTheme/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..b99760e3f
--- /dev/null
+++ b/MediaBrowser.Plugins.DefaultTheme/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.17929
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace MediaBrowser.Plugins.DefaultTheme.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/MediaBrowser.Plugins.DefaultTheme/Properties/Settings.settings b/MediaBrowser.Plugins.DefaultTheme/Properties/Settings.settings
new file mode 100644
index 000000000..8f2fd95d6
--- /dev/null
+++ b/MediaBrowser.Plugins.DefaultTheme/Properties/Settings.settings
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile> \ No newline at end of file
diff --git a/MediaBrowser.Plugins.sln b/MediaBrowser.Plugins.sln
new file mode 100644
index 000000000..cd237ebce
--- /dev/null
+++ b/MediaBrowser.Plugins.sln
@@ -0,0 +1,50 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Plugins.DefaultTheme", "MediaBrowser.Plugins.DefaultTheme\MediaBrowser.Plugins.DefaultTheme.csproj", "{6E892999-711D-4E24-8BAC-DACF5BFA783A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Controller", "MediaBrowser.Controller\MediaBrowser.Controller.csproj", "{17E1F4E6-8ABD-4FE5-9ECF-43D4B6087BA2}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.UI", "..\MediaBrowserUI\MediaBrowser.UI\MediaBrowser.UI.csproj", "{B5ECE1FB-618E-420B-9A99-8E972D76920A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Common", "MediaBrowser.Common\MediaBrowser.Common.csproj", "{9142EEFA-7570-41E1-BFCC-468BB571AF2F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Model", "MediaBrowser.Model\MediaBrowser.Model.csproj", "{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.ApiInteraction", "MediaBrowser.ApiInteraction\MediaBrowser.ApiInteraction.csproj", "{921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6E892999-711D-4E24-8BAC-DACF5BFA783A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {17E1F4E6-8ABD-4FE5-9ECF-43D4B6087BA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {17E1F4E6-8ABD-4FE5-9ECF-43D4B6087BA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {17E1F4E6-8ABD-4FE5-9ECF-43D4B6087BA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {17E1F4E6-8ABD-4FE5-9ECF-43D4B6087BA2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B5ECE1FB-618E-420B-9A99-8E972D76920A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B5ECE1FB-618E-420B-9A99-8E972D76920A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B5ECE1FB-618E-420B-9A99-8E972D76920A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B5ECE1FB-618E-420B-9A99-8E972D76920A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {921C0F64-FDA7-4E9F-9E73-0CB0EEDB2422}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/MediaBrowser.ServerApplication/App.xaml.cs b/MediaBrowser.ServerApplication/App.xaml.cs
index db229905d..41fb8f24e 100644
--- a/MediaBrowser.ServerApplication/App.xaml.cs
+++ b/MediaBrowser.ServerApplication/App.xaml.cs
@@ -1,50 +1,57 @@
-using System;
+using MediaBrowser.Common.Kernel;
+using MediaBrowser.Common.UI;
+using MediaBrowser.Controller;
+using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
-using MediaBrowser.Common.Kernel;
-using MediaBrowser.Common.UI;
-using MediaBrowser.Controller;
-using Microsoft.Shell;
namespace MediaBrowser.ServerApplication
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
- public partial class App : BaseApplication, ISingleInstanceApp
+ public partial class App : BaseApplication, IApplication
{
- private const string Unique = "MediaBrowser3";
-
[STAThread]
public static void Main()
{
- if (SingleInstance<App>.InitializeAsFirstInstance(Unique))
- {
- var application = new App();
- application.InitializeComponent();
+ RunApplication<App>("MediaBrowserServer");
+ }
- application.Run();
+ protected override void OnSecondInstanceLaunched(IList<string> args)
+ {
+ base.OnSecondInstanceLaunched(args);
- // Allow single instance code to perform cleanup operations
- SingleInstance<App>.Cleanup();
- }
+ OpenDashboard();
+ InitializeComponent();
+ }
+
+ public static void OpenDashboard()
+ {
+ OpenUrl("http://localhost:" + Kernel.Instance.Configuration.HttpServerPortNumber + "/mediabrowser/dashboard/index.html");
}
- #region ISingleInstanceApp Members
- public bool SignalExternalCommandLineArgs(IList<string> args)
+ public static void OpenUrl(string url)
{
- OpenDashboard();
+ var process = new Process
+ {
+ StartInfo = new ProcessStartInfo
+ {
+ FileName = url
+ },
- return true;
+ EnableRaisingEvents = true
+ };
+
+ process.Exited += ProcessExited;
+
+ process.Start();
}
- #endregion
- public static void OpenDashboard()
+ static void ProcessExited(object sender, EventArgs e)
{
- using (Process process = Process.Start("http://localhost:" + Kernel.Instance.Configuration.HttpServerPortNumber + "/mediabrowser/dashboard/index.html"))
- {
- }
+ (sender as Process).Dispose();
}
protected override IKernel InstantiateKernel()
diff --git a/MediaBrowser.ServerApplication/MainWindow.xaml b/MediaBrowser.ServerApplication/MainWindow.xaml
index e5c848752..ade1caee9 100644
--- a/MediaBrowser.ServerApplication/MainWindow.xaml
+++ b/MediaBrowser.ServerApplication/MainWindow.xaml
@@ -4,16 +4,37 @@
xmlns:tb="http://www.hardcodet.net/taskbar"
Title="MainWindow" Height="350" Width="525" AllowsTransparency="True" Background="Transparent" WindowStyle="None" ShowInTaskbar="False">
<Grid>
- <tb:TaskbarIcon Name="MbTaskbarIcon" IconSource="/Resources/Images/Icon.ico" ToolTipText="MediaBrowser Server">
+ <tb:TaskbarIcon Name="MbTaskbarIcon" ToolTipText="MediaBrowser Server">
<tb:TaskbarIcon.ContextMenu>
<ContextMenu Background="White">
<MenuItem Name="cmOpenDashboard" Header="Open Dashboard" Click="cmOpenDashboard_click"/>
+ <MenuItem Name="cmdReloadServer" Header="Reload Server" Click="cmdReloadServer_click"/>
<MenuItem Name="cmVisitCT" Header="Visit Community Tracker" Click="cmVisitCT_click"/>
<Separator/>
<MenuItem Name="cmExit" Header="Exit" Click="cmExit_click"/>
</ContextMenu>
- </tb:TaskbarIcon.ContextMenu>
+ </tb:TaskbarIcon.ContextMenu>
+
+ <tb:TaskbarIcon.Style>
+ <Style TargetType="{x:Type tb:TaskbarIcon}">
+ <Setter Property="IconSource" Value="/Resources/Images/icon.ico" />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding LoadingImageIndex}" Value="1">
+ <Setter Property="IconSource" Value="/Resources/Images/loadingIcon1.ico" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding LoadingImageIndex}" Value="2">
+ <Setter Property="IconSource" Value="/Resources/Images/loadingIcon2.ico" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding LoadingImageIndex}" Value="3">
+ <Setter Property="IconSource" Value="/Resources/Images/loadingIcon3.ico" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding LoadingImageIndex}" Value="4">
+ <Setter Property="IconSource" Value="/Resources/Images/loadingIcon4.ico" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </tb:TaskbarIcon.Style>
</tb:TaskbarIcon>
</Grid>
diff --git a/MediaBrowser.ServerApplication/MainWindow.xaml.cs b/MediaBrowser.ServerApplication/MainWindow.xaml.cs
index 2e087a791..3839dc52e 100644
--- a/MediaBrowser.ServerApplication/MainWindow.xaml.cs
+++ b/MediaBrowser.ServerApplication/MainWindow.xaml.cs
@@ -1,4 +1,7 @@
-using System.Diagnostics;
+using Hardcodet.Wpf.TaskbarNotification;
+using System;
+using System.ComponentModel;
+using System.Threading;
using System.Windows;
namespace MediaBrowser.ServerApplication
@@ -6,12 +9,38 @@ namespace MediaBrowser.ServerApplication
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
- public partial class MainWindow : Window
+ public partial class MainWindow : Window, INotifyPropertyChanged
{
public MainWindow()
{
InitializeComponent();
- //LoadKernel();
+ Loaded += MainWindow_Loaded;
+ }
+
+ void MainWindow_Loaded(object sender, RoutedEventArgs e)
+ {
+ DataContext = this;
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ public void OnPropertyChanged(String info)
+ {
+ if (PropertyChanged != null)
+ {
+ PropertyChanged(this, new PropertyChangedEventArgs(info));
+ }
+ }
+
+ private int _loadingImageIndex;
+ public int LoadingImageIndex
+ {
+ get { return _loadingImageIndex; }
+ set
+ {
+ _loadingImageIndex = value;
+ OnPropertyChanged("LoadingImageIndex");
+ }
}
#region Context Menu events
@@ -23,9 +52,7 @@ namespace MediaBrowser.ServerApplication
private void cmVisitCT_click(object sender, RoutedEventArgs e)
{
- using (Process process = Process.Start("http://community.mediabrowser.tv/"))
- {
- }
+ App.OpenUrl("http://community.mediabrowser.tv/");
}
private void cmExit_click(object sender, RoutedEventArgs e)
@@ -33,6 +60,36 @@ namespace MediaBrowser.ServerApplication
Close();
}
+ private async void cmdReloadServer_click(object sender, RoutedEventArgs e)
+ {
+ MbTaskbarIcon.ShowBalloonTip("Media Browser is reloading", "Please wait...", BalloonIcon.Info);
+
+ LoadingImageIndex = 0;
+
+ Timer timer = new Timer(LoadingIconTimerCallback, null, 0, 250);
+
+ await (Application.Current as App).ReloadKernel().ConfigureAwait(false);
+
+ timer.Dispose();
+
+ LoadingImageIndex = 0;
+ }
+
+ private void LoadingIconTimerCallback(object stateInfo)
+ {
+ const int numImages = 4;
+
+ if (LoadingImageIndex < numImages)
+ {
+ LoadingImageIndex++;
+ }
+ else
+ {
+ LoadingImageIndex = 1;
+ }
+ }
+
#endregion
+
}
}
diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
index 00fdfbfef..de20c9256 100644
--- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
+++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
@@ -37,7 +37,7 @@
<StartupObject>MediaBrowser.ServerApplication.App</StartupObject>
</PropertyGroup>
<PropertyGroup>
- <ApplicationIcon>Resources\Images\Icon.ico</ApplicationIcon>
+ <ApplicationIcon>Resources\Images\icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Hardcodet.Wpf.TaskbarNotification">
@@ -45,6 +45,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
@@ -120,9 +121,16 @@
<Name>MediaBrowser.Model</Name>
</ProjectReference>
</ItemGroup>
- <ItemGroup />
<ItemGroup>
- <Resource Include="Resources\Images\Icon.ico" />
+ <Resource Include="Resources\Images\icon.ico" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Resources\Images\loadingIcon1.ico" />
+ <Resource Include="Resources\Images\loadingIcon2.ico" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Resources\Images\loadingIcon3.ico" />
+ <Resource Include="Resources\Images\loadingIcon4.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
diff --git a/MediaBrowser.ServerApplication/Properties/AssemblyInfo.cs b/MediaBrowser.ServerApplication/Properties/AssemblyInfo.cs
index 09882706f..35b3c6f98 100644
--- a/MediaBrowser.ServerApplication/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.ServerApplication/Properties/AssemblyInfo.cs
@@ -1,6 +1,4 @@
using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
diff --git a/MediaBrowser.ServerApplication/Resources/Images/Icon.ico b/MediaBrowser.ServerApplication/Resources/Images/Icon.ico
index f8accfab2..1541dabdc 100644
--- a/MediaBrowser.ServerApplication/Resources/Images/Icon.ico
+++ b/MediaBrowser.ServerApplication/Resources/Images/Icon.ico
Binary files differ
diff --git a/MediaBrowser.ServerApplication/Resources/Images/loadingIcon1.ico b/MediaBrowser.ServerApplication/Resources/Images/loadingIcon1.ico
new file mode 100644
index 000000000..f7c2f2783
--- /dev/null
+++ b/MediaBrowser.ServerApplication/Resources/Images/loadingIcon1.ico
Binary files differ
diff --git a/MediaBrowser.ServerApplication/Resources/Images/loadingIcon2.ico b/MediaBrowser.ServerApplication/Resources/Images/loadingIcon2.ico
new file mode 100644
index 000000000..0f20c2b7a
--- /dev/null
+++ b/MediaBrowser.ServerApplication/Resources/Images/loadingIcon2.ico
Binary files differ
diff --git a/MediaBrowser.ServerApplication/Resources/Images/loadingIcon3.ico b/MediaBrowser.ServerApplication/Resources/Images/loadingIcon3.ico
new file mode 100644
index 000000000..bc915ea9f
--- /dev/null
+++ b/MediaBrowser.ServerApplication/Resources/Images/loadingIcon3.ico
Binary files differ
diff --git a/MediaBrowser.ServerApplication/Resources/Images/loadingIcon4.ico b/MediaBrowser.ServerApplication/Resources/Images/loadingIcon4.ico
new file mode 100644
index 000000000..183049b06
--- /dev/null
+++ b/MediaBrowser.ServerApplication/Resources/Images/loadingIcon4.ico
Binary files differ
diff --git a/MediaBrowser.TV/Plugin.cs b/MediaBrowser.TV/Plugin.cs
deleted file mode 100644
index c4ae87cae..000000000
--- a/MediaBrowser.TV/Plugin.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System;
-using System.ComponentModel.Composition;
-using MediaBrowser.Common.Plugins;
-using MediaBrowser.Controller;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Plugins;
-using MediaBrowser.TV.Entities;
-
-namespace MediaBrowser.TV
-{
- [Export(typeof(BasePlugin))]
- public class Plugin : BaseGenericPlugin<BasePluginConfiguration>
- {
- public override string Name
- {
- get { return "TV"; }
- }
-
- protected override void InitializeOnServer()
- {
- Kernel.Instance.ItemController.PreBeginResolvePath += ItemController_PreBeginResolvePath;
- }
-
- protected override void DisposeOnServer()
- {
- Kernel.Instance.ItemController.PreBeginResolvePath -= ItemController_PreBeginResolvePath;
- }
-
- void ItemController_PreBeginResolvePath(object sender, PreBeginResolveEventArgs e)
- {
- // Don't try and resolve files with the metadata folder
- if (System.IO.Path.GetFileName(e.Path).Equals("metadata", StringComparison.OrdinalIgnoreCase) && e.IsDirectory)
- {
- if (e.Parent is Season || e.Parent is Series)
- {
- e.Cancel = true;
- }
- }
- }
- }
-}
diff --git a/MediaBrowser.TV/Properties/AssemblyInfo.cs b/MediaBrowser.TV/Properties/AssemblyInfo.cs
deleted file mode 100644
index ebc70e3a2..000000000
--- a/MediaBrowser.TV/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("MediaBrowser.TV")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("MediaBrowser.TV")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("1646eb9e-3f4f-46ea-b1e9-09bc85c1143a")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/MediaBrowser.WebDashboard/Plugin.cs b/MediaBrowser.WebDashboard/Plugin.cs
index 3317c7f16..95727a06f 100644
--- a/MediaBrowser.WebDashboard/Plugin.cs
+++ b/MediaBrowser.WebDashboard/Plugin.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.Composition;
namespace MediaBrowser.WebDashboard
{
[Export(typeof(BasePlugin))]
- public class Plugin : BaseGenericPlugin<BasePluginConfiguration>
+ public class Plugin : BasePlugin
{
public override string Name
{
diff --git a/MediaBrowser.WebDashboard/Properties/AssemblyInfo.cs b/MediaBrowser.WebDashboard/Properties/AssemblyInfo.cs
index 17aca6c5c..a33fd4462 100644
--- a/MediaBrowser.WebDashboard/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.WebDashboard/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
diff --git a/UpgradeLog.XML b/UpgradeLog.XML
deleted file mode 100644
index f3acc6966..000000000
--- a/UpgradeLog.XML
+++ /dev/null
Binary files differ
diff --git a/UpgradeLog.htm b/UpgradeLog.htm
deleted file mode 100644
index 383ccd351..000000000
--- a/UpgradeLog.htm
+++ /dev/null
Binary files differ
diff --git a/_UpgradeReport_Files/UpgradeReport.css b/_UpgradeReport_Files/UpgradeReport.css
deleted file mode 100644
index 1f0cd1ffc..000000000
--- a/_UpgradeReport_Files/UpgradeReport.css
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Body style, for the entire document */
-body
-{
- background: #F3F3F4;
- color: #1E1E1F;
- font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
- padding: 0;
- margin: 0;
-}
-
-/* Header1 style, used for the main title */
-h1
-{
- padding: 10px 0px 10px 10px;
- font-size: 21pt;
- background-color: #E2E2E2;
- border-bottom: 1px #C1C1C2 solid;
- color: #201F20;
- margin: 0;
- font-weight: normal;
-}
-
-/* Header2 style, used for "Overview" and other sections */
-h2
-{
- font-size: 18pt;
- font-weight: normal;
- padding: 15px 0 5px 0;
- margin: 0;
-}
-
-/* Header3 style, used for sub-sections, such as project name */
-h3
-{
- font-weight: normal;
- font-size: 15pt;
- margin: 0;
- padding: 15px 0 5px 0;
- background-color: transparent;
-}
-
-/* Color all hyperlinks one color */
-a
-{
- color: #1382CE;
-}
-
-/* Table styles */
-table
-{
- border-spacing: 0 0;
- border-collapse: collapse;
- font-size: 10pt;
-}
-
-table th
-{
- background: #E7E7E8;
- text-align: left;
- text-decoration: none;
- font-weight: normal;
- padding: 3px 6px 3px 6px;
-}
-
-table td
-{
- vertical-align: top;
- padding: 3px 6px 5px 5px;
- margin: 0px;
- border: 1px solid #E7E7E8;
- background: #F7F7F8;
-}
-
-/* Local link is a style for hyperlinks that link to file:/// content, there are lots so color them as 'normal' text until the user mouse overs */
-.localLink
-{
- color: #1E1E1F;
- background: #EEEEED;
- text-decoration: none;
-}
-
-.localLink:hover
-{
- color: #1382CE;
- background: #FFFF99;
- text-decoration: none;
-}
-
-/* Center text, used in the over views cells that contain message level counts */
-.textCentered
-{
- text-align: center;
-}
-
-/* The message cells in message tables should take up all avaliable space */
-.messageCell
-{
- width: 100%;
-}
-
-/* Padding around the content after the h1 */
-#content
-{
- padding: 0px 12px 12px 12px;
-}
-
-/* The overview table expands to width, with a max width of 97% */
-#overview table
-{
- width: auto;
- max-width: 75%;
-}
-
-/* The messages tables are always 97% width */
-#messages table
-{
- width: 97%;
-} \ No newline at end of file
diff --git a/_UpgradeReport_Files/UpgradeReport.xslt b/_UpgradeReport_Files/UpgradeReport.xslt
deleted file mode 100644
index acf18c33f..000000000
--- a/_UpgradeReport_Files/UpgradeReport.xslt
+++ /dev/null
@@ -1,538 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl='urn:schemas-microsoft-com:xslt'>
- <xsl:output omit-xml-declaration="yes" />
-
- <!-- Keys -->
- <xsl:key name="ProjectKey" match="Event" use="@Project" />
-
- <!-- String split template -->
- <xsl:template name="SplitString">
- <xsl:param name="source" select="''" />
- <xsl:param name="separator" select="','" />
- <xsl:if test="not($source = '' or $separator = '')">
- <xsl:variable name="head" select="substring-before(concat($source, $separator), $separator)" />
- <xsl:variable name="tail" select="substring-after($source, $separator)" />
- <part>
- <xsl:value-of select="$head"/>
- </part>
- <xsl:call-template name="SplitString">
- <xsl:with-param name="source" select="$tail" />
- <xsl:with-param name="separator" select="$separator" />
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <!-- Intermediate Templates -->
- <xsl:template match="UpgradeReport" mode="ProjectOverviewXML">
- <Projects>
- <xsl:for-each select="Event[generate-id(.) = generate-id(key('ProjectKey', @Project))]">
- <Project>
- <xsl:variable name="pNode" select="current()" />
- <xsl:variable name="errorCount" select="count(../Event[@Project = current()/@Project and @ErrorLevel=2])" />
- <xsl:variable name="warningCount" select="count(../Event[@Project = current()/@Project and @ErrorLevel=1])" />
- <xsl:variable name="messageCount" select="count(../Event[@Project = current()/@Project and @ErrorLevel=0])" />
- <xsl:variable name="pathSplitSeparator">
- <xsl:text>\</xsl:text>
- </xsl:variable>
- <xsl:variable name="projectName">
- <xsl:choose>
- <xsl:when test="@Project = ''">Solution</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@Project"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:attribute name="IsSolution">
- <xsl:value-of select="@Project = ''"/>
- </xsl:attribute>
- <xsl:attribute name="Project">
- <xsl:value-of select="$projectName"/>
- </xsl:attribute>
- <xsl:attribute name="ProjectDisplayName">
- <!-- Sometimes it is possible to have project name set to a path over a real project name,
- we split the string on '\' and if we end up with >1 part in the resulting tokens set
- we format the ProjectDisplayName as ..\prior\last -->
- <xsl:variable name="pathTokens">
- <xsl:call-template name="SplitString">
- <xsl:with-param name="source" select="$projectName" />
- <xsl:with-param name="separator" select="$pathSplitSeparator" />
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="count(msxsl:node-set($pathTokens)/part) > 1">
- <xsl:value-of select="concat('..', $pathSplitSeparator, msxsl:node-set($pathTokens)/part[last() - 1], $pathSplitSeparator, msxsl:node-set($pathTokens)/part[last()])"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$projectName"/>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:attribute>
- <xsl:attribute name="ProjectSafeName">
- <xsl:value-of select="translate($projectName, '\', '-')"/>
- </xsl:attribute>
- <xsl:attribute name="Solution">
- <xsl:value-of select="/UpgradeReport/Properties/Property[@Name='Solution']/@Value"/>
- </xsl:attribute>
- <xsl:attribute name="Source">
- <xsl:value-of select="@Source"/>
- </xsl:attribute>
- <xsl:attribute name="Status">
- <xsl:choose>
- <xsl:when test="$errorCount > 0">Error</xsl:when>
- <xsl:when test="$warningCount > 0">Warning</xsl:when>
- <xsl:otherwise>Success</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:attribute name="ErrorCount">
- <xsl:value-of select="$errorCount" />
- </xsl:attribute>
- <xsl:attribute name="WarningCount">
- <xsl:value-of select="$warningCount" />
- </xsl:attribute>
- <xsl:attribute name="MessageCount">
- <xsl:value-of select="$messageCount" />
- </xsl:attribute>
- <xsl:attribute name="TotalCount">
- <xsl:value-of select="$errorCount + $warningCount + $messageCount"/>
- </xsl:attribute>
- <xsl:for-each select="../Event[@Project = $pNode/@Project and @ErrorLevel=3]">
- <ConversionStatus>
- <xsl:value-of select="@Description"/>
- </ConversionStatus>
- </xsl:for-each>
- <Messages>
- <xsl:for-each select="../Event[@Project = $pNode/@Project and @ErrorLevel&lt;3]">
- <Message>
- <xsl:attribute name="Level">
- <xsl:value-of select="@ErrorLevel" />
- </xsl:attribute>
- <xsl:attribute name="Status">
- <xsl:choose>
- <xsl:when test="@ErrorLevel = 0">Message</xsl:when>
- <xsl:when test="@ErrorLevel = 1">Warning</xsl:when>
- <xsl:when test="@ErrorLevel = 2">Error</xsl:when>
- <xsl:otherwise>Message</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:attribute name="Source">
- <xsl:value-of select="@Source"/>
- </xsl:attribute>
- <xsl:attribute name="Message">
- <xsl:value-of select="@Description"/>
- </xsl:attribute>
- </Message>
- </xsl:for-each>
- </Messages>
- </Project>
- </xsl:for-each>
- </Projects>
- </xsl:template>
-
-
-
- <!-- Project Overview template -->
- <xsl:template match="Projects" mode="ProjectOverview">
-
- <table>
- <tr>
- <th></th>
- <th _locID="ProjectTableHeader">Project</th>
- <th _locID="PathTableHeader">Path</th>
- <th _locID="ErrorsTableHeader">Errors</th>
- <th _locID="WarningsTableHeader">Warnings</th>
- <th _locID="MessagesTableHeader">Messages</th>
- </tr>
-
- <xsl:for-each select="Project">
-
- <xsl:sort select="@ErrorCount" order="descending" />
- <xsl:sort select="@WarningCount" order="descending" />
- <!-- Always make solution last within a group -->
- <xsl:sort select="@IsSolution" order="ascending" />
- <xsl:sort select="@ProjectSafeName" order="ascending" />
-
- <tr>
- <td>
- <img width="16" height="16">
- <xsl:attribute name="src">
- <xsl:choose>
- <xsl:when test="@Status = 'Error'">_UpgradeReport_Files\UpgradeReport_Error.png</xsl:when>
- <xsl:when test="@Status = 'Warning'">_UpgradeReport_Files\UpgradeReport_Warning.png</xsl:when>
- <xsl:when test="@Status = 'Success'">_UpgradeReport_Files\UpgradeReport_Success.png</xsl:when>
- </xsl:choose>
- </xsl:attribute>
- <xsl:attribute name="alt">
- <xsl:value-of select="@Status" />
- </xsl:attribute>
- </img>
- </td>
- <td>
- <strong>
- <a>
- <xsl:attribute name="href">
- <xsl:value-of select="concat('#', @ProjectSafeName)"/>
- </xsl:attribute>
- <xsl:value-of select="@ProjectDisplayName" />
- </a>
- </strong>
- </td>
- <td>
- <xsl:value-of select="@Source" />
- </td>
- <td class="textCentered">
- <a>
- <xsl:if test="@ErrorCount > 0">
- <xsl:attribute name="href">
- <xsl:value-of select="concat('#', @ProjectSafeName, 'Error')"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:value-of select="@ErrorCount" />
- </a>
- </td>
- <td class="textCentered">
- <a>
- <xsl:if test="@WarningCount > 0">
- <xsl:attribute name="href">
- <xsl:value-of select="concat('#', @ProjectSafeName, 'Warning')"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:value-of select="@WarningCount" />
- </a>
- </td>
- <td class="textCentered">
- <a href="#">
- <xsl:if test="@MessageCount > 0">
- <xsl:attribute name="onclick">
- <xsl:variable name="apos">
- <xsl:text>'</xsl:text>
- </xsl:variable>
- <xsl:variable name="JS" select="concat('ScrollToFirstVisibleMessage(', $apos, @ProjectSafeName, $apos, ')')" />
- <xsl:value-of select="concat($JS, '; return false;')"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:value-of select="@MessageCount" />
- </a>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </xsl:template>
-
- <!-- Show messages row -->
- <xsl:template match="Project" mode="ProjectShowMessages">
- <tr>
- <xsl:attribute name="name">
- <xsl:value-of select="concat('MessageRowHeaderShow', @ProjectSafeName)"/>
- </xsl:attribute>
- <td>
- <img width="16" height="16" src="_UpgradeReport_Files\UpgradeReport_Information.png" />
- </td>
- <td class="messageCell">
- <xsl:variable name="apos">
- <xsl:text>'</xsl:text>
- </xsl:variable>
- <xsl:variable name="toggleRowsJS" select="concat('ToggleMessageVisibility(', $apos, @ProjectSafeName, $apos, ')')" />
-
- <a _locID="ShowAdditionalMessages" href="#">
- <xsl:attribute name="name">
- <xsl:value-of select="concat(@ProjectSafeName, 'Message')"/>
- </xsl:attribute>
- <xsl:attribute name="onclick">
- <xsl:value-of select="concat($toggleRowsJS, '; return false;')"/>
- </xsl:attribute>
- Show <xsl:value-of select="@MessageCount" /> additional messages
- </a>
- </td>
- </tr>
- </xsl:template>
-
- <!-- Hide messages row -->
- <xsl:template match="Project" mode="ProjectHideMessages">
- <tr style="display: none">
- <xsl:attribute name="name">
- <xsl:value-of select="concat('MessageRowHeaderHide', @ProjectSafeName)"/>
- </xsl:attribute>
- <td>
- <img width="16" height="16" src="_UpgradeReport_Files\UpgradeReport_Information.png" />
- </td>
- <td class="messageCell">
- <xsl:variable name="apos">
- <xsl:text>'</xsl:text>
- </xsl:variable>
- <xsl:variable name="toggleRowsJS" select="concat('ToggleMessageVisibility(', $apos, @ProjectSafeName, $apos, ')')" />
-
- <a _locID="HideAdditionalMessages" href="#">
- <xsl:attribute name="name">
- <xsl:value-of select="concat(@ProjectSafeName, 'Message')"/>
- </xsl:attribute>
- <xsl:attribute name="onclick">
- <xsl:value-of select="concat($toggleRowsJS, '; return false;')"/>
- </xsl:attribute>
- Hide <xsl:value-of select="@MessageCount" /> additional messages
- </a>
- </td>
- </tr>
- </xsl:template>
-
- <!-- Message row templates -->
- <xsl:template match="Message">
- <tr>
- <xsl:attribute name="name">
- <xsl:value-of select="concat(@Status, 'RowClass', ../../@ProjectSafeName)"/>
- </xsl:attribute>
-
- <xsl:if test="@Level = 0">
- <xsl:attribute name="style">display: none</xsl:attribute>
- </xsl:if>
- <td>
- <a>
- <xsl:attribute name="name">
- <xsl:value-of select="concat(../../@ProjectSafeName, @Status)"/>
- </xsl:attribute>
- </a>
- <img width="16" height="16">
- <xsl:attribute name="src">
- <xsl:choose>
- <xsl:when test="@Status = 'Error'">_UpgradeReport_Files\UpgradeReport_Error.png</xsl:when>
- <xsl:when test="@Status = 'Warning'">_UpgradeReport_Files\UpgradeReport_Warning.png</xsl:when>
- <xsl:when test="@Status = 'Message'">_UpgradeReport_Files\UpgradeReport_Information.png</xsl:when>
- </xsl:choose>
- </xsl:attribute>
- <xsl:attribute name="alt">
- <xsl:value-of select="@Status" />
- </xsl:attribute>
- </img>
- </td>
- <td class="messageCell">
- <strong>
- <xsl:value-of select="@Source"/>:
- </strong>
- <span>
- <xsl:value-of select="@Message"/>
- </span>
- </td>
- </tr>
- </xsl:template>
-
- <!-- Project Details Template -->
- <xsl:template match="Projects" mode="ProjectDetails">
-
- <xsl:for-each select="Project">
- <xsl:sort select="@ErrorCount" order="descending" />
- <xsl:sort select="@WarningCount" order="descending" />
- <!-- Always make solution last within a group -->
- <xsl:sort select="@IsSolution" order="ascending" />
- <xsl:sort select="@ProjectSafeName" order="ascending" />
-
- <a>
- <xsl:attribute name="name">
- <xsl:value-of select="@ProjectSafeName"/>
- </xsl:attribute>
- </a>
- <h3>
- <xsl:value-of select="@ProjectDisplayName"/>
- </h3>
-
- <table>
- <tr>
- <xsl:attribute name="id">
- <xsl:value-of select="concat(@ProjectSafeName, 'HeaderRow')"/>
- </xsl:attribute>
- <th></th>
- <th class="messageCell" _locID="MessageTableHeader">Message</th>
- </tr>
-
- <!-- Errors and warnings -->
- <xsl:for-each select="Messages/Message[@Level &gt; 0]">
- <xsl:sort select="@Level" order="descending" />
- <xsl:apply-templates select="." />
- </xsl:for-each>
-
- <xsl:if test="@MessageCount > 0">
- <xsl:apply-templates select="." mode="ProjectShowMessages" />
- </xsl:if>
-
- <!-- Messages -->
- <xsl:for-each select="Messages/Message[@Level = 0]">
- <xsl:apply-templates select="." />
- </xsl:for-each>
-
- <xsl:choose>
- <!-- Additional row as a 'place holder' for 'Show/Hide' additional messages -->
- <xsl:when test="@MessageCount > 0">
- <xsl:apply-templates select="." mode="ProjectHideMessages" />
- </xsl:when>
- <!-- No messages at all, show blank row -->
- <xsl:when test="@TotalCount = 0">
- <tr>
- <td>
- <img width="16" height="16" src="_UpgradeReport_Files\UpgradeReport_Information.png" />
- </td>
- <td class="messageCell" _locID="NoMessagesRow">
- <xsl:value-of select="@ProjectDisplayName" /> logged no messages.
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- </table>
- </xsl:for-each>
- </xsl:template>
-
- <!-- Document, matches "UpgradeReport" -->
- <xsl:template match="UpgradeReport">
- <!-- Output doc type the 'Mark of the web' which disabled prompting to run JavaScript from local HTML Files in IE -->
- <!-- NOTE: The whitespace around the 'Mark of the web' is important it must be exact -->
- <xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE html>
-<!-- saved from url=(0014)about:internet -->
-]]>
- </xsl:text>
- <html>
- <head>
- <meta content="en-us" http-equiv="Content-Language" />
- <meta content="text/html; charset=utf-16" http-equiv="Content-Type" />
- <link type="text/css" rel="stylesheet" href="_UpgradeReport_Files\UpgradeReport.css" />
- <title _locID="ConversionReport0">
- Migration Report
- </title>
-
- <script type="text/javascript" language="javascript">
- <xsl:text disable-output-escaping="yes">
- <![CDATA[
-
- // Startup
- // Hook up the the loaded event for the document/window, to linkify the document content
- var startupFunction = function() { linkifyElement("messages"); };
-
- if(window.attachEvent)
- {
- window.attachEvent('onload', startupFunction);
- }
- else if (window.addEventListener)
- {
- window.addEventListener('load', startupFunction, false);
- }
- else
- {
- document.addEventListener('load', startupFunction, false);
- }
-
- // Toggles the visibility of table rows with the specified name
- function toggleTableRowsByName(name)
- {
- var allRows = document.getElementsByTagName('tr');
- for (i=0; i < allRows.length; i++)
- {
- var currentName = allRows[i].getAttribute('name');
- if(!!currentName && currentName.indexOf(name) == 0)
- {
- var isVisible = allRows[i].style.display == '';
- isVisible ? allRows[i].style.display = 'none' : allRows[i].style.display = '';
- }
- }
- }
-
- function scrollToFirstVisibleRow(name)
- {
- var allRows = document.getElementsByTagName('tr');
- for (i=0; i < allRows.length; i++)
- {
- var currentName = allRows[i].getAttribute('name');
- var isVisible = allRows[i].style.display == '';
- if(!!currentName && currentName.indexOf(name) == 0 && isVisible)
- {
- allRows[i].scrollIntoView(true);
- return true;
- }
- }
-
- return false;
- }
-
- // Linkifies the specified text content, replaces candidate links with html links
- function linkify(text)
- {
- if(!text || 0 === text.length)
- {
- return text;
- }
-
- // Find {DriveLetter}:\Something or \\{uncshare}\something strings and replace them with file:/// links
- // It expects that a path ends in .extension, and that that extension does not have a space within it,
- // it does this as not to greedily match in the case of "Text C:\foo\file.txt some other text"
- var filePath = /([A-z]\:|\\{2}[A-z].+)\\([^<]+)\.([^<\s]+)/gi;
-
- // Find http, https and ftp links and replace them with hyper links
- var urlLink = /(http|https|ftp)\:\/\/[a-zA-Z0-9\-\.]+(:[a-zA-Z0-9]*)?\/?([a-zA-Z0-9\-\._\?\,\/\\\+&%\$#\=~;\{\}])*/gi;
-
- return text.replace(filePath, '<a class="localLink" href="file:///$&">$&</a>')
- .replace(urlLink, '<a href="$&">$&</a>') ;
- }
-
- // Linkifies the specified element by ID
- function linkifyElement(id)
- {
- var element = document.getElementById(id);
- if(!!element)
- {
- element.innerHTML = linkify(element.innerHTML);
- }
- }
-
- function ToggleMessageVisibility(projectName)
- {
- if(!projectName || 0 === projectName.length)
- {
- return;
- }
-
- toggleTableRowsByName("MessageRowClass" + projectName);
- toggleTableRowsByName('MessageRowHeaderShow' + projectName);
- toggleTableRowsByName('MessageRowHeaderHide' + projectName);
- }
-
- function ScrollToFirstVisibleMessage(projectName)
- {
- if(!projectName || 0 === projectName.length)
- {
- return;
- }
-
- // First try the 'Show messages' row
- if(!scrollToFirstVisibleRow('MessageRowHeaderShow' + projectName))
- {
- // Failed to find a visible row for 'Show messages', try an actual message row
- scrollToFirstVisibleRow('MessageRowClass' + projectName);
- }
- }
- ]]>
- </xsl:text>
- </script>
- </head>
- <body>
- <h1 _locID="ConversionReport">
- Migration Report - <xsl:value-of select="Properties/Property[@Name='Solution']/@Value"/>
- </h1>
-
- <div id="content">
- <h2 _locID="OverviewTitle">Overview</h2>
- <xsl:variable name="projectOverview">
- <xsl:apply-templates select="self::node()" mode="ProjectOverviewXML" />
- </xsl:variable>
-
- <div id="overview">
- <xsl:apply-templates select="msxsl:node-set($projectOverview)/*" mode="ProjectOverview" />
- </div>
-
- <h2 _locID="SolutionAndProjectsTitle">Solution and projects</h2>
-
- <div id="messages">
- <xsl:apply-templates select="msxsl:node-set($projectOverview)/*" mode="ProjectDetails" />
- </div>
- </div>
- </body>
- </html>
- </xsl:template>
-
-</xsl:stylesheet> \ No newline at end of file
diff --git a/_UpgradeReport_Files/UpgradeReport_Error.png b/_UpgradeReport_Files/UpgradeReport_Error.png
deleted file mode 100644
index 2ecbdf3c9..000000000
--- a/_UpgradeReport_Files/UpgradeReport_Error.png
+++ /dev/null
Binary files differ
diff --git a/_UpgradeReport_Files/UpgradeReport_Information.png b/_UpgradeReport_Files/UpgradeReport_Information.png
deleted file mode 100644
index adefdc716..000000000
--- a/_UpgradeReport_Files/UpgradeReport_Information.png
+++ /dev/null
Binary files differ
diff --git a/_UpgradeReport_Files/UpgradeReport_Success.png b/_UpgradeReport_Files/UpgradeReport_Success.png
deleted file mode 100644
index c8c27bcf0..000000000
--- a/_UpgradeReport_Files/UpgradeReport_Success.png
+++ /dev/null
Binary files differ
diff --git a/_UpgradeReport_Files/UpgradeReport_Warning.png b/_UpgradeReport_Files/UpgradeReport_Warning.png
deleted file mode 100644
index 7197e0304..000000000
--- a/_UpgradeReport_Files/UpgradeReport_Warning.png
+++ /dev/null
Binary files differ