-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac1e7ac
commit a348e1b
Showing
3 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using MediaBrowser.Common.Configuration; | ||
using MediaBrowser.Controller.Entities; | ||
using MediaBrowser.Controller.Providers; | ||
using MediaBrowser.Model.IO; | ||
using MediaBrowser.Model.Logging; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.IO; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Threading; | ||
using System.Xml; | ||
|
||
namespace NfoMetadata.Parsers | ||
{ | ||
public class GameNfoParser : BaseNfoParser<Game> | ||
{ | ||
public GameNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager, IFileSystem fileSystem) : base(logger, config, providerManager, fileSystem) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using MediaBrowser.Common.Configuration; | ||
using MediaBrowser.Controller.Entities.TV; | ||
using MediaBrowser.Controller.Entities; | ||
using MediaBrowser.Controller.Providers; | ||
using MediaBrowser.Model.Configuration; | ||
using MediaBrowser.Model.IO; | ||
using MediaBrowser.Model.Logging; | ||
using NfoMetadata.Parsers; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Threading; | ||
|
||
namespace NfoMetadata.Providers | ||
{ | ||
public class GameNfoProvider : BaseNfoProvider<Game> | ||
{ | ||
private readonly ILogger _logger; | ||
private readonly IConfigurationManager _config; | ||
private readonly IProviderManager _providerManager; | ||
|
||
public GameNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager) | ||
: base(fileSystem) | ||
{ | ||
_logger = logger; | ||
_config = config; | ||
_providerManager = providerManager; | ||
} | ||
|
||
protected override Task Fetch(MetadataResult<Game> result, string path, CancellationToken cancellationToken) | ||
{ | ||
return new GameNfoParser(_logger, _config, _providerManager, FileSystem).Fetch(result, path, cancellationToken); | ||
} | ||
|
||
protected override FileSystemMetadata GetXmlFile(ItemInfo info, LibraryOptions libraryOptions, IDirectoryService directoryService) | ||
{ | ||
var path = info.Path; | ||
|
||
if (string.IsNullOrEmpty(path) || BaseItem.MediaSourceManager.GetPathProtocol(path.AsSpan()) != MediaBrowser.Model.MediaInfo.MediaProtocol.File) | ||
{ | ||
return null; | ||
} | ||
|
||
path = Path.ChangeExtension(path, ".nfo"); | ||
|
||
return directoryService.GetFile(path); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using MediaBrowser.Controller.Configuration; | ||
using MediaBrowser.Controller.Entities.TV; | ||
using MediaBrowser.Controller.Entities; | ||
using MediaBrowser.Controller.Library; | ||
using MediaBrowser.Model.Configuration; | ||
using MediaBrowser.Model.IO; | ||
using MediaBrowser.Model.Logging; | ||
using NfoMetadata.Configuration; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Xml; | ||
|
||
namespace NfoMetadata.Savers | ||
{ | ||
public class GameNfoSaver : BaseNfoSaver | ||
{ | ||
public GameNfoSaver(IFileSystem fileSystem, ILibraryMonitor libraryMonitor, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger) : base(fileSystem, libraryMonitor, configurationManager, libraryManager, userManager, userDataManager, logger) | ||
{ | ||
} | ||
|
||
protected override string GetSavePath(BaseItem item, LibraryOptions libraryOptions) | ||
{ | ||
return Path.ChangeExtension(item.Path, ".nfo"); | ||
} | ||
|
||
protected override string GetRootElementName(BaseItem item) | ||
{ | ||
return "game"; | ||
} | ||
|
||
public override bool IsEnabledFor(BaseItem item, ItemUpdateType updateType) | ||
{ | ||
if (!item.IsFileProtocol) | ||
{ | ||
return false; | ||
} | ||
|
||
return item is Game && updateType >= MinimumUpdateType; | ||
} | ||
|
||
protected override void WriteCustomElements(BaseItem item, XmlWriter writer, int nodeIndex, int numNodes) | ||
{ | ||
} | ||
|
||
protected override List<string> GetTagsUsed(BaseItem item, XbmcMetadataOptions options) | ||
{ | ||
var list = base.GetTagsUsed(item, options); | ||
list.AddRange(new string[] | ||
{ | ||
}); | ||
return list; | ||
} | ||
} | ||
} |