remove constant.JavTube

This commit is contained in:
xjasonlyu
2022-05-30 13:46:45 +08:00
parent 37cb98fe6a
commit 66f8d42e6a
11 changed files with 24 additions and 36 deletions

View File

@@ -2,7 +2,7 @@ namespace Jellyfin.Plugin.JavTube;
public static class Constant
{
public const string JavTube = "JavTube";
// public const string JavTube = "JavTube";
public const string Rating = "JP-18+";

View File

@@ -7,7 +7,7 @@ internal static class LogManagerExtension
{
public static ILogger CreateLogger<T>(this ILogManager logManager)
{
return logManager.GetLogger($"{Constant.JavTube}.{typeof(T).Name}");
return logManager.GetLogger($"{Plugin.Instance.Name}.{typeof(T).Name}");
}
}

View File

@@ -10,13 +10,13 @@ namespace Jellyfin.Plugin.JavTube.ExternalIds;
public class ActorExternalId : IExternalId
{
#if __EMBY__
public string Name => Constant.JavTube;
public string Name => Plugin.Instance.Name;
#else
public string ProviderName => Constant.JavTube;
public string ProviderName => Plugin.Instance.Name;
public ExternalIdMediaType? Type => ExternalIdMediaType.Person;
#endif
public string Key => Constant.JavTube;
public string Key => Plugin.Instance.Name;
public string UrlFormatString => Plugin.Instance.Configuration.Server + "/r/{0}";

View File

@@ -10,13 +10,13 @@ namespace Jellyfin.Plugin.JavTube.ExternalIds;
public class MovieExternalId : IExternalId
{
#if __EMBY__
public string Name => Constant.JavTube;
public string Name => Plugin.Instance.Name;
#else
public string ProviderName => Constant.JavTube;
public string ProviderName => Plugin.Instance.Name;
public ExternalIdMediaType? Type => ExternalIdMediaType.Movie;
#endif
public string Key => Constant.JavTube;
public string Key => Plugin.Instance.Name;
public string UrlFormatString => Plugin.Instance.Configuration.Server + "/r/{0}";

View File

@@ -21,7 +21,7 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
Instance = this;
}
public override string Name => Constant.JavTube;
public override string Name => "JavTube";
public override string Description => "JavTube Plugin for Jellyfin/Emby";

View File

@@ -26,10 +26,6 @@ public class ActorImageProvider : BaseProvider, IRemoteImageProvider, IHasOrder
// Init
}
public int Order => 1;
public string Name => Constant.JavTube;
#if __EMBY__
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, LibraryOptions libraryOptions,
CancellationToken cancellationToken)

View File

@@ -26,10 +26,6 @@ public class ActorProvider : BaseProvider, IRemoteMetadataProvider<Person, Perso
// Init
}
public int Order => 1;
public string Name => Constant.JavTube;
public async Task<MetadataResult<Person>> GetMetadata(PersonLookupInfo info,
CancellationToken cancellationToken)
{

View File

@@ -28,6 +28,10 @@ public abstract class BaseProvider
_logger = logger;
}
#endif
public int Order => 1;
public string Name => Plugin.Instance.Name;
#if __EMBY__
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)

View File

@@ -28,10 +28,6 @@ public class ImageProvider : BaseProvider, IRemoteImageProvider, IHasOrder
// Init
}
public int Order => 1;
public string Name => Constant.JavTube;
#if __EMBY__
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, LibraryOptions libraryOptions,
CancellationToken cancellationToken)
@@ -39,7 +35,7 @@ public class ImageProvider : BaseProvider, IRemoteImageProvider, IHasOrder
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
#endif
{
var pid = item.GetProviderIdModel(Constant.JavTube);
var pid = item.GetProviderIdModel(Name);
if (string.IsNullOrWhiteSpace(pid.Id) || string.IsNullOrWhiteSpace(pid.Provider))
return new List<RemoteImageInfo>();

View File

@@ -27,14 +27,10 @@ public class MovieProvider : BaseProvider, IRemoteMetadataProvider<Movie, MovieI
// Init
}
public int Order => 1;
public string Name => Constant.JavTube;
public async Task<MetadataResult<Movie>> GetMetadata(MovieInfo info,
CancellationToken cancellationToken)
{
var pid = info.GetProviderIdModel(Constant.JavTube);
var pid = info.GetProviderIdModel(Name);
if (string.IsNullOrWhiteSpace(pid.Id) || string.IsNullOrWhiteSpace(pid.Provider))
{
// Search movie and pick the first result.
@@ -42,7 +38,7 @@ public class MovieProvider : BaseProvider, IRemoteMetadataProvider<Movie, MovieI
if (searchResults.Any())
{
var firstResult = searchResults.First();
pid = firstResult.GetProviderIdModel(Constant.JavTube);
pid = firstResult.GetProviderIdModel(Name);
}
}
@@ -70,7 +66,7 @@ public class MovieProvider : BaseProvider, IRemoteMetadataProvider<Movie, MovieI
};
// Set ProviderIdModel.
result.Item.SetProviderIdModel(Constant.JavTube, new ProviderIdModel
result.Item.SetProviderIdModel(Name, new ProviderIdModel
{
Provider = m.Provider,
Id = m.Id
@@ -106,7 +102,7 @@ public class MovieProvider : BaseProvider, IRemoteMetadataProvider<Movie, MovieI
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(MovieInfo info,
CancellationToken cancellationToken)
{
var pid = info.GetProviderIdModel(Constant.JavTube);
var pid = info.GetProviderIdModel(Name);
if (string.IsNullOrWhiteSpace(pid.Id))
// Search movie by name.
pid.Id = info.Name;
@@ -132,7 +128,7 @@ public class MovieProvider : BaseProvider, IRemoteMetadataProvider<Movie, MovieI
ProductionYear = m.ReleaseDate.ValidDateTime()?.Year,
ImageUrl = ApiClient.GetPrimaryImageApiUrl(m.Id, m.Provider, m.ThumbUrl, 1.0, true)
};
result.SetProviderIdModel(Constant.JavTube, new ProviderIdModel
result.SetProviderIdModel(Name, new ProviderIdModel
{
Provider = m.Provider,
Id = m.Id

View File

@@ -34,13 +34,13 @@ public class OrganizeGenresTask : IScheduledTask
}
#endif
public string Key => $"{Constant.JavTube}OrganizeGenres";
public string Key => $"{Plugin.Instance.Name}OrganizeGenres";
public string Name => "Organize Genres";
public string Description => $"Organize metadata genres provided by {Constant.JavTube} in library.";
public string Description => $"Organize metadata genres provided by {Plugin.Instance.Name} in library.";
public string Category => Constant.JavTube;
public string Category => Plugin.Instance.Name;
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
@@ -66,10 +66,10 @@ public class OrganizeGenresTask : IScheduledTask
{
MediaTypes = new[] { MediaType.Video },
#if __EMBY__
HasAnyProviderId = new[] { Constant.JavTube },
HasAnyProviderId = new[] { Plugin.Instance.Name },
IncludeItemTypes = new[] { nameof(Movie) },
#else
HasAnyProviderId = new Dictionary<string, string> { { Constant.JavTube, string.Empty } },
HasAnyProviderId = new Dictionary<string, string> { { Plugin.Instance.Name, string.Empty } },
IncludeItemTypes = new[] { BaseItemKind.Movie }
#endif
}).ToList();