Optimize log

This commit is contained in:
cxfksword 2023-04-14 23:30:59 +08:00
parent 277ec77d15
commit 771e14f2ad
2 changed files with 15 additions and 6 deletions

View File

@ -226,13 +226,22 @@ namespace Jellyfin.Plugin.MetaShark.Api
list.Add(movie);
}
if (list.Count <= 0)
if (list.Count > 0)
{
this._logger.LogWarning("douban搜索不到内容这消息大量出现时可能触发了爬虫风控。。。keyword: {0}", keyword);
_memoryCache.Set<List<DoubanSubject>>(cacheKey, list, expiredOption);
}
else
{
if (body.Contains("sec.douban.com"))
{
this._logger.LogWarning("douban触发风控可能ip被封请到插件配置中打开防封禁功能。。。keyword: {0}", keyword);
}
else
{
this._logger.LogWarning("douban搜索不到内容这消息大量出现时可能触发了爬虫风控。。。keyword: {0}", keyword);
}
}
_memoryCache.Set<List<DoubanSubject>>(cacheKey, list, expiredOption);
return list;
}

View File

@ -505,7 +505,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
// 当movie放在文件夹中并只有一部影片时, info.name是根据文件夹名解析的但info.Path是影片的路径名
// 当movie放在文件夹中并有多部影片时info.Name和info.Path都是具体的影片
var directoryName = Path.GetFileName(Path.GetDirectoryName(info.Path));
if (directoryName != null && directoryName.Contains(info.Name))
if (!string.IsNullOrEmpty(directoryName) && directoryName.Contains(info.Name))
{
return directoryName;
}
@ -513,7 +513,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
case EpisodeInfo:
return Path.GetFileNameWithoutExtension(info.Path) ?? info.Name;
default:
// series和season文件名没扩展名
// series和season的info.Path是文件夹路径
return Path.GetFileName(info.Path) ?? info.Name;
}
}