@nosatyj
you mean adding support for getting the lyrics from it? i'll see what i can do
Hi, this is my first post in HA forums, I've read the forums for a long time, as a guest, but I think It's time to contribute.
I think this code can help You.
I've modified the "ReadLyricFromTag" function from "main.cpp" file. Now It is able to query for any kind of tag.
bool ReadLyricFromTag(const metadb_handle_ptr & track, tstring & out)
{
const char * path = track->get_path();
//压缩文件(网络文件等等)不读入Tag
if (strnicmp("file://", path, _countof("file://") - 1))
return false;
if (wildcard_helper::test_path(path, t2u(cfg_skipbyfiletype.get_value()), true))
return false;
tstring tag = cfg_lyric_tag.get_string_ref();
util::replace(tag, ';', '\0');
const file_info * pinfo = 0;
track->metadb_lock();
if (track->get_info_locked(pinfo))
{
for (const tchar * p = tag.c_str(); p - tag.c_str() < (int)tag.length(); p += _tcslen(p) + 1)
{
while (0 == *p || ' ' == *p || '\t' == *p)
++p;
if (p - tag.c_str() >= (int)tag.length())
break;
service_ptr_t<titleformat_object> script_tag;
pfc::string8 out_tmp;
static_api_ptr_t<titleformat_compiler>()->compile_safe(script_tag, t2u(p) );
track->format_title( NULL, out_tmp, script_tag, NULL );
//if( out_tmp.get_length() != 0 && out_tmp != pfc::string8("?") ) //Secure version
if( out_tmp.get_length() > 1 ) //Faster version
{
out = u2t( out_tmp.get_ptr() );
track->metadb_unlock();
return true;
}
}
}
track->metadb_unlock();
return false;
}
If You want to implement this method, You must change the "Read lyric from field" configuration, adding "%" characters at the beginning and end of tags.
This can be done in two ways:
1: example (from "vars.cpp" file ):
change line 90: "cfg_wstring cfg_lyric_tag(guid_lyric_tag, L"LYRICS;UNSYNCED LYRICS");"
To: "cfg_wstring cfg_lyric_tag(guid_lyric_tag, L"%LYRICS%;%UNSYNCED LYRICS%");"
2: Building a temp string whith the "%" character at the beginning and end using:
tstring current_tag = L"%";
curent_tag.append( p );
curent_tag.append( L"%" );
static_api_ptr_t<titleformat_compiler>()->compile_safe(script_tag, t2u(curent_tag.c_str()) );
The only problem I can find with my function is that if the tag's content has only the "?" character, isn't detected as a valid tag, but I think this isn't a real problem because a lyric can't be just a "?" character.