mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
- rename COVERDIR => COVERDIR_TMP
Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -522,8 +522,8 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover)
|
|||||||
bitrate += avc->streams[i]->codecpar->bit_rate;
|
bitrate += avc->streams[i]->codecpar->bit_rate;
|
||||||
#endif
|
#endif
|
||||||
if (save_cover && (avc->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC)) {
|
if (save_cover && (avc->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC)) {
|
||||||
mkdir(COVERDIR, 0755);
|
mkdir(COVERDIR_TMP, 0755);
|
||||||
std::string cover(COVERDIR);
|
std::string cover(COVERDIR_TMP);
|
||||||
cover += "/cover_" + to_string(cover_count++) + ".jpg";
|
cover += "/cover_" + to_string(cover_count++) + ".jpg";
|
||||||
FILE *f = fopen(cover.c_str(), "wb");
|
FILE *f = fopen(cover.c_str(), "wb");
|
||||||
if (f) {
|
if (f) {
|
||||||
|
@@ -1389,9 +1389,9 @@ bool CMP3Dec::SaveCover(FILE * in, CAudioMetaData * const m)
|
|||||||
data = id3_field_getbinarydata(field, &size);
|
data = id3_field_getbinarydata(field, &size);
|
||||||
if ( data )
|
if ( data )
|
||||||
{
|
{
|
||||||
mkdir(COVERDIR, 0755);
|
mkdir(COVERDIR_TMP, 0755);
|
||||||
std::ostringstream cover;
|
std::ostringstream cover;
|
||||||
cover.str(COVERDIR);
|
cover.str(COVERDIR_TMP);
|
||||||
cover << "/cover_" << cover_count++ << ".jpg";
|
cover << "/cover_" << cover_count++ << ".jpg";
|
||||||
FILE * pFile;
|
FILE * pFile;
|
||||||
pFile = fopen ( cover.str().c_str() , "wb" );
|
pFile = fopen ( cover.str().c_str() , "wb" );
|
||||||
|
@@ -47,7 +47,7 @@
|
|||||||
#define NEUTRINO_SCAN_SETTINGS_FILE CONFIGDIR "/scan.conf"
|
#define NEUTRINO_SCAN_SETTINGS_FILE CONFIGDIR "/scan.conf"
|
||||||
#define NEUTRINO_PARENTALLOCKED_FILE DATADIR "/neutrino/.plocked"
|
#define NEUTRINO_PARENTALLOCKED_FILE DATADIR "/neutrino/.plocked"
|
||||||
|
|
||||||
#define COVERDIR "/tmp/cover"
|
#define COVERDIR_TMP "/tmp/.cover"
|
||||||
|
|
||||||
#define LOGODIR ICONSDIR "/logo"
|
#define LOGODIR ICONSDIR "/logo"
|
||||||
#define LOGODIR_VAR ICONSDIR_VAR "/logo"
|
#define LOGODIR_VAR ICONSDIR_VAR "/logo"
|
||||||
|
@@ -1718,14 +1718,14 @@ void CAudioPlayerGui::paintCover()
|
|||||||
std::size_t found_url = meta.logo.find("://");
|
std::size_t found_url = meta.logo.find("://");
|
||||||
if (found_url != std::string::npos)
|
if (found_url != std::string::npos)
|
||||||
{
|
{
|
||||||
mkdir(COVERDIR, 0755);
|
mkdir(COVERDIR_TMP, 0755);
|
||||||
|
|
||||||
std::string filename(meta.logo);
|
std::string filename(meta.logo);
|
||||||
const size_t last_slash_idx = filename.find_last_of("/");
|
const size_t last_slash_idx = filename.find_last_of("/");
|
||||||
if (last_slash_idx != std::string::npos)
|
if (last_slash_idx != std::string::npos)
|
||||||
filename.erase(0, last_slash_idx + 1);
|
filename.erase(0, last_slash_idx + 1);
|
||||||
|
|
||||||
std::string fullname(COVERDIR);
|
std::string fullname(COVERDIR_TMP);
|
||||||
fullname += "/" + filename;
|
fullname += "/" + filename;
|
||||||
|
|
||||||
CHTTPTool httptool;
|
CHTTPTool httptool;
|
||||||
@@ -2788,10 +2788,10 @@ std::string CAudioPlayerGui::absPath2Rel(const std::string& fromDir,
|
|||||||
|
|
||||||
void CAudioPlayerGui::cleanupCovers()
|
void CAudioPlayerGui::cleanupCovers()
|
||||||
{
|
{
|
||||||
if (access(COVERDIR, F_OK) == 0)
|
if (access(COVERDIR_TMP, F_OK) == 0)
|
||||||
{
|
{
|
||||||
struct dirent **coverlist;
|
struct dirent **coverlist;
|
||||||
int n = scandir(COVERDIR, &coverlist, 0, alphasort);
|
int n = scandir(COVERDIR_TMP, &coverlist, 0, alphasort);
|
||||||
if (n > -1)
|
if (n > -1)
|
||||||
{
|
{
|
||||||
while (n--)
|
while (n--)
|
||||||
@@ -2799,8 +2799,8 @@ void CAudioPlayerGui::cleanupCovers()
|
|||||||
const char *coverfile = coverlist[n]->d_name;
|
const char *coverfile = coverlist[n]->d_name;
|
||||||
if (strcmp(coverfile, ".") == 0 || strcmp(coverfile, "..") == 0)
|
if (strcmp(coverfile, ".") == 0 || strcmp(coverfile, "..") == 0)
|
||||||
continue;
|
continue;
|
||||||
printf("[audioplayer] removing cover %s/%s\n", COVERDIR, coverfile);
|
printf("[audioplayer] removing cover %s/%s\n", COVERDIR_TMP, coverfile);
|
||||||
unlink(((std::string)COVERDIR + "/" + coverfile).c_str());
|
unlink(((std::string)COVERDIR_TMP + "/" + coverfile).c_str());
|
||||||
free(coverlist[n]);
|
free(coverlist[n]);
|
||||||
}
|
}
|
||||||
free(coverlist);
|
free(coverlist);
|
||||||
|
@@ -169,7 +169,22 @@ void* CScreenSaver::ScreenSaverPrg(void* arg)
|
|||||||
|
|
||||||
bool CScreenSaver::ReadDir()
|
bool CScreenSaver::ReadDir()
|
||||||
{
|
{
|
||||||
string d = g_settings.screensaver_dir;
|
bool show_audiocover = false;
|
||||||
|
|
||||||
|
if (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_audio && g_settings.audioplayer_cover_as_screensaver)
|
||||||
|
{
|
||||||
|
if (access(COVERDIR_TMP, F_OK) == 0)
|
||||||
|
{
|
||||||
|
struct dirent **coverlist;
|
||||||
|
int n = scandir(COVERDIR_TMP, &coverlist, 0, alphasort);
|
||||||
|
if (n > 2) // we always have the "." and ".." entrys
|
||||||
|
show_audiocover = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string d;
|
||||||
|
if (show_audiocover)
|
||||||
|
d = COVERDIR_TMP;
|
||||||
if (d.length() > 1)
|
if (d.length() > 1)
|
||||||
{
|
{
|
||||||
//remove trailing slash
|
//remove trailing slash
|
||||||
|
Reference in New Issue
Block a user