Clean Up Model (EpisodeFileOrganizationRequest)

This commit is contained in:
softworkz 2016-02-27 04:18:47 +01:00
parent 5bc7089990
commit 35fb164c1d
2 changed files with 20 additions and 28 deletions

View File

@ -157,6 +157,24 @@ namespace MediaBrowser.Api.Library
public void Post(OrganizeEpisode request)
{
var dicNewProviderIds = new Dictionary<string, string>();
if (!string.IsNullOrEmpty(request.NewSeriesProviderIds))
{
var str = request.NewSeriesProviderIds.Replace("{", "").Replace("}", "").Replace("\"", "");
foreach (var item in str.Split(','))
{
var itemArr = item.Split(':');
if (itemArr.Length > 1)
{
var key = itemArr[0].Trim();
var val = itemArr[1].Trim();
dicNewProviderIds.Add(key, val);
}
}
}
var task = _iFileOrganizationService.PerformEpisodeOrganization(new EpisodeFileOrganizationRequest
{
EndingEpisodeNumber = request.EndingEpisodeNumber,
@ -167,7 +185,7 @@ namespace MediaBrowser.Api.Library
SeriesId = request.SeriesId,
NewSeriesName = request.NewSeriesName,
NewSeriesYear = request.NewSeriesYear,
NewSeriesProviderIds = request.NewSeriesProviderIds,
NewSeriesProviderIdsDictionary = dicNewProviderIds,
TargetFolder = request.TargetFolder
});

View File

@ -19,34 +19,8 @@ namespace MediaBrowser.Model.FileOrganization
public string NewSeriesYear { get; set; }
public string NewSeriesProviderIds { get; set; }
public string TargetFolder { get; set; }
public Dictionary<string, string> NewSeriesProviderIdsDictionary
{
get
{
var dic = new Dictionary<string, string>();
if (!string.IsNullOrEmpty(NewSeriesProviderIds))
{
var str = NewSeriesProviderIds.Replace("{", "").Replace("}", "").Replace("\"", "");
foreach (var item in str.Split(','))
{
var itemArr = item.Split(':');
if (itemArr.Length > 1)
{
var key = itemArr[0].Trim();
var val = itemArr[1].Trim();
dic.Add(key, val);
}
}
}
return dic;
}
}
public Dictionary<string, string> NewSeriesProviderIdsDictionary { get; set; }
}
}