Merge linux patches

This commit is contained in:
Ron Pedde 2003-11-03 20:34:18 +00:00
parent c758c1078e
commit 1c1a9e62f2
9 changed files with 231 additions and 394 deletions

View File

@ -5,6 +5,7 @@
<BODY>
<h1>Configuration Updated</h1>
<B>Web Root:</B> @WEB_ROOT@<BR>
<B>MP3 Dir:</B> @MP3DIR@<BR>
<B>Port:</B> @PORT@<BR>
<B>Admin Password:</B> @ADMINPW@
<HR>

View File

@ -15,9 +15,14 @@
<TABLE>
<TR>
<TD>Web Root</TD>
<TD><INPUT TYPE="TEXT" NAME="WEB_ROOT" READONLY
<TD><INPUT TYPE="TEXT" NAME="WEB_ROOT" READONLY SIZE="80"
VALUE="@WEB_ROOT@"></TD>
</TR>
<TR>
<TD>MP3 Dir</TD>
<TD><INPUT TYPE="TEXT" NAME="MP3DIR" READONLY SIZE="80"
VALUE="@MP3DIR@"></TD>
</TR>
<TR>
<TD>Port</TD>
<TD><INPUT TYPE="TEXT" NAME="PORT" READONLY

View File

@ -24,6 +24,7 @@ esac
dnl Checks for libraries.
AC_CHECK_LIB(pthread,pthread_create,LDFLAGS="$LDFLAGS -lpthread")
AC_CHECK_LIB(z,compress,LDFLAGS="$LDFLAGS -lz",echo "Must have zlib";exit)
dnl Checks for header files.
AC_HEADER_STDC

View File

@ -1,384 +0,0 @@
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# src/Makefile. Generated from Makefile.in by configure.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = /bin/sh
srcdir = .
top_srcdir = ..
prefix = /usr/local
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
sbindir = ${exec_prefix}/sbin
libexecdir = ${exec_prefix}/libexec
datadir = ${prefix}/share
sysconfdir = ${prefix}/etc
sharedstatedir = ${prefix}/com
localstatedir = ${prefix}/var
libdir = ${exec_prefix}/lib
infodir = ${prefix}/info
mandir = ${prefix}/man
includedir = ${prefix}/include
oldincludedir = /usr/include
pkgdatadir = $(datadir)/mt-daapd
pkglibdir = $(libdir)/mt-daapd
pkgincludedir = $(includedir)/mt-daapd
top_builddir = ..
ACLOCAL = ${SHELL} /home/ron/working/mt-daapd/missing --run aclocal-1.6
AUTOCONF = ${SHELL} /home/ron/working/mt-daapd/missing --run autoconf
AUTOMAKE = ${SHELL} /home/ron/working/mt-daapd/missing --run automake-1.6
AUTOHEADER = ${SHELL} /home/ron/working/mt-daapd/missing --run autoheader
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = ${INSTALL}
INSTALL_HEADER = $(INSTALL_DATA)
transform = s,x,x,
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias =
host_triplet = i686-pc-linux-gnu
EXEEXT =
OBJEXT = o
PATH_SEPARATOR = :
AMTAR = ${SHELL} /home/ron/working/mt-daapd/missing --run tar
AWK = gawk
CC = gcc
DEPDIR = .deps
INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
PACKAGE = mt-daapd
STRIP =
VERSION = 0.1.0
V_NETLIBS =
am__include = include
am__quote =
install_sh = /home/ron/working/mt-daapd/install-sh
# $Id$
#
sbin_PROGRAMS = mt-daapd
mt_daapd_SOURCES = main.c daapd.h rend.c rend.h uici.c uici.h webserver.c \
webserver.h configfile.c configfile.h err.c err.h restart.c restart.h \
daap-proto.c daap-proto.h daap.c daap.h \
mdns/mDNS.c mdns/mDNSClientAPI.h mdns/mDNSDebug.h mdns/mDNSPosix.c \
mdns/mDNSUNP.c
subdir = src
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
sbin_PROGRAMS = mt-daapd$(EXEEXT)
PROGRAMS = $(sbin_PROGRAMS)
am_mt_daapd_OBJECTS = main.$(OBJEXT) rend.$(OBJEXT) uici.$(OBJEXT) \
webserver.$(OBJEXT) configfile.$(OBJEXT) err.$(OBJEXT) \
restart.$(OBJEXT) daap-proto.$(OBJEXT) daap.$(OBJEXT) \
mDNS.$(OBJEXT) mDNSPosix.$(OBJEXT) mDNSUNP.$(OBJEXT)
mt_daapd_OBJECTS = $(am_mt_daapd_OBJECTS)
mt_daapd_LDADD = $(LDADD)
mt_daapd_DEPENDENCIES =
mt_daapd_LDFLAGS =
DEFS = -DHAVE_CONFIG_H
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
CPPFLAGS = -DDEBUG -g -DHAVE_SOCKLEN_T
LDFLAGS = -lpthread
LIBS =
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
DEP_FILES = ./$(DEPDIR)/configfile.Po \
./$(DEPDIR)/daap-proto.Po ./$(DEPDIR)/daap.Po \
./$(DEPDIR)/err.Po ./$(DEPDIR)/mDNS.Po \
./$(DEPDIR)/mDNSPosix.Po ./$(DEPDIR)/mDNSUNP.Po \
./$(DEPDIR)/main.Po ./$(DEPDIR)/rend.Po \
./$(DEPDIR)/restart.Po ./$(DEPDIR)/uici.Po \
./$(DEPDIR)/webserver.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
CFLAGS = -g -O2
DIST_SOURCES = $(mt_daapd_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
SOURCES = $(mt_daapd_SOURCES)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu src/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(sbindir)
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f"; \
$(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f; \
else :; fi; \
done
uninstall-sbinPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f $(DESTDIR)$(sbindir)/$$f"; \
rm -f $(DESTDIR)$(sbindir)/$$f; \
done
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
mDNS.$(OBJEXT): mdns/mDNS.c
mDNSPosix.$(OBJEXT): mdns/mDNSPosix.c
mDNSUNP.$(OBJEXT): mdns/mDNSUNP.c
mt-daapd$(EXEEXT): $(mt_daapd_OBJECTS) $(mt_daapd_DEPENDENCIES)
@rm -f mt-daapd$(EXEEXT)
$(LINK) $(mt_daapd_LDFLAGS) $(mt_daapd_OBJECTS) $(mt_daapd_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
include ./$(DEPDIR)/configfile.Po
include ./$(DEPDIR)/daap-proto.Po
include ./$(DEPDIR)/daap.Po
include ./$(DEPDIR)/err.Po
include ./$(DEPDIR)/mDNS.Po
include ./$(DEPDIR)/mDNSPosix.Po
include ./$(DEPDIR)/mDNSUNP.Po
include ./$(DEPDIR)/main.Po
include ./$(DEPDIR)/rend.Po
include ./$(DEPDIR)/restart.Po
include ./$(DEPDIR)/uici.Po
include ./$(DEPDIR)/webserver.Po
distclean-depend:
-rm -rf ./$(DEPDIR)
.c.o:
source='$<' object='$@' libtool=no \
depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
$(CCDEPMODE) $(depcomp) \
$(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
source='$<' object='$@' libtool=no \
depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
$(CCDEPMODE) $(depcomp) \
$(COMPILE) -c `cygpath -w $<`
mDNS.o: mdns/mDNS.c
source='mdns/mDNS.c' object='mDNS.o' libtool=no \
depfile='$(DEPDIR)/mDNS.Po' tmpdepfile='$(DEPDIR)/mDNS.TPo' \
$(CCDEPMODE) $(depcomp) \
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mDNS.o `test -f 'mdns/mDNS.c' || echo '$(srcdir)/'`mdns/mDNS.c
mDNS.obj: mdns/mDNS.c
source='mdns/mDNS.c' object='mDNS.obj' libtool=no \
depfile='$(DEPDIR)/mDNS.Po' tmpdepfile='$(DEPDIR)/mDNS.TPo' \
$(CCDEPMODE) $(depcomp) \
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mDNS.obj `cygpath -w mdns/mDNS.c`
mDNSPosix.o: mdns/mDNSPosix.c
source='mdns/mDNSPosix.c' object='mDNSPosix.o' libtool=no \
depfile='$(DEPDIR)/mDNSPosix.Po' tmpdepfile='$(DEPDIR)/mDNSPosix.TPo' \
$(CCDEPMODE) $(depcomp) \
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mDNSPosix.o `test -f 'mdns/mDNSPosix.c' || echo '$(srcdir)/'`mdns/mDNSPosix.c
mDNSPosix.obj: mdns/mDNSPosix.c
source='mdns/mDNSPosix.c' object='mDNSPosix.obj' libtool=no \
depfile='$(DEPDIR)/mDNSPosix.Po' tmpdepfile='$(DEPDIR)/mDNSPosix.TPo' \
$(CCDEPMODE) $(depcomp) \
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mDNSPosix.obj `cygpath -w mdns/mDNSPosix.c`
mDNSUNP.o: mdns/mDNSUNP.c
source='mdns/mDNSUNP.c' object='mDNSUNP.o' libtool=no \
depfile='$(DEPDIR)/mDNSUNP.Po' tmpdepfile='$(DEPDIR)/mDNSUNP.TPo' \
$(CCDEPMODE) $(depcomp) \
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mDNSUNP.o `test -f 'mdns/mDNSUNP.c' || echo '$(srcdir)/'`mdns/mDNSUNP.c
mDNSUNP.obj: mdns/mDNSUNP.c
source='mdns/mDNSUNP.c' object='mDNSUNP.obj' libtool=no \
depfile='$(DEPDIR)/mDNSUNP.Po' tmpdepfile='$(DEPDIR)/mDNSUNP.TPo' \
$(CCDEPMODE) $(depcomp) \
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mDNSUNP.obj `cygpath -w mdns/mDNSUNP.c`
CCDEPMODE = depmode=gcc3
uninstall-info-am:
ETAGS = etags
ETAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@list='$(DISTFILES)'; for file in $$list; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(sbindir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am
distclean: distclean-am
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am:
install-exec-am: install-sbinPROGRAMS
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
uninstall-am: uninstall-info-am uninstall-sbinPROGRAMS
.PHONY: GTAGS all all-am check check-am clean clean-generic \
clean-sbinPROGRAMS distclean distclean-compile distclean-depend \
distclean-generic distclean-tags distdir dvi dvi-am info \
info-am install install-am install-data install-data-am \
install-exec install-exec-am install-info install-info-am \
install-man install-sbinPROGRAMS install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic tags uninstall uninstall-am \
uninstall-info-am uninstall-sbinPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -88,6 +88,9 @@ int config_read(char *file, CONFIG *pconfig) {
} else if(!strcasecmp(buffer,"admin_password")) {
pconfig->adminpassword=strdup(value);
DPRINTF(ERR_DEBUG,"Admin pw: %s\n",value);
} else if(!strcasecmp(buffer,"mp3_dir")) {
pconfig->mp3dir=strdup(value);
DPRINTF(ERR_DEBUG,"MP3 Dir: %s\n",value);
} else {
DPRINTF(ERR_INFO,"Bad config directive: %s\n",buffer);
}
@ -115,6 +118,12 @@ int config_read(char *file, CONFIG *pconfig) {
err=-1;
}
if(!pconfig->mp3dir) {
fprintf(stderr,"Config: missing mp3_dir entry\n");
errno=EINVAL;
err=-1;
}
return err;
}

View File

@ -19,7 +19,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "daap-proto.h"
#include "daap.h"
@ -119,6 +121,11 @@ DAAP_ITEMS taglist[] = {
{ 0x00, NULL, NULL }
};
/* Forwards */
DAAP_BLOCK *daap_response_songlist(void);
DAAP_BLOCK *daap_response_playlists(void);
DAAP_BLOCK *daap_response_dbinfo(void);
DAAP_BLOCK *daap_response_playlist_items(int playlist);
int daap_add_mdcl(DAAP_BLOCK *root, char *tag, char *name, short int number) {
DAAP_BLOCK *mdcl;
@ -149,7 +156,6 @@ DAAP_BLOCK *daap_response_content_codes(void) {
DAAP_ITEMS *current=taglist;
int g=1;
root=daap_add_empty(NULL,"mccr");
if(root) {
g = (int)daap_add_int(root,"mstt",200);
@ -195,6 +201,35 @@ DAAP_BLOCK *daap_response_login(void) {
return root;
}
/*
* daap_response_songlist
*
* handle the daap block for the /databases/x/items URI
*/
DAAP_BLOCK *daap_response_songlist(void) {
DAAP_BLOCK *root;
int g=1;
root=daap_add_empty(NULL,"adbs");
if(root) {
g = (int)daap_add_int(root,"mstt",200);
g = g && daap_add_char(root,"muty",0);
g = g && daap_add_int(root,"mtco",0);
g = g && daap_add_int(root,"mrco",0);
g = g && daap_add_empty(root,"mlcl");
}
if(!g) {
daap_free(root);
return NULL;
}
return root;
}
/*
* daap_response_update
*
@ -226,7 +261,141 @@ DAAP_BLOCK *daap_response_update(void) {
* handle the daap block for the /databases URI
*/
DAAP_BLOCK *daap_response_databases(void) {
DAAP_BLOCK *daap_response_databases(char *path) {
char *uri;
int db_index;
int playlist_index;
char *first, *last;
if(strcmp(path,"/databases")==0) {
return daap_response_dbinfo();
}
uri = strdup(path);
first=(char*)&uri[11];
last=first;
while((*last) && (*last != '/')) {
last++;
}
if(*last != '/') {
return NULL;
}
*last='\0';
db_index=atoi(first);
/* now we have the db id. Next, we have to figure out
* if it's a container request or a
* items request
*
* note we generally don't care about the DB index, since we only
* support 1 db.
*/
/* the /databases/ uri will either be
*
* /databases, which returns an AVDB,
* /databases/id/items, which returns items in a db
* /databases/id/containers, which returns a container
* /databases/id/containers/id/items, which returns playlist elements
* /databases/id/items/id.mp3, to spool an mp3
*/
last++;
if(strncasecmp(last,"items/",6)==0) {
/* streaming */
free(uri);
return NULL;
}
if(strncasecmp(last,"items",5)==0) {
/* songlist */
free(uri);
return daap_response_songlist();
}
if(strncasecmp(last,"containers/",11)==0) {
/* playlist elements */
first=last + 11;
last=first;
while((*last) && (*last != '/')) {
last++;
}
if(*last != '/') {
return NULL;
}
*last='\0';
playlist_index=atoi(first);
free(uri);
return daap_response_playlist_items(playlist_index);
}
if(strncasecmp(last,"containers",10)==0) {
/* list of playlists */
free(uri);
return daap_response_playlists();
return NULL;
}
free(uri);
return NULL;
}
/*
* daap_response_playlists
*
* handle the daap block for the /databases/containers URI
*/
DAAP_BLOCK *daap_response_playlists(void) {
DAAP_BLOCK *root;
DAAP_BLOCK *mlcl;
DAAP_BLOCK *mlit;
int g=1;
root=daap_add_empty(NULL,"aply");
if(root) {
g = (int)daap_add_int(root,"mstt",200);
g = g && daap_add_char(root,"muty",0);
g = g && daap_add_int(root,"mtco",1);
g = g && daap_add_int(root,"mrco",1);
mlcl=daap_add_empty(root,"mlcl");
if(mlcl) {
mlit=daap_add_empty(mlcl,"mlit");
if(mlit) {
g = g && daap_add_int(mlit,"miid",0x1);
g = g && daap_add_long(mlit,"mper",0,2);
g = g && daap_add_string(mlit,"minm","daapd music");
g = g && daap_add_int(mlit,"mimc",0x0);
}
}
}
g = g && mlcl && mlit;
if(!g) {
DPRINTF(ERR_INFO,"Memory problem. Bailing\n");
daap_free(root);
return NULL;
}
return root;
}
/*
* daap_response_dbinfo
*
* handle the daap block for the /databases URI
*/
DAAP_BLOCK *daap_response_dbinfo(void) {
DAAP_BLOCK *root;
DAAP_BLOCK *mlcl;
DAAP_BLOCK *mlit;
@ -245,8 +414,8 @@ DAAP_BLOCK *daap_response_databases(void) {
g = g && daap_add_int(mlit,"miid",0x20);
g = g && daap_add_long(mlit,"mper",0,1);
g = g && daap_add_string(mlit,"minm","daapd music");
g = g && daap_add_int(mlit,"mimc",0x10);
g = g && daap_add_int(mlit,"mctc",0x1);
g = g && daap_add_int(mlit,"mimc",0x0); /* songs */
g = g && daap_add_int(mlit,"mctc",0x1); /* playlists */
}
}
}
@ -298,3 +467,31 @@ DAAP_BLOCK *daap_response_server_info(void) {
return root;
}
/*
* daap_response_playlist_items
*
* given a playlist number, return the items on the playlist
*/
DAAP_BLOCK *daap_response_playlist_items(int playlist) {
DAAP_BLOCK *root;
int g=1;
root=daap_add_empty(NULL,"apso");
if(root) {
g = (int)daap_add_int(root,"mstt",200);
g = g && daap_add_char(root,"muty",0);
g = g && daap_add_int(root,"mtco",0);
g = g && daap_add_int(root,"mrco",0);
g = g && daap_add_empty(root,"mlcl");
}
if(!g) {
daap_free(root);
return NULL;
}
return root;
}

View File

@ -27,7 +27,7 @@ DAAP_BLOCK *daap_response_server_info(void);
DAAP_BLOCK *daap_response_content_codes(void);
DAAP_BLOCK *daap_response_login(void);
DAAP_BLOCK *daap_response_update(void);
DAAP_BLOCK *daap_response_databases(void);
DAAP_BLOCK *daap_response_databases(char *path);
#endif /* _DAAP_H_ */

View File

@ -79,18 +79,22 @@ void daap_handler(WS_CONNINFO *pwsc) {
} else if (!strcasecmp(pwsc->uri,"/update")) {
root=daap_response_update();
} else if (!strcasecmp(pwsc->uri,"/databases")) {
root=daap_response_databases();
root=daap_response_databases(pwsc->uri);
} else if (!strcasecmp(pwsc->uri,"/logout")) {
ws_returnerror(pwsc,204,"Logout Successful");
return;
} else if (!strncasecmp(pwsc->uri,"/databases/",11)) {
root=daap_response_databases(pwsc->uri);
} else {
DPRINTF(ERR_WARN,"Bad handler! Can't find uri handler for %s\n",
pwsc->uri);
return;
}
if(!root)
if(!root) {
ws_returnerror(pwsc,400,"Invalid Request");
return;
}
pwsc->close=close;
@ -169,6 +173,8 @@ void config_handler(WS_CONNINFO *pwsc) {
/* we need to update stuff */
argptr=ws_getvar(pwsc,"adminpw");
if(argptr) {
if(config.adminpassword)
free(config.adminpassword);
config.adminpassword=strdup(argptr);
}
}
@ -195,6 +201,8 @@ void config_handler(WS_CONNINFO *pwsc) {
ws_writefd(pwsc,"%s",config.adminpassword);
} else if (strcasecmp(argbuffer,"RELEASE") == 0) {
ws_writefd(pwsc,"mt-daapd %s\n",VERSION);
} else if (strcasecmp(argbuffer,"MP3DIR") == 0) {
ws_writefd(pwsc,"%s",config.mp3dir);
} else {
ws_writefd(pwsc,"@ERR@");
}
@ -311,6 +319,7 @@ int main(int argc, char *argv[]) {
ws_registerhandler(server,"^/update$",daap_handler,NULL,0);
ws_registerhandler(server,"^/databases$",daap_handler,NULL,0);
ws_registerhandler(server,"^/logout$",daap_handler,NULL,0);
ws_registerhandler(server,"^/databases/.*",daap_handler,NULL,0);
if(use_mdns)
rend_init(&rendezvous_pid);

View File

@ -1,5 +1,4 @@
web_root /Users/ron/Documents/School/cs4953 - Concurrency/mt-daapd/admin-root
port 3689
admin_password secret
mp3_dir /Users/ron/Music/iTunes/iTunes Music/Poe/Hello