Merge branch 'ncmpcpp:master' into master
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
# ncmpcpp-0.10.2 (2025-??-??)
|
||||||
|
* Update lyrics fetchers.
|
||||||
|
* Add support for hexadecimal HTML escape codes.
|
||||||
|
|
||||||
# ncmpcpp-0.10.1 (2024-10-24)
|
# ncmpcpp-0.10.1 (2024-10-24)
|
||||||
* Fix compilation with `libc++`.
|
* Fix compilation with `libc++`.
|
||||||
* Remove `autogen.sh` in favour of `autoreconf`.
|
* Remove `autogen.sh` in favour of `autoreconf`.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
AC_INIT([ncmpcpp],[0.10.1])
|
AC_INIT([ncmpcpp],[0.10.2_dev])
|
||||||
AC_CONFIG_SRCDIR([configure.ac])
|
AC_CONFIG_SRCDIR([configure.ac])
|
||||||
AC_CONFIG_HEADERS(config.h)
|
AC_CONFIG_HEADERS(config.h)
|
||||||
AM_INIT_AUTOMAKE([subdir-objects])
|
AM_INIT_AUTOMAKE([subdir-objects])
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ struct GeniusFetcher : public GoogleLyricsFetcher
|
|||||||
virtual const char *name() const override { return "genius.com"; }
|
virtual const char *name() const override { return "genius.com"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const char *regex() const override { return "<div.*?class=\"(?:lyrics|Lyrics__Container).*?>(.*?)</div>"; }
|
virtual const char *regex() const override { return "<div data-lyrics-container.*?>(.*?)</div>"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct JahLyricsFetcher : public GoogleLyricsFetcher
|
struct JahLyricsFetcher : public GoogleLyricsFetcher
|
||||||
@@ -116,7 +116,7 @@ struct ZeneszovegFetcher : public GoogleLyricsFetcher
|
|||||||
virtual const char *name() const override { return "zeneszoveg.hu"; }
|
virtual const char *name() const override { return "zeneszoveg.hu"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const char *regex() const override { return "<div id=\"tartalom_slide_content\"> (.*?)<style>"; }
|
virtual const char *regex() const override { return "<div class=\"lyrics-plain-text trans_original\">(.*?)</div>"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct InternetLyricsFetcher : public GoogleLyricsFetcher
|
struct InternetLyricsFetcher : public GoogleLyricsFetcher
|
||||||
|
|||||||
@@ -20,16 +20,29 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
|
#include <cstdlib>
|
||||||
#include "utility/html.h"
|
#include "utility/html.h"
|
||||||
|
|
||||||
std::string unescapeHtmlUtf8(const std::string &data)
|
std::string unescapeHtmlUtf8(const std::string &data)
|
||||||
{
|
{
|
||||||
|
int base;
|
||||||
|
size_t offset;
|
||||||
std::string result;
|
std::string result;
|
||||||
for (size_t i = 0, j; i < data.length(); ++i)
|
for (size_t i = 0, j; i < data.length(); ++i)
|
||||||
{
|
{
|
||||||
if (data[i] == '&' && data[i+1] == '#' && (j = data.find(';', i)) != std::string::npos)
|
if (data[i] == '&' && data[i+1] == '#' && (j = data.find(';', i)) != std::string::npos)
|
||||||
{
|
{
|
||||||
int n = atoi(&data.c_str()[i+2]);
|
if (data[i+2] == 'x')
|
||||||
|
{
|
||||||
|
offset = 3;
|
||||||
|
base = 16;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
offset = 2;
|
||||||
|
base = 10;
|
||||||
|
}
|
||||||
|
int n = strtol(&data.c_str()[i+offset], nullptr, base);
|
||||||
if (n >= 0x800)
|
if (n >= 0x800)
|
||||||
{
|
{
|
||||||
result += (0xe0 | ((n >> 12) & 0x0f));
|
result += (0xe0 | ((n >> 12) & 0x0f));
|
||||||
|
|||||||
Reference in New Issue
Block a user