mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-14 08:15:02 -05:00
fixed error when not finding cover art
This commit is contained in:
parent
ffee7a4acf
commit
40169a7e91
@ -76,7 +76,7 @@ int da_get_image_fd(char *filename) {
|
|||||||
path_end = strrchr(buffer,'/');
|
path_end = strrchr(buffer,'/');
|
||||||
strcpy(path_end+1,config.artfilename);
|
strcpy(path_end+1,config.artfilename);
|
||||||
fd = open(buffer,O_RDONLY);
|
fd = open(buffer,O_RDONLY);
|
||||||
if(fd)
|
if(fd != -1)
|
||||||
DPRINTF(ERR_INFO,"Found image file %s\n",buffer);
|
DPRINTF(ERR_INFO,"Found image file %s\n",buffer);
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
@ -125,7 +125,11 @@ int da_attach_image(int img_fd, int out_fd, int mp3_fd, int offset)
|
|||||||
unsigned char buffer[4];
|
unsigned char buffer[4];
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
fstat(img_fd,&sb);
|
if(fstat(img_fd,&sb)) {
|
||||||
|
DPRINTF(ERR_INFO,"Cannot stat image file... %s\n",strerror(errno));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
img_size=sb.st_size;
|
img_size=sb.st_size;
|
||||||
DPRINTF(ERR_INFO,"Image appears to be %ld bytes\n",img_size);
|
DPRINTF(ERR_INFO,"Image appears to be %ld bytes\n",img_size);
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ void daap_handler(WS_CONNINFO *pwsc) {
|
|||||||
if(!offset)
|
if(!offset)
|
||||||
config.stats.songs_served++; /* FIXME: remove stat races */
|
config.stats.songs_served++; /* FIXME: remove stat races */
|
||||||
|
|
||||||
if((config.artfilename) && (img_fd=da_get_image_fd(pmp3->path))) {
|
if((config.artfilename) && (img_fd=da_get_image_fd(pmp3->path) != -1)) {
|
||||||
DPRINTF(ERR_INFO,"Dynamically attaching artwork to %s (fd %d)\n",
|
DPRINTF(ERR_INFO,"Dynamically attaching artwork to %s (fd %d)\n",
|
||||||
pmp3->fname, img_fd);
|
pmp3->fname, img_fd);
|
||||||
da_attach_image(img_fd, pwsc->fd, file_fd, offset);
|
da_attach_image(img_fd, pwsc->fd, file_fd, offset);
|
||||||
|
Loading…
Reference in New Issue
Block a user