Skip to content

Commit

Permalink
add lightmediascannerd and lightmediascannerctl
Browse files Browse the repository at this point in the history
The daemon and control client are provided as a way to make usage of
lightmediascanner easier in a platform. It will scan directories based
on the startup configuration of categories, their parsers and
directories.

One can request a write lock, avoiding the server to scan and also
report to others that they should not write to DB.

Scanning status, Write Lock and global Update ID are provided as
properties.

The scan method will take a dict of categories and their respective
scan paths. This allows to reduce the scan scope to just few
categories and paths. The categories must exist previously and paths
must be inside the previously known categories directories, this
avoids people doing mistakes. If a category is provided as an empty
list, all directories will be used. If there are no categories
provided, then all categories with all directories will be used.
  • Loading branch information
barbieri authored and lucasdemarchi committed Aug 30, 2013
1 parent d0c3240 commit e414e1f
Show file tree
Hide file tree
Showing 8 changed files with 1,850 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
org.lightmediascanner.service
5 changes: 5 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = lightmediascanner.pc

ACLOCAL_AMFLAGS = -I m4

if BUILD_DAEMON
servicedir = @dbusservicedir@
service_DATA = org.lightmediascanner.service
endif
21 changes: 21 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,25 @@ AC_LMS_OPTIONAL_MODULE([flac], true, [CHECK_MODULE_FLAC])
AC_LMS_OPTIONAL_MODULE([wave], true)


AC_ARG_ENABLE([daemon],
[AC_HELP_STRING([--disable-daemon],
[Disable DBus scanner daemon. @<:@default=enable@:>@])],
[build_daemon=${enableval}], [build_daemon=yes])

dbusservicedir="${datadir}/dbus-1/services"
AC_ARG_WITH([dbus-services],
[AC_HELP_STRING([--with-dbus-services=DBUS_SERVICES],
[Specify a directory to store dbus service files.])],
[dbusservicedir=$withval])
AC_SUBST(dbusservicedir)

dbusdir=""
if test "$build_daemon" = "yes"; then
PKG_CHECK_MODULES(GIO, [gio-2.0 >= 2.32])
fi
AM_CONDITIONAL([BUILD_DAEMON], [test "$build_daemon" = "yes"])


#####################################################################
# Default CFLAGS and LDFLAGS
#####################################################################
Expand Down Expand Up @@ -178,6 +197,7 @@ AC_SUBST([GCLDFLAGS], $with_ldflags)
AC_OUTPUT([
lightmediascanner.pc
lightmediascanner.spec
org.lightmediascanner.service
Makefile
m4/Makefile
src/Makefile
Expand Down Expand Up @@ -213,3 +233,4 @@ Summary:
SUMMARY_EOF

echo -e " * modules........: $MODS $UNUSED_MODS"
echo -e " * daemon.........: ${build_daemon}"
3 changes: 3 additions & 0 deletions org.lightmediascanner.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[D-BUS Service]
Name=org.lightmediascanner
Exec=@prefix@/bin/lightmediascannerd
2 changes: 2 additions & 0 deletions src/bin/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
test
list-parsers
lightmediascannerd
lightmediascannerctl
18 changes: 18 additions & 0 deletions src/bin/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,21 @@ list_parsers_SOURCES = list-parsers.c
list_parsers_LDADD = $(top_builddir)/src/lib/liblightmediascanner.la \
@SQLITE3_LIBS@
list_parsers_DEPENDENCIES = $(top_builddir)/src/lib/liblightmediascanner.la


if BUILD_DAEMON
bin_PROGRAMS = lightmediascannerd lightmediascannerctl

lightmediascannerd_SOURCES = lightmediascannerd.c
lightmediascannerd_CPPFLAGS = $(AM_CPPFLAGS) @GIO_CFLAGS@
lightmediascannerd_LDADD = \
$(top_builddir)/src/lib/liblightmediascanner.la \
@SQLITE3_LIBS@ \
@GIO_LIBS@
lightmediascannerd_DEPENDENCIES = \
$(top_builddir)/src/lib/liblightmediascanner.la

lightmediascannerctl_SOURCES = lightmediascannerctl.c
lightmediascannerctl_CPPFLAGS = $(AM_CPPFLAGS) @GIO_CFLAGS@
lightmediascannerctl_LDADD = @GIO_LIBS@
endif
Loading

0 comments on commit e414e1f

Please sign in to comment.