This commit is contained in:
parent
54fd425849
commit
f5cf162e67
|
@ -24,6 +24,10 @@ public class PluginConfiguration : BasePluginConfiguration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool EnableDoubanAvoidRiskControl { get; set; } = false;
|
public bool EnableDoubanAvoidRiskControl { get; set; } = false;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 豆瓣海报使用大图
|
||||||
|
/// </summary>
|
||||||
|
public bool EnableDoubanLargePoster { get; set; } = false;
|
||||||
|
/// <summary>
|
||||||
/// 豆瓣背景图使用原图
|
/// 豆瓣背景图使用原图
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool EnableDoubanBackdropRaw { get; set; } = false;
|
public bool EnableDoubanBackdropRaw { get; set; } = false;
|
||||||
|
|
|
@ -54,6 +54,13 @@
|
||||||
可为空,填写jellyfin访问域名(有端口时要加上端口),只有使用了Nginx代理、Docker部署或启用了HTTPS,并且豆瓣图片无法显示时,才需要填写
|
可为空,填写jellyfin访问域名(有端口时要加上端口),只有使用了Nginx代理、Docker部署或启用了HTTPS,并且豆瓣图片无法显示时,才需要填写
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||||
|
<label class="emby-checkbox-label" for="EnableDoubanLargePoster">
|
||||||
|
<input id="EnableDoubanLargePoster" name="EnableDoubanLargePoster" type="checkbox"
|
||||||
|
is="emby-checkbox" />
|
||||||
|
<span>海报使用大图</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||||
<label class="emby-checkbox-label" for="EnableDoubanBackdropRaw">
|
<label class="emby-checkbox-label" for="EnableDoubanBackdropRaw">
|
||||||
<input id="EnableDoubanBackdropRaw" name="EnableDoubanBackdropRaw" type="checkbox"
|
<input id="EnableDoubanBackdropRaw" name="EnableDoubanBackdropRaw" type="checkbox"
|
||||||
|
@ -165,6 +172,7 @@
|
||||||
document.querySelector('#DoubanCookies').value = config.DoubanCookies;
|
document.querySelector('#DoubanCookies').value = config.DoubanCookies;
|
||||||
document.querySelector('#DoubanImageProxyBaseUrl').value = config.DoubanImageProxyBaseUrl;
|
document.querySelector('#DoubanImageProxyBaseUrl').value = config.DoubanImageProxyBaseUrl;
|
||||||
document.querySelector('#EnableDoubanAvoidRiskControl').checked = config.EnableDoubanAvoidRiskControl;
|
document.querySelector('#EnableDoubanAvoidRiskControl').checked = config.EnableDoubanAvoidRiskControl;
|
||||||
|
document.querySelector('#EnableDoubanLargePoster').checked = config.EnableDoubanLargePoster;
|
||||||
document.querySelector('#EnableDoubanBackdropRaw').checked = config.EnableDoubanBackdropRaw;
|
document.querySelector('#EnableDoubanBackdropRaw').checked = config.EnableDoubanBackdropRaw;
|
||||||
|
|
||||||
document.querySelector('#EnableTmdb').checked = config.EnableTmdb;
|
document.querySelector('#EnableTmdb').checked = config.EnableTmdb;
|
||||||
|
@ -193,6 +201,7 @@
|
||||||
config.DoubanCookies = document.querySelector('#DoubanCookies').value;
|
config.DoubanCookies = document.querySelector('#DoubanCookies').value;
|
||||||
config.DoubanImageProxyBaseUrl = document.querySelector('#DoubanImageProxyBaseUrl').value;
|
config.DoubanImageProxyBaseUrl = document.querySelector('#DoubanImageProxyBaseUrl').value;
|
||||||
config.EnableDoubanAvoidRiskControl = document.querySelector('#EnableDoubanAvoidRiskControl').checked;
|
config.EnableDoubanAvoidRiskControl = document.querySelector('#EnableDoubanAvoidRiskControl').checked;
|
||||||
|
config.EnableDoubanLargePoster = document.querySelector('#EnableDoubanLargePoster').checked;
|
||||||
config.EnableDoubanBackdropRaw = document.querySelector('#EnableDoubanBackdropRaw').checked;
|
config.EnableDoubanBackdropRaw = document.querySelector('#EnableDoubanBackdropRaw').checked;
|
||||||
|
|
||||||
config.EnableTmdb = document.querySelector('#EnableTmdb').checked;
|
config.EnableTmdb = document.querySelector('#EnableTmdb').checked;
|
||||||
|
@ -221,6 +230,7 @@
|
||||||
changeProxyDisplay();
|
changeProxyDisplay();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function changeProxyDisplay() {
|
function changeProxyDisplay() {
|
||||||
let proxyType = document.querySelector('#TmdbProxyType').value;
|
let proxyType = document.querySelector('#TmdbProxyType').value;
|
||||||
if (proxyType) {
|
if (proxyType) {
|
||||||
|
|
|
@ -93,6 +93,15 @@ namespace Jellyfin.Plugin.MetaShark.Model
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public string ImgLarge
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.Img.Replace("s_ratio_poster", "l");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string[] Genres
|
public string[] Genres
|
||||||
{
|
{
|
||||||
|
@ -155,6 +164,16 @@ namespace Jellyfin.Plugin.MetaShark.Model
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public string ImgMiddle
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.Img.Replace("/raw/", "/m/").Replace("/s_ratio_poster/", "/m/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DoubanPhoto
|
public class DoubanPhoto
|
||||||
|
|
|
@ -471,53 +471,32 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
||||||
|
|
||||||
protected string GetLocalProxyImageUrl(string url)
|
protected string GetLocalProxyImageUrl(string url)
|
||||||
{
|
{
|
||||||
var baseUrl = Plugin.Instance?.GetLocalApiBaseUrl();
|
var baseUrl = Plugin.Instance?.GetLocalApiBaseUrl() ?? string.Empty;
|
||||||
if (!string.IsNullOrEmpty(config.DoubanImageProxyBaseUrl))
|
if (!string.IsNullOrWhiteSpace(config.DoubanImageProxyBaseUrl))
|
||||||
{
|
{
|
||||||
baseUrl = config.DoubanImageProxyBaseUrl.TrimEnd('/');
|
baseUrl = config.DoubanImageProxyBaseUrl.TrimEnd('/');
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(baseUrl))
|
|
||||||
{
|
|
||||||
var encodedUrl = HttpUtility.UrlEncode(url);
|
|
||||||
return $"{baseUrl}/plugin/metashark/proxy/image/?url={encodedUrl}";
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.GetProxyImageUrl(url);
|
var encodedUrl = HttpUtility.UrlEncode(url);
|
||||||
|
return $"{baseUrl}/plugin/metashark/proxy/image/?url={encodedUrl}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetBaseUrl()
|
private string GetBaseUrl()
|
||||||
{
|
{
|
||||||
// 配置优先
|
// 配置优先
|
||||||
if (!string.IsNullOrEmpty(this.config.DoubanImageProxyBaseUrl))
|
if (!string.IsNullOrWhiteSpace(config.DoubanImageProxyBaseUrl))
|
||||||
{
|
{
|
||||||
return this.config.DoubanImageProxyBaseUrl.TrimEnd('/');
|
return this.config.DoubanImageProxyBaseUrl.TrimEnd('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
// http请求时,获取请求的host (nginx代理/docker中部署时,没配置透传host时,本方式会有问题)
|
// TODO:http请求时,获取请求的host (nginx代理/docker中部署时,没配置透传host时,本方式会有问题)
|
||||||
|
// 除自动扫描之外都会执行这里,修改图片功能图片是直接下载,不走插件图片代理处理函数,host拿不到就下载不了
|
||||||
if (Plugin.Instance != null && this._httpContextAccessor.HttpContext != null)
|
if (Plugin.Instance != null && this._httpContextAccessor.HttpContext != null)
|
||||||
{
|
{
|
||||||
// 特殊处理下搜索请求,直接使用相对链接,可以减少使用nginx代理但不透传host的问题
|
|
||||||
var userAgent = this._httpContextAccessor.HttpContext.Request.Headers.UserAgent.ToString();
|
|
||||||
var fromWeb = userAgent.Contains("Chrome") || userAgent.Contains("Safari");
|
|
||||||
var fromItemSearch = this._httpContextAccessor.HttpContext.Request.Path.ToString().Contains("/RemoteSearch");
|
|
||||||
if (fromWeb && fromItemSearch)
|
|
||||||
{
|
|
||||||
// 处理通过nginx反向代理后,url加了subpath访问的情况
|
|
||||||
var subpath = string.Empty;
|
|
||||||
var baseUrl = Plugin.Instance.GetApiBaseUrl(this._httpContextAccessor.HttpContext.Request);
|
|
||||||
var uri = new UriBuilder(baseUrl);
|
|
||||||
if (!string.IsNullOrEmpty(uri.Path) && uri.Path != "/")
|
|
||||||
{
|
|
||||||
subpath = "/" + uri.Path.Trim('/');
|
|
||||||
}
|
|
||||||
|
|
||||||
return subpath;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Plugin.Instance.GetApiBaseUrl(this._httpContextAccessor.HttpContext.Request);
|
return Plugin.Instance.GetApiBaseUrl(this._httpContextAccessor.HttpContext.Request);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 自动扫描刷新时,直接使用本地地址
|
// 自动扫描刷新时,直接使用本地地址(127.0.0.1)
|
||||||
return Plugin.Instance?.GetLocalApiBaseUrl() ?? string.Empty;
|
return Plugin.Instance?.GetLocalApiBaseUrl() ?? string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,7 +552,17 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
||||||
|
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected string GetDoubanPoster(DoubanSubject subject)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(subject.Img)) {
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
var url = config.EnableDoubanLargePoster ? subject.ImgLarge : subject.ImgMiddle;
|
||||||
|
return this.GetProxyImageUrl(url);
|
||||||
|
}
|
||||||
|
|
||||||
protected string GetOriginalFileName(ItemLookupInfo info)
|
protected string GetOriginalFileName(ItemLookupInfo info)
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
||||||
if (metaSource != MetaSource.Tmdb && !string.IsNullOrEmpty(sid))
|
if (metaSource != MetaSource.Tmdb && !string.IsNullOrEmpty(sid))
|
||||||
{
|
{
|
||||||
var primary = await this._doubanApi.GetMovieAsync(sid, cancellationToken);
|
var primary = await this._doubanApi.GetMovieAsync(sid, cancellationToken);
|
||||||
if (primary == null || string.IsNullOrEmpty(primary.ImgMiddle))
|
if (primary == null || string.IsNullOrEmpty(primary.Img))
|
||||||
{
|
{
|
||||||
return Enumerable.Empty<RemoteImageInfo>();
|
return Enumerable.Empty<RemoteImageInfo>();
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
||||||
new RemoteImageInfo
|
new RemoteImageInfo
|
||||||
{
|
{
|
||||||
ProviderName = this.Name,
|
ProviderName = this.Name,
|
||||||
Url = this.GetProxyImageUrl(primary.ImgMiddle),
|
Url = this.GetDoubanPoster(primary),
|
||||||
Type = ImageType.Primary,
|
Type = ImageType.Primary,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
||||||
new RemoteImageInfo
|
new RemoteImageInfo
|
||||||
{
|
{
|
||||||
ProviderName = primary.Name,
|
ProviderName = primary.Name,
|
||||||
Url = this.GetProxyImageUrl(primary.ImgMiddle),
|
Url = this.GetDoubanPoster(primary),
|
||||||
Type = ImageType.Primary,
|
Type = ImageType.Primary,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -93,6 +93,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
||||||
ProviderIds = new Dictionary<string, string> { { DoubanProviderId, c.Id } },
|
ProviderIds = new Dictionary<string, string> { { DoubanProviderId, c.Id } },
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
this.Log($"GetSeasonMetaData of douban [sid]: {seasonSid}");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
||||||
if (metaSource != MetaSource.Tmdb && !string.IsNullOrEmpty(sid))
|
if (metaSource != MetaSource.Tmdb && !string.IsNullOrEmpty(sid))
|
||||||
{
|
{
|
||||||
var primary = await this._doubanApi.GetMovieAsync(sid, cancellationToken);
|
var primary = await this._doubanApi.GetMovieAsync(sid, cancellationToken);
|
||||||
if (primary == null || string.IsNullOrEmpty(primary.ImgMiddle))
|
if (primary == null || string.IsNullOrEmpty(primary.Img))
|
||||||
{
|
{
|
||||||
return Enumerable.Empty<RemoteImageInfo>();
|
return Enumerable.Empty<RemoteImageInfo>();
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
||||||
new RemoteImageInfo
|
new RemoteImageInfo
|
||||||
{
|
{
|
||||||
ProviderName = this.Name,
|
ProviderName = this.Name,
|
||||||
Url = this.GetProxyImageUrl(primary.ImgMiddle),
|
Url = this.GetDoubanPoster(primary),
|
||||||
Type = ImageType.Primary,
|
Type = ImageType.Primary,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,7 +22,7 @@ jellyfin电影元数据插件,影片信息只要从豆瓣获取,并由TheMov
|
||||||
|
|
||||||
国外访问:https://github.com/cxfksword/jellyfin-plugin-metashark/releases/download/manifest/manifest.json
|
国外访问:https://github.com/cxfksword/jellyfin-plugin-metashark/releases/download/manifest/manifest.json
|
||||||
|
|
||||||
> 如果无法访问,可以直接从 [Release](https://github.com/cxfksword/jellyfin-plugin-metashark/releases) 页面下载,并解压到 jellyfin 插件目录中使用
|
> 如果都无法访问,可以直接从 [Release](https://github.com/cxfksword/jellyfin-plugin-metashark/releases) 页面下载,并解压到 jellyfin 插件目录中使用
|
||||||
|
|
||||||
## 如何使用
|
## 如何使用
|
||||||
|
|
||||||
|
@ -36,6 +36,8 @@ jellyfin电影元数据插件,影片信息只要从豆瓣获取,并由TheMov
|
||||||
|
|
||||||
> 🚨假如需要刮削大量电影,请到插件配置中打开防封禁功能,避免频繁请求豆瓣导致被封IP(封IP需要等6小时左右才能恢复访问)
|
> 🚨假如需要刮削大量电影,请到插件配置中打开防封禁功能,避免频繁请求豆瓣导致被封IP(封IP需要等6小时左右才能恢复访问)
|
||||||
|
|
||||||
|
> :fire:遇到图片显示不出来时,请到插件配置中配置jellyfin访问域名
|
||||||
|
|
||||||
## How to build
|
## How to build
|
||||||
|
|
||||||
1. Clone or download this repository
|
1. Clone or download this repository
|
||||||
|
|
Loading…
Reference in New Issue