mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
update metadata parsing
This commit is contained in:
parent
edecae6ed5
commit
6d13cec38e
@ -312,7 +312,6 @@
|
|||||||
<Compile Include="Providers\ItemInfo.cs" />
|
<Compile Include="Providers\ItemInfo.cs" />
|
||||||
<Compile Include="Providers\LiveTvProgramLookupInfo.cs" />
|
<Compile Include="Providers\LiveTvProgramLookupInfo.cs" />
|
||||||
<Compile Include="Providers\LocalImageInfo.cs" />
|
<Compile Include="Providers\LocalImageInfo.cs" />
|
||||||
<Compile Include="Providers\LocalMetadataResult.cs" />
|
|
||||||
<Compile Include="Providers\MetadataRefreshMode.cs" />
|
<Compile Include="Providers\MetadataRefreshMode.cs" />
|
||||||
<Compile Include="Providers\MetadataResult.cs" />
|
<Compile Include="Providers\MetadataResult.cs" />
|
||||||
<Compile Include="Providers\MovieInfo.cs" />
|
<Compile Include="Providers\MovieInfo.cs" />
|
||||||
|
@ -18,7 +18,7 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
/// <param name="directoryService">The directory service.</param>
|
/// <param name="directoryService">The directory service.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task{MetadataResult{`0}}.</returns>
|
/// <returns>Task{MetadataResult{`0}}.</returns>
|
||||||
Task<LocalMetadataResult<TItemType>> GetMetadata(ItemInfo info,
|
Task<MetadataResult<TItemType>> GetMetadata(ItemInfo info,
|
||||||
IDirectoryService directoryService,
|
IDirectoryService directoryService,
|
||||||
CancellationToken cancellationToken);
|
CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
using MediaBrowser.Controller.Entities;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Providers
|
|
||||||
{
|
|
||||||
public class LocalMetadataResult<T> : MetadataResult<T>
|
|
||||||
where T : IHasMetadata
|
|
||||||
{
|
|
||||||
public List<LocalImageInfo> Images { get; set; }
|
|
||||||
public List<UserItemData> UserDataLIst { get; set; }
|
|
||||||
|
|
||||||
public LocalMetadataResult()
|
|
||||||
{
|
|
||||||
Images = new List<LocalImageInfo>();
|
|
||||||
UserDataLIst = new List<UserItemData>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +1,20 @@
|
|||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Providers
|
namespace MediaBrowser.Controller.Providers
|
||||||
{
|
{
|
||||||
public class MetadataResult<T>
|
public class MetadataResult<T>
|
||||||
{
|
{
|
||||||
|
public List<LocalImageInfo> Images { get; set; }
|
||||||
|
public List<UserItemData> UserDataList { get; set; }
|
||||||
|
|
||||||
|
public MetadataResult()
|
||||||
|
{
|
||||||
|
Images = new List<LocalImageInfo>();
|
||||||
|
}
|
||||||
|
|
||||||
public List<PersonInfo> People { get; set; }
|
public List<PersonInfo> People { get; set; }
|
||||||
|
|
||||||
public bool HasMetadata { get; set; }
|
public bool HasMetadata { get; set; }
|
||||||
@ -31,5 +41,27 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
}
|
}
|
||||||
People.Clear();
|
People.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserItemData GetOrAddUserData(string userId)
|
||||||
|
{
|
||||||
|
if (UserDataList == null)
|
||||||
|
{
|
||||||
|
UserDataList = new List<UserItemData>();
|
||||||
|
}
|
||||||
|
|
||||||
|
var userData = UserDataList.FirstOrDefault(i => string.Equals(userId, i.UserId.ToString("N"), StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
if (userData == null)
|
||||||
|
{
|
||||||
|
userData = new UserItemData()
|
||||||
|
{
|
||||||
|
UserId = new Guid(userId)
|
||||||
|
};
|
||||||
|
|
||||||
|
UserDataList.Add(userData);
|
||||||
|
}
|
||||||
|
|
||||||
|
return userData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,11 +13,11 @@ namespace MediaBrowser.LocalMetadata
|
|||||||
{
|
{
|
||||||
protected IFileSystem FileSystem;
|
protected IFileSystem FileSystem;
|
||||||
|
|
||||||
public async Task<LocalMetadataResult<T>> GetMetadata(ItemInfo info,
|
public async Task<MetadataResult<T>> GetMetadata(ItemInfo info,
|
||||||
IDirectoryService directoryService,
|
IDirectoryService directoryService,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var result = new LocalMetadataResult<T>();
|
var result = new MetadataResult<T>();
|
||||||
|
|
||||||
var file = GetXmlFile(info, directoryService);
|
var file = GetXmlFile(info, directoryService);
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ namespace MediaBrowser.LocalMetadata
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void Fetch(LocalMetadataResult<T> result, string path, CancellationToken cancellationToken);
|
protected abstract void Fetch(MetadataResult<T> result, string path, CancellationToken cancellationToken);
|
||||||
|
|
||||||
protected BaseXmlProvider(IFileSystem fileSystem)
|
protected BaseXmlProvider(IFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
using System.Threading;
|
using MediaBrowser.Controller.Entities;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Xml;
|
|
||||||
using MediaBrowser.Controller.Entities;
|
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.LocalMetadata.Parsers
|
namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<BoxSet> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<BoxSet> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new BoxSetXmlParser(_logger).Fetch(result, path, cancellationToken);
|
new BoxSetXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Episode> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<Episode> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var images = new List<LocalImageInfo>();
|
var images = new List<LocalImageInfo>();
|
||||||
var chapters = new List<ChapterInfo>();
|
var chapters = new List<ChapterInfo>();
|
||||||
|
@ -20,7 +20,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Folder> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<Folder> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new BaseItemXmlParser<Folder>(_logger).Fetch(result, path, cancellationToken);
|
new BaseItemXmlParser<Folder>(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<GameSystem> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<GameSystem> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new GameSystemXmlParser(_logger).Fetch(result, path, cancellationToken);
|
new GameSystemXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Game> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<Game> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new GameXmlParser(_logger).Fetch(result, path, cancellationToken);
|
new GameXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Movie> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<Movie> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new MovieXmlParser(_logger).Fetch(result, path, cancellationToken);
|
new MovieXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<MusicVideo> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<MusicVideo> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new MusicVideoXmlParser(_logger).Fetch(result, path, cancellationToken);
|
new MusicVideoXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Person> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<Person> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new BaseItemXmlParser<Person>(_logger).Fetch(result, path, cancellationToken);
|
new BaseItemXmlParser<Person>(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Playlist> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<Playlist> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new PlaylistXmlParser(_logger).Fetch(result, path, cancellationToken);
|
new PlaylistXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Season> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<Season> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new SeasonXmlParser(_logger).Fetch(result, path, cancellationToken);
|
new SeasonXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Series> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<Series> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new SeriesXmlParser(_logger).Fetch(result, path, cancellationToken);
|
new SeriesXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Video> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<Video> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new VideoXmlParser(_logger).Fetch(result, path, cancellationToken);
|
new VideoXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -408,7 +408,10 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
refreshResult.UpdateType = refreshResult.UpdateType | ItemUpdateType.ImageUpdate;
|
refreshResult.UpdateType = refreshResult.UpdateType | ItemUpdateType.ImageUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
userDataList = localItem.UserDataLIst;
|
if (localItem.UserDataList != null)
|
||||||
|
{
|
||||||
|
userDataList.AddRange(localItem.UserDataList);
|
||||||
|
}
|
||||||
|
|
||||||
MergeData(localItem, temp, new List<MetadataFields>(), !options.ReplaceAllMetadata, true);
|
MergeData(localItem, temp, new List<MetadataFields>(), !options.ReplaceAllMetadata, true);
|
||||||
refreshResult.UpdateType = refreshResult.UpdateType | ItemUpdateType.MetadataImport;
|
refreshResult.UpdateType = refreshResult.UpdateType | ItemUpdateType.MetadataImport;
|
||||||
|
@ -47,7 +47,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">
|
/// <exception cref="System.ArgumentNullException">
|
||||||
/// </exception>
|
/// </exception>
|
||||||
public void Fetch(LocalMetadataResult<T> item, string metadataFile, CancellationToken cancellationToken)
|
public void Fetch(MetadataResult<T> item, string metadataFile, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
@ -82,7 +82,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
/// <param name="metadataFile">The metadata file.</param>
|
/// <param name="metadataFile">The metadata file.</param>
|
||||||
/// <param name="settings">The settings.</param>
|
/// <param name="settings">The settings.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
private void Fetch(LocalMetadataResult<T> item, string metadataFile, XmlReaderSettings settings, CancellationToken cancellationToken)
|
private void Fetch(MetadataResult<T> item, string metadataFile, XmlReaderSettings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
item.ResetPeople();
|
item.ResetPeople();
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
// http://www.themoviedb.org/movie/36557
|
// http://www.themoviedb.org/movie/36557
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void FetchDataFromXmlNode(XmlReader reader, LocalMetadataResult<T> itemResult)
|
protected virtual void FetchDataFromXmlNode(XmlReader reader, MetadataResult<T> itemResult)
|
||||||
{
|
{
|
||||||
var item = itemResult.Item;
|
var item = itemResult.Item;
|
||||||
|
|
||||||
@ -927,17 +927,14 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
{
|
{
|
||||||
var val = reader.ReadElementContentAsString();
|
var val = reader.ReadElementContentAsString();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(val))
|
if (!string.IsNullOrWhiteSpace(val) && !string.IsNullOrWhiteSpace(userDataUserId))
|
||||||
{
|
{
|
||||||
bool parsedValue;
|
bool parsedValue;
|
||||||
if (bool.TryParse(val, out parsedValue))
|
if (bool.TryParse(val, out parsedValue))
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(userDataUserId))
|
var userData = GetOrAdd(itemResult, userDataUserId);
|
||||||
{
|
|
||||||
var userData = GetOrAdd(itemResult.UserDataLIst, userDataUserId);
|
|
||||||
|
|
||||||
userData.Played = parsedValue;
|
userData.Played = parsedValue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -947,21 +944,18 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
{
|
{
|
||||||
var val = reader.ReadElementContentAsString();
|
var val = reader.ReadElementContentAsString();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(val))
|
if (!string.IsNullOrWhiteSpace(val) && !string.IsNullOrWhiteSpace(userDataUserId))
|
||||||
{
|
{
|
||||||
int parsedValue;
|
int parsedValue;
|
||||||
if (int.TryParse(val, NumberStyles.Integer, _usCulture, out parsedValue))
|
if (int.TryParse(val, NumberStyles.Integer, _usCulture, out parsedValue))
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(userDataUserId))
|
var userData = GetOrAdd(itemResult, userDataUserId);
|
||||||
|
|
||||||
|
userData.PlayCount = parsedValue;
|
||||||
|
|
||||||
|
if (parsedValue > 0)
|
||||||
{
|
{
|
||||||
var userData = GetOrAdd(itemResult.UserDataLIst, userDataUserId);
|
userData.Played = true;
|
||||||
|
|
||||||
userData.PlayCount = parsedValue;
|
|
||||||
|
|
||||||
if (parsedValue > 0)
|
|
||||||
{
|
|
||||||
userData.Played = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -972,17 +966,14 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
{
|
{
|
||||||
var val = reader.ReadElementContentAsString();
|
var val = reader.ReadElementContentAsString();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(val))
|
if (!string.IsNullOrWhiteSpace(val) && !string.IsNullOrWhiteSpace(userDataUserId))
|
||||||
{
|
{
|
||||||
DateTime parsedValue;
|
DateTime parsedValue;
|
||||||
if (DateTime.TryParseExact(val, "yyyy-MM-dd HH:mm:ss", _usCulture, DateTimeStyles.None, out parsedValue))
|
if (DateTime.TryParseExact(val, "yyyy-MM-dd HH:mm:ss", _usCulture, DateTimeStyles.None, out parsedValue))
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(userDataUserId))
|
var userData = GetOrAdd(itemResult, userDataUserId);
|
||||||
{
|
|
||||||
var userData = GetOrAdd(itemResult.UserDataLIst, userDataUserId);
|
|
||||||
|
|
||||||
userData.LastPlayedDate = parsedValue;
|
userData.LastPlayedDate = parsedValue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -994,7 +985,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(userDataUserId))
|
if (!string.IsNullOrWhiteSpace(userDataUserId))
|
||||||
{
|
{
|
||||||
var userData = GetOrAdd(itemResult.UserDataLIst, userDataUserId);
|
var userData = GetOrAdd(itemResult, userDataUserId);
|
||||||
|
|
||||||
FetchFromResumeNode(subtree, item, userData);
|
FetchFromResumeNode(subtree, item, userData);
|
||||||
}
|
}
|
||||||
@ -1006,17 +997,14 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
{
|
{
|
||||||
var val = reader.ReadElementContentAsString();
|
var val = reader.ReadElementContentAsString();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(val))
|
if (!string.IsNullOrWhiteSpace(val) && !string.IsNullOrWhiteSpace(userDataUserId))
|
||||||
{
|
{
|
||||||
bool parsedValue;
|
bool parsedValue;
|
||||||
if (bool.TryParse(val, out parsedValue))
|
if (bool.TryParse(val, out parsedValue))
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(userDataUserId))
|
var userData = GetOrAdd(itemResult, userDataUserId);
|
||||||
{
|
|
||||||
var userData = GetOrAdd(itemResult.UserDataLIst, userDataUserId);
|
|
||||||
|
|
||||||
userData.IsFavorite = parsedValue;
|
userData.IsFavorite = parsedValue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1026,17 +1014,14 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
{
|
{
|
||||||
var val = reader.ReadElementContentAsString();
|
var val = reader.ReadElementContentAsString();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(val))
|
if (!string.IsNullOrWhiteSpace(val) && !string.IsNullOrWhiteSpace(userDataUserId))
|
||||||
{
|
{
|
||||||
double parsedValue;
|
double parsedValue;
|
||||||
if (double.TryParse(val, NumberStyles.Any, _usCulture, out parsedValue))
|
if (double.TryParse(val, NumberStyles.Any, _usCulture, out parsedValue))
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(userDataUserId))
|
var userData = GetOrAdd(itemResult, userDataUserId);
|
||||||
{
|
|
||||||
var userData = GetOrAdd(itemResult.UserDataLIst, userDataUserId);
|
|
||||||
|
|
||||||
userData.Rating = parsedValue;
|
userData.Rating = parsedValue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1048,21 +1033,9 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private UserItemData GetOrAdd(List<UserItemData> userDataList, string userId)
|
private UserItemData GetOrAdd(MetadataResult<T> result, string userId)
|
||||||
{
|
{
|
||||||
var userData = userDataList.FirstOrDefault(i => string.Equals(userId, i.UserId.ToString("N"), StringComparison.OrdinalIgnoreCase));
|
return result.GetOrAddUserData(userId);
|
||||||
|
|
||||||
if (userData == null)
|
|
||||||
{
|
|
||||||
userData = new UserItemData()
|
|
||||||
{
|
|
||||||
UserId = new Guid(userId)
|
|
||||||
};
|
|
||||||
|
|
||||||
userDataList.Add(userData);
|
|
||||||
}
|
|
||||||
|
|
||||||
return userData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FetchFromResumeNode(XmlReader reader, T item, UserItemData userData)
|
private void FetchFromResumeNode(XmlReader reader, T item, UserItemData userData)
|
||||||
|
@ -17,7 +17,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Fetch(LocalMetadataResult<Episode> item,
|
public void Fetch(MetadataResult<Episode> item,
|
||||||
List<LocalImageInfo> images,
|
List<LocalImageInfo> images,
|
||||||
string metadataFile,
|
string metadataFile,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
@ -32,7 +32,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reader">The reader.</param>
|
/// <param name="reader">The reader.</param>
|
||||||
/// <param name="itemResult">The item result.</param>
|
/// <param name="itemResult">The item result.</param>
|
||||||
protected override void FetchDataFromXmlNode(XmlReader reader, LocalMetadataResult<Episode> itemResult)
|
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<Episode> itemResult)
|
||||||
{
|
{
|
||||||
var item = itemResult.Item;
|
var item = itemResult.Item;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reader">The reader.</param>
|
/// <param name="reader">The reader.</param>
|
||||||
/// <param name="itemResult">The item result.</param>
|
/// <param name="itemResult">The item result.</param>
|
||||||
protected override void FetchDataFromXmlNode(XmlReader reader, LocalMetadataResult<Video> itemResult)
|
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<Video> itemResult)
|
||||||
{
|
{
|
||||||
var item = itemResult.Item;
|
var item = itemResult.Item;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reader">The reader.</param>
|
/// <param name="reader">The reader.</param>
|
||||||
/// <param name="itemResult">The item result.</param>
|
/// <param name="itemResult">The item result.</param>
|
||||||
protected override void FetchDataFromXmlNode(XmlReader reader, LocalMetadataResult<Season> itemResult)
|
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<Season> itemResult)
|
||||||
{
|
{
|
||||||
var item = itemResult.Item;
|
var item = itemResult.Item;
|
||||||
|
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Controller.Entities;
|
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Parsers
|
namespace MediaBrowser.XbmcMetadata.Parsers
|
||||||
@ -22,7 +20,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reader">The reader.</param>
|
/// <param name="reader">The reader.</param>
|
||||||
/// <param name="itemResult">The item result.</param>
|
/// <param name="itemResult">The item result.</param>
|
||||||
protected override void FetchDataFromXmlNode(XmlReader reader, LocalMetadataResult<Series> itemResult)
|
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<Series> itemResult)
|
||||||
{
|
{
|
||||||
var item = itemResult.Item;
|
var item = itemResult.Item;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
_config = config;
|
_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<MusicAlbum> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<MusicAlbum> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new BaseNfoParser<MusicAlbum>(_logger, _config).Fetch(result, path, cancellationToken);
|
new BaseNfoParser<MusicAlbum>(_logger, _config).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
_config = config;
|
_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<MusicArtist> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<MusicArtist> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new BaseNfoParser<MusicArtist>(_logger, _config).Fetch(result, path, cancellationToken);
|
new BaseNfoParser<MusicArtist>(_logger, _config).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,11 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
{
|
{
|
||||||
protected IFileSystem FileSystem;
|
protected IFileSystem FileSystem;
|
||||||
|
|
||||||
public async Task<LocalMetadataResult<T>> GetMetadata(ItemInfo info,
|
public async Task<MetadataResult<T>> GetMetadata(ItemInfo info,
|
||||||
IDirectoryService directoryService,
|
IDirectoryService directoryService,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var result = new LocalMetadataResult<T>();
|
var result = new MetadataResult<T>();
|
||||||
|
|
||||||
var file = GetXmlFile(info, directoryService);
|
var file = GetXmlFile(info, directoryService);
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void Fetch(LocalMetadataResult<T> result, string path, CancellationToken cancellationToken);
|
protected abstract void Fetch(MetadataResult<T> result, string path, CancellationToken cancellationToken);
|
||||||
|
|
||||||
protected BaseNfoProvider(IFileSystem fileSystem)
|
protected BaseNfoProvider(IFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
|
@ -24,9 +24,9 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
_config = config;
|
_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<T> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<T> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var tmpItem = new LocalMetadataResult<Video>
|
var tmpItem = new MetadataResult<Video>
|
||||||
{
|
{
|
||||||
Item = result.Item
|
Item = result.Item
|
||||||
};
|
};
|
||||||
@ -34,7 +34,11 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
|
|
||||||
result.Item = (T)tmpItem.Item;
|
result.Item = (T)tmpItem.Item;
|
||||||
result.People = tmpItem.People;
|
result.People = tmpItem.People;
|
||||||
result.UserDataLIst = tmpItem.UserDataLIst;
|
|
||||||
|
if (tmpItem.UserDataList != null)
|
||||||
|
{
|
||||||
|
result.UserDataList = tmpItem.UserDataList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
@ -23,7 +23,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
_config = config;
|
_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Episode> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<Episode> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var images = new List<LocalImageInfo>();
|
var images = new List<LocalImageInfo>();
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
_config = config;
|
_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Season> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<Season> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new SeasonNfoParser(_logger, _config).Fetch(result, path, cancellationToken);
|
new SeasonNfoParser(_logger, _config).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
_config = config;
|
_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Series> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<Series> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new SeriesNfoParser(_logger, _config).Fetch(result, path, cancellationToken);
|
new SeriesNfoParser(_logger, _config).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user