支持中文模糊搜索和拼音搜索
注意:此方法会修改数据库检索表的结构,Emby版本更新会导致无法启动
工具:dnSpy 6.2.0、simple插件
http://res.ssr0.cn:8000/?/ISO/dnSpy-net-win64.zip
http://res.ssr0.cn:8000/?/ISO/libsimple.so
修改文件:SQLitePCL.pretty.dll、Emby.Server.Implementations.dll、library.db
请将EMBY关机后修改文件,注意文件备份。修改dll需要/system
文件夹中的依赖
编辑方法(C#)->编译报错,请将此处内容注释掉别直接删除
修改SQLitePCL.pretty.dll
SQLitePCL.pretty->SQLiteDatabaseConnectionBuilder->Build()
添加:
raw.sqlite3_enable_load_extension(sqlite, 1);
修改Emby.Server.Implementations.dll
Emby.Server.Implementations.Data->SqliteItemRepository->Initialize()
添加:
using System.IO;
databaseConnection.Execute("SELECT load_extension('" + Path.Combine(this._config.ApplicationPaths.DataPath, "libsimple") + "');");
修改tokenize=\"unicode61 remove diacritics 2\"
为tokenize=\"simple\"
修改GetJoinCommandText()中match @SearchTerm
为 match simple_query(@SearchTerm)
重写CreateSearchTerm(),增加引用using System.Text.RegularExpressions;
private string CreateSearchTerm(string searchTerm)
{
string newSearchTerm = searchTerm;
if (Regex.Matches(searchTerm, "'").Count >= 3)
{
newSearchTerm = searchTerm.Replace("'", "");
}
return newSearchTerm;
}
修改QueryItemsInTransaction()添加:
if (!string.IsNullOrEmpty(query.NameStartsWith))
{
query.SearchTerm = query.NameStartsWith;
query.NameStartsWith = null;
}
if (!string.IsNullOrEmpty(query.SearchTerm) && query.IncludeItemTypes.Length == 0)
{
query.IncludeItemTypes = new string[]{ "Movie", "Series", "BoxSet", "Audio", "MusicAlbum","MusicArtist"};
}
修改EnableJoinFtsSearch()
private bool EnableJoinFtsSearch(InternalItemsQuery query)
{
int? limit = query.Limit;
int num = 50;
return (limit.GetValueOrDefault() == num & limit != null) && (!string.IsNullOrEmpty(query.SearchTerm) || (!string.IsNullOrEmpty(query.Name) && this.IsNameSearchaleWithFts(query.Name)));
}
文件->保存模块->Emby.Server.Implementations.dll
修改library.db数据库,删除fts_search8表:
sqlite3 database.db "DROP TABLE IF EXISTS fts_search8;"
修改完后替换文件:
替换library.db,将libsimple.so和数据库放在一起,然后启动容器,再替换dll文件,重启容器
老哥,修改完很顺利,但是替换Emby.Server.Implementations.dll就启动不了...