File moodbar.spec of Package moodbar

#
# spec file for package moodbar
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           moodbar
Version:        0.1.4
Release:        0
Summary:        Analysis program for creating a colorful visual representation of an audio file
License:        GPL-2.0-or-later
Group:          System/Libraries
URL:            https://github.com/Mazhoon/moodbar
Source:         %{name}-%{version}.tar.gz
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  fftw3-devel
BuildRequires:  gstreamer-devel
BuildRequires:  gstreamer-plugins-base-devel
BuildRequires:  libtool
Requires:       gstreamer-plugins-good

%package devel
Summary:        Devel files for moodbar
Group:          Development/Languages/C and C++
Requires:       %{name} = %{version}

%description
The Moodbar is an algorithm for creating a colorful visual
representation of the contents of an audio file, giving an idea of its
"mood" (this is a rather fanciful term for the simple analysis it
actually does).  The Moodbar was invented by Gavin Wood and Simon
O'Keefe for inclusion in the Amarok music player.

This package contains a GStreamer plugin with elements that are used
in the moodbar analysis, and an application that actually does the
analysis.

The package also contains a shell-script (create-moodbar.sh), which will
generate the mood files for all music-files (mp3|ogg|flac|wma|wav) in the directory
(including sub-directories) where it is being executed

%description devel
The Moodbar is an algorithm for creating a colorful visual
representation of the contents of an audio file, giving an idea of its
"mood" (this is a rather fanciful term for the simple analysis it
actually does).  The Moodbar was invented by Gavin Wood and Simon
O'Keefe for inclusion in the Amarok music player.

This package contains a link library for GStreamer plugin with elements
that are used in the moodbar analysis, and an application that actually
does the analysis.

%prep
%setup -q

%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
./autogen.sh
%configure
make %{?_smp_mflags}

%install
%make_install

%define gnomelibdir %(pkg-config --variable=pluginsdir gstreamer-1.0)
cat > %{buildroot}%{_bindir}/create-moodbar.sh <<EOF
#!/bin/bash
control_c()        # run if user hits control-c
{
 echo $1 > lastreadsong
 echo "Exiting..."
 exit
}
if [ -e lastreadsong ]; then
  read filetodelete < lastreadsong
  rm "\$filetodelete" lastreadsong
fi
find . -type f -regextype posix-awk -iregex '.*\.(mp3|ogg|flac|wma|wav)' | while read i
do
  trap 'control_c "\$OUTF"' SIGINT
  TEMP="\${i%.*}.mood"
  OUTF=\`echo "\$TEMP" | sed 's#\(.*\)/\([^,]*\)#\1/.\2#'\`
  if [ ! -e "\$OUTF" ]; then
    moodbar -o "\$OUTF" "\$i"
  fi
done
EOF

%files
%license COPYING
%doc NEWS TODO AUTHORS README README.md
%{_bindir}/moodbar
%exclude %{gnomelibdir}/libmoodbar.la
%{gnomelibdir}/libmoodbar.so
%attr(755,root,root) %{_bindir}/create-moodbar.sh

%files devel
%{gnomelibdir}/libmoodbar.a

%changelog
openSUSE Build Service is sponsored by