mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-25 06:35:57 -05:00
Add experimental dynamic art code by Hiren Joshi
This commit is contained in:
parent
7048d7c15e
commit
3e31ccf1d2
4
CREDITS
4
CREDITS
@ -30,3 +30,7 @@ David Imhoff (6219@thrijswijk.nl)
|
||||
James Turner (jmturner@users.sourceforge.net)
|
||||
* Fixes for OSX 10.2
|
||||
* configure.in suggestions
|
||||
|
||||
Hiren Joshi (hirenj@mooh.org)
|
||||
* Dynamic art code (!!)
|
||||
|
||||
|
12
ChangeLog
12
ChangeLog
@ -1,4 +1,14 @@
|
||||
2004-04-04 Ron Pedde <ron@mac-laptop.dynamic.pedde.com>
|
||||
2004-04-13 Ron Pedde <ron@pedde.com>
|
||||
|
||||
* src/dynamic-art.c: merged in patch from Hiren Joshi
|
||||
(hirenj@mooh.org) to allow .jpg files to be transparently
|
||||
streamed into the id3 tag. ubercool.
|
||||
|
||||
2004-04-11 Ron Pedde <ron@pedde.com>
|
||||
|
||||
* src/err.c: add in support for a logfile. Feature request #916153
|
||||
|
||||
2004-04-04 Ron Pedde <ron@pedde.com>
|
||||
|
||||
* src/mp3-scanner.c: add support for MPEG v 2 and 2.5. Feature
|
||||
request #916151
|
||||
|
@ -119,5 +119,21 @@ extensions .mp3,.m4a,.m4p
|
||||
|
||||
#logfile /var/log/mt-daapd.log
|
||||
|
||||
#
|
||||
# art_filename (optional)
|
||||
#
|
||||
# There is (experimental!) support thanks to Hiren Joshi
|
||||
# (hirenj@mooh.org) for dynamically adding art to the id3v2
|
||||
# header as it is streamed (!!). If you were using a music system
|
||||
# like zina or andromeda, for example, with cover art called
|
||||
# "_folderOpenImage.jpg", you could use the parameter
|
||||
# art_file _folderOpenImage.jpg and if the file _folderOpenImage.jpg
|
||||
# was located in the same folder as the .mp3 file, it would appear
|
||||
# in iTunes. Cool, eh?
|
||||
#
|
||||
|
||||
#art_filename _folderOpenImage.jpg
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@ mt_daapd_SOURCES = main.c daapd.h rend.h uici.c uici.h webserver.c \
|
||||
daap-proto.c daap-proto.h daap.c daap.h db-gdbm.c db-memory.h \
|
||||
mp3-scanner.h mp3-scanner.c playlist.c playlist.h rend-unix.c \
|
||||
rend-unix.h lexer.l parser.y strcasestr.c strcasestr.h strsep.c \
|
||||
redblack.c redblack.h \
|
||||
redblack.c redblack.h dynamic-art.c dynamic-art.h \
|
||||
$(PRENDSRC) $(ORENDSRC) $(HRENDSRC)
|
||||
|
||||
EXTRA_DIST = mDNS.c mDNSClientAPI.h mDNSDebug.h mDNSPosix.c \
|
||||
|
@ -109,6 +109,7 @@ CONFIGELEMENT config_elements[] = {
|
||||
{ 0,0,0,CONFIG_TYPE_SPECIAL,"readonly",(void*)NULL,config_emit_readonly },
|
||||
{ 0,0,0,CONFIG_TYPE_SPECIAL,"version",(void*)NULL,config_emit_version },
|
||||
{ 0,0,0,CONFIG_TYPE_SPECIAL,"system",(void*)NULL,config_emit_system },
|
||||
{ 1,0,0,CONFIG_TYPE_STRING,"art_filename",(void*)&config.artfilename,config_emit_string },
|
||||
{ 0,0,0,CONFIG_TYPE_SPECIAL,"flags",(void*)NULL,config_emit_flags },
|
||||
{ -1,1,0,CONFIG_TYPE_STRING,NULL,NULL,NULL }
|
||||
};
|
||||
@ -164,6 +165,7 @@ int config_read(char *file) {
|
||||
config.mp3dir=NULL;
|
||||
config.playlist=NULL;
|
||||
config.runas=NULL;
|
||||
config.artfilename=NULL;
|
||||
config.logfile=NULL;
|
||||
config.extensions=".mp3";
|
||||
|
||||
|
@ -44,6 +44,7 @@ typedef struct tag_config {
|
||||
char *runas;
|
||||
char *dbdir;
|
||||
char *extensions;
|
||||
char *artfilename;
|
||||
char *logfile;
|
||||
STATS stats;
|
||||
} CONFIG;
|
||||
|
21
src/main.c
21
src/main.c
@ -49,6 +49,7 @@
|
||||
#include "rend.h"
|
||||
#include "webserver.h"
|
||||
#include "playlist.h"
|
||||
#include "dynamic-art.h"
|
||||
|
||||
#define DEFAULT_CONFIGFILE "/etc/mt-daapd.conf"
|
||||
|
||||
@ -105,6 +106,8 @@ void daap_handler(WS_CONNINFO *pwsc) {
|
||||
int file_fd;
|
||||
int session_id=0;
|
||||
|
||||
int img_fd;
|
||||
|
||||
off_t offset=0;
|
||||
off_t file_len;
|
||||
|
||||
@ -278,13 +281,21 @@ void daap_handler(WS_CONNINFO *pwsc) {
|
||||
config_set_status(pwsc,session_id,"Streaming file '%s'",pmp3->fname);
|
||||
DPRINTF(ERR_LOG,"Session %d: Streaming file '%s' to %s\n",session_id,
|
||||
pmp3->fname, pwsc->hostname);
|
||||
|
||||
if(!offset)
|
||||
config.stats.songs_served++; /* FIXME: remove stat races */
|
||||
|
||||
config.stats.songs_served++; /* FIXME: remove stat races */
|
||||
|
||||
if(offset) {
|
||||
DPRINTF(ERR_INFO,"Seeking to offset %d\n",offset);
|
||||
lseek(file_fd,offset,SEEK_SET);
|
||||
if((config.artfilename) && (img_fd=da_get_image_fd(pmp3->path)) && (!offset)) {
|
||||
DPRINTF(ERR_INFO,"Dynamically attaching artwork to %s\n",pmp3->fname);
|
||||
da_attach_image(img_fd, pwsc->fd, file_fd, offset);
|
||||
r_close(img_fd);
|
||||
} else {
|
||||
if(offset) {
|
||||
DPRINTF(ERR_INFO,"Seeking to offset %d\n",offset);
|
||||
lseek(file_fd,offset,SEEK_SET);
|
||||
}
|
||||
}
|
||||
|
||||
if(copyfile(file_fd,pwsc->fd)) {
|
||||
DPRINTF(ERR_INFO,"Error copying file to remote... %s\n",
|
||||
strerror(errno));
|
||||
|
Loading…
Reference in New Issue
Block a user