unity-lens-music-6.9.1+16.04/0000775000175000017500000000000012627011301017041 5ustar didrocksdidrocks00000000000000unity-lens-music-6.9.1+16.04/rhythmbox.scope.in.in0000664000175000017500000000103612627006552023146 0ustar didrocksdidrocks00000000000000[Scope] DBusName=com.canonical.Unity.Scope.Music DBusPath=/com/canonical/unity/scope/rhythmbox Icon=@prefix@/share/unity/icons/lens-nav-music.svg QueryBinary=rhythmbox _Name=Rhythmbox _Description=This is an Ubuntu search plugin that enables information from Rhythmbox to be searched and displayed in the Dash underneath the Music header. If you do not wish to search this content source, you can disable this search plugin. _SearchHint=Search music collection Shortcut=m Type=music [Desktop Entry] X-Ubuntu-Gettext-Domain=unity-lens-music unity-lens-music-6.9.1+16.04/configure.ac0000664000175000017500000001276412627010650021347 0ustar didrocksdidrocks00000000000000AC_INIT(unity-lens-music, 6.9.1, https://launchpad.net/unity-lens-music) AC_COPYRIGHT([Copyright 2011-2014 Canonical]) AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) ##################################################### # Silent build rules ##################################################### m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) AC_PREREQ(2.59) AC_CONFIG_HEADERS([config.h]) ##################################################### # Init the other things we depend on ##################################################### AM_MAINTAINER_MODE AM_PROG_VALAC([0.18.0]) AS_IF([test -z "$VALAC"], [AC_MSG_ERROR(["No valac compiler found."])]) AC_PROG_CC AM_PROG_CC_C_O AC_HEADER_STDC LT_INIT AC_CONFIG_MACRO_DIR([m4]) ############################################# # Gettext ############################################# GETTEXT_PACKAGE="$PACKAGE" AC_SUBST(GETTEXT_PACKAGE) AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/po/LINGUAS']) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [gettext domain]) AM_GLIB_GNU_GETTEXT # AM_GNOME_GETTEXT above substs $DATADIRNAME # this is the directory where the *.{mo,gmo} files are installed localedir='${prefix}/${DATADIRNAME}/locale' AC_SUBST(localedir) IT_PROG_INTLTOOL([0.40.0]) AC_DEFINE_UNQUOTED(LOCALE_DIR, "${PREFIX}/${DATADIRNAME}/locale",[Locale directory]) AC_DEFINE_UNQUOTED(DATADIR, "${PREFIX}/${DATADIRNAME}",[Data directory]) AC_DEFINE_UNQUOTED(PREFIXDIR, "${PREFIX}",[Prefix directory]) ###################################################### # intltool rule for generating translated .lens file ###################################################### INTLTOOL_SCOPE_RULE='%.scope: %.scope.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' AC_SUBST(INTLTOOL_SCOPE_RULE) ########################### # gcov coverage reporting ########################### m4_include([m4/gcov.m4]) AC_TDD_GCOV AM_CONDITIONAL([HAVE_GCOV], [test "x$ac_cv_check_gcov" = xyes]) AM_CONDITIONAL([HAVE_LCOV], [test "x$ac_cv_check_lcov" = xyes]) AM_CONDITIONAL([HAVE_GCOVR], [test "x$ac_cv_check_gcovr" = xyes]) AC_SUBST(COVERAGE_CFLAGS) AC_SUBST(COVERAGE_LDFLAGS) ##################################################### # Check for module and library dependancies ##################################################### GLIB_REQUIRED=2.32 PKG_CHECK_MODULES(SCOPE_DAEMON, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED gio-unix-2.0 >= $GLIB_REQUIRED dee-1.0 >= 1.2.5 sqlite3 >= 3.7.7 gee-1.0 json-glib-1.0 libnotify libsoup-2.4 oauth unity >= 7.1.0 unity-extras >= 7.0.0 tdb >= 1.2.6) PKG_CHECK_MODULES(PREVIEW_PLAYER, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED gstreamer-1.0 gstreamer-pbutils-1.0 ) AC_SUBST(SCOPE_DAEMON_CFLAGS) AC_SUBST(SCOPE_DAEMON_LIBS) AC_SUBST(PREVIEW_PLAYER_CFLAGS) AC_SUBST(PREVIEW_PLAYER_LIBS) ##################################################### # local install for distcheck and stand-alone running ##################################################### with_localinstall="no" AC_ARG_ENABLE(localinstall, AS_HELP_STRING([--enable-localinstall], [Install all of the files locally instead of in system directories (for distcheck)]), with_localinstall=$enableval, with_localinstall=no) AM_CONDITIONAL([HAVE_LOCALINSTALL], [test "x$with_localinstall" = "xyes"]) ##################################################### # Expand variables needed for config.vala ##################################################### AS_AC_EXPAND(PREFIX, $prefix) AC_SUBST(PREFIX) AS_AC_EXPAND(DATADIR, $datarootdir) AC_SUBST(DATADIR) AS_AC_EXPAND(LIBEXECDIR, $libexecdir) AC_SUBST(LIBEXECDIR) ##################################################### # Look for dbus service dir ##################################################### if test "x$with_localinstall" = "xyes"; then DBUSSERVICEDIR="${datadir}/dbus-1/services/" else DBUSSERVICEDIR=`$PKG_CONFIG --variable=session_bus_services_dir dbus-1` fi AC_SUBST(DBUSSERVICEDIR) ##################################################### # Look for correct Scopes dir ##################################################### if test "x$with_localinstall" = "xyes"; then SCOPESDIR="${datadir}/unity/scopes" else SCOPESDIR=`$PKG_CONFIG --variable=scopesdir unity` fi AC_SUBST(SCOPESDIR) ##################################################### # Create the Makefiles ##################################################### AC_CONFIG_FILES([ Makefile banshee.scope.in rhythmbox.scope.in data/Makefile src/Makefile src/config.vala po/Makefile.in tests/Makefile tests/unit/Makefile ]) AC_OUTPUT ##################################################### # Output the results ##################################################### AC_MSG_NOTICE([ Unity Music Lens Daemon $VERSION ------------------------------- Prefix : ${prefix} Local install : ${with_localinstall} Extra CFlags : ${CPPFLAGS} $MAINTAINER_CFLAGS Extra ValaFlags : ${CPPFLAGS} $MAINTAINER_VALAFLAGS Scopes Directory: ${SCOPESDIR} Testing Coverage reporting : ${use_gcov} ]) unity-lens-music-6.9.1+16.04/banshee.scope.in.in0000664000175000017500000000102612627006552022526 0ustar didrocksdidrocks00000000000000[Scope] DBusName=com.canonical.Unity.Scope.Music DBusPath=/com/canonical/unity/scope/banshee Icon=@prefix@/share/unity/icons/lens-nav-music.svg QueryBinary=banshee _Name=Banshee _Description=This is an Ubuntu search plugin that enables information from Banshee to be searched and displayed in the Dash underneath the Music header. If you do not wish to search this content source, you can disable this search plugin. _SearchHint=Search music collection Shortcut=m Type=music [Desktop Entry] X-Ubuntu-Gettext-Domain=unity-lens-music unity-lens-music-6.9.1+16.04/autogen.sh0000775000175000017500000000027312627006552021060 0ustar didrocksdidrocks00000000000000#!/bin/sh srcdir=`dirname $0` PKG_NAME="unity-place-music" which gnome-autogen.sh || { echo "You need gnome-common from GNOME SVN" exit 1 } USE_GNOME2_MACROS=1 \ . gnome-autogen.sh unity-lens-music-6.9.1+16.04/acinclude.m40000664000175000017500000000170712627006552021253 0ustar didrocksdidrocks00000000000000dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR) dnl dnl example dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir) dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local AC_DEFUN([AS_AC_EXPAND], [ EXP_VAR=[$1] FROM_VAR=[$2] dnl first expand prefix and exec_prefix if necessary prefix_save=$prefix exec_prefix_save=$exec_prefix dnl if no prefix given, then use /usr/local, the default prefix if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix fi dnl if no exec_prefix given, then use prefix if test "x$exec_prefix" = "xNONE"; then exec_prefix=$prefix fi full_var="$FROM_VAR" dnl loop until it doesn't change anymore while true; do new_full_var="`eval echo $full_var`" if test "x$new_full_var"="x$full_var"; then break; fi full_var=$new_full_var done dnl clean up full_var=$new_full_var AC_SUBST([$1], "$full_var") dnl restore prefix and exec_prefix prefix=$prefix_save exec_prefix=$exec_prefix_save ]) unity-lens-music-6.9.1+16.04/TESTS-TODO.txt0000664000175000017500000000045712627006552021271 0ustar didrocksdidrocks00000000000000Since testing lenses is dependant on multiple components in the system, we use the `libunity-tool` which is able to talk to the lenses and examine results they return. Currently this is not hooked into the build system, but you can run the tests by invoking `libunity-tool --test-server-mode ./tests` unity-lens-music-6.9.1+16.04/README0000664000175000017500000000000012627006552017723 0ustar didrocksdidrocks00000000000000unity-lens-music-6.9.1+16.04/NEWS0000664000175000017500000000000212627006552017544 0ustar didrocksdidrocks00000000000000 unity-lens-music-6.9.1+16.04/Makefile.am.coverage0000664000175000017500000000250512627006552022705 0ustar didrocksdidrocks00000000000000 # Coverage targets .PHONY: clean-gcno clean-gcda \ coverage-html generate-coverage-html clean-coverage-html \ coverage-gcovr generate-coverage-gcovr clean-coverage-gcovr clean-local: clean-gcno clean-coverage-html clean-coverage-gcovr if HAVE_GCOV clean-gcno: @echo Removing old coverage instrumentation -find -name '*.gcno' -print | xargs -r rm clean-gcda: @echo Removing old coverage results -find -name '*.gcda' -print | xargs -r rm coverage-html: clean-gcda -$(MAKE) $(AM_MAKEFLAGS) -k check $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html generate-coverage-html: @echo Collecting coverage data $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info clean-coverage-html: clean-gcda -$(LCOV) --directory $(top_builddir) -z -rm -rf coverage.info coveragereport if HAVE_GCOVR coverage-gcovr: clean-gcda -$(MAKE) $(AM_MAKEFLAGS) -k check $(MAKE) $(AM_MAKEFLAGS) generate-coverage-gcovr generate-coverage-gcovr: @echo Generating coverage GCOVR report $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml clean-coverage-gcovr: clean-gcda -rm -rf $(top_builddir)/coverage.xml endif # HAVE_GCOVR endif # HAVE_GCOV unity-lens-music-6.9.1+16.04/Makefile.am0000664000175000017500000000201612627006552021110 0ustar didrocksdidrocks00000000000000SUBDIRS = src data po tests # # Install the music.lens and musicstore.scope files # scope_in_files = \ banshee.scope.in \ rhythmbox.scope.in \ musicstore.scope.in scopedir = $(SCOPESDIR)/music scope_DATA = $(scope_in_files:.scope.in=.scope) icondir = $(datadir)/unity/themes @INTLTOOL_SCOPE_RULE@ DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall # ChangeLog file created at distcheck time dist-hook: @if test -d "$(srcdir)/.bzr"; \ then \ echo Creating ChangeLog && \ ( cd "$(top_srcdir)" && \ echo '# Generated by Makefile. Do not edit.'; echo; \ $(top_srcdir)/missing --run bzr log --gnu-changelog ) > ChangeLog.tmp \ && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \ || (rm -f ChangeLog.tmp; \ echo Failed to generate ChangeLog >&2 ); \ else \ echo Failed to generate ChangeLog: not a branch >&2; \ fi EXTRA_DIST = \ autogen.sh \ $(scope_in_files) \ AUTHORS \ COPYING \ MAINTAINERS \ README CLEANFILES = \ $(scope_DATA) include $(top_srcdir)/Makefile.am.coverage unity-lens-music-6.9.1+16.04/MAINTAINERS0000664000175000017500000000004512627006552020551 0ustar didrocksdidrocks00000000000000Alex Launi unity-lens-music-6.9.1+16.04/ChangeLog0000664000175000017500000000000012627006552020615 0ustar didrocksdidrocks00000000000000unity-lens-music-6.9.1+16.04/COPYING0000664000175000017500000010437412627006552020121 0ustar didrocksdidrocks00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . unity-lens-music-6.9.1+16.04/AUTHORS0000664000175000017500000000014112627006552020121 0ustar didrocksdidrocks00000000000000Mikkel Kamstrup Erlandsen Alex Launi unity-lens-music-6.9.1+16.04/tests/0000775000175000017500000000000012627011301020203 5ustar didrocksdidrocks00000000000000unity-lens-music-6.9.1+16.04/tests/test-no-results.sh0000775000175000017500000000034412627006552023647 0ustar didrocksdidrocks00000000000000#!/bin/sh # Check that a non-sensical search string returns reply with "no-results-hint" # set. unity-tool -n com.canonical.Unity.Lens.Music -p /com/canonical/unity/lens/music -s asdfqwer | grep -q "no-results-hint" || exit 1 unity-lens-music-6.9.1+16.04/tests/test-common.sh0000775000175000017500000000021312627006552023017 0ustar didrocksdidrocks00000000000000#!/bin/sh # Common tests for emitting finished signal unity-tool -n com.canonical.Unity.Lens.Music -p /com/canonical/unity/lens/music -c unity-lens-music-6.9.1+16.04/tests/Makefile.am0000664000175000017500000000001712627006552022251 0ustar didrocksdidrocks00000000000000SUBDIRS = unit unity-lens-music-6.9.1+16.04/tests/unit/0000775000175000017500000000000012627011301021162 5ustar didrocksdidrocks00000000000000unity-lens-music-6.9.1+16.04/tests/unit/test-rhythmbox-parser.vala0000664000175000017500000001340412627006552026340 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Didier Roche * */ using Unity.MusicLens; using Assertions; public class Main { public static int main (string[] args) { Test.init (ref args); Test.add_data_func ("/Unit/ParserChecker/Radios", test_radios); Test.add_data_func ("/Unit/ParserChecker/Songs", test_songs); Test.add_data_func ("/Unit/ParserChecker/LazyLoad", test_lazy_load); Test.add_data_func ("/Unit/ParserChecker/InvalidTag", test_invalid_tag); Test.run (); return 0; } /* FIXME: this test is broken - it passes if iradio tag is not parsed * because all checks are done in a callback that's never called in such case. */ private static void test_radios () { var parser = new RhythmboxCollection.XmlParser (); string collection_to_parse = """ Absolute Radio 80s (Modem) 80's http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a8 6 1339693331 32 0 application/octet-stream """; parser.track_info_ready.connect ((track) => { assert_cmpstr (track.title, OperatorType.EQUAL, "Absolute Radio 80s (Modem)"); assert_cmpstr (track.genre, OperatorType.EQUAL, "other"); assert_cmpstr (track.artist, OperatorType.EQUAL, ""); assert_cmpstr (track.album, OperatorType.EQUAL, ""); assert_cmpstr (track.uri, OperatorType.EQUAL, "http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a8"); assert_cmpint (track.year, OperatorType.EQUAL, 0); assert (track.type_track == TrackType.RADIO); }); parser.parse(collection_to_parse, collection_to_parse.length); } private static void test_songs () { var parser = new RhythmboxCollection.XmlParser (); string collection_to_parse = """ LA PASSION Dance GIGI D'AGOSTINO Loulou 007 228 3661842 file:///home/moi/Gigi%20d'agostino%20Passion.mp3 1338273042 1338536342 1340378542 128 730142 audio/mpeg http://www.danceparadise.ca.tc """; parser.track_info_ready.connect ((track) => { assert_cmpstr (track.title, OperatorType.EQUAL, "LA PASSION"); assert_cmpstr (track.genre, OperatorType.EQUAL, "techno"); assert_cmpstr (track.artist, OperatorType.EQUAL, "GIGI D'AGOSTINO"); assert_cmpstr (track.album, OperatorType.EQUAL, "Loulou 007"); assert_cmpstr (track.uri, OperatorType.EQUAL, "file:///home/moi/Gigi%20d'agostino%20Passion.mp3"); assert_cmpint (track.year, OperatorType.EQUAL, 2000); assert_cmpstr (track.mime_type, OperatorType.EQUAL, "audio/mpeg"); assert (track.type_track == TrackType.SONG); }); parser.parse(collection_to_parse, collection_to_parse.length); } private static void test_lazy_load () { var parser = new RhythmboxCollection.XmlParser (); string collection_to_parse_chunk = """ LA PASSION Dance GIGI D'AGOSTINO """; parser.parse(collection_to_parse_chunk, collection_to_parse_chunk.length); collection_to_parse_chunk = """ Loulou 007 228 3661842 file:///home/moi/Gigi%20d'agostino%20Passion.mp3 1338273042 1338536342 1340378542 128 730142 audio/mpeg http://www.danceparadise.ca.tc """; parser.track_info_ready.connect ((track) => { assert_cmpstr (track.title, OperatorType.EQUAL, "LA PASSION"); assert_cmpstr (track.album, OperatorType.EQUAL, "Loulou 007"); assert (track.type_track == TrackType.SONG); }); parser.parse(collection_to_parse_chunk, collection_to_parse_chunk.length); } private static void test_invalid_tag () { var parser = new RhythmboxCollection.XmlParser (); string collection_to_parse_chunk = """ LA PASSION Dance le poisson Dance """; parser.track_info_ready.connect ((track) => { assert_cmpstr (track.title, OperatorType.EQUAL, "le poisson"); assert (track.type_track == TrackType.SONG); }); parser.parse(collection_to_parse_chunk, collection_to_parse_chunk.length); } } unity-lens-music-6.9.1+16.04/tests/unit/assertions.vapi0000664000175000017500000000133412627006552024252 0ustar didrocksdidrocks00000000000000[CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "glib.h")] namespace Assertions { public enum OperatorType { [CCode (cname = "==")] EQUAL, [CCode (cname = "!=")] NOT_EQUAL, [CCode (cname = "<")] LESS_THAN, [CCode (cname = ">")] GREATER_THAN, [CCode (cname = "<=")] LESS_OR_EQUAL, [CCode (cname = ">=")] GREATER_OR_EQUAL } public void assert_cmpstr (string? s1, OperatorType op, string? s2); public void assert_cmpint (int n1, OperatorType op, int n2); public void assert_cmpuint (uint n1, OperatorType op, uint n2); public void assert_cmphex (uint n1, OperatorType op, uint n2); public void assert_cmpfloat (float n1, OperatorType op, float n2); } unity-lens-music-6.9.1+16.04/tests/unit/Makefile.am0000664000175000017500000000320012627010464023222 0ustar didrocksdidrocks00000000000000check_PROGRAMS = test-rhythmbox-parser TESTS = $(check_PROGRAMS) AM_CPPFLAGS = \ -w \ $(SCOPE_DAEMON_CFLAGS) \ -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \ -I$(top_srcdir)/src \ $(COVERAGE_CFLAGS) \ $(NULL) AM_LDFLAGS = $(COVERAGE_LDFLAGS) AM_VALAFLAGS = \ -C \ --pkg dee-1.0 \ --pkg gee-1.0 \ --pkg gio-2.0 \ --pkg gio-unix-2.0 \ --pkg glib-2.0 \ --pkg json-glib-1.0 \ --pkg oauth \ --pkg libsoup-2.4 \ --vapidir $(top_srcdir)/src \ --pkg tdb \ --pkg unity \ $(srcdir)/assertions.vapi \ $(MAINTAINER_VALAFLAGS) $(NULL) test_libs = \ $(SCOPE_DAEMON_LIBS) \ $(NULL) test_rhythmbox_parser_LDADD = $(test_libs) # Files starting from track.vala are not used in this test, # but they are listed here so they show up in coverage # measurements. When new tests are written for these features, # move these files to them. # # All main scope vala files are missing because they would # not compile and really need their own test binaries. test_rhythmbox_parser_SOURCES = \ test-rhythmbox-parser.vala \ $(top_srcdir)/src/album.vala \ $(top_srcdir)/src/categories.vala \ $(top_srcdir)/src/config.vala \ $(top_srcdir)/src/filter-parser.vala \ $(top_srcdir)/src/filter-parser-decade.vala \ $(top_srcdir)/src/filter-parser-genre.vala \ $(top_srcdir)/src/genre.vala \ $(top_srcdir)/src/rhythmbox-collection.vala \ $(top_srcdir)/src/track.vala \ $(top_srcdir)/src/banshee-filter-parser-decade.vala \ $(top_srcdir)/src/banshee-filter-parser-genre.vala \ $(top_srcdir)/src/banshee-filter-parser.vala \ $(top_srcdir)/src/dash-proxy.vala \ $(NULL) EXTRA_DIST = assertions.vapi CLEANFILES = *.stamp unity-lens-music-6.9.1+16.04/tests/manual/0000775000175000017500000000000012627011301021460 5ustar didrocksdidrocks00000000000000unity-lens-music-6.9.1+16.04/tests/manual/previews-rhythmbox.txt0000664000175000017500000001711412627006552026127 0ustar didrocksdidrocks00000000000000Preview of local album ---------------------------------------------------- Test that the local album preview are displayed correctly in the Dash. Setup: Rhythmbox installed and rhythmbox database exists, some music files are available in ~/Music and are indexed by Rhythmbox. Actions: 1. Open the Dash and switch to the music lens. 2. Make sure some local albums are displayed. 3. Right-click an album. Expected Result: Album preview should be displayed. It should display album cover, album title, album artist and year (as subtitle) a list of tracks and 'Show in Folder' and 'Play' buttons. Album preview - 'Show in Folder' action. ---------------------------------------------------- Test 'Show in Folder' action opens proper folder. Setup: Rhythmbox installed and rhythmbox database exists, some music files are available in ~/Music and are indexed by Rhythmbox. Actions: 1. Open a preview of local album. 2. Click 'Show in Folder' button. Expected Result: Nautilus is launched, showing the parent folder of selected album. Album preview - 'Play' action. --------------------------------------------------- Test that 'Play' action enqueues album in Rhythmbox. Setup: Rhythmbox installed and rhythmbox database exists, some music files are available in ~/Music and are indexed by Rhythmbox. Actions: 1. Open a preview of local album. 2. Click 'Play' button. Expected Result: The album is enqueued in Rhythmbox and playback starts. Preview - codec installation ---------------------------------------------------- Test that missing mp3 codec is installed when required by preview. Setup: Rhythmbox installed and rhythmbox database exists, some mp3 files are available in ~/Music and are indexed by Rhythmbox. MP3 codec (such as fluendo or gstreamer-bad/ugly package) is not installed. Actions: 1. Open the Dash and switch to the music lens. 2. Make sure some local albums are displayed. 3. Right-click an album that contains mp3s. 4. Hover mouse over track number to reveal play button, click it. Expected Result: Album preview should be displayed. A standard GNOME popup box is displayed prompting the user for codec installation and dash gets closed. After providing a password the codec gets installed (verify with 'dpkg -l|grep fluendo') and user is no longer prompted for it when previewing mp3s. Album preview - built-in playback for album tracks ---------------------------------------------------- Test that built-in playback via music-preview-player supports play/pause and resume. Setup: Rhythmbox installed and rhythmbox database exists, some music files are available in ~/Music and are indexed by Rhythmbox. Actions: 1. Open a preview of local album. 2. Click small play button next to a track. 3. As the track is played, hit pause / play a few times. Expected Result: Selected track is played by music-preview-player. Playback progress is reported in the Dash. Playback is paused/resumed when hitting pause/play button. Album preview - end of playback with build-in playback ---------------------------------------------------- Test progress and playback state are reported correctly on end-of-playback when built-in playback is used. Setup: Rhythmbox installed and rhythmbox database exists, some music files are available in ~/Music and are indexed by Rhythmbox. Actions: 1. Open a preview of local album. 2. Click small play button next to a track. 3. Wait for the playback to finish. Expected Result: Selected track is played by music-preview-player. Playback progress is reported in the Dash. When playback finishes, the progress is reset. Album preview - song change with built-in playback ---------------------------------------------------- Test that song can be changed with built-in playback functionality and progress/state are reported accordingly. Setup: Rhythmbox installed and rhythmbox database exists, some music files are available in ~/Music and are indexed by Rhythmbox. Actions: 1. Open a preview of local album. 2. Click small play button next to a track. 3. As the track is played, click small play button for another track. Expected Result: Selected track is played by music-preview-player. When another track is activated for playback then playback progress is updated accrodingly to show play state and progress for only one track. Album preview - closing the preview during playback ---------------------------------------------------- Test that built-in playback stops when preview is closed. Setup: Rhythmbox installed and rhythmbox database exists, some music files are available in ~/Music and are indexed by Rhythmbox. Actions: 1. Open a preview of local album. 2. Click small play button next to a track. 3. As the track is played, close the preview. Expected Result: Selected track is played by music-preview-player. Playback stops when the preview is closed. Preview player process quits (verify with 'ps uax|grep music-preview-player'). Album preview - switching to a different preview during playback ---------------------------------------------------- Test that built-in playback stops when switching to a different preview. Setup: Rhythmbox installed and rhythmbox database exists, some music files are available in ~/Music and are indexed by Rhythmbox. Actions: 1. Open a preview of local album. 2. Click small play button next to a track. 3. As the track is played, switch to a different preview by clicking left/right arrows. Expected Result: Selected track is played by music-preview-player. Playback stops when preview of different album is displayed. Single track preview display in the dash. ---------------------------------------------------- Test that the single track preview for local album is displayed correctly in the Dash. Setup: Rhythmbox installed and rhythmbox database exists, some music files are available in ~/Music and are indexed by Rhythmbox. Actions: 1. Open the Dash and switch to the music lens. 2. Make sure some local songs are displayed. 3. Right-click a song. Expected Result: Song preview should be displayed. It should display album cover, song title, album artist and year (as subtitle). Only a single track should be displayed in the player area. Two buttons should be present: 'Show in Folder' and 'Play'. Single track preview - 'Show in Folder' action. ---------------------------------------------------- Test 'Show in Folder' action opens proper folder. Setup: Rhythmbox installed and rhythmbox database exists, some music files are available in ~/Music and are indexed by Rhythmbox. Actions: 1. Open a preview of local song. 2. Click 'Show in Folder' button. Expected Result: Nautilus is launched, showing the parent folder of selected song (i.e. its album folder). Single track preview - 'Play' action. ---------------------------------------------------- Test that 'Play' action enqueues song in Rhythmbox. Setup: Rhythmbox installed and rhythmbox database exists, some music files are available in ~/Music and are indexed by Rhythmbox. Actions: 1. Open a preview of local song. 2. Click 'Play' button. Expected Result: The song is enqueued in Rhythmbox and playback starts. Test built-in playback for single track. ---------------------------------------------------- Test that built-in playback via music-preview-player supports play/pause and resume. Setup: Rhythmbox installed and rhythmbox database exists, some music files are available in ~/Music and are indexed by Rhythmbox. Actions: 1. Open a preview of local song. 2. Click small play button next to a track. 3. As the track is played, hit pause / play a few times. Expected Result: The track is played by music-preview-player. Playback progress is reported in the Dash. Playback is paused/resumed when hitting pause/play button. unity-lens-music-6.9.1+16.04/tests/manual/categorization.txt0000664000175000017500000000043212627006552025256 0ustar didrocksdidrocks00000000000000Categorization ============== Tests that the categorization of results is correct. #. Open the Dash and switch to the music lens. #. Make sure that the search string is empty. Outcome The "Albums" category should list only album titles, if you see a song title the test failed. unity-lens-music-6.9.1+16.04/src/0000775000175000017500000000000012627011301017630 5ustar didrocksdidrocks00000000000000unity-lens-music-6.9.1+16.04/src/track.vala0000664000175000017500000000247112627006552021621 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2011 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Alex Launi * */ namespace Unity.MusicLens { public enum TrackType { SONG, RADIO } public class Track : GLib.Object { public TrackType type_track { get; set; } public string title { get; set; } public string uri { get; set; } public string artist { get; set; } public string mime_type { get; set; } public string artwork_path { get; set; } public string album { get; set; } public string album_artist { get; set; } public string genre { get; set; } public int track_number { get; set; } public int year { get; set; } public int play_count { get; set; } public int duration { get; set; } } } unity-lens-music-6.9.1+16.04/src/tdb.vapi0000664000175000017500000000641312627006552021302 0ustar didrocksdidrocks00000000000000/* tdb.vapi * * Copyright (C) 2012 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Author: * Michal Hruby */ [CCode (lower_case_cprefix = "tdb_", cheader_filename = "tdb.h")] namespace TDB { /* Database Connection Handle */ [Compact] [CCode (free_function = "tdb_close", cname = "TDB_CONTEXT", cprefix = "tdb_")] public class Database { [CCode (cname = "tdb_open")] public Database (string name, int hash_size, TDB.OpenFlags tdb_flags, int open_flags, Posix.mode_t mode); [CCode (cname = "tdb_open_ex")] public Database.open_ex (string name, int hash_size, int tdb_flags, int open_flags, Posix.mode_t mode, TDB.LogFunc log_fn); public int reopen (); public static int reopen_all (); public TDB.Error error (); public unowned string errorstr (); public TDB.Data fetch (TDB.Data key); public int @delete (TDB.Data key); public int store (TDB.Data key, TDB.Data dbuf, TDB.StoreType type_flag); public TDB.Data firstkey (); public TDB.Data nextkey (TDB.Data key); public int traverse (TDB.TraverseFunc traverse_func); public int exists (TDB.Data key); public int lockkeys (TDB.Data[] keys); public void unlockkeys (); public int lockall (); public void unlockall (); public int chainlock (TDB.Data key); public void chainunlock (TDB.Data key); } [CCode (cname = "TDB_DATA")] [SimpleType] public struct Data { [CCode (array_length_cname = "dsize", array_length_type = "size_t", cname = "dptr")] public unowned uint8[] data; [CCode (cname = "dsize")] public size_t data_size; } [CCode (cname = "tdb_null")] public const TDB.Data NULL_DATA; [CCode (has_target = false)] public delegate void LogFunc (TDB.Database db, TDB.DebugLevel debug_level, string format, ...); public delegate int TraverseFunc (TDB.Database db, TDB.Data key, TDB.Data @value); [CCode (cname = "SQLITE_ANY")] public const int ANY; [CCode (cname = "enum tdb_debug_level", cprefix = "TDB_DEBUG_")] public enum DebugLevel { FATAL, ERROR, WARNING, TRACE } [CCode (cname = "int", cprefix = "TDB_")] public enum StoreType { REPLACE, INSERT, MODIFY } [CCode (cname = "int", cprefix = "TDB_")] public enum OpenFlags { DEFAULT, CLEAR_IF_FIRST, INTERNAL, NOLOCK, NOMMAP, CONVERT, BIGENDIAN, NOSYNC, SEQNUM, VOLATILE, ALLOW_NESTING, DISALLOW_NESTING, INCOMPATIBLE_HASH } [CCode (cname = "enum TDB_ERROR", cprefix = "TDB_ERR_")] public enum Error { [CCode (cname = "TDB_SUCCESS")] SUCCESS, CORRUPT, IO, LOCK, OOM, EXISTS, NOLOCK, LOCK_TIMEOUT, NOEXISTS, EINVAL, RDONLY, NESTING } } unity-lens-music-6.9.1+16.04/src/tdb.deps0000664000175000017500000000000612627006552021266 0ustar didrocksdidrocks00000000000000posix unity-lens-music-6.9.1+16.04/src/simple-scope.vala0000664000175000017500000001661312627006552023120 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2011 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Alex Launi * */ using GLib; using Config; namespace Unity.MusicLens { public abstract class SimpleScope : Object { public Unity.DeprecatedScope scope { get; protected set; } protected abstract int num_results_without_search { get; } protected abstract int num_results_global_search { get; } protected abstract int num_results_lens_search { get; } protected abstract async void perform_search (DeprecatedScopeSearch search, SearchType search_type, owned List filters, int max_results = -1, GLib.Cancellable? cancellable = null); public SimpleScope () { } protected void initialize () { populate_filters (); populate_categories (); scope.active_sources_changed.connect (() => { scope.queue_search_changed (SearchType.DEFAULT); }); /* No need to search if only the whitespace changes */ scope.generate_search_key.connect ((search) => { return search.search_string.strip (); }); /* Listen for changes to the lens search entry */ scope.search_changed.connect ((search, search_type, cancellable) => { update_search_async.begin (search, search_type, cancellable); }); } private void populate_filters () { var filters = new Unity.FilterSet (); /* Decade filter */ { var filter = new MultiRangeFilter ("decade", _("Decade")); filter.add_option ("0", _("Old")); filter.add_option ("1960", _("60s")); filter.add_option ("1970", _("70s")); filter.add_option ("1980", _("80s")); filter.add_option ("1990", _("90s")); filter.add_option ("2000", _("00s")); filter.add_option ("2010", _("10s")); filters.add (filter); } /* Genre filter */ { var filter = new CheckOptionFilterCompact ("genre", _("Genre")); filter.sort_type = OptionsFilter.SortType.DISPLAY_NAME; filter.add_option (Genre.BLUES_ID, _("Blues")); filter.add_option (Genre.CLASSICAL_ID, _("Classical")); filter.add_option (Genre.COUNTRY_ID, _("Country")); filter.add_option (Genre.DISCO_ID, _("Disco")); filter.add_option (Genre.FUNK_ID, _("Funk")); filter.add_option (Genre.ROCK_ID, _("Rock")); filter.add_option (Genre.METAL_ID, _("Metal")); filter.add_option (Genre.HIPHOP_ID, _("Hip-hop")); filter.add_option (Genre.HOUSE_ID, _("House")); filter.add_option (Genre.NEWWAVE_ID, _("New-wave")); filter.add_option (Genre.RANDB_ID, _("R&B")); filter.add_option (Genre.PUNK_ID, _("Punk")); filter.add_option (Genre.JAZZ_ID, _("Jazz")); filter.add_option (Genre.POP_ID, _("Pop")); filter.add_option (Genre.REGGAE_ID, _("Reggae")); filter.add_option (Genre.SOUL_ID, _("Soul")); filter.add_option (Genre.TECHNO_ID, _("Techno")); filter.add_option (Genre.OTHER_ID, _("Other")); filters.add (filter); } scope.filters = filters; } // FIXME icons private void populate_categories () { /* Offsets of categories must match up with the Category enum */ var categories = new Unity.CategorySet (); var icon_dir = File.new_for_path (Config.ICON_PATH); var cat = new Unity.Category ("global", _("Music"), new FileIcon (icon_dir.get_child ("group-songs.svg"))); categories.add (cat); cat = new Unity.Category ("songs", _("Songs"), new FileIcon (icon_dir.get_child ("group-songs.svg"))); categories.add (cat); cat = new Unity.Category ("albums", _("Albums"), new FileIcon (icon_dir.get_child ("group-albums.svg"))); categories.add (cat); cat = new Unity.Category ("more", _("More suggestions"), new FileIcon (icon_dir.get_child ("group-treat-yourself.svg")), Unity.CategoryRenderer.CAROUSEL); categories.add (cat); cat = new Unity.Category ("radio", _("Radio"), new FileIcon (icon_dir.get_child ("group-songs.svg"))); categories.add (cat); scope.categories = categories; } private async void update_search_async (DeprecatedScopeSearch search, SearchType search_type, GLib.Cancellable cancellable) { int max_results; /* * results for a global search from just hitting Super. * Here we want to return a smaller number of results with 0 filters. */ if (search_type == SearchType.GLOBAL) max_results = num_results_global_search; else if (is_search_empty (search)) max_results = num_results_without_search; else max_results = num_results_lens_search; yield prepare_search (search, search_type, max_results, cancellable); search.finished (); } private async void prepare_search (DeprecatedScopeSearch search, SearchType search_type, int max_results, GLib.Cancellable cancellable) { var results_model = search.results_model; List filters = new List (); // don't apply filters to global searches if (search_type != SearchType.GLOBAL) { Filter filter = search.get_filter ("genre"); if (filter.filtering) filters.append (new GenreFilterParser (filter as CheckOptionFilterCompact)); filter = search.get_filter ("decade"); if (filter.filtering) filters.append (new DecadeFilterParser (filter as MultiRangeFilter)); } results_model.clear (); // don't perform search is all sources are inactive if (scope.sources.options.length () > 0 && scope.sources.filtering) { bool any_active = false; foreach (var source in scope.sources.options) { if (source.active) any_active = true; } if (!any_active) { return; } } yield perform_search (search, search_type, (owned) filters, max_results, cancellable); if (results_model.get_n_rows () == 0) { search.set_reply_hint ("no-results-hint", _("Sorry, there is no music that matches your search.")); } } protected bool is_search_empty (DeprecatedScopeSearch search) requires (search.search_string != null) { return search.search_string.strip () == ""; } } } unity-lens-music-6.9.1+16.04/src/rhythmbox-scope.vala0000664000175000017500000002262512627006552023653 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2011 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Alex Launi * */ using GLib; namespace Unity.MusicLens { public class RhythmboxScope : SimpleScope { private RhythmboxCollection collection; private bool db_ready; private FileMonitor rb_xml_monitor; private Unity.MusicPreview? music_preview; public RhythmboxScope () { base (); scope = new Unity.DeprecatedScope ("/com/canonical/unity/scope/rhythmbox", "music-rhythmbox.scope"); scope.search_in_global = true; scope.search_hint = _("Search music"); scope.visible = true; scope.activate_uri.connect (activate); scope.preview_uri.connect (preview); scope.sources.add_option ("rhythmbox", _("Rhythmbox"), null); base.initialize (); collection = new RhythmboxCollection (); db_ready = false; } protected override int num_results_without_search { get {return 100; } } protected override int num_results_global_search { get { return 20; } } protected override int num_results_lens_search { get { return 50; } } private async void prepare_rhythmbox_play_queue (string[] exec_args) { var main_exec = exec_args; // copy arguments for thread's benefit try { new Thread.try ("rhythmbox-thread", () => { try { Process.spawn_command_line_sync ("rhythmbox-client --pause"); Process.spawn_command_line_sync ("rhythmbox-client --clear-queue"); Process.spawn_sync (null, main_exec, null, SpawnFlags.SEARCH_PATH, null, null); Process.spawn_command_line_sync ("rhythmbox-client --next"); // make sure we're playing Process.spawn_command_line_sync ("rhythmbox-client --play"); } catch (Error err) { warning ("%s", err.message); } Idle.add (prepare_rhythmbox_play_queue.callback); return null; }); } catch (Error err) { warning ("Could not create rhythmbox-thread: %s", err.message); } yield; } public Unity.Preview preview (string uri) { music_preview = null; GLib.Icon? icon_file = null; GLib.Icon? missing_icon_file = new GLib.FileIcon (File.new_for_path (ALBUM_MISSING_PREVIEW_ICON_PATH)); if (Uri.parse_scheme (uri) == "album") { string album_key = uri.substring (8); foreach (unowned Track track in collection.get_album_tracks_detailed (album_key)) { if (music_preview == null) { var artwork_path = track.artwork_path; if (artwork_path == null || artwork_path == "") icon_file = missing_icon_file; else icon_file = new GLib.FileIcon(File.new_for_path (artwork_path)); music_preview = new Unity.MusicPreview (track.album, track.album_artist, icon_file); var play_action = new Unity.PreviewAction ("play_album", _("Play"), null); play_action.activated.connect (play_album_preview); music_preview.add_action (play_action); var show_folder_action = new Unity.PreviewAction ("show_in_folder", _("Show in Folder"), null); show_folder_action.activated.connect (show_in_folder); music_preview.add_action (show_folder_action); } var tm = new Unity.TrackMetadata(); tm.uri = track.uri; tm.track_no = track.track_number; tm.title = track.title; tm.length = track.duration; music_preview.add_track(tm); } } else if (Uri.parse_scheme (uri) == "file") // preview single track, ignore radio stations { Track? track = collection.get_album_track (uri); if (track != null) { var artwork_path = track.artwork_path; if (artwork_path == null || artwork_path == "") icon_file = missing_icon_file; else icon_file = new GLib.FileIcon(File.new_for_path (artwork_path)); music_preview = new Unity.MusicPreview (track.title, track.album_artist, icon_file); var play_action = new Unity.PreviewAction ("play_track", _("Play"), null); play_action.activated.connect (play_track_in_rhythmbox); music_preview.add_action (play_action); var show_folder_action = new Unity.PreviewAction ("show_in_folder", _("Show in Folder"), null); show_folder_action.activated.connect (show_in_folder); music_preview.add_action (show_folder_action); var tm = new Unity.TrackMetadata(); tm.uri = track.uri; tm.track_no = track.track_number; tm.title = track.title; tm.length = track.duration; music_preview.add_track(tm); } } return music_preview; } private Unity.ActivationResponse show_in_folder (string uri) { string? file_uri = null; if (Uri.parse_scheme (uri) == "album") { string album_key = uri.substring (8); var tracks = collection.get_album_tracks (album_key); if (tracks.length () > 0) { file_uri = tracks.nth_data (0); } else { warning ("Album '%s' has no tracks, unable to get uri", uri); } } else //file { file_uri = uri; } if (file_uri != null) { Unity.Extras.show_in_folder.begin (file_uri); return new Unity.ActivationResponse (Unity.HandledType.HIDE_DASH); } return new Unity.ActivationResponse (Unity.HandledType.NOT_HANDLED); } private Unity.ActivationResponse play_track_in_rhythmbox (string uri) { return activate (uri); } private Unity.ActivationResponse play_album_preview (string uri) { return activate (uri); } /** * Tells rhythmbox to play the selected uri(s) */ public Unity.ActivationResponse activate (string uri) { string[] exec = {"rhythmbox-client"}; try { if (Uri.parse_scheme (uri) == "album") { // this will be a bit crazy, let's do it in a separate thread exec += "--enqueue"; string album_key = uri.substring (8); foreach (unowned string track_uri in collection.get_album_tracks (album_key)) { exec += track_uri; } exec += null; prepare_rhythmbox_play_queue.begin (exec); return new Unity.ActivationResponse (Unity.HandledType.HIDE_DASH); } else { exec += "--play-uri"; exec += uri; } exec += null; debug ("Spawning rb '%s'", string.joinv (" ", exec)); Process.spawn_async (null, exec, null, SpawnFlags.SEARCH_PATH, null, null); return new Unity.ActivationResponse (Unity.HandledType.HIDE_DASH); } catch (SpawnError error) { warning ("Failed to launch URI %s", uri); return new Unity.ActivationResponse (Unity.HandledType.NOT_HANDLED); } } public override async void perform_search (DeprecatedScopeSearch search, SearchType search_type, owned List filters, int max_results = -1, GLib.Cancellable? cancellable = null) { int category_override = -1; if (search_type == SearchType.GLOBAL) { category_override = Category.MUSIC; // the lens shouldn't display anything for empty search if (is_search_empty (search)) return; } if (!db_ready) { // parse the DB lazily var tdb_path = Path.build_filename (Environment.get_user_cache_dir (), "rhythmbox", "album-art", "store.tdb"); collection.parse_metadata_file (tdb_path); var xml_path = Path.build_filename (Environment.get_user_data_dir (), "rhythmbox", "rhythmdb.xml"); collection.parse_file (xml_path); if (rb_xml_monitor == null) { // re-parse the file if it changes File xml_file = File.new_for_path (xml_path); try { rb_xml_monitor = xml_file.monitor (FileMonitorFlags.NONE); rb_xml_monitor.changed.connect (() => { db_ready = false; }); } catch (Error err) { warning ("%s", err.message); } } db_ready = true; } collection.search (search, search_type, filters, max_results, category_override); } } } unity-lens-music-6.9.1+16.04/src/rhythmbox-collection.vala0000664000175000017500000010466512627006552024702 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by David Calle * Michal Hruby * */ using Dee; using Gee; namespace Unity.MusicLens { const string UNITY_ICON_PATH = Config.PKGDATADIR + "/icons"; const string ALBUM_MISSING_ICON_PATH = UNITY_ICON_PATH + "/album_missing.png"; const string ALBUM_MISSING_PREVIEW_ICON_PATH = UNITY_ICON_PATH + "/album_missing_preview.png"; private enum Columns { TYPE, URI, TITLE, ARTIST, ALBUM, ARTWORK, MIMETYPE, GENRE, ALBUM_ARTIST, TRACK_NUMBER, YEAR, PLAY_COUNT, DURATION, N_COLUMNS } class RhythmboxCollection : Object { const string UNKNOWN_ALBUM = _("Unknown"); SequenceModel all_tracks; ModelTag album_art_tag; FilterModel tracks_by_play_count; HashTable> album_to_tracks_map; TDB.Database album_art_tdb; FileMonitor tdb_monitor; int current_album_art_tag; HashTable variant_store; HashTable int_variant_store; Variant row_buffer[13]; Analyzer analyzer; Index? index; ICUTermFilter ascii_filter; string media_art_dir; public class XmlParser: Object { const MarkupParser parser = { start_tag, end_tag, process_text, null, null }; // contains genre maps Genre genre = new Genre (); MarkupParseContext context; bool is_rhythmdb_xml = false; construct { context = new MarkupParseContext (parser, 0, this, null); } public bool parse (string content, size_t len) throws MarkupError { return context.parse (content, (ssize_t) len); } bool processing_track; Track current_track; int current_data = -1; private void start_tag (MarkupParseContext context, string name, [CCode (array_length = false, array_null_terminated = true)] string[] attr_names, [CCode (array_length = false, array_null_terminated = true)] string[] attr_values) throws MarkupError { if (!processing_track) { switch (name) { case "rhythmdb": is_rhythmdb_xml = true; break; case "entry": string accepted_element_name = null; for (int i = 0; attr_names[i] != null; i++) { if (attr_names[i] == "type" && (attr_values[i] == "song" /*|| attr_values[i] == "iradio"*/)) // disable radio stations accepted_element_name = attr_values[i]; } if (accepted_element_name == null) return; processing_track = true; current_track = new Track (); current_track.type_track = accepted_element_name == "song" ? TrackType.SONG : TrackType.RADIO; break; } } else { switch (name) { case "location": current_data = Columns.URI; break; case "title": current_data = Columns.TITLE; break; case "duration": current_data = Columns.DURATION; break; case "artist": current_data = Columns.ARTIST; break; case "album": current_data = Columns.ALBUM; break; case "genre": current_data = Columns.GENRE; break; case "track-number": current_data = Columns.TRACK_NUMBER; break; case "play-count": current_data = Columns.PLAY_COUNT; break; case "date": current_data = Columns.YEAR; break; case "media-type": current_data = Columns.MIMETYPE; break; case "album-artist": current_data = Columns.ALBUM_ARTIST; break; default: current_data = -1; break; } } } public signal void track_info_ready (Track track); private void end_tag (MarkupParseContext content, string name) throws MarkupError { switch (name) { case "location": case "title": case "duration": case "artist": case "album": case "genre": case "track-number": case "play-count": case "date": case "media-type": case "album-artist": if (current_data >= 0) current_data = -1; break; case "hidden": if (processing_track) processing_track = false; break; case "entry": if (processing_track && current_track != null) { track_info_ready (current_track); } processing_track = false; break; } } private void process_text (MarkupParseContext context, string text, size_t text_len) throws MarkupError { if (!processing_track || current_data < 0) return; switch (current_data) { case Columns.URI: current_track.uri = text; break; case Columns.TITLE: current_track.title = text; break; case Columns.ARTIST: current_track.artist = text; break; case Columns.ALBUM: current_track.album = text; break; case Columns.ALBUM_ARTIST: current_track.album_artist = text; break; case Columns.GENRE: current_track.genre = genre.get_id_for_genre (text.down ()); break; case Columns.MIMETYPE: current_track.mime_type = text; break; case Columns.YEAR: current_track.year = int.parse (text) / 365; break; case Columns.PLAY_COUNT: current_track.play_count = int.parse (text); break; case Columns.TRACK_NUMBER: current_track.track_number = int.parse (text); break; case Columns.DURATION: current_track.duration = int.parse (text); break; } } } construct { static_assert (13 == Columns.N_COLUMNS); // sync with row_buffer size media_art_dir = Path.build_filename ( Environment.get_user_cache_dir (), "media-art"); variant_store = new HashTable (str_hash, str_equal); int_variant_store = new HashTable (direct_hash, direct_equal); all_tracks = new SequenceModel (); // the columns correspond to the Columns enum all_tracks.set_schema ("i", "s", "s", "s", "s", "s", "s", "s", "s", "i", "i", "i", "i"); assert (all_tracks.get_schema ().length == Columns.N_COLUMNS); album_art_tag = new ModelTag (all_tracks); album_to_tracks_map = new HashTable> (str_hash, str_equal); var filter = Dee.Filter.new_sort ((row1, row2) => { int a = row1[Columns.PLAY_COUNT].get_int32 (); int b = row2[Columns.PLAY_COUNT].get_int32 (); return b - a; // higher play count first }); tracks_by_play_count = new FilterModel (all_tracks, filter); ascii_filter = new ICUTermFilter.ascii_folder (); analyzer = new TextAnalyzer (); analyzer.add_term_filter ((terms_in, terms_out) => { foreach (unowned string term in terms_in) { var folded = ascii_filter.apply (term); terms_out.add_term (term); if (folded != term) terms_out.add_term (folded); } }); initialize_index (); } private void initialize_index () { var reader = ModelReader.new ((model, iter) => { var s ="%s\n%s\n%s".printf (model.get_string (iter, Columns.TITLE), model.get_string (iter, Columns.ARTIST), model.get_string (iter, Columns.ALBUM)); return s; }); index = new TreeIndex (all_tracks, analyzer, reader); } private string? check_album_art_tdb (string artist, string album) { if (album_art_tdb == null) return null; uint8 null_helper[1] = { 0 }; ByteArray byte_arr = new ByteArray (); byte_arr.append ("album".data); byte_arr.append (null_helper); byte_arr.append (album.data); byte_arr.append (null_helper); byte_arr.append ("artist".data); byte_arr.append (null_helper); byte_arr.append (artist.data); byte_arr.append (null_helper); TDB.Data key = TDB.NULL_DATA; key.data = byte_arr.data; var val = album_art_tdb.fetch (key); if (val.data != null) { Variant v = Variant.new_from_data (new VariantType ("a{sv}"), val.data, false); var file_variant = v.lookup_value ("file", VariantType.STRING); if (file_variant != null) { return file_variant.get_string (); } } return null; } private string? get_albumart (Track track) { string filename; var artist = track.album_artist ?? track.artist; var album = track.album; var artist_norm = artist.normalize (-1, NormalizeMode.NFKD); var album_norm = album.normalize (-1, NormalizeMode.NFKD); filename = check_album_art_tdb (artist, album); if (filename != null) { filename = Path.build_filename (Environment.get_user_cache_dir (), "rhythmbox", "album-art", filename); if (FileUtils.test (filename, FileTest.EXISTS)) return filename; } var artist_md5 = Checksum.compute_for_string (ChecksumType.MD5, artist_norm); var album_md5 = Checksum.compute_for_string (ChecksumType.MD5, album_norm); filename = Path.build_filename (media_art_dir, "album-%s-%s".printf (artist_md5, album_md5)); if (FileUtils.test (filename, FileTest.EXISTS)) return filename; var combined = "%s\t%s".printf (artist, album).normalize (-1, NormalizeMode.NFKD); filename = Path.build_filename (media_art_dir, "album-%s.jpg".printf (Checksum.compute_for_string ( ChecksumType.MD5, combined))); if (FileUtils.test (filename, FileTest.EXISTS)) return filename; if (track.uri.has_prefix ("file://")) { // Try Nautilus thumbnails try { File artwork_file = File.new_for_uri (track.uri); var info = artwork_file.query_info (FileAttribute.THUMBNAIL_PATH, 0, null); var thumbnail_path = info.get_attribute_string (FileAttribute.THUMBNAIL_PATH); if (thumbnail_path != null) return thumbnail_path; } catch {} } // Try covers folder string artwork = Path.build_filename ( Environment.get_user_cache_dir (), "rhythmbox", "covers", "%s - %s.jpg".printf (track.artist, track.album)); if (FileUtils.test (artwork, FileTest.EXISTS)) return artwork; return null; } public SList get_album_tracks (string album_key) { SList results = new SList (); var iter_arr = album_to_tracks_map[album_key]; if (iter_arr != null) { for (int i = iter_arr.length - 1; i >= 0; i--) { results.prepend (all_tracks.get_string (iter_arr[i], Columns.URI)); } } return results; } private Track get_track (ModelIter iter) { Track track = new Track(); track.uri = all_tracks.get_string (iter, Columns.URI); track.title = all_tracks.get_string (iter, Columns.TITLE); track.artist = all_tracks.get_string (iter, Columns.ARTIST); track.album = all_tracks.get_string (iter, Columns.ALBUM); track.artwork_path = all_tracks.get_string (iter, Columns.ARTWORK); track.mime_type = all_tracks.get_string (iter, Columns.MIMETYPE); track.genre = all_tracks.get_string (iter, Columns.GENRE); track.album_artist = all_tracks.get_string (iter, Columns.ALBUM_ARTIST); track.track_number = all_tracks.get_int32 (iter, Columns.TRACK_NUMBER); track.year = all_tracks.get_int32 (iter, Columns.YEAR); track.play_count = all_tracks.get_int32 (iter, Columns.PLAY_COUNT); track.duration = all_tracks.get_int32 (iter, Columns.DURATION); return track; } public Track? get_album_track (string uri) { var iter = all_tracks.get_first_iter (); var end_iter = all_tracks.get_last_iter (); // FIXME: linear search, change to insert_sorted / find_sorted while (iter != end_iter) { if (all_tracks.get_string (iter, Columns.URI) == uri) { return get_track (iter); } iter = all_tracks.next (iter); } return null; } public SList get_album_tracks_detailed (string album_key) { var results = new SList (); var iter_arr = album_to_tracks_map[album_key]; if (iter_arr != null) { for (int i = iter_arr.length - 1; i >= 0; i--) { results.prepend (get_track (iter_arr[i])); } } return results; } private Variant cached_variant_for_string (string? input) { unowned string text = input != null ? input : ""; Variant? v = variant_store[text]; if (v != null) return v; v = new Variant.string (text); // key is owned by value... awesome right? variant_store[v.get_string ()] = v; return v; } private Variant cached_variant_for_int (int input) { Variant? v = int_variant_store[input]; if (v != null) return v; v = new Variant.int32 (input); // let's not cache every random integer if (input < 128) int_variant_store[input] = v; return v; } private void prepare_row_buffer (Track track) { Variant type = cached_variant_for_int (track.type_track); Variant uri = new Variant.string (track.uri); Variant title = new Variant.string (track.title); Variant artist = cached_variant_for_string (track.artist); Variant album_artist = cached_variant_for_string (track.album_artist); Variant album = cached_variant_for_string (track.album); Variant mime_type = cached_variant_for_string (track.mime_type); Variant artwork = cached_variant_for_string (track.artwork_path); Variant genre = cached_variant_for_string (track.genre); Variant track_number = cached_variant_for_int (track.track_number); Variant year = cached_variant_for_int (track.year); Variant play_count = cached_variant_for_int (track.play_count); Variant duration = cached_variant_for_int (track.duration); row_buffer[0] = type; row_buffer[1] = uri; row_buffer[2] = title; row_buffer[3] = artist; row_buffer[4] = album; row_buffer[5] = artwork; row_buffer[6] = mime_type; row_buffer[7] = genre; row_buffer[8] = album_artist; row_buffer[9] = track_number; row_buffer[10] = year; row_buffer[11] = play_count; row_buffer[12] = duration; } public void parse_metadata_file (string path) { if (album_art_tdb != null) return; if (tdb_monitor == null) { var tdb_file = File.new_for_path (path); try { tdb_monitor = tdb_file.monitor (FileMonitorFlags.NONE); tdb_monitor.changed.connect (() => { if (album_art_tdb == null) parse_metadata_file (path); else current_album_art_tag++; }); } catch (Error err) { warning ("%s", err.message); } } var flags = TDB.OpenFlags.INCOMPATIBLE_HASH | TDB.OpenFlags.SEQNUM | TDB.OpenFlags.NOLOCK; album_art_tdb = new TDB.Database (path, 999, flags, Posix.O_RDONLY, 0600); if (album_art_tdb == null) { warning ("Unable to open album-art DB!"); return; } /* album_art_tdb.traverse ((db, key, val) => { var byte_arr = new ByteArray.sized ((uint) val.data_size); byte_arr.append (val.data); Variant v = Variant.new_from_data (new VariantType ("a{sv}"), byte_arr.data, false, byte_arr); message ("value: %s", v.print (true)); return 0; }); */ } public void parse_file (string path) { // this could be really expensive if the index was already built, so // we'll destroy it first index = null; all_tracks.clear (); initialize_index (); current_album_art_tag = 0; album_to_tracks_map.remove_all (); var parser = new XmlParser (); parser.track_info_ready.connect ((track) => { // Get cover art string albumart = get_albumart (track); if (albumart != null) track.artwork_path = albumart; prepare_row_buffer (track); var iter = all_tracks.append_row (row_buffer); if (track.album == "" || track.album == UNKNOWN_ALBUM) return; var album_key = "%s - %s".printf (track.album, track.album_artist != null ? track.album_artist : track.artist); var arr = album_to_tracks_map[album_key]; if (arr == null) { arr = new GenericArray (); album_to_tracks_map[album_key] = arr; } arr.add ((owned) iter); }); var file = File.new_for_path (path); try { var stream = file.read (null); uint8 buffer[65536]; size_t bytes_read; while ((bytes_read = stream.read (buffer, null)) > 0) { parser.parse ((string) buffer, bytes_read); } } catch (Error err) { warning ("Error while parsing rhythmbox DB: %s", err.message); } GLib.List all_albums = album_to_tracks_map.get_keys (); foreach (unowned string s in all_albums) { album_to_tracks_map[s].sort_with_data ((a, b) => { var trackno1 = all_tracks.get_int32 (a, Columns.TRACK_NUMBER); var trackno2 = all_tracks.get_int32 (b, Columns.TRACK_NUMBER); return trackno1 - trackno2; }); } } private enum ResultType { ALBUM, SONG, RADIO } private void add_result (Model results_model, Model model, ModelIter iter, ResultType result_type, uint category_id) { // check for updated album art var tag = album_art_tag[model, iter]; if (tag < current_album_art_tag) { unowned string album = model.get_string (iter, Columns.ALBUM); unowned string artist = model.get_string (iter, Columns.ALBUM_ARTIST); if (artist == "") artist = model.get_string (iter, Columns.ARTIST); var album_art_string = check_album_art_tdb (artist, album); if (album_art_string != null && album_art_string != "") { string filename; filename = Path.build_filename (Environment.get_user_cache_dir (), "rhythmbox", "album-art", album_art_string); album_art_string = FileUtils.test (filename, FileTest.EXISTS) ? filename : ALBUM_MISSING_ICON_PATH; } else { album_art_string = ALBUM_MISSING_ICON_PATH; } if (album_art_string != model.get_string (iter, Columns.ARTWORK)) { model.set_value (iter, Columns.ARTWORK, cached_variant_for_string (album_art_string)); } album_art_tag[model, iter] = current_album_art_tag; } var title_col = (result_type == ResultType.SONG || result_type == ResultType.RADIO) ? Columns.TITLE : Columns.ALBUM; unowned string title = model.get_string (iter, title_col); var uri = model.get_string (iter, Columns.URI); var dnd_uri = model.get_string (iter, Columns.URI); if (result_type == ResultType.ALBUM) { if (title == "" || title == UNKNOWN_ALBUM) return; unowned string artist = model.get_string (iter, Columns.ALBUM_ARTIST); if (artist == "") artist = model.get_string (iter, Columns.ARTIST); var album_key = "%s - %s".printf (title, artist); StringBuilder sb = new StringBuilder (); foreach (unowned string track_uri in get_album_tracks (album_key)) { sb.append_printf ("%s\r\n", track_uri); } dnd_uri = (owned) sb.str; uri = "album://%s".printf (album_key); } var artwork = model.get_string (iter, Columns.ARTWORK); if (artwork == null || artwork == "") artwork = ALBUM_MISSING_ICON_PATH; var empty_asv = new Variant.array (VariantType.VARDICT.element (), {}); results_model.append (uri, artwork, category_id, Unity.ResultType.PERSONAL, model.get_string (iter, Columns.MIMETYPE), title, model.get_string (iter, Columns.ARTIST), dnd_uri, empty_asv); } public void search (DeprecatedScopeSearch search, SearchType search_type, GLib.List? filters = null, int max_results = -1, int category_override = -1) { int num_results = 0; var empty_search = search.search_string.strip () == ""; int min_year; int max_year; int category_id; ResultType result_type; Model model = all_tracks; get_decade_filter (filters, out min_year, out max_year); var active_genres = get_genre_filter (filters); // we need this to be able to sort the albums properly var helper_model = search.results_model; if (category_override >= 0) { helper_model = new Dee.SequenceModel (); helper_model.set_schema_full (search.results_model.get_schema ()); } if (empty_search) { // display a couple of most played songs model = tracks_by_play_count; var iter = model.get_first_iter (); var end_iter = model.get_last_iter (); var albums_list_nosearch = new HashSet (); while (iter != end_iter) { int year = model.get_int32 (iter, Columns.YEAR); unowned string genre = model.get_string (iter, Columns.GENRE); // check filters if (year < min_year || year > max_year) { iter = model.next (iter); continue; } // check filters if (active_genres != null) { if (!(genre in active_genres)) { iter = model.next (iter); continue; } } if (model.get_int32 (iter, Columns.TYPE) == TrackType.SONG) { unowned string album = model.get_string (iter, Columns.ALBUM); // it's not first as in track #1, but first found from album bool first_track_from_album = !(album in albums_list_nosearch); albums_list_nosearch.add (album); if (first_track_from_album) { category_id = category_override >= 0 ? category_override : Category.ALBUMS; add_result (search.results_model, model, iter, ResultType.ALBUM, category_id); } category_id = Category.SONGS; result_type = ResultType.SONG; } else { category_id = Category.RADIOS; result_type = ResultType.RADIO; } if (category_override >= 0) category_id = category_override; // Do not show radios in Dash because previews // is not working yet. Re-enable once this bug is fixed: // https://bugs.launchpad.net/unity-lens-music/+bug/1044325 if (category_id != Category.RADIOS) { add_result (helper_model, model, iter, result_type, category_id); num_results++; if (max_results >= 0 && num_results >= max_results) break; } iter = model.next (iter); } return; } var term_list = Object.new (typeof (Dee.TermList)) as Dee.TermList; // search only the folded terms, FIXME: is that a good idea? analyzer.tokenize (ascii_filter.apply (search.search_string), term_list); var matches = new Sequence (); bool first_pass = true; foreach (unowned string term in term_list) { // FIXME: use PREFIX search only for the last term? var result_set = index.lookup (term, TermMatchFlag.PREFIX); CompareDataFunc cmp_func = (a, b) => { return a == b ? 0 : ((void*) a > (void*) b ? 1 : -1); }; // intersect the results (cause we want to AND the terms) var remaining = new Sequence (); foreach (var item in result_set) { if (first_pass) matches.insert_sorted (item, cmp_func); else if (matches.lookup (item, cmp_func) != null) remaining.insert_sorted (item, cmp_func); } if (!first_pass) matches = (owned) remaining; // final result set empty already? if (matches.get_begin_iter () == matches.get_end_iter ()) break; first_pass = false; } // matches now contain iterators into the all_tracks model which // match the search string var seq_iter = matches.get_begin_iter (); var seq_end_iter = matches.get_end_iter (); var albums_list = new HashSet (); while (seq_iter != seq_end_iter) { var model_iter = seq_iter.get (); int year = model.get_int32 (model_iter, Columns.YEAR); string genre = model.get_string (model_iter, Columns.GENRE); // check filters if (year < min_year || year > max_year) { seq_iter = seq_iter.next (); continue; } // check filters if (active_genres != null) { bool genre_match = (genre in active_genres); if (!genre_match) { seq_iter = seq_iter.next (); continue; } } if (model.get_int32 (model_iter, Columns.TYPE) == TrackType.SONG) { unowned string album = model.get_string (model_iter, Columns.ALBUM); // it's not first as in track #1, but first found from album bool first_track_from_album = !(album in albums_list); albums_list.add (album); if (first_track_from_album) { category_id = category_override >= 0 ? category_override : Category.ALBUMS; add_result (search.results_model, model, model_iter, ResultType.ALBUM, category_id); } category_id = Category.SONGS; result_type = ResultType.SONG; } else { category_id = Category.RADIOS; result_type = ResultType.RADIO; } if (category_override >= 0) category_id = category_override; // Do not show radios in Dash because previews // is not working yet. Re-enable once this bug is fixed: // https://bugs.launchpad.net/unity-lens-music/+bug/1044325 if (category_id != Category.RADIOS) { add_result (helper_model, model, model_iter, result_type, category_id); num_results++; } if (max_results >= 0 && num_results >= max_results) break; seq_iter = seq_iter.next (); } if (helper_model == search.results_model) return; // we need to do this because the dash doesn't care about position // of a newly added rows in the model - it just appends it var iter = helper_model.get_first_iter (); var last = helper_model.get_last_iter (); while (iter != last) { var row = helper_model.get_row (iter); search.results_model.append_row (row); iter = helper_model.next (iter); } } private void get_decade_filter (GLib.List filters, out int min_year, out int max_year) { Filter? filter = null; foreach (var parser in filters) { if (parser is DecadeFilterParser) filter = parser.filter; } if (filter == null || !filter.filtering) { min_year = 0; max_year = int.MAX; return; } var mrf = filter as MultiRangeFilter; min_year = int.parse (mrf.get_first_active ().id); // it's supposed to be a decade, so 2000-2009 max_year = int.parse (mrf.get_last_active ().id) + 9; } private Set? get_genre_filter (GLib.List filters) { Filter? filter = null; foreach (var parser in filters) { if (parser is GenreFilterParser) filter = parser.filter; } if (filter == null || !filter.filtering) { return null; } var active_genres = new HashSet (); var all_genres = filter as CheckOptionFilterCompact; foreach (FilterOption option in all_genres.options) { if (option.id == null || !option.active) continue; active_genres.add (option.id); } return active_genres; } } } unity-lens-music-6.9.1+16.04/src/player.vala0000664000175000017500000002711212627006552022010 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Pawel Stolowski */ using Gst; using Gst.PbUtils; namespace PreviewPlayer { errordomain PreviewPlayerError { GST_INIT_FAILED } public class PreviewPlayer { // Track states; keep in sync with libunity - TrackState enum private enum TrackState { STOPPED, PLAYING, PAUSED } private static uint GST_NETWORK_TIMEOUT_SECS = 10; //gstreamer network timeout (in seconds) private static uint64 GST_STATE_QUERY_TIMEOUT = 1000000; // gstreamer - playbin plugin flags; run 'gst-inspect1.0 playbin' for more flags & description private static int GST_PLAYBIN_AUDIO = 0x02; private static int GST_PLAYBIN_SOFT_VOLUME = 0x10; private Gst.Pipeline gst_pipeline; private Gst.Element gst_playbin; private Gst.Element gst_sink; private Gst.Bus gst_bus; private uint timer_id; private string uri; private bool error; private bool update_registry = false; public signal void progress (string uri, uint32 state, double value); public PreviewPlayer () throws PreviewPlayerError { timer_id = 0; init_gst (); } internal void init_gst () throws PreviewPlayerError { gst_pipeline = new Gst.Pipeline ("preview-player-pipeline"); gst_playbin = Gst.ElementFactory.make ("playbin", "playbin"); gst_sink = Gst.ElementFactory.make ("pulsesink", "sink"); if (gst_sink == null) { gst_sink = Gst.ElementFactory.make ("alsasink", "sink"); if (gst_sink == null) { throw new PreviewPlayerError.GST_INIT_FAILED ("Can't create backend sink"); } } gst_playbin.set_property ("audio-sink", gst_sink); gst_playbin.set_property ("flags", GST_PLAYBIN_AUDIO | GST_PLAYBIN_SOFT_VOLUME); gst_playbin.notify["source"].connect (playbin_setup); gst_pipeline.add (gst_playbin); gst_bus = gst_pipeline.get_bus (); gst_bus.add_watch (GLib.Priority.DEFAULT, gst_bus_message_cb); } internal void playbin_setup (GLib.Object source, GLib.ParamSpec spec) { GLib.Value source_element = GLib.Value (GLib.Type.from_name("GstElement")); gst_playbin.get_property ("source", ref source_element); Gst.Element obj = (Gst.Element)source_element.get_object(); // playbin use different source plugins (e.g. FileSrc), timeout is only valid for http source if (obj.get_class ().get_type ().name () == "GstSoupHTTPSrc") { obj.set_property ("timeout", GST_NETWORK_TIMEOUT_SECS); } } internal bool gst_bus_message_cb (Gst.Bus bus, Gst.Message message) { switch (message.type) { case Gst.MessageType.EOS: gst_pipeline.set_state (Gst.State.READY); progress (uri, TrackState.PLAYING, 1.0f); break; case Gst.MessageType.ERROR: gst_pipeline.set_state (Gst.State.READY); error = true; break; case Gst.MessageType.ELEMENT: if (Gst.PbUtils.is_missing_plugin_message (message)) { handle_missing_plugin.begin (message); } break; default: // there are more meesages gstreamer may send over bus, but we're not interested in them break; } return true; } private async void handle_missing_plugin (Gst.Message message) { var detail = Gst.PbUtils.missing_plugin_message_get_installer_detail (message); var descr = Gst.PbUtils.missing_plugin_message_get_description (message); warning ("Missing plugin: '%s': %s\n", descr, detail); string[] details = {detail}; var status = Gst.PbUtils.install_plugins_async (details, null, codec_install_finished); if (status == Gst.PbUtils.InstallPluginsReturn.STARTED_OK) { var dash_proxy = new DashProxy (); try { yield dash_proxy.hide_dash (); } catch (Error e) { warning ("Failed to hide dash: %s", e.message); } } else { warning ("Failed to start codec installation"); } } private void codec_install_finished (Gst.PbUtils.InstallPluginsReturn result) { debug ("Codec install returned: %d\n", result); if (result == Gst.PbUtils.InstallPluginsReturn.SUCCESS) { /* In theory we should get here after codec installation successfully finished and then calling Gst.update_registry() would pick the changes. It turns out we get SUCCESS before apt actually finishes installation... As a workaround set a flag and postpone registry update till next call to play(). Note that this may result in another codec installation popup for same codec if user requests playback again before installation ends. */ update_registry = true; } } private void remove_progress_cb () { if (timer_id > 0) { GLib.Source.remove(timer_id); timer_id = 0; } } private bool progress_report_cb () { Gst.State current_state; Gst.State pending_state; var status = gst_pipeline.get_state (out current_state, out pending_state, GST_STATE_QUERY_TIMEOUT); if (status != Gst.StateChangeReturn.FAILURE) { if (current_state == Gst.State.PLAYING || pending_state == Gst.State.PLAYING) { progress (uri, TrackState.PLAYING, gst_progress ()); return true; } if (current_state == Gst.State.PAUSED || pending_state == Gst.State.PAUSED) { return true; } // FIXME: set TrackState.ERROR if error=true (and STOPPED if false) when we have ERROR state supported by libunity & unity core progress (uri, TrackState.STOPPED, 0.0f); } return false; } private double gst_progress () { int64 pos; int64 dur; var fmt = Gst.Format.TIME; if (gst_pipeline.query_position (fmt, out pos)) { if (gst_pipeline.query_duration (fmt, out dur)) { if (dur > 0) { return pos / (double)dur; } } } return 0.0f; } private bool is_playing () { Gst.State current_state; Gst.State pending_state; var status = gst_pipeline.get_state (out current_state, out pending_state, GST_STATE_QUERY_TIMEOUT); return status != Gst.StateChangeReturn.FAILURE && (current_state == Gst.State.PLAYING || pending_state == Gst.State.PLAYING); } public void play (string uri) { if (update_registry) { update_registry = false; debug ("Updating gstreamer plugin registry\n"); Gst.update_registry (); debug ("Finished gstreamer plugin registry update\n"); } // resume playback for same uri if (uri == this.uri) { Gst.State current_state; Gst.State pending_state; var status = gst_pipeline.get_state (out current_state, out pending_state, GST_STATE_QUERY_TIMEOUT); if (status != Gst.StateChangeReturn.FAILURE) { if (current_state == Gst.State.PAUSED || pending_state == Gst.State.PAUSED) { gst_pipeline.set_state (Gst.State.PLAYING); progress (uri, TrackState.PLAYING, gst_progress ()); return; } } } // start new playback remove_progress_cb (); error = false; this.uri = uri; gst_pipeline.set_state (Gst.State.NULL); gst_playbin.set_property ("uri", uri); gst_pipeline.set_state (Gst.State.PLAYING); timer_id = GLib.Timeout.add_seconds (1, progress_report_cb); progress_report_cb(); } public void stop () { Gst.State current_state; Gst.State pending_state; var status = gst_pipeline.get_state (out current_state, out pending_state, GST_STATE_QUERY_TIMEOUT); if (status != Gst.StateChangeReturn.FAILURE) { if (current_state == Gst.State.PAUSED || current_state == Gst.State.PLAYING || pending_state == Gst.State.PAUSED || pending_state == Gst.State.PLAYING) { gst_pipeline.set_state (Gst.State.READY); progress (uri, TrackState.STOPPED, 0.0f); } } } public void pause () { if (is_playing()) { gst_pipeline.set_state (Gst.State.PAUSED); progress (uri, TrackState.PAUSED, gst_progress ()); } } public void resume () { Gst.State current_state; Gst.State pending_state; var status = gst_pipeline.get_state (out current_state, out pending_state, GST_STATE_QUERY_TIMEOUT); if (status != Gst.StateChangeReturn.FAILURE) { if (current_state == Gst.State.PAUSED || pending_state == Gst.State.PAUSED) { gst_pipeline.set_state (Gst.State.PLAYING); progress (uri, TrackState.PLAYING, gst_progress ()); } } } public void pause_resume() { Gst.State current_state; Gst.State pending_state; var status = gst_pipeline.get_state (out current_state, out pending_state, GST_STATE_QUERY_TIMEOUT); if (status != Gst.StateChangeReturn.FAILURE) { TrackState track_state = TrackState.STOPPED; Gst.State gst_state = Gst.State.NULL; if (current_state == Gst.State.PLAYING || pending_state == Gst.State.PLAYING) { track_state = TrackState.PAUSED; gst_state = Gst.State.PAUSED; gst_pipeline.set_state (Gst.State.PAUSED); } else if (current_state == Gst.State.PAUSED || pending_state == Gst.State.PAUSED) { track_state = TrackState.PLAYING; gst_state = Gst.State.PLAYING; } if (gst_state != Gst.State.NULL) { gst_pipeline.set_state (gst_state); progress (uri, track_state, gst_progress ()); } } } public HashTable get_video_file_props (string uri) { var props = new HashTable (str_hash, str_equal); try { var discoverer = new Gst.PbUtils.Discoverer (2 * 1000000000); //2 seconds var discoverer_info = discoverer.discover_uri (uri); var video_streams = discoverer_info.get_video_streams (); // note: the container may have multiple video and audio streams, we just get properties of the first one if (video_streams != null && video_streams.length () > 0) { var vstream = video_streams.nth_data (0) as Gst.PbUtils.DiscovererVideoInfo; props.insert ("width", new GLib.Variant.uint32 (vstream.get_width ())); props.insert ("height", new GLib.Variant.uint32 (vstream.get_height ())); props.insert ("codec", new GLib.Variant.string (Gst.PbUtils.get_codec_description (vstream.get_caps ()))); } } catch (GLib.Error e) { warning ("Failed to get video file properties for '%s': '%s'\n", uri, e.message); } return props; } } } unity-lens-music-6.9.1+16.04/src/player-service.vala0000664000175000017500000000425612627006552023452 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Pawel Stolowski */ namespace PreviewPlayer { [DBus (name = "com.canonical.Unity.Lens.Music.PreviewPlayer")] public class PreviewPlayerService : Object { private PreviewPlayer player; private bool released; public PreviewPlayerService (PreviewPlayer preview_player) { released = false; player = preview_player; player.progress.connect (on_progress_change); } private void on_progress_change (string uri, uint32 state, double value) { progress (uri, state, value); } public void play (string uri) { if (released) { released = false; var app = GLib.Application.get_default (); app.hold (); } player.play (uri); } public void pause () { player.pause (); } public void resume () { player.resume (); } public void pause_resume () { player.pause_resume (); } public void stop () { player.stop (); } public void close () { if (released) return; released = true; player.stop (); var app = GLib.Application.get_default (); app.release (); } public HashTable video_properties (string uri) { if (released) { released = false; var app = GLib.Application.get_default (); app.hold (); } return player.get_video_file_props (uri); } public signal void progress (string uri, uint32 state, double value); } }unity-lens-music-6.9.1+16.04/src/oauth.vapi0000664000175000017500000000105612627006552021647 0ustar didrocksdidrocks00000000000000/* Minimal vapi for OAuth */ [CCode (cheader_filename="oauth.h")] namespace OAuth { [CCode (cheader_filename="oauth.h", cprefix="OA_")] public enum Method { HMAC, RSA, PLAINTEXT } [CCode (cheader_filename="oauth.h", cprefix="oauth_")] public string sign_url2(string url, out string postargs, OAuth.Method method, string? http_method, string c_key, string c_secret, string t_key, string t_secret); } unity-lens-music-6.9.1+16.04/src/music-preview-player.vala0000664000175000017500000000342012627006552024601 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Pawel Stolowski */ using Gst; using GLib; namespace PreviewPlayer { public uint INACTIVITY_TIMEOUT_MSECS = 60*1000; //player will quit after that many milliseconds after Close() DBus call public static void main (string[] args) { GLib.Environment.set_prgname ("music-preview-player"); PreviewPlayerService service = null; PreviewPlayer player = null; Gst.init (ref args); var app = new GLib.Application ("com.canonical.Unity.Lens.Music.PreviewPlayer", GLib.ApplicationFlags.IS_SERVICE); app.set_inactivity_timeout (INACTIVITY_TIMEOUT_MSECS); try { var conn = GLib.Bus.get_sync (BusType.SESSION, null); player = new PreviewPlayer (); service = new PreviewPlayerService (player); conn.register_object ("/com/canonical/Unity/Lens/Music/PreviewPlayer", service); app.hold(); app.run(args); } catch (PreviewPlayerError e) { stderr.printf ("Couldn't create preview player: %s\n", e.message); } catch (GLib.IOError e) { stderr.printf ("Couldn't register dbus object: %s\n", e.message); } } }unity-lens-music-6.9.1+16.04/src/main.vala0000664000175000017500000000723712627006552021446 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2011 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Mikkel Kamstrup Erlandsen * Alex Launi * */ using GLib; using Config; namespace Unity.MusicLens { static Application? app = null; static Daemon? daemon = null; static const string BUS_NAME = "com.canonical.Unity.Scope.Music"; /* Check if a given well known DBus is owned. * WARNING: This does sync IO! */ public static bool dbus_name_has_owner (string name) { try { bool has_owner; DBusConnection bus = Bus.get_sync (BusType.SESSION); Variant result = bus.call_sync ("org.freedesktop.DBus", "/org/freedesktop/dbus", "org.freedesktop.DBus", "NameHasOwner", new Variant ("(s)", name), new VariantType ("(b)"), DBusCallFlags.NO_AUTO_START, -1); result.get ("(b)", out has_owner); return has_owner; } catch (Error e) { warning ("Unable to decide whether '%s' is running: %s", name, e.message); } return false; } public static int main (string[] args) { GLib.Environment.set_prgname ("unity-music-daemon"); /* Sort up locale to get translations but also sorting and * punctuation right */ GLib.Intl.textdomain (Config.PACKAGE); GLib.Intl.bindtextdomain (Config.PACKAGE, Config.LOCALEDIR); GLib.Intl.bind_textdomain_codeset (Config.PACKAGE, "UTF-8"); GLib.Intl.setlocale(GLib.LocaleCategory.ALL, ""); /* Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=640714 * GApplication.register() call owns our DBus name in a sync manner * making it race against GDBus' worker thread to export our * objects on the bus before/after owning our name and receiving * method calls on our objects (which may not yet be up!)*/ if (dbus_name_has_owner (BUS_NAME)) { print ("Another instance of the Unity Music Daemon " + "already appears to be running.\nBailing out.\n"); return 2; } /* Now register our DBus objects *before* acquiring the name! * See above for reasons */ daemon = new Daemon (); /* Use GApplication directly for single instance app functionality */ app = new Application (BUS_NAME, ApplicationFlags.IS_SERVICE); try { app.register (); } catch (Error e) { /* FIXME: We get this error if another daemon is already running, * but it uses a generic error so we can't detect this reliably... */ print ("Failed to start music daemon: %s\n", e.message); return 1; } if (app.get_is_remote ()) { print ("Another instance of the Unity Music Daemon " + "already appears to be running.\nBailing out.\n"); return 2; } /* Hold()ing the app makes sure the GApplication doesn't exit */ app.hold(); return app.run (); } } /* namespace */ unity-lens-music-6.9.1+16.04/src/genre.vala0000664000175000017500000001137112627006552021614 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2011 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Alex Launi * */ using Gee; namespace Unity.MusicLens { public class Genre : GLib.Object { public static const string BLUES_ID = "blues"; public static const string CLASSICAL_ID = "classical"; public static const string COUNTRY_ID = "country"; public static const string DISCO_ID = "disco"; public static const string FUNK_ID = "funk"; public static const string ROCK_ID = "rock"; public static const string METAL_ID = "metal"; public static const string HIPHOP_ID = "hip-hop"; public static const string HOUSE_ID = "house"; public static const string NEWWAVE_ID = "new-wave"; public static const string RANDB_ID = "r-and-b"; public static const string PUNK_ID = "punk"; public static const string JAZZ_ID = "jazz"; public static const string POP_ID = "pop"; public static const string REGGAE_ID = "reggae"; public static const string SOUL_ID = "soul"; public static const string TECHNO_ID = "techno"; public static const string OTHER_ID = "other"; private static TreeMultiMap map; private static Map inverted_map; static construct { map = new TreeMultiMap (); /* blues */ map.set (BLUES_ID, "blues"); /* classical */ map.set (CLASSICAL_ID, "classic"); map.set (CLASSICAL_ID, "classical"); map.set (CLASSICAL_ID, "opera"); /* country */ map.set (COUNTRY_ID, "country"); /* disco */ map.set (DISCO_ID, "disco"); /* funk */ map.set (FUNK_ID, "funk"); /* rock */ map.set (ROCK_ID, "rock"); map.set (ROCK_ID, "heavy"); map.set (ROCK_ID, "hard"); map.set (ROCK_ID, "rock and roll"); /* metal */ map.set (METAL_ID, "metal"); map.set (METAL_ID, "heavy"); map.set (METAL_ID, "heavy metal"); /*hip hop */ map.set (HIPHOP_ID, "hip-hop"); map.set (HIPHOP_ID, "rap"); map.set (HIPHOP_ID, "rap & hip hop"); /*house*/ map.set (HOUSE_ID, "house"); map.set (HOUSE_ID, "chillout"); map.set (HOUSE_ID, "minimal"); map.set (HOUSE_ID, "hard"); map.set (HOUSE_ID, "electronic"); map.set (HOUSE_ID, "dance"); /*new wave*/ map.set (NEWWAVE_ID, "new-wave"); /*r-and-b*/ map.set (RANDB_ID, "r-and-b"); map.set (RANDB_ID, "r&b"); /*punk*/ map.set (PUNK_ID, "punk"); map.set (PUNK_ID, "punk rock"); map.set (PUNK_ID, "hardcore"); map.set (PUNK_ID, "heavy"); /*jazz*/ map.set (JAZZ_ID, "jazz"); /*pop*/ map.set (POP_ID, "pop"); /*reggae*/ map.set (REGGAE_ID, "reggae"); /*soul*/ map.set (SOUL_ID, "soul"); map.set (SOUL_ID, "gospel"); /*techno*/ map.set (TECHNO_ID, "techno"); map.set (TECHNO_ID, "minimal"); map.set (TECHNO_ID, "trance"); map.set (TECHNO_ID, "chillout"); map.set (TECHNO_ID, "electronic"); map.set (TECHNO_ID, "electronica"); map.set (TECHNO_ID, "dance"); /*other*/ map.set (OTHER_ID, "other"); map.set (OTHER_ID, "african"); map.set (OTHER_ID, "alternative"); map.set (OTHER_ID, "ambient"); map.set (OTHER_ID, "asian"); map.set (OTHER_ID, "brazilian"); map.set (OTHER_ID, "celtic"); map.set (OTHER_ID, "christmas"); map.set (OTHER_ID, "folk"); map.set (OTHER_ID, "latin"); map.set (OTHER_ID, "oldies"); map.set (OTHER_ID, "soundtrack"); map.set (OTHER_ID, "traditional"); map.set (OTHER_ID, "world"); inverted_map = new HashMap (); foreach (var key in map.get_keys ()) { var values_collection = map[key]; foreach (var val in values_collection) { inverted_map[val] = key; } } } public Collection get_genre_synonyms (string genre_id) { if (map.contains (genre_id)) return map.get (genre_id); return new LinkedList (); } public string get_id_for_genre (string genre) { return inverted_map[genre] ?? OTHER_ID; } } } unity-lens-music-6.9.1+16.04/src/filter-parser.vala0000664000175000017500000000174412627006552023276 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2011 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Alex Launi * */ using GLib; namespace Unity.MusicLens { public abstract class FilterParser : Object { public FilterParser (Filter filter) { this.filter = filter; } public Filter filter { get; protected set; } public abstract string id { get;} public abstract string parse (); } }unity-lens-music-6.9.1+16.04/src/filter-parser-genre.vala0000664000175000017500000000264412627006552024374 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2011 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Alex Launi * */ using GLib; namespace Unity.MusicLens { public class GenreFilterParser : FilterParser { public GenreFilterParser (CheckOptionFilterCompact filter) { base (filter); map = new Genre (); } public override string parse () { return ""; } protected override string id { get { return "genre"; } } protected Genre map { get; private set; } protected List get_all_selected_genres () { unowned List options = (filter as CheckOptionFilterCompact).options; var active = new List (); foreach (FilterOption option in options) { if (option.active) active.append (option); } return active; } } } unity-lens-music-6.9.1+16.04/src/filter-parser-decade.vala0000664000175000017500000000175712627006552024505 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2011 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Alex Launi * */ using GLib; namespace Unity.MusicLens { public class DecadeFilterParser : FilterParser { public DecadeFilterParser (MultiRangeFilter filter) { base (filter); } public override string parse () { return ""; } protected override string id { get { return "decade"; } } } }unity-lens-music-6.9.1+16.04/src/dash-proxy.vala0000664000175000017500000000265012627006552022612 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Pawel Stolowski */ namespace PreviewPlayer { static const string DASH_DBUS_NAME = "com.canonical.Unity"; static const string DASH_DBUS_PATH = "/com/canonical/Unity/Dash"; [DBus (name = "com.canonical.Unity.Dash")] public interface DashInterface: GLib.Object { public abstract async void hide_dash () throws Error; } public class DashProxy: GLib.Object { public async void connect_to () throws Error { _dash_interface = Bus.get_proxy_sync (BusType.SESSION, DASH_DBUS_NAME, DASH_DBUS_PATH); } public async void hide_dash () throws Error { if (_dash_interface == null) { yield connect_to (); } yield _dash_interface.hide_dash (); } private DashInterface _dash_interface; } } unity-lens-music-6.9.1+16.04/src/daemon.vala0000664000175000017500000000275412627006552021764 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2010 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Mikkel Kamstrup Erlandsen * */ using Dee; using Config; using Gee; namespace Unity.MusicLens { public class Daemon : GLib.Object { private BansheeScopeProxy banshee; private RhythmboxScope rb; construct { var app_check = new DesktopAppInfo ("banshee.desktop"); if (app_check != null) { banshee = new BansheeScopeProxy (); try { banshee.scope.export (); } catch (GLib.IOError e) { stdout.printf ("error %s\n", e.message); } } app_check = new DesktopAppInfo ("rhythmbox.desktop"); if (app_check != null) { rb = new RhythmboxScope (); try { rb.scope.export (); } catch (GLib.IOError e) { stdout.printf ("error %s\n", e.message); } } } } } /* namespace */ unity-lens-music-6.9.1+16.04/src/config.vala.in0000664000175000017500000000067612627006552022374 0ustar didrocksdidrocks00000000000000namespace Config { const string PREFIX = "@prefix@"; const string DATADIR = "@DATADIR@"; const string PKGDATADIR = "@DATADIR@/unity"; const string BINDIR = "@prefix@/bin"; const string LIBEXECDIR = "@LIBEXECDIR@"; const string LOCALEDIR = "@DATADIR@/locale"; const string PACKAGE = "@PACKAGE@"; const string VERSION = "@VERSION@"; const string ICON_PATH = "@DATADIR@/icons/unity-icon-theme/places/svg"; } unity-lens-music-6.9.1+16.04/src/categories.vala0000664000175000017500000000147412627006552022644 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Mikkel Kamstrup Erlandsen * */ namespace Unity.MusicLens { public enum Category { MUSIC, SONGS, ALBUMS, PURCHASE, RADIOS } } unity-lens-music-6.9.1+16.04/src/banshee-scope.vala0000664000175000017500000001650312627006552023232 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2011 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Alex Launi * */ using GLib; namespace Unity.MusicLens { public class BansheeScopeProxy : SimpleScope { private BansheeCollection collection; private Unity.MusicPreview? music_preview; public BansheeScopeProxy () { base (); scope = new Unity.DeprecatedScope ("/com/canonical/unity/scope/banshee", "music-banshee.scope"); scope.search_in_global = true; scope.search_hint = _("Search music"); scope.visible = true; scope.activate_uri.connect (activate); scope.preview_uri.connect (preview); scope.sources.add_option ("banshee", _("Banshee"), null); base.initialize (); try { collection = new BansheeCollection (); } catch (DatabaseError error) { printerr ("Failed to open the Banshee collection database\n"); return; } } protected override int num_results_without_search { get {return 100; } } protected override int num_results_global_search { get { return 20; } } protected override int num_results_lens_search { get { return 50; } } public Unity.Preview preview (string uri) { music_preview = null; GLib.Icon? icon_file = null; GLib.Icon? missing_icon_file = new GLib.FileIcon (File.new_for_path (ALBUM_MISSING_PREVIEW_ICON_PATH)); if (Uri.parse_scheme (uri) == "album") { string[] split = uri.split ("/"); //FIXME: there must be more reliable way if (split.length >= 4) { string artist = split[2]; string title = split[3]; foreach (unowned Track track in collection.get_album_tracks_detailed (title, artist)) { if (music_preview == null) { if (track.artwork_path != null && track.artwork_path != "" && FileUtils.test(track.artwork_path, FileTest.EXISTS)) icon_file = new GLib.ThemedIcon(track.artwork_path); else icon_file = missing_icon_file; music_preview = new Unity.MusicPreview (title, artist, icon_file); } var tm = new Unity.TrackMetadata(); tm.uri = track.uri; tm.track_no = track.track_number; tm.title = track.title ?? ""; tm.length = track.duration; music_preview.add_track(tm); } } else { warning ("Invalid uri: %s", uri); } } else // preview single track { Track? track = collection.get_album_track (uri); if (track != null) { if (track.artwork_path != null && track.artwork_path != "" && FileUtils.test(track.artwork_path, FileTest.EXISTS)) icon_file = new GLib.ThemedIcon(track.artwork_path); else icon_file = missing_icon_file; music_preview = new Unity.MusicPreview (track.title, track.artist, icon_file); var tm = new Unity.TrackMetadata(); tm.uri = track.uri; tm.track_no = track.track_number; tm.title = track.title ?? ""; tm.length = track.duration; music_preview.add_track(tm); } } if (preview != null) { var play_action = new Unity.PreviewAction ("play", _("Play"), null); play_action.activated.connect (play_in_banshee); music_preview.add_action (play_action); var show_folder_action = new Unity.PreviewAction ("show_in_folder", _("Show in Folder"), null); show_folder_action.activated.connect (show_in_folder); music_preview.add_action (show_folder_action); } return music_preview; } private Unity.ActivationResponse play_in_banshee (string uri) { return activate (uri); } private Unity.ActivationResponse show_in_folder (string uri) { string? file_uri = null; if (Uri.parse_scheme (uri) == "album") { string[] split = uri.split ("/"); if (split.length >= 4) { string artist = split[2]; string title = split[3]; var album = new Album () { title = title, artist = artist }; var tracks = collection.get_track_uris (album); if (tracks.length > 0) { file_uri = tracks[0]; } else { warning ("Album '%s' has no tracks, unable to get uri", uri); } } else { warning ("Invalid uri: %s", uri); } } else //file { file_uri = uri; } if (file_uri != null) { Unity.Extras.show_in_folder.begin (file_uri); return new Unity.ActivationResponse (Unity.HandledType.HIDE_DASH); } return new Unity.ActivationResponse (Unity.HandledType.NOT_HANDLED); } /** * Tells banshee to play the selected uri(s) */ public Unity.ActivationResponse activate (string uri) { string[] exec = {"banshee", "--play-enqueued"}; try { if (Uri.parse_scheme (uri) == "album") { debug (@"searching for tracks for $uri"); string[] split = uri.split ("/"); string artist = split[2]; string title = split[3]; Album album = new Album (); album.artist = artist; album.title = title; // FIXME there must be a better way.. foreach (string track in collection.get_track_uris (album)) exec += track; } else { exec += uri; } exec += null; debug (@"Spawning banshee '%s'", string.joinv (" ", exec)); Process.spawn_async (null, exec, null, SpawnFlags.SEARCH_PATH, null, null); return new Unity.ActivationResponse (Unity.HandledType.HIDE_DASH); } catch (SpawnError error) { warning ("Failed to launch URI %s", uri); return new Unity.ActivationResponse (Unity.HandledType.NOT_HANDLED); } } public override async void perform_search (DeprecatedScopeSearch search, SearchType search_type, owned List filters, int max_results = -1, GLib.Cancellable? cancellable = null) { int category_override = -1; if (search_type == SearchType.GLOBAL) { category_override = Category.MUSIC; // the lens shouldn't display anything for empty search if (is_search_empty (search)) return; } collection.search (search, search_type, filters, max_results, category_override); } } } unity-lens-music-6.9.1+16.04/src/banshee-filter-parser.vala0000664000175000017500000000143512627006552024676 0ustar didrocksdidrocks00000000000000 /* * Copyright (C) 2011 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Alex Launi * */ using GLib; namespace Unity.MusicLens { public interface BansheeFilterParser : FilterParser { } } unity-lens-music-6.9.1+16.04/src/banshee-filter-parser-genre.vala0000664000175000017500000000330412627006552025771 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2011 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Alex Launi * */ using GLib; namespace Unity.MusicLens { public class BansheeGenreFilterParser : BansheeFilterParser, GenreFilterParser { public BansheeGenreFilterParser (GenreFilterParser parser) { base (parser.filter as CheckOptionFilterCompact); } public override string parse () { StringBuilder builder = new StringBuilder (); List genres = get_all_selected_genres (); /* CoreTracks.Genre IS ___ OR CoreTracks.Genre IS ____ ... */ foreach (FilterOption genre in genres) { string id = genre.id; if (genre.id == null) continue; foreach (string alt in map.get_genre_synonyms (id)) { builder.append ("(CoreTracks.Genre LIKE '%"); builder.append (alt); builder.append ("""%' ESCAPE '\' AND CoreTracks.Genre IS NOT NULL) OR """); } } builder.truncate (builder.len - (" OR ".length)); builder.prepend ("("); builder.append (")"); return builder.str; } } } unity-lens-music-6.9.1+16.04/src/banshee-filter-parser-decade.vala0000664000175000017500000000333312627006552026100 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2011 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Alex Launi * */ using GLib; namespace Unity.MusicLens { public class BansheeDecadeFilterParser : BansheeFilterParser, DecadeFilterParser { public BansheeDecadeFilterParser (DecadeFilterParser parser) { base (parser.filter as MultiRangeFilter); } public override string parse () { int start_year, end_year; MultiRangeFilter range_filter = filter as MultiRangeFilter; FilterOption start = range_filter.get_first_active (); FilterOption end = range_filter.get_last_active (); start_year = int.parse (start.id); end_year = int.parse (end.id); // bump the end_year up to the beginning of the next range int end_index = range_filter.options.index (end); // if we have already selected the last option if (end_index == range_filter.options.length () - 1) end_year += 10; else end_year = int.parse (range_filter.options.nth_data (end_index + 1).id); return "(CoreTracks.Year >= %d AND CoreTracks.Year < %d) ".printf (start_year, end_year); } } }unity-lens-music-6.9.1+16.04/src/banshee-collection.vala0000664000175000017500000003151412627006552024253 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2011 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Alex Launi * */ using Gee; using GLib; using Sqlite; namespace Unity.MusicLens { public errordomain DatabaseError { FAILED_TO_OPEN } /** * Abstracts talking to the banshee collection database */ public class BansheeCollection : Object { private const int MAX_RESULTS = 100; private Database db; public BansheeCollection () throws DatabaseError { int rc = Database.open ("%s/banshee-1/banshee.db".printf (Environment.get_user_config_dir ()), out db); if (rc != Sqlite.OK) { printerr ("failed to open db, %d, %s\n", rc, db.errmsg ()); throw new DatabaseError.FAILED_TO_OPEN ("Failed to open banshee database"); } } /** * Performs a search on the banshee db */ public void search (DeprecatedScopeSearch search, SearchType search_type, GLib.List? filters = null, int max_results = -1, int category_override = -1) { const int TRACK_TITLE = 0; const int TRACK_URI = 1; const int TRACK_MIMETYPE = 2; const int ALBUM_TITLE = 3; const int ALBUM_ARTWORKID = 4; const int ARTIST_NAME = 5; int rc = 0; Statement stmt; var results_model = search.results_model; var helper_model = results_model; var empty_asv = new Variant.array (VariantType.VARDICT.element (), {}); if (category_override >= 0) { helper_model = new Dee.SequenceModel (); helper_model.set_schema_full (results_model.get_schema ()); } // use a tree set to ensure we don't duplicate albums TreeSet albums = new TreeSet (); string filters_sql = build_sql_from_filters (filters); // BUILD SQL STATEMENT string sql = """SELECT CoreTracks.Title, CoreTracks.Uri, CoreTracks.MimeType, CoreAlbums.Title, CoreAlbums.ArtworkID, CoreArtists.Name FROM CoreTracks CROSS JOIN CoreArtists, CoreAlbums WHERE CoreArtists.ArtistID = CoreTracks.ArtistID AND CoreAlbums.AlbumID = CoreTracks.AlbumID AND CoreTracks.PrimarySourceID = 1 AND ((CoreArtists.NameLowered LIKE '%%%s%%' ESCAPE '\' AND CoreArtists.NameLowered IS NOT NULL) OR (CoreAlbums.TitleLowered LIKE '%%%s%%' ESCAPE '\' AND CoreAlbums.TitleLowered IS NOT NULL) OR (CoreTracks.TitleLowered LIKE '%%%s%%' ESCAPE '\' AND CoreTracks.TitleLowered IS NOT NULL) ) %s ORDER BY CoreTracks.Score DESC LIMIT 0, %d;""".printf (search.search_string, search.search_string, search.search_string, filters_sql, max_results == -1 ? MAX_RESULTS : max_results); rc = execute_sql (sql, out stmt); if (stmt == null) return; do { rc = stmt.step (); switch (rc) { case Sqlite.DONE: break; case Sqlite.ROW: string artwork_path = get_album_artwork_path (stmt.column_text (ALBUM_ARTWORKID)); if (artwork_path == null || artwork_path == "" || !FileUtils.test(artwork_path, FileTest.EXISTS)) artwork_path = ALBUM_MISSING_ICON_PATH; Track track = new Track (); track.title = stmt.column_text (TRACK_TITLE); track.artist = stmt.column_text (ARTIST_NAME); track.uri = stmt.column_text (TRACK_URI); track.mime_type = stmt.column_text (TRACK_MIMETYPE); track.artwork_path = artwork_path; Album album = new Album (); album.title = stmt.column_text (ALBUM_TITLE); album.artist = stmt.column_text (ARTIST_NAME); album.uri = "album://%s/%s".printf (album.artist, album.title); album.artwork_path = artwork_path; uint category_id = Category.SONGS; if (category_override >= 0) category_id = category_override; helper_model.append (track.uri, artwork_path, category_id, Unity.ResultType.PERSONAL, track.mime_type, track.title, track.artist, track.uri, empty_asv); if (albums.add (album.artist + album.title)) { StringBuilder uri_list_builder = new StringBuilder (); foreach (string uri in get_track_uris (album)) { uri_list_builder.append ("'"); uri_list_builder.append (uri); uri_list_builder.append ("' "); } category_id = Category.ALBUMS; if (category_override >= 0) category_id = category_override; results_model.append (album.uri, album.artwork_path, category_id, Unity.ResultType.PERSONAL, "audio/mp3", album.title, album.artist, uri_list_builder.str, empty_asv); } break; default: break; } } while (rc == Sqlite.ROW); if (helper_model == results_model) return; // we need to do this because the dash doesn't care about position // of a newly added row in the model - it just appends it var iter = helper_model.get_first_iter (); var last = helper_model.get_last_iter (); while (iter != last) { var row = helper_model.get_row (iter); results_model.append_row (row); iter = helper_model.next (iter); } } /** * Computes path for album artwork. */ private string get_album_artwork_path (string artwork_id) { string album_art_dir = "%s/media-art/".printf (Environment.get_user_cache_dir ()); string artwork_path = "%s/%s.jpg".printf (album_art_dir, artwork_id); return artwork_path; } /** * Creates Track object out of single row of Statement result data. */ private Track get_track (Statement stmt) { const int TRACK_URI = 0; const int TRACK_TITLE = 1; const int ARTIST_NAME = 2; const int ALBUM_TITLE = 3; const int ALBUM_ARTWORKID = 4; const int TRACK_MIMETYPE = 5; const int TRACK_GENRE = 6; const int TRACK_NUMBER = 7; const int TRACK_YEAR = 8; const int TRACK_PLAYCOUNT = 9; const int TRACK_DURATION = 10; Track track = new Track(); track.uri = stmt.column_text (TRACK_URI); track.title = stmt.column_text (TRACK_TITLE); track.artist = stmt.column_text (ARTIST_NAME); track.album = stmt.column_text (ALBUM_TITLE); track.artwork_path = get_album_artwork_path (stmt.column_text (ALBUM_ARTWORKID)); track.mime_type = stmt.column_text (TRACK_MIMETYPE); track.genre = stmt.column_text (TRACK_GENRE); track.track_number = stmt.column_int (TRACK_NUMBER); track.year = stmt.column_int (TRACK_YEAR); track.play_count = stmt.column_int (TRACK_PLAYCOUNT); track.duration = stmt.column_int (TRACK_DURATION) / 1000; return track; } /** * Returns single track. */ public Track? get_album_track (string uri) { string sql = "SELECT CoreTracks.Uri, CoreTracks.Title, CoreArtists.Name, CoreAlbums.Title, CoreAlbums.ArtworkID, CoreTracks.MimeType, CoreTracks.Genre, CoreTracks.TrackNumber, CoreTracks.Year, CoreTracks.PlayCount, CoreTracks.Duration FROM CoreTracks CROSS JOIN CoreAlbums, CoreArtists WHERE CoreTracks.URI IS ? AND CoreArtists.ArtistID = CoreTracks.ArtistID AND CoreAlbums.AlbumID = CoreTracks.AlbumID"; Statement stmt; int rc = execute_sql (sql, out stmt); stmt.bind_text (1, uri); rc = stmt.step (); if (rc == Sqlite.ROW) { return get_track (stmt); } return null; } /** * Returns all tracks of an album. */ public SList get_album_tracks_detailed (string album_title, string album_artist) { string sql = "SELECT CoreTracks.Uri, CoreTracks.Title, CoreArtists.Name, CoreAlbums.Title, CoreAlbums.ArtworkID, CoreTracks.MimeType, CoreTracks.Genre, CoreTracks.TrackNumber, CoreTracks.Year, CoreTracks.PlayCount, CoreTracks.Duration FROM CoreTracks CROSS JOIN CoreAlbums, CoreArtists WHERE CoreArtists.ArtistID = CoreTracks.ArtistID AND CoreAlbums.AlbumID = CoreTracks.AlbumID AND CoreAlbums.Title IS ? AND CoreArtists.Name IS ? AND CoreTracks.URI IS NOT NULL ORDER BY CoreTracks.TrackNumber ASC"; Statement stmt; int rc = execute_sql (sql, out stmt); stmt.bind_text (1, album_title); stmt.bind_text (2, album_artist); SList tracks = new SList(); do { rc = stmt.step (); switch (rc) { case Sqlite.DONE: break; case Sqlite.ROW: tracks.append (get_track (stmt)); break; default: break; } } while (rc == Sqlite.ROW); return tracks; } /** * returns an array like {uri://, uri://, ...} */ public string[] get_track_uris (Album album) { const int URI_COLUMN = 0; int rc; Statement stmt; string sql = "SELECT CoreTracks.Uri FROM CoreTracks CROSS JOIN CoreAlbums, CoreArtists WHERE CoreArtists.ArtistID = CoreTracks.ArtistID AND CoreAlbums.AlbumID = CoreTracks.AlbumID AND CoreAlbums.Title IS '%s' AND CoreArtists.Name IS '%s' AND CoreTracks.URI IS NOT NULL ORDER BY CoreTracks.TrackNumber ASC".printf (album.title, album.artist); rc = execute_sql (sql, out stmt); ArrayList uris = new ArrayList (); do { rc = stmt.step (); switch (rc) { case Sqlite.DONE: break; case Sqlite.ROW: uris.add (stmt.column_text (URI_COLUMN)); break; default: break; } } while (rc == Sqlite.ROW); return uris.to_array (); } /** * returns a string like "AND (Table.Column IS filter OR Table.OtherCol IS filter2) * AND (Table.OtherColAgain IS AnotherFilter)" */ private string build_sql_from_filters (GLib.List filters) { if (filters == null || filters.length () == 0) return ""; var builder = new StringBuilder (); foreach (FilterParser parser in filters) { BansheeFilterParser bparser; if (parser is GenreFilterParser) bparser = new BansheeGenreFilterParser (parser as GenreFilterParser); else if (parser is DecadeFilterParser) bparser = new BansheeDecadeFilterParser (parser as DecadeFilterParser); else { warning ("Recieved an unimplemented filter type"); continue; } string parsed = bparser.parse (); if (parsed == null || parsed == "") continue; builder.append (" AND "); builder.append (parsed); } builder.append (" "); return builder.str; } private int execute_sql (string sql, out Statement stmt) { int rc; debug ("preparing to execute sql %s\n", sql); if ((rc = db.prepare_v2 (sql, -1, out stmt, null)) == 1) { warning ("SQL Error: %d, %s\n", rc, db.errmsg ()); } return rc; } } } unity-lens-music-6.9.1+16.04/src/album.vala0000664000175000017500000000205012627006552021606 0ustar didrocksdidrocks00000000000000/* * Copyright (C) 2011 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by Alex Launi * */ using GLib; namespace Unity.MusicLens { public class Album : GLib.Object { public string title { get; set; } public string artist { get; set; } public string uri { get; set; } public string artwork_path { get; set; } public double price { get; set; } public string formatted_price { get; set; } public string purchase_sku { get; set; } } } unity-lens-music-6.9.1+16.04/src/Makefile.am0000664000175000017500000000553512627010245021702 0ustar didrocksdidrocks00000000000000NULL = BUILT_SOURCES = CLEANFILES = EXTRA_DIST = DATADIR = $(datadir) LIBEXECDIR = $(libexecdir) # we're using Vala, C warnings are useless AM_CFLAGS = -w AM_CPPFLAGS = $(COVERAGE_CFLAGS) AM_LDFLAGS = $(COVERAGE_LDFLAGS) pkglibexec_PROGRAMS = \ unity-music-daemon \ music-preview-player unity_music_daemon_CPPFLAGS = \ -DDATADIR=\"$(DATADIR)\" \ -DPKGDATADIR=\"$(PKGDATADIR)\" \ -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \ -DG_LOG_DOMAIN=\"unity-music-daemon\" \ $(SCOPE_DAEMON_CFLAGS) \ $(MAINTAINER_CFLAGS) \ -I$(srcdir) \ -g unity_music_daemon_VALAFLAGS = \ -C \ --pkg dee-1.0 \ --pkg sqlite3 \ --pkg unity \ --pkg unity-extras \ --pkg gee-1.0 \ --pkg gio-2.0 \ --pkg gio-unix-2.0 \ --pkg glib-2.0 \ --vapidir $(srcdir) \ --pkg tdb \ --target-glib=2.32 \ $(MAINTAINER_VALAFLAGS) unity_music_daemon_LDADD = \ $(SCOPE_DAEMON_LIBS) \ $(NULL) unity_music_daemon_VALASOURCES = \ album.vala \ banshee-collection.vala \ banshee-filter-parser.vala \ banshee-filter-parser-decade.vala \ banshee-filter-parser-genre.vala \ banshee-scope.vala \ categories.vala \ config.vala \ daemon.vala \ filter-parser.vala \ filter-parser-decade.vala \ filter-parser-genre.vala \ genre.vala \ main.vala \ rhythmbox-scope.vala \ rhythmbox-collection.vala \ simple-scope.vala \ track.vala \ $(NULL) unity_music_daemon_SOURCES = \ $(unity_music_daemon_VALASOURCES:.vala=.c) \ $(NULL) music_preview_player_CPPFLAGS = \ -DDATADIR=\"$(DATADIR)\" \ -DPKGDATADIR=\"$(PKGDATADIR)\" \ $(MAINTAINER_CFLAGS) \ $(PREVIEW_PLAYER_CFLAGS) \ -I$(srcdir) \ -g music_preview_player_LDADD = \ $(PREVIEW_PLAYER_LIBS) music_preview_player_VALASOURCES = \ music-preview-player.vala \ player-service.vala \ dash-proxy.vala \ player.vala music_preview_player_SOURCES = \ $(music_preview_player_VALASOURCES:.vala=.c) \ $(NULL) # We pass --enable-experimental to quiet warnings about using Gst-1.0 bindings music_preview_player_VALAFLAGS = \ -C \ --pkg gstreamer-1.0 \ --pkg gstreamer-pbutils-1.0 \ --pkg gio-2.0 \ --enable-experimental \ $(MAINTAINER_VALAFLAGS) BUILT_SOURCES += \ unity_music_daemon.vala.stamp \ music_preview_player.vala.stamp EXTRA_DIST += \ unity_music_daemon.vala.stamp \ music_preview_player.vala.stamp \ $(unity_music_daemon_VALASOURCES) \ $(music_preview_player_VALASOURCES) \ tdb.vapi \ tdb.deps \ $(NULL) unity_music_daemon.vala.stamp: $(unity_music_daemon_VALASOURCES) $(AM_V_GEN) $(VALAC) $(unity_music_daemon_VALAFLAGS) $^ touch unity_music_daemon.vala.stamp music_preview_player.vala.stamp: $(music_preview_player_VALASOURCES) $(AM_V_GEN) $(VALAC) $(music_preview_player_VALAFLAGS) $^ touch music_preview_player.vala.stamp CLEANFILES += \ *.stamp \ $(unity_music_daemon_VALASOURCES:.vala=.c) \ $(music_preview_player_VALASOURCES:.vala=.c) \ $(NULL) unity-lens-music-6.9.1+16.04/po/0000775000175000017500000000000012627011301017457 5ustar didrocksdidrocks00000000000000unity-lens-music-6.9.1+16.04/po/POTFILES.skip0000664000175000017500000000026712627006552021615 0ustar didrocksdidrocks00000000000000src/main.c src/daemon.c src/utils.c src/simple-scope.c src/banshee-scope.c src/rhythmbox-scope.c src/musicstore-scope.c src/ubuntuone-webservices.c tests/unit/ubuntuone-webservices.c unity-lens-music-6.9.1+16.04/po/POTFILES.in0000664000175000017500000000030712627010523021241 0ustar didrocksdidrocks00000000000000[encoding: UTF-8] src/daemon.vala src/main.vala src/banshee-scope.vala src/rhythmbox-scope.vala src/simple-scope.vala [type: gettext/ini]banshee.scope.in.in [type: gettext/ini]rhythmbox.scope.in.in unity-lens-music-6.9.1+16.04/po/LINGUAS0000664000175000017500000000000212627006552020510 0ustar didrocksdidrocks00000000000000 unity-lens-music-6.9.1+16.04/m4/0000775000175000017500000000000012627011301017361 5ustar didrocksdidrocks00000000000000unity-lens-music-6.9.1+16.04/m4/gcov.m40000664000175000017500000000471712627006552020606 0ustar didrocksdidrocks00000000000000# Checks for existence of coverage tools: # * gcov # * lcov # * genhtml # * gcovr # # Sets ac_cv_check_gcov to yes if tooling is present # and reports the executables to the variables LCOV, GCOVR and GENHTML. AC_DEFUN([AC_TDD_GCOV], [ AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov], [enable coverage testing with gcov]), [use_gcov=$enableval], [use_gcov=no]) if test "x$use_gcov" = "xyes"; then # we need gcc: if test "$GCC" != "yes"; then AC_MSG_ERROR([GCC is required for --enable-gcov]) fi # Check if ccache is being used AC_CHECK_PROG(SHTOOL, shtool, shtool) case `$SHTOOL path $CC` in *ccache*[)] gcc_ccache=yes;; *[)] gcc_ccache=no;; esac if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.]) fi lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11" AC_CHECK_PROG(LCOV, lcov, lcov) AC_CHECK_PROG(GENHTML, genhtml, genhtml) if test "$LCOV"; then AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [ glib_cv_lcov_version=invalid lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` for lcov_check_version in $lcov_version_list; do if test "$lcov_version" = "$lcov_check_version"; then glib_cv_lcov_version="$lcov_check_version (ok)" fi done ]) else lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list" AC_MSG_ERROR([$lcov_msg]) fi case $glib_cv_lcov_version in ""|invalid[)] lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)." AC_MSG_ERROR([$lcov_msg]) LCOV="exit 0;" ;; esac if test -z "$GENHTML"; then AC_MSG_ERROR([Could not find genhtml from the lcov package]) fi ac_cv_check_gcov=yes ac_cv_check_lcov=yes # Remove all optimization flags from CFLAGS changequote({,}) CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'` changequote([,]) # Add the special gcc flags COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage" COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage" COVERAGE_LDFLAGS="-lgcov" # Check availability of gcovr AC_CHECK_PROG(GCOVR, gcovr, gcovr) if test -z "$GCOVR"; then ac_cv_check_gcovr=no else ac_cv_check_gcovr=yes fi fi ]) # AC_TDD_GCOV unity-lens-music-6.9.1+16.04/data/0000775000175000017500000000000012627011301017752 5ustar didrocksdidrocks00000000000000unity-lens-music-6.9.1+16.04/data/unity-scope-music.service.in0000664000175000017500000000013512627006552025351 0ustar didrocksdidrocks00000000000000[D-BUS Service] Name=com.canonical.Unity.Scope.Music Exec=@pkglibexecdir@/unity-music-daemon unity-lens-music-6.9.1+16.04/data/music-preview-player.service.in0000664000175000017500000000015412627006552026046 0ustar didrocksdidrocks00000000000000[D-BUS Service] Name=com.canonical.Unity.Lens.Music.PreviewPlayer Exec=@pkglibexecdir@/music-preview-player unity-lens-music-6.9.1+16.04/data/Makefile.am0000664000175000017500000000060112627010271022010 0ustar didrocksdidrocks00000000000000dbus_servicesdir = $(DBUSSERVICEDIR) service_in_files = \ unity-scope-music.service.in \ music-preview-player.service.in dbus_services_DATA = $(service_in_files:.service.in=.service) %.service: %.service.in sed -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ EXTRA_DIST = \ $(service_in_files) CLEANFILES = \ unity-scope-music.service \ music-preview-player.service