fix compilation --without-curl
This commit is contained in:
27
src/info.cpp
27
src/info.cpp
@@ -45,12 +45,13 @@ const string artists_folder = home_folder + "/.ncmpcpp/artists";
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
# ifdef HAVE_CURL_CURL_H
|
||||||
pthread_t artist_info_downloader;
|
pthread_t artist_info_downloader;
|
||||||
bool artist_info_ready = 0;
|
bool artist_info_ready = 0;
|
||||||
|
|
||||||
# ifdef HAVE_CURL_CURL_H
|
|
||||||
void *GetArtistInfo(void *);
|
void *GetArtistInfo(void *);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
void GetSongInfo(MPD::Song &, Scrollpad &);
|
void GetSongInfo(MPD::Song &, Scrollpad &);
|
||||||
const basic_buffer<my_char_t> &ShowTagInInfoScreen(const string &);
|
const basic_buffer<my_char_t> &ShowTagInInfoScreen(const string &);
|
||||||
}
|
}
|
||||||
@@ -66,17 +67,6 @@ void Info::Resize()
|
|||||||
sInfo->Resize(COLS, main_height);
|
sInfo->Resize(COLS, main_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Info::Ready()
|
|
||||||
{
|
|
||||||
if (!artist_info_ready)
|
|
||||||
return false;
|
|
||||||
pthread_join(artist_info_downloader, NULL);
|
|
||||||
sInfo->Flush();
|
|
||||||
artist_info_downloader = 0;
|
|
||||||
artist_info_ready = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Info::GetSong()
|
void Info::GetSong()
|
||||||
{
|
{
|
||||||
if (wCurrent == sInfo)
|
if (wCurrent == sInfo)
|
||||||
@@ -152,6 +142,18 @@ void Info::GetSong()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_CURL_CURL_H
|
||||||
|
bool Info::Ready()
|
||||||
|
{
|
||||||
|
if (!artist_info_ready)
|
||||||
|
return false;
|
||||||
|
pthread_join(artist_info_downloader, NULL);
|
||||||
|
sInfo->Flush();
|
||||||
|
artist_info_downloader = 0;
|
||||||
|
artist_info_ready = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void Info::GetArtist()
|
void Info::GetArtist()
|
||||||
{
|
{
|
||||||
if (wCurrent == sInfo)
|
if (wCurrent == sInfo)
|
||||||
@@ -241,6 +243,7 @@ void Info::GetArtist()
|
|||||||
delete artist;
|
delete artist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // HVAE_CURL_CURL_H
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
#ifdef HAVE_CURL_CURL_H
|
#ifdef HAVE_CURL_CURL_H
|
||||||
|
|||||||
@@ -29,10 +29,9 @@ namespace Info
|
|||||||
void Init();
|
void Init();
|
||||||
void Resize();
|
void Resize();
|
||||||
|
|
||||||
bool Ready();
|
|
||||||
|
|
||||||
void GetSong();
|
void GetSong();
|
||||||
# ifdef HAVE_CURL_CURL_H
|
# ifdef HAVE_CURL_CURL_H
|
||||||
|
bool Ready();
|
||||||
void GetArtist();
|
void GetArtist();
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,8 +48,10 @@ pthread_mutex_t Global::curl = PTHREAD_MUTEX_INITIALIZER;
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
# ifdef HAVE_CURL_CURL_H
|
||||||
pthread_t lyrics_downloader;
|
pthread_t lyrics_downloader;
|
||||||
bool lyrics_ready;
|
bool lyrics_ready;
|
||||||
|
# endif
|
||||||
|
|
||||||
void *GetLyrics(void *);
|
void *GetLyrics(void *);
|
||||||
}
|
}
|
||||||
@@ -77,17 +79,6 @@ void Lyrics::Update()
|
|||||||
reload_lyrics = 0;
|
reload_lyrics = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Lyrics::Ready()
|
|
||||||
{
|
|
||||||
if (!lyrics_ready)
|
|
||||||
return false;
|
|
||||||
pthread_join(lyrics_downloader, NULL);
|
|
||||||
sLyrics->Flush();
|
|
||||||
lyrics_downloader = 0;
|
|
||||||
lyrics_ready = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Lyrics::Get()
|
void Lyrics::Get()
|
||||||
{
|
{
|
||||||
if (wCurrent == sLyrics && !reload_lyrics)
|
if (wCurrent == sLyrics && !reload_lyrics)
|
||||||
@@ -196,6 +187,16 @@ void Lyrics::Get()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_CURL_CURL_H
|
#ifdef HAVE_CURL_CURL_H
|
||||||
|
bool Lyrics::Ready()
|
||||||
|
{
|
||||||
|
if (!lyrics_ready)
|
||||||
|
return false;
|
||||||
|
pthread_join(lyrics_downloader, NULL);
|
||||||
|
sLyrics->Flush();
|
||||||
|
lyrics_downloader = 0;
|
||||||
|
lyrics_ready = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|||||||
14
src/lyrics.h
14
src/lyrics.h
@@ -23,20 +23,22 @@
|
|||||||
|
|
||||||
#include "ncmpcpp.h"
|
#include "ncmpcpp.h"
|
||||||
|
|
||||||
#ifdef HAVE_CURL_CURL_H
|
|
||||||
# include <pthread.h>
|
|
||||||
# include "curl/curl.h"
|
|
||||||
|
|
||||||
namespace Lyrics
|
namespace Lyrics
|
||||||
{
|
{
|
||||||
void Init();
|
void Init();
|
||||||
void Resize();
|
void Resize();
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
bool Ready();
|
|
||||||
void Get();
|
void Get();
|
||||||
|
# ifdef HAVE_CURL_CURL_H
|
||||||
|
bool Ready();
|
||||||
|
# endif // HAVE_CURL_CURL_H
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_CURL_CURL_H
|
||||||
|
# include <pthread.h>
|
||||||
|
# include "curl/curl.h"
|
||||||
|
|
||||||
struct LyricsPlugin
|
struct LyricsPlugin
|
||||||
{
|
{
|
||||||
const char *url;
|
const char *url;
|
||||||
@@ -47,7 +49,7 @@ struct LyricsPlugin
|
|||||||
|
|
||||||
const char *GetLyricsPluginName(int);
|
const char *GetLyricsPluginName(int);
|
||||||
|
|
||||||
#endif
|
#endif // HAVE_CURL_CURL_H
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user