unity-lens-video-0.3.15+16.04.20160212.1/ 0000755 0000156 0000165 00000000000 12657433655 017530 5 ustar pbuser pbgroup 0000000 0000000 unity-lens-video-0.3.15+16.04.20160212.1/autogen.sh 0000755 0000156 0000165 00000000277 12657432760 021533 0 ustar pbuser pbgroup 0000000 0000000 #!/bin/sh
srcdir=`dirname $0`
PKG_NAME="unity-lens-video"
which gnome-autogen.sh || {
echo "You need gnome-common from GNOME SVN"
exit 1
}
USE_GNOME2_MACROS=1 \
. gnome-autogen.sh "$@"
unity-lens-video-0.3.15+16.04.20160212.1/Makefile.am.coverage 0000644 0000156 0000165 00000002505 12657432760 023354 0 ustar pbuser pbgroup 0000000 0000000
# 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-video-0.3.15+16.04.20160212.1/tests/ 0000755 0000156 0000165 00000000000 12657433655 020672 5 ustar pbuser pbgroup 0000000 0000000 unity-lens-video-0.3.15+16.04.20160212.1/tests/unit/ 0000755 0000156 0000165 00000000000 12657433655 021651 5 ustar pbuser pbgroup 0000000 0000000 unity-lens-video-0.3.15+16.04.20160212.1/tests/unit/test-locate.vala 0000644 0000156 0000165 00000003667 12657432760 024752 0 ustar pbuser pbgroup 0000000 0000000 /*
* 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 Unity.VideoLens
{
private Thumbnailer thumbnailer;
private Locate locate;
private string video_dir;
private string user_videos_folder;
public static int main (string[] args)
{
video_dir = Config.TESTDATADIR;
user_videos_folder = GLib.Environment.get_user_special_dir (GLib.UserDirectory.VIDEOS);
locate = new Locate ("cache", video_dir);
thumbnailer = new Thumbnailer ();
Test.init (ref args);
Test.add_data_func ("/Locate/ParseLocateResults", test_parse);
Test.add_data_func ("/Locate/LocateQueryString", test_query_string);
Test.run ();
return 0;
}
internal static void test_parse ()
{
string input = @"$video_dir/video1.avi\n$video_dir/video2.avi\n$video_dir/video1.mpg\n$video_dir/video2.mpg\n";
var results = locate.parse_locate_results (input, 1000, thumbnailer, (path) => { return true; });
assert (results.size == 4);
/* Filter out all results */
results = locate.parse_locate_results (input, 1000, thumbnailer, (path) => { return false; });
assert (results.size == 0);
}
internal static void test_query_string ()
{
assert (locate.locate_query_string ("foo") == video_dir + "*foo*");
assert (locate.locate_query_string ("foo bar") == video_dir + "*foo*bar*");
}
} unity-lens-video-0.3.15+16.04.20160212.1/tests/unit/Makefile.am 0000644 0000156 0000165 00000005262 12657432763 023711 0 ustar pbuser pbgroup 0000000 0000000 include $(top_srcdir)/Makefile.decl
check_PROGRAMS = \
test-locate \
test-utils \
test-ubuntu-video-search \
$(NULL)
TEST_PROGS += $(check_PROGRAMS)
AM_VALAFLAGS = \
--pkg dee-1.0 \
--pkg unity \
--pkg unity-extras \
--pkg gio-2.0 \
--pkg gio-unix-2.0 \
--pkg json-glib-1.0 \
--pkg glib-2.0 \
--pkg gee-0.8 \
--pkg zeitgeist-1.0 \
--pkg libsoup-gnome-2.4 \
--pkg libsoup-2.4 \
--vapidir $(srcdir) \
--vapidir $(top_srcdir)/vapi \
--target-glib=2.26 \
$(MAINTAINER_VALAFLAGS) \
$(NULL)
LDADD = $(SCOPE_DAEMON_LIBS) \
$(test_libs)
AM_CPPFLAGS = \
$(SCOPE_DAEMON_CFLAGS) \
-I$(srcdir) \
-I$(top_srcdir)/src \
-DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
$(COVERAGE_CFLAGS) \
$(NULL)
AM_LDFLAGS = $(COVERAGE_LDFLAGS)
if !ENABLE_C_WARNINGS
AM_CPPFLAGS += -w
endif
test_locate_VALASOURCES = \
test-locate.vala \
thumbnailer-mock.vala \
config-tests.vala \
$(top_srcdir)/src/locate.vala \
$(top_srcdir)/src/utils.vala \
$(top_srcdir)/src/video-file.vala \
$(NULL)
test_utils_VALASOURCES = \
test-utils.vala \
config-tests.vala \
$(top_srcdir)/src/utils.vala \
$(NULL)
test_ubuntu_video_search_VALASOURCES = \
test-ubuntu-video-search.vala \
config-tests.vala \
$(top_srcdir)/src/remote-scope-globals.vala \
$(top_srcdir)/src/ubuntu-video-search.vala \
$(top_srcdir)/src/video-file.vala \
$(top_srcdir)/src/remote-scope.vala \
$(top_srcdir)/src/utils.vala \
$(NULL)
nodist_test_locate_SOURCES = $(test_locate_VALASOURCES:.vala=.c)
nodist_test_utils_SOURCES = $(test_utils_VALASOURCES:.vala=.c)
nodist_test_ubuntu_video_search_SOURCES = $(test_ubuntu_video_search_VALASOURCES:.vala=.c)
CLEANFILES = *.stamp \
*.c \
$(NULL)
EXTRA_DIST = \
$(test_locate_VALASOURCES) \
$(test_utils_VALASOURCES) \
$(test_ubuntu_video_search_VALASOURCES) \
data/videosearch_input1.txt \
data/videosearch_input2.txt \
data/videosearch_details1.txt \
data/video1.avi \
data/video2.avi \
data/video3.avi \
data/video1.mpg \
data/video2.mpg \
data/video3.mpg \
$(NULL)
BUILT_SOURCES = \
test-locate.vala.stamp \
test-utils.vala.stamp \
test-ubuntu-video-search.vala.stamp \
$(NULL)
test-locate.vala.stamp: $(test_locate_VALASOURCES)
$(AM_V_GEN)$(VALAC) -C $(AM_VALAFLAGS) $(VALAFLAGS) $^
@touch $@
test-utils.vala.stamp: $(test_utils_VALASOURCES)
$(AM_V_GEN)$(VALAC) -C $(AM_VALAFLAGS) $(VALAFLAGS) $^
@touch $@
test-ubuntu-video-search.vala.stamp: $(test_ubuntu_video_search_VALASOURCES)
$(AM_V_GEN)$(VALAC) -C $(AM_VALAFLAGS) $(VALAFLAGS) $^
@touch $@
# START HEADLESS TESTS
if ENABLE_HEADLESS_TESTS
test-headless:
$(XVFB) make test-nonrecursive; \
sleep 1;
endif
# END HEADLESS TESTS
unity-lens-video-0.3.15+16.04.20160212.1/tests/unit/thumbnailer-mock.vala 0000644 0000156 0000165 00000001516 12657432760 025756 0 ustar pbuser pbgroup 0000000 0000000 /*
* 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 Unity.VideoLens
{
public class Thumbnailer
{
public string get_icon (string video_file)
{
return "mock-icon";
}
}
} unity-lens-video-0.3.15+16.04.20160212.1/tests/unit/test-ubuntu-video-search.vala 0000644 0000156 0000165 00000026020 12657432760 027360 0 ustar pbuser pbgroup 0000000 0000000 /*
* 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 Unity.VideoLens
{
public static int main (string[] args)
{
/* 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, "");
Test.init (ref args);
Test.add_data_func ("/UbuntuVideoSearch/ProcessSourcesResults", test_process_sources_results);
Test.add_data_func ("/UbuntuVideoSearch/ProcessInvalidSourcesResults", test_process_invalid_sources_results);
Test.add_data_func ("/UbuntuVideoSearch/BuildSearchUri", test_build_search_uri);
Test.add_data_func ("/UbuntuVideoSearch/ProcessInvalidSearchResultsJson", test_invalid_search_results_json);
Test.add_data_func ("/UbuntuVideoSearch/ProcessSearchResults", test_process_search_results);
Test.add_data_func ("/UbuntuVideoSearch/ProcessSearchResultsTreatYourself", test_process_search_no_split_ty_category);
Test.add_data_func ("/UbuntuVideoSearch/ProcessSearchResultsOnline", test_process_search_no_split_online_category);
Test.add_data_func ("/UbuntuVideoSearch/JoinArray", test_join_array);
Test.add_data_func ("/UbuntuVideoSearch/ProcessInvalidDetailsResults", test_process_invalid_details_results);
Test.add_data_func ("/UbuntuVideoSearch/ProcessDetailsResults", test_process_details_results);
Test.run ();
return 0;
}
internal static void test_process_sources_results ()
{
assert (UbuntuVideoSearch.process_sources_results ("[]").size == 0);
var sources = UbuntuVideoSearch.process_sources_results ("[\"Foo\", \"Bar\"]");
assert (sources.size == 2);
assert (sources[0] == "Foo");
assert (sources[1] == "Bar");
}
internal static void test_process_invalid_sources_results ()
{
bool got_excp = false;
try
{
UbuntuVideoSearch.process_sources_results (";");
}
catch (Error e)
{
got_excp = true;
}
assert (got_excp == true);
}
internal static void test_build_search_uri ()
{
// test null sources
assert (UbuntuVideoSearch.build_search_uri ("foo", null) == "http://videosearch.ubuntu.com/v0/search?q=foo&split=true");
// test empty sources list
var sources = new Gee.ArrayList (null);
assert (UbuntuVideoSearch.build_search_uri ("foo", sources) == "http://videosearch.ubuntu.com/v0/search?q=foo&split=true");
// test non-empty sources and uri escaping
sources.add ("Amazon");
sources.add ("BBC");
assert (UbuntuVideoSearch.build_search_uri ("foo!", sources) == "http://videosearch.ubuntu.com/v0/search?q=foo%21&split=true&sources=Amazon,BBC");
}
internal static void test_invalid_search_results_json ()
{
// ignore warnings
Test.log_set_fatal_handler (() => { return false; });
bool got_excp = false;
try
{
UbuntuVideoSearch.process_search_results (",", false);
}
catch (Error e)
{
got_excp = true;
}
assert (got_excp == true);
}
/**
* Test search results of search query with 'split=true' flag, resulting in search results
* being placed in CAT_INDEX_MORE (if from 'treats' results group) and CAT_INDEX_ONLINE category (if from 'other' group).
*/
internal static void test_process_search_results ()
{
string datadir = Config.TESTDATADIR;
uint8[] contents;
assert (File.new_for_path (@"$datadir/videosearch_input1.txt").load_contents (null, out contents, null) == true);
var results = UbuntuVideoSearch.process_search_results ((string)contents, false);
assert (results.size == 5);
bool got_video[5] = {false, false, false, false, false};
// verify that all expected records are there
foreach (var res in results)
{
if (res.title == "title0")
{
got_video[0] = true;
assert (res.comment == "source0");
assert (res.uri == "http://url0");
assert (res.icon == "http://image0");
assert (res.details_uri == "");
assert (res.price == null);
assert (res.category == CAT_INDEX_ONLINE);
}
else if (res.title == "title1")
{
got_video[1] = true;
assert (res.comment == "source1");
assert (res.uri == "http://url1");
assert (res.icon == "http://image1");
assert (res.details_uri == "http://details1");
assert (res.price == null);
assert (res.category == CAT_INDEX_ONLINE);
}
else if (res.title == "title2")
{
got_video[2] = true;
assert (res.comment == "source2");
assert (res.uri == "http://url2");
assert (res.icon == "http://image2");
assert (res.details_uri == "http://details2");
assert (res.price == "1 USD");
assert (res.category == CAT_INDEX_MORE);
}
else if (res.title == "title3")
{
got_video[3] = true;
assert (res.comment == "source3");
assert (res.uri == "http://url3");
assert (res.icon == "http://image3");
assert (res.details_uri == "http://details3");
assert (res.price == _("Free"));
assert (res.category == CAT_INDEX_MORE);
}
else if (res.title == "title4")
{
got_video[4] = true;
assert (res.comment == "source4");
assert (res.uri == "http://url4");
assert (res.icon == "http://image4");
assert (res.details_uri == "http://details4");
assert (res.price == _("Free")); // null price of video4 turned into 'free' for 'Treat yourself category'
assert (res.category == CAT_INDEX_MORE);
}
else
{
assert (1 == 0); // this shouldn't happen
}
}
assert (got_video[0] == true);
assert (got_video[1] == true);
assert (got_video[2] == true);
assert (got_video[3] == true);
assert (got_video[4] == true);
}
/**
* Test search results of search query with no 'split' option and is_treat_yourself=true, resulting in all search results
* being placed in CAT_INDEX_MORE category.
*/
internal static void test_process_search_no_split_ty_category ()
{
string datadir = Config.TESTDATADIR;
uint8[] contents;
assert (File.new_for_path (@"$datadir/videosearch_input2.txt").load_contents (null, out contents, null) == true);
var results = UbuntuVideoSearch.process_search_results ((string)contents, /* is_treat_yourself */ true);
assert (results.size == 2);
bool got_video[2] = {false, false};
// verify that all expected records are there
foreach (var res in results)
{
if (res.title == "title0")
{
got_video[0] = true;
assert (res.comment == "source0");
assert (res.uri == "http://url0");
assert (res.icon == "http://image0");
assert (res.details_uri == "");
assert (res.price == _("Free"));
assert (res.category == CAT_INDEX_MORE);
}
else if (res.title == "title1")
{
got_video[1] = true;
assert (res.comment == "source1");
assert (res.uri == "http://url1");
assert (res.icon == "http://image1");
assert (res.details_uri == "http://details1");
assert (res.price == "1 USD");
assert (res.category == CAT_INDEX_MORE);
}
else
{
assert (1 == 0); // this shouldn't happen
}
}
assert (got_video[0] == true);
assert (got_video[1] == true);
}
/**
* Test search results of search query with no 'split' option and is_treat_yourself=false, resulting in all search results
* being placed in CAT_INDEX_ONLINE
*/
internal static void test_process_search_no_split_online_category ()
{
string datadir = Config.TESTDATADIR;
uint8[] contents;
assert (File.new_for_path (@"$datadir/videosearch_input2.txt").load_contents (null, out contents, null) == true);
var results = UbuntuVideoSearch.process_search_results ((string)contents, /* is_treat_yourself */ false);
assert (results.size == 2);
bool got_video[2] = {false, false};
// verify that all expected records are there
foreach (var res in results)
{
if (res.title == "title0")
{
got_video[0] = true;
assert (res.comment == "source0");
assert (res.uri == "http://url0");
assert (res.icon == "http://image0");
assert (res.details_uri == "");
assert (res.price == null);
assert (res.category == CAT_INDEX_ONLINE);
}
else if (res.title == "title1")
{
got_video[1] = true;
assert (res.comment == "source1");
assert (res.uri == "http://url1");
assert (res.icon == "http://image1");
assert (res.details_uri == "http://details1");
assert (res.price == null);
assert (res.category == CAT_INDEX_ONLINE);
}
else
{
assert (1 == 0); // this shouldn't happen
}
}
assert (got_video[0] == true);
assert (got_video[1] == true);
}
internal static void test_join_array ()
{
var array = new Json.Array ();
array.add_string_element ("abc");
array.add_string_element ("def");
assert (UbuntuVideoSearch.join_array (array, ", ") == "abc, def");
}
internal static void test_process_invalid_details_results ()
{
bool got_excp = false;
try
{
UbuntuVideoSearch.process_details_results (",");
}
catch (Error e)
{
got_excp = true;
}
assert (got_excp == true);
}
internal static void test_process_details_results ()
{
string datadir = Config.TESTDATADIR;
uint8[] contents;
assert (File.new_for_path (@"$datadir/videosearch_details1.txt").load_contents (null, out contents, null) == true);
var video = UbuntuVideoSearch.process_details_results ((string)contents);
assert (video.title == "title1");
assert (video.description == "a movie");
assert (video.image == "http://image1");
assert (video.directors.length == 2);
assert (video.directors[0] == "director1");
assert (video.directors[1] == "director2");
assert (video.duration == 91);
assert (video.genres.length == 2);
assert (video.genres[0] == "genre1");
assert (video.genres[1] == "genre2");
assert (video.starring == "star1, star2");
assert (video.source == "source1");
assert (video.release_date == "2010");
assert (video.uploaded_by == "uploader1");
assert (video.price == "$1");
assert (video.date_uploaded == "2012-06-06T21:55:12.000Z");
}
}
unity-lens-video-0.3.15+16.04.20160212.1/tests/unit/data/ 0000755 0000156 0000165 00000000000 12657433655 022562 5 ustar pbuser pbgroup 0000000 0000000 unity-lens-video-0.3.15+16.04.20160212.1/tests/unit/data/videosearch_input2.txt 0000644 0000156 0000165 00000000517 12657432760 027117 0 ustar pbuser pbgroup 0000000 0000000 [
{
"url": "http://url0",
"source": "source0",
"img": "http://image0",
"title": "title0"
},
{
"url": "http://url1",
"source": "source1",
"details": "http://details1",
"img": "http://image1",
"title": "title1",
"price": 1,
"formatted_price": "1 USD"
}
]
unity-lens-video-0.3.15+16.04.20160212.1/tests/unit/data/videosearch_input1.txt 0000644 0000156 0000165 00000001577 12657432760 027125 0 ustar pbuser pbgroup 0000000 0000000 {
"other": [
{
"url": "http://url0",
"source": "source0",
"img": "http://image0",
"title": "title0"
},
{
"url": "http://url1",
"source": "source1",
"details": "http://details1",
"img": "http://image1",
"title": "title1"
}
],
"treats": [
{
"img": "http://image2",
"title": "title2",
"url": "http://url2",
"price": 1,
"source": "source2",
"details": "http://details2",
"formatted_price": "1 USD"
},
{
"img": "http://image3",
"title": "title3",
"url": "http://url3",
"price": 0,
"source": "source3",
"details": "http://details3",
"formatted_price": "free"
},
{
"img": "http://image4",
"title": "title4",
"url": "http://url4",
"source": "source4",
"details": "http://details4"
}
]
}
unity-lens-video-0.3.15+16.04.20160212.1/tests/unit/data/video1.mpg 0000644 0000156 0000165 00000000000 12657432760 024440 0 ustar pbuser pbgroup 0000000 0000000 unity-lens-video-0.3.15+16.04.20160212.1/tests/unit/data/videosearch_details1.txt 0000644 0000156 0000165 00000000776 12657432760 027413 0 ustar pbuser pbgroup 0000000 0000000 {
"browser_url": "http://browserurl1",
"genres": [
"genre1",
"genre2"
],
"description": "a movie",
"title": "title1",
"price": 1,
"source": "source1",
"directors": [
"director1",
"director2"
],
"details": "http://detailsurl1",
"starring": [
"star1",
"star2"
],
"uploaded_by": "uploader1",
"duration": "5477",
"release_date": "2010-04-01T07:00:00.000Z",
"image": "http://image1",
"date_uploaded": "2012-06-06T21:55:12.000Z",
"formatted_price": "$1"
}
unity-lens-video-0.3.15+16.04.20160212.1/tests/unit/data/video3.mpg 0000644 0000156 0000165 00000000000 12657432760 024442 0 ustar pbuser pbgroup 0000000 0000000 unity-lens-video-0.3.15+16.04.20160212.1/tests/unit/data/video1.avi 0000644 0000156 0000165 00000000000 12657432760 024434 0 ustar pbuser pbgroup 0000000 0000000 unity-lens-video-0.3.15+16.04.20160212.1/tests/unit/data/video3.avi 0000644 0000156 0000165 00000000000 12657432760 024436 0 ustar pbuser pbgroup 0000000 0000000 unity-lens-video-0.3.15+16.04.20160212.1/tests/unit/data/video2.mpg 0000644 0000156 0000165 00000000000 12657432760 024441 0 ustar pbuser pbgroup 0000000 0000000 unity-lens-video-0.3.15+16.04.20160212.1/tests/unit/data/video2.avi 0000644 0000156 0000165 00000000000 12657432760 024435 0 ustar pbuser pbgroup 0000000 0000000 unity-lens-video-0.3.15+16.04.20160212.1/tests/unit/config-tests.vala.in 0000644 0000156 0000165 00000000433 12657432760 025524 0 ustar pbuser pbgroup 0000000 0000000 namespace Config {
const string TESTDATADIR = "@abs_top_srcdir@/tests/unit/data";
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-video-0.3.15+16.04.20160212.1/tests/unit/test-utils.vala 0000644 0000156 0000165 00000003460 12657432760 024632 0 ustar pbuser pbgroup 0000000 0000000 /*
* 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 Unity.VideoLens
{
public static int main (string[] args)
{
Test.init (ref args);
Test.add_data_func ("/Utils/Gcd", test_gcd);
Test.add_data_func ("/Utils/IsRegularFile", test_is_regular_file);
Test.add_data_func ("/Utils/GetName", test_get_name);
Test.add_data_func ("/Utils/IsVideo", test_is_video);
Test.run ();
return 0;
}
internal static void test_gcd ()
{
assert (Utils.gcd (1, 1) == 1);
assert (Utils.gcd (2, 1) == 1);
assert (Utils.gcd (10, 2) == 2);
assert (Utils.gcd (2, 10) == 2);
assert (Utils.gcd (20, 15) == 5);
}
internal static void test_is_regular_file ()
{
assert (Utils.is_regular_file ("/etc/passwd") == true);
assert (Utils.is_regular_file ("/dev/null") == false);
assert (Utils.is_regular_file ("/non-existing-file") == false);
}
internal static void test_get_name ()
{
assert (Utils.get_name ("/etc/passwd") == "passwd");
}
internal static void test_is_video ()
{
var video_dir = Config.TESTDATADIR;
assert (Utils.is_video ("/etc/passwd") == false);
assert (Utils.is_video (@"$video_dir/video1.avi") == true);
}
} unity-lens-video-0.3.15+16.04.20160212.1/tests/manual/ 0000755 0000156 0000165 00000000000 12657433655 022147 5 ustar pbuser pbgroup 0000000 0000000 unity-lens-video-0.3.15+16.04.20160212.1/tests/manual/local-video-previews.txt 0000644 0000156 0000165 00000002347 12657432760 026752 0 ustar pbuser pbgroup 0000000 0000000 Preview of local video file
---------------------------
Test that details of a local video file are displayed in the preview.
Setup:
Have some video files available in ~/Videos folder.
Actions:
1. Open the Dash and switch to the video lens.
2. Make sure some video files from ~/Videos folder are displayed.
3. Right click a video file.
Expected Result:
Video preview should be displayed. Verify the preview display a sample video frame (a picture) and contains
the following data: file name (as title), modification date and time (as subtitle) and 'Format', 'Dimensions',
'Size' info; 'Dimensions' should include resolution and aspect ratio, e.g. '1280:720, 16:9'.
Preview of local video file - preview-player close
--------------------------------------------------
Test that music-preview-player is closed automatically when not needed.
Setup:
Have some video files available in ~/Videos folder.
Actions:
1. Open the Dash and switch to the video lens.
2. Make sure some video files from ~/Videos folder are displayed.
3. Right click a video file.
4. Close the preview.
Expected Result:
Video preview should be displayed. After closing the preview, verify with 'ps aux' that music-preview-player
process disappears after approximately 1 minute.
unity-lens-video-0.3.15+16.04.20160212.1/tests/manual/local-video-search.txt 0000644 0000156 0000165 00000001002 12657432760 026336 0 ustar pbuser pbgroup 0000000 0000000 Search a local video file
---------------------------
Test that local video files in the ~/Videos folder are easily found
Setup:
Have some video files available in ~/Videos folder.
Actions:
1. Open the Dash and switch to the video lens.
2. Make sure some video files from ~/Videos folder are displayed.
3. Search for multiple consecutive substrings of a video file name.
Expected Result:
Results matching the search should be displayed. For example, searching for "ubuntu 1" should returns "ubuntu_video1.avi".
unity-lens-video-0.3.15+16.04.20160212.1/src/ 0000755 0000156 0000165 00000000000 12657433655 020317 5 ustar pbuser pbgroup 0000000 0000000 unity-lens-video-0.3.15+16.04.20160212.1/src/Makefile.am 0000644 0000156 0000165 00000005714 12657432763 022361 0 ustar pbuser pbgroup 0000000 0000000 NULL =
BUILT_SOURCES =
CLEANFILES =
EXTRA_DIST =
DATADIR = $(datadir)
AM_CFLAGS = -w
AM_CPPFLAGS = $(COVERAGE_CFLAGS)
AM_LDFLAGS = $(COVERAGE_LDFLAGS)
pkglibexec_PROGRAMS = \
unity-video-lens-daemon \
unity-scope-video-remote \
$(NULL)
unity_video_lens_daemon_CPPFLAGS = \
-DDATADIR=\"$(DATADIR)\" \
-DPKGDATADIR=\"$(PKGDATADIR)\" \
-DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
-DG_LOG_DOMAIN=\"unity-video-lens-daemon\" \
$(SCOPE_DAEMON_CFLAGS) \
$(MAINTAINER_CFLAGS) \
-I$(srcdir) \
$(NULL)
unity_scope_video_remote_CPPFLAGS = \
-DDATADIR=\"$(DATADIR)\" \
-DPKGDATADIR=\"$(PKGDATADIR)\" \
-DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
-DG_LOG_DOMAIN=\"unity-scope-video-remote\" \
$(SCOPE_DAEMON_CFLAGS) \
$(MAINTAINER_CFLAGS) \
-I$(srcdir) \
$(NULL)
unity_video_lens_daemon_VALAFLAGS = \
-C \
--pkg dee-1.0 \
--pkg unity \
--pkg unity-extras \
--pkg gio-2.0 \
--pkg gio-unix-2.0 \
--pkg glib-2.0 \
--pkg gee-0.8 \
--pkg zeitgeist-1.0 \
--vapidir $(srcdir) \
--vapidir $(top_srcdir)/vapi \
--target-glib=2.26 \
$(MAINTAINER_VALAFLAGS) \
$(NULL)
unity_scope_video_remote_VALAFLAGS = \
-C \
--pkg dee-1.0 \
--pkg unity \
--pkg unity-extras \
--pkg gio-2.0 \
--pkg gio-unix-2.0 \
--pkg glib-2.0 \
--pkg gee-0.8 \
--pkg zeitgeist-1.0 \
--pkg libsoup-gnome-2.4 \
--pkg libsoup-2.4 \
--pkg json-glib-1.0 \
--vapidir $(srcdir) \
--vapidir $(top_srcdir)/vapi \
--target-glib=2.26 \
$(MAINTAINER_VALAFLAGS) \
$(NULL)
unity_video_lens_daemon_LDADD = \
$(SCOPE_DAEMON_LIBS) \
$(NULL)
unity_scope_video_remote_LDADD = \
$(SCOPE_DAEMON_LIBS) \
$(NULL)
unity_video_lens_daemon_VALASOURCES = \
blacklist-tracker.vala \
daemon.vala \
main.vala \
locate.vala \
scope.vala \
config.vala \
thumbnailer.vala \
utils.vala \
video-file.vala \
$(NULL)
unity_scope_video_remote_VALASOURCES = \
config.vala \
remote-scope-globals.vala \
remote-video-main.vala \
remote-scope.vala \
ubuntu-video-search.vala \
utils.vala \
video-file.vala \
$(NULL)
unity_video_lens_daemon_SOURCES = \
$(unity_video_lens_daemon_VALASOURCES:.vala=.c) \
$(NULL)
unity_scope_video_remote_SOURCES = \
$(unity_scope_video_remote_VALASOURCES:.vala=.c) \
$(NULL)
BUILT_SOURCES += \
unity_video_lens_daemon.vala.stamp \
unity_scope_video_remote.vala.stamp \
$(NULL)
EXTRA_DIST += \
unity_video_lens_daemon.vala.stamp \
unity_scope_video_remote.vala.stamp \
$(unity_video_lens_daemon_VALASOURCES) \
$(unity_scope_video_remote_VALASOURCES) \
$(NULL)
unity_video_lens_daemon.vala.stamp: $(unity_video_lens_daemon_VALASOURCES)
$(AM_V_GEN) $(VALAC) $(unity_video_lens_daemon_VALAFLAGS) $^
@touch $@
unity_scope_video_remote.vala.stamp: $(unity_scope_video_remote_VALASOURCES)
$(AM_V_GEN) $(VALAC) $(unity_scope_video_remote_VALAFLAGS) $^
@touch $@
CLEANFILES += \
*.stamp \
$(unity_video_lens_daemon_VALASOURCES:.vala=.c) \
$(unity_scope_video_remote_VALASOURCES:.vala=.c) \
$(NULL)
unity-lens-video-0.3.15+16.04.20160212.1/src/remote-video-main.vala 0000644 0000156 0000165 00000002624 12657432760 024505 0 ustar pbuser pbgroup 0000000 0000000 /*
* 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 .
*/
using GLib;
using Config;
namespace Unity.VideoLens {
public static int main (string[] args)
{
GLib.Environment.set_prgname ("unity-remote-video-scope");
/* 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, "");
var scope = new RemoteVideoScope ();
var exporter = new Unity.ScopeDBusConnector (scope);
try
{
exporter.export ();
}
catch (GLib.Error e)
{
error ("Cannot export scope to DBus: %s", e.message);
}
Unity.ScopeDBusConnector.run ();
return 0;
}
} /* namespace */
unity-lens-video-0.3.15+16.04.20160212.1/src/daemon.vala 0000644 0000156 0000165 00000002040 12657432760 022417 0 ustar pbuser pbgroup 0000000 0000000 /*
* 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
* based on python code by David Calle
*/
namespace Unity.VideoLens {
public class Daemon : GLib.Object
{
private Unity.DeprecatedScope scope;
construct
{
scope = new VideoScope ();
try {
scope.export ();
} catch (GLib.IOError e) {
stdout.printf ("error %s\n", e.message);
}
}
}
}
unity-lens-video-0.3.15+16.04.20160212.1/src/config.vala.in 0000644 0000156 0000165 00000000603 12657432760 023031 0 ustar pbuser pbgroup 0000000 0000000 namespace Config {
const string PREFIX = "@prefix@";
const string DATADIR = "@DATADIR@";
const string PKGDATADIR = "@DATADIR@/unity";
const string BINDIR = "@prefix@/bin";
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-video-0.3.15+16.04.20160212.1/src/video-file.vala 0000644 0000156 0000165 00000002514 12657432760 023205 0 ustar pbuser pbgroup 0000000 0000000 /*
* 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 Unity.VideoLens
{
public struct VideoFile
{
string title;
string lc_title;
string comment;
string uri;
string icon;
int category;
}
public struct RemoteVideoFile
{
string title;
string comment;
string uri;
string icon;
string details_uri;
string price;
int category;
}
public struct RemoteVideoDetails
{
string title;
string description;
string uri;
string image;
string source;
string release_date;
int duration;
string[] directors;
string starring;
string[] genres;
string uploaded_by;
string date_uploaded;
string price;
}
} unity-lens-video-0.3.15+16.04.20160212.1/src/thumbnailer.vala 0000644 0000156 0000165 00000007203 12657432760 023474 0 ustar pbuser pbgroup 0000000 0000000 /*
* 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
* based on python code by David Calle
*
*/
namespace Unity.VideoLens
{
public class Thumbnailer
{
private static const int MAX_THUMBNAILERS = 3;
private string videos_folder;
private string cache_directory;
private Gee.LinkedList thumbnailer_pids;
public Thumbnailer (string cache_dir)
{
cache_directory = cache_dir;
videos_folder = GLib.Environment.get_user_special_dir (GLib.UserDirectory.VIDEOS);
thumbnailer_pids = new Gee.LinkedList ();
}
public string get_icon (string video_file)
{
/* This method checks several locations for a video thumbnail.
1) .jpg file in the same folder (not activated for now)
2) Nautilus thumbnails
3) Cached thumbnails generated by the scope
If nothing has been found, it tries to generate a thumbnail with Totem,
stores and uses it.
If the generation fails or is slow, it fallbacks to the standard video
icon.
*/
var file = GLib.File.new_for_path (video_file);
var video_path = file.get_path ();
string? icon_path = null;
// check if nautilus thumbnail is available
try
{
var finfo = file.query_info (GLib.FileAttribute.THUMBNAIL_PATH + "," + GLib.FileAttribute.THUMBNAILING_FAILED, GLib.FileQueryInfoFlags.NONE);
if (finfo.get_attribute_boolean (GLib.FileAttribute.THUMBNAILING_FAILED))
return "video";
else
icon_path = finfo.get_attribute_as_string (GLib.FileAttribute.THUMBNAIL_PATH);
}
catch (GLib.Error e)
{
// silently ignore
}
if (icon_path == null || icon_path == "")
{
string check_path = cache_directory + "/" + video_path.replace (videos_folder, "").replace ("/", "_");
// check for thumbnail generated by this scope
if (Utils.is_regular_file (check_path))
return check_path;
create_thumbnail (video_path, check_path);
// FIXME: this is not reliable, since we spawn thumbnailer async
if (Utils.is_regular_file (check_path))
return check_path;
}
if (icon_path == null || icon_path == "")
icon_path = "video";
return icon_path;
}
private void thumbnailer_process_watch (Pid pid, int status)
{
thumbnailer_pids.remove (pid);
}
public void create_thumbnail (string video_path, string thumbnail_path)
{
if (thumbnailer_pids.size < MAX_THUMBNAILERS)
{
GLib.Pid pid;
string[] args = {"/usr/bin/totem-video-thumbnailer", video_path, thumbnail_path};
try
{
GLib.Process.spawn_async (null, args, null, GLib.SpawnFlags.DO_NOT_REAP_CHILD, null, out pid);
GLib.ChildWatch.add (pid, thumbnailer_process_watch);
thumbnailer_pids.add (pid);
}
catch (Error e)
{
warning ("Failed to spawn thumbailer: %s", e.message);
}
}
}
}
} unity-lens-video-0.3.15+16.04.20160212.1/src/remote-scope-globals.vala 0000644 0000156 0000165 00000001434 12657432760 025205 0 ustar pbuser pbgroup 0000000 0000000
/*
* 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 Unity.VideoLens
{
static int CAT_INDEX_ONLINE = 0;
static int CAT_INDEX_MORE = 1;
}
unity-lens-video-0.3.15+16.04.20160212.1/src/locate.vala 0000644 0000156 0000165 00000006535 12657432760 022440 0 ustar pbuser pbgroup 0000000 0000000 /*
* 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 Unity.VideoLens
{
public class Locate
{
/* Filter used by locate handling loop; return value of false means file will be ignored */
public delegate bool LocateFilter (string path);
private static const int MAX_RESULTS = 100;
private static const int MAX_LOCATE_RESULTS = 200;
private string cache_db;
private string videos_folder;
public string locate_bin { get; set; default = "locate"; }
public string updatedb_bin { get; set; default = "updatedb"; }
public Locate (string cache_dir, string videos_dir)
{
cache_db = cache_dir + "/videos.db";
videos_folder = videos_dir;
}
public Gee.ArrayList? run_locate (string search_string, Thumbnailer thumbnailer, LocateFilter? filter = null)
{
if (Utils.is_regular_file (cache_db))
{
string stdout;
try
{
string query = locate_query_string (search_string);
GLib.Process.spawn_command_line_sync (@"$locate_bin -l $MAX_LOCATE_RESULTS -id $cache_db $query", out stdout);
var result_list = parse_locate_results (stdout, 100, thumbnailer, filter);
return result_list;
}
catch (GLib.Error e)
{
warning ("Failed to run locate: %s", e.message);
}
}
return null;
}
internal string locate_query_string (string search_string)
{
return videos_folder + "*" + search_string.replace (" ", "*") + "*";
}
public void updatedb ()
{
try
{
GLib.Process.spawn_command_line_async (@"$updatedb_bin -o $cache_db -l 0 -U $videos_folder");
}
catch (GLib.Error e)
{
warning ("Can't create database, will retry: %s", e.message);
}
}
public Gee.ArrayList parse_locate_results (string locate_output, int max, Thumbnailer thumbnailer, LocateFilter? filter)
{
var results_list = locate_output.split ("\n");
var res = new Gee.ArrayList ();
int video_count = 0;
foreach (var video in results_list)
{
if (video_count >= MAX_RESULTS)
break;
try
{
if (Utils.is_video (video) && (filter == null || filter (video)))
{
video_count++;
var name = Utils.get_name (video);
VideoFile video_file = VideoFile ()
{
title = name,
lc_title = name.down (),
uri = "file://" + video,
icon = thumbnailer.get_icon (video)
};
res.add (video_file);
}
}
catch (Error e)
{
// silently ignore
}
}
return res;
}
}
} unity-lens-video-0.3.15+16.04.20160212.1/src/ubuntu-video-search.vala 0000644 0000156 0000165 00000015507 12657432760 025061 0 ustar pbuser pbgroup 0000000 0000000 /*
* 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 Unity.VideoLens.UbuntuVideoSearch
{
private static const string SERVER = "http://videosearch.ubuntu.com/v0";
public static string sources_uri ()
{
return SERVER + "/sources";
}
public static string recommendations_uri ()
{
return SERVER + "/search?q=";
}
public static string build_search_uri (string query, Gee.ArrayList? sources, string? form_factor = null)
{
var uri = new StringBuilder ();
uri.append (SERVER);
uri.append ("/search?q=");
uri.append (Uri.escape_string (query, "", false));
uri.append ("&split=true");
if (sources != null && sources.size>0)
{
uri.append ("&sources=");
uri.append (sources[0]);
for (int i=1; i? process_search_results (string json_data, bool is_treat_yourself) throws Error
{
var parser = new Json.Parser ();
parser.load_from_data (json_data);
var root = parser.get_root ();
if (root.get_node_type () == Json.NodeType.OBJECT)
{
var records = root.get_object ().get_array_member ("other");
var results = process_results_array (records, CAT_INDEX_ONLINE);
records = root.get_object ().get_array_member ("treats");
results.add_all (process_results_array (records, CAT_INDEX_MORE));
return results;
}
else
{
var records = root.get_array ();
var results = process_results_array (records, is_treat_yourself ? CAT_INDEX_MORE : CAT_INDEX_ONLINE);
return results;
}
}
/**
* Joins elements of JSON array of strings.
*/
internal string join_array (Json.Array array, string separator)
{
var res = new StringBuilder ();
var len = array.get_length ();
array.foreach_element ((a, index, node) =>
{
res.append (node.get_string ());
if (index < len - 1)
res.append (separator);
});
return res.str;
}
public string[] json_array_to_str_array (Json.Array array)
{
string [] res = {};
array.foreach_element ((a, index, node) =>
{
res += node.get_string ();
});
return res;
}
public RemoteVideoDetails process_details_results (string json_data) throws Error
{
var parser = new Json.Parser ();
parser.load_from_data (json_data);
var details = parser.get_root ().get_object ();
var video = RemoteVideoDetails ();
video.title = details.get_string_member ("title");
video.image = details.get_string_member ("image");
video.description = details.get_string_member ("description");
video.source = details.get_string_member ("source");
if (details.has_member ("release_date"))
{
// v1 spec states release_date will be YYYY-MM-DD
var release_date = GLib.Time ();
if (release_date.strptime (details.get_string_member ("release_date"), "%Y-%m-%d") != null)
{
video.release_date = release_date.format ("%Y");
}
else
{
warning ("Failed to parse release_date: '%s'", details.get_string_member ("release_date"));
}
}
video.price = details.has_member ("formatted_price") ? details.get_string_member ("formatted_price") : "";
video.duration = 0;
if (details.has_member ("duration"))
video.duration = int.parse (details.get_string_member ("duration")) / 60;
video.directors = {};
if (details.has_member ("directors"))
{
var directors = details.get_array_member ("directors");
video.directors = json_array_to_str_array (directors);
}
if (details.has_member ("starring"))
{
var starring = details.get_array_member ("starring");
video.starring = join_array (starring, ", ");
}
video.genres = {};
if (details.has_member ("genres"))
{
var genres = details.get_array_member ("genres");
video.genres = json_array_to_str_array (genres);
}
if (details.has_member ("uploaded_by"))
video.uploaded_by = details.get_string_member ("uploaded_by");
if (details.has_member ("date_uploaded"))
video.date_uploaded = details.get_string_member ("date_uploaded");
return video;
}
/**
* Parses JSON data returned by 'sources' query, returns list of sources (e.g. "Amazon", "Youtube" etc.)
*/
public Gee.ArrayList? process_sources_results (string json_data) throws Error
{
var parser = new Json.Parser ();
parser.load_from_data (json_data);
var sources_array = parser.get_root ().get_array ();
var results = new Gee.ArrayList (null);
sources_array.foreach_element ((array, index, node) =>
{
results.add (node.get_string ());
});
return results;
}
/**
* Converts JSON results array to list of RemoteVideoFile records.
*/
internal Gee.ArrayList process_results_array (Json.Array results, int category)
{
var videos = new Gee.ArrayList ();
results.foreach_element ((array, index, node) =>
{
try
{
var video = RemoteVideoFile ();
var rec = node.get_object ();
video.uri = rec.get_string_member ("url");
video.title = rec.get_string_member ("title");
video.icon = rec.get_string_member ("img");
video.comment = rec.get_string_member ("source");
video.details_uri = (rec.has_member ("details") ? rec.get_string_member ("details") : "");
video.category = category;
video.price = null;
if (category == CAT_INDEX_MORE)
{
string price = null;
if (rec.has_member ("formatted_price"))
{
price = rec.get_string_member ("formatted_price");
}
if (price == null || price == "free")
{
price = _("Free");
}
video.price = price;
}
videos.add (video);
}
catch (Error e)
{
warning ("Malformed result, skipping: %s", e.message);
}
});
return videos;
}
}
unity-lens-video-0.3.15+16.04.20160212.1/src/main.vala 0000644 0000156 0000165 00000003171 12657432760 022106 0 ustar pbuser pbgroup 0000000 0000000 /*
* 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 .
*/
using GLib;
using Config;
namespace Unity.VideoLens {
static Application? app = null;
static Daemon? daemon = null;
public static int main (string[] args)
{
GLib.Environment.set_prgname ("unity-video-lens");
/* 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, "");
try
{
app = Extras.dbus_own_name ("net.launchpad.scope.LocalVideos", () =>
{
daemon = new Daemon ();
});
}
catch (Error e)
{
warning ("Failed to start video lens daemon: %s\n", e.message);
return 1;
}
if (app == null)
{
warning ("Another instance of the Unity Videos Lens " +
"already appears to be running.\nBailing out.\n");
return 2;
}
return app.run ();
}
} /* namespace */
unity-lens-video-0.3.15+16.04.20160212.1/src/remote-scope.vala 0000644 0000156 0000165 00000036177 12657432760 023600 0 ustar pbuser pbgroup 0000000 0000000 /*
* 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
* based on python code by David Calle
*
*/
using Config;
namespace Unity.VideoLens
{
public class RemoteVideoScope : Unity.SimpleScope
{
private const int REFRESH_INTERVAL = 3600; // fetch sources & recommendations once an hour
private const int RETRY_INTERVAL = 60; // retry sources/recommendations after a minute
private const string RESULT_PREVIEW_ON_LMB = "lmb-preview";
private const string RESULT_DETAILS_URI = "details-uri";
private Soup.Session session;
Gee.ArrayList recommendations;
int64 recommendations_last_update = 0;
Zeitgeist.DataSourceRegistry zg_sources;
bool use_zeitgeist;
public RemoteVideoScope ()
{
Object (unique_name: "/net/launchpad/scope/remotevideos",
group_name: "net.launchpad.scope.RemoteVideos");
}
protected override void constructed ()
{
base.constructed ();
var schema = new Unity.Schema ();
schema.add_field (RESULT_PREVIEW_ON_LMB, "b", Unity.Schema.FieldType.OPTIONAL);
schema.add_field (RESULT_DETAILS_URI, "s", Unity.Schema.FieldType.OPTIONAL);
this.schema = schema;
recommendations = new Gee.ArrayList ();
use_zeitgeist = false;
try
{
zeitgeist_init ();
use_zeitgeist = true;
}
catch (Error e)
{
warning ("Failed to initialize Zeitgeist, won't store events");
}
session = new Soup.SessionAsync ();
session.ssl_use_system_ca_file = true;
session.ssl_strict = true;
session.user_agent = "Unity Video Lens Remote Scope v" + Config.VERSION;
session.add_feature_by_type (typeof (SoupGNOME.ProxyResolverGNOME));
populate_categories ();
// refresh the search at least once every 30 minutes
GLib.Timeout.add_seconds (REFRESH_INTERVAL/2, () =>
{
results_invalidated (SearchType.DEFAULT);
return true;
});
set_search_async_func (dispatch_search);
set_preview_async_func (dispatch_preview);
set_activate_func (activate_result);
}
private void populate_categories ()
{
var categories = new Unity.CategorySet ();
var icon_dir = File.new_for_path (Config.ICON_PATH);
categories.add(new Unity.Category ("online", _("Online"), new FileIcon (icon_dir.get_child ("group-internet.svg")), Unity.CategoryRenderer.VERTICAL_TILE));
categories.add(new Unity.Category ("more", _("More suggestions"), new FileIcon (icon_dir.get_child ("group-treat-yourself.svg")), Unity.CategoryRenderer.VERTICAL_TILE));
this.category_set = categories;
}
private void dispatch_search (ScopeSearchBase search,
ScopeSearchBaseCallback cb)
{
perform_search.begin (search, (obj, res) =>
{
try
{
perform_search.end (res);
}
catch (Error err)
{
warning ("Unable to perform search: %s", err.message);
}
cb (search);
});
}
private void dispatch_preview (ResultPreviewer previewer,
AbstractPreviewCallback cb)
{
preview_result.begin (previewer.result, (obj, res) =>
{
var preview = preview_result.end (res);
cb (previewer, preview);
});
}
public override string normalize_search_query (string search_query)
{
return search_query.strip ();
}
/* Query the server for a list of sources that will be used
* to build sources filter options and search queries.
*/
private async void query_list_of_sources ()
{
try
{
var sources_msg = new Soup.Message ("GET", UbuntuVideoSearch.sources_uri ());
var msg = yield queue_soup_message (sources_msg);
var sources_array = UbuntuVideoSearch.process_sources_results ((string) msg.response_body.data);
// FIXME: do something with the sources once we support dynamic filters
}
catch (Error e)
{
warning ("Got invalid json from the server");
}
// refresh the sources after a while
GLib.Timeout.add_seconds (REFRESH_INTERVAL, () =>
{
query_list_of_sources.begin (); return false;
});
}
public Unity.ActivationResponse? activate_result (ScopeResult result,
SearchMetadata metadata,
string? action_id)
{
var realcat = result.metadata.lookup (RESULT_PREVIEW_ON_LMB);
// activation of More Suggestions should display a preview.
if (action_id == null && realcat != null && realcat.get_boolean ())
{
return new Unity.ActivationResponse (Unity.HandledType.SHOW_PREVIEW);
}
return on_activate_uri (result);
}
private Unity.ActivationResponse on_activate_uri (Unity.ScopeResult result)
{
zeitgeist_insert_event (result.uri, result.title, result.icon_hint);
// let unity open the uri for us
return new Unity.ActivationResponse (Unity.HandledType.NOT_HANDLED);
}
private Unity.Preview? build_preview (ScopeResult result, RemoteVideoDetails? details)
{
string title = result.title;
string subtitle = "";
string description = "";
if (details != null)
{
title = details.title;
description = details.description;
if (details.release_date != null && details.release_date != "")
subtitle = details.release_date;
if (details.duration > 0)
{
string duration = ngettext ("%d min", "%d mins", details.duration).printf (details.duration);
if (subtitle != "")
subtitle += ", " + duration;
else
subtitle = duration;
}
}
GLib.Icon thumbnail;
if (details != null)
{
thumbnail = new GLib.FileIcon (GLib.File.new_for_uri (details.image));
}
else
{
try
{
thumbnail = GLib.Icon.new_for_string (result.icon_hint);
}
catch (Error err) { thumbnail = null; }
}
if (subtitle == "") subtitle = result.comment;
var real_preview = new Unity.MoviePreview (title, subtitle,
description, thumbnail);
var play_video = new Unity.PreviewAction ("play", _("Play"), null);
real_preview.add_action (play_video);
// For now, rating == -1 and num_ratings == 0 hides the rating widget from the preview
real_preview.set_rating (-1, 0);
if (details != null)
{
//TODO: For details of future source types, factor out common detail key/value pairs
if (details.directors.length > 0)
real_preview.add_info (new Unity.InfoHint ("directors", ngettext ("Director", "Directors", details.directors.length), null, string.joinv (", ", details.directors)));
if (details.starring != null && details.starring != "")
real_preview.add_info (new Unity.InfoHint ("cast", _("Cast"), null, details.starring));
if (details.genres != null && details.genres.length > 0)
real_preview.add_info (new Unity.InfoHint ("genres", ngettext("Genre", "Genres", details.genres.length), null, string.joinv (", ", details.genres)));
// TODO: Add Vimeo & YouTube details for v1 of JSON API
if (details.uploaded_by != null && details.uploaded_by != "")
real_preview.add_info (new Unity.InfoHint ("uploaded-by", _("Uploaded by"), null, details.uploaded_by));
if (details.date_uploaded != null && details.date_uploaded != "")
real_preview.add_info (new Unity.InfoHint ("uploaded-on", _("Uploaded on"), null, details.date_uploaded));
}
return real_preview;
}
public async Preview? preview_result (ScopeResult result)
{
var uri_variant = result.metadata.lookup (RESULT_DETAILS_URI);
var details_uri = uri_variant.get_string ();
if (details_uri != null && details_uri != "")
{
try
{
var details = yield get_details (details_uri);
return build_preview (result, details);
}
catch (Error e)
{
warning ("Failed to fetch video details: %s", e.message);
}
}
else
{
warning ("Missing details uri for: '%s'", result.uri);
}
return build_preview (result, null);
}
private async RemoteVideoDetails? get_details (string url) throws Error
{
try
{
var msg = yield queue_soup_message (new Soup.Message ("GET", url));
var details = UbuntuVideoSearch.process_details_results ((string) msg.response_body.data);
return details;
}
catch (Error err)
{
warning ("Unable to get details from the server: %s", err.message);
}
return null;
}
/* Query the server with the search string and the list of sources.
*/
private async void perform_search (ScopeSearchBase search) throws Error
{
if (search.search_context.search_type != Unity.SearchType.DEFAULT) return;
var search_string = search.search_context.search_query;
var result_set = search.search_context.result_set;
if ((search_string == null || search_string == "") && (recommendations.size > 0))
{
var time = new DateTime.now_utc ();
// do we have cached recommendations?
if (time.to_unix () - recommendations_last_update < REFRESH_INTERVAL)
{
debug ("Updating search results with recommendations");
push_results (result_set, recommendations);
result_set.ttl = REFRESH_INTERVAL;
return;
}
}
var cancellable = search.search_context.cancellable.get_gcancellable ();
var url = UbuntuVideoSearch.build_search_uri (search_string, null, search.search_context.search_metadata.form_factor);
debug ("Querying the server: %s", url);
bool is_treat_yourself = (search_string == null || search_string == "");
var msg = yield queue_soup_message (new Soup.Message ("GET", url), cancellable);
var results = UbuntuVideoSearch.process_search_results ((string)msg.response_body.data, is_treat_yourself);
if (results != null)
{
if (search_string == null || search_string.strip () == "")
{
debug ("Empty search, updating recommendations");
var time = new DateTime.now_utc ();
recommendations = results;
recommendations_last_update = time.to_unix ();
}
push_results (result_set, results);
}
}
private async Soup.Message? queue_soup_message (Soup.Message msg,
GLib.Cancellable? cancellable = null)
throws Error
{
Soup.Message? result_msg = null;
session.queue_message (msg, (session_, msg_) =>
{
result_msg = msg_;
queue_soup_message.callback ();
});
var cancelled = false;
ulong cancel_id = 0;
if (cancellable != null)
{
cancel_id = cancellable.cancelled.connect (() =>
{
cancelled = true;
session.cancel_message (msg, Soup.KnownStatusCode.CANCELLED);
});
}
yield;
if (cancelled)
{
// we can't disconnect right away, as that would deadlock (cause
// cancel_message doesn't return before invoking the callback)
Idle.add (queue_soup_message.callback);
yield;
cancellable.disconnect (cancel_id);
throw new IOError.CANCELLED ("Cancelled");
}
if (cancellable != null)
cancellable.disconnect (cancel_id);
if (result_msg.status_code < 100)
{
throw new IOError.FAILED ("Request failed with error %u",
result_msg.status_code);
}
if (result_msg.status_code != 200)
{
throw new IOError.FAILED ("Request returned status code %u",
result_msg.status_code);
}
return result_msg;
}
private void push_results (Unity.ResultSet result_set, Gee.ArrayList results)
{
foreach (var video in results)
{
if (video.uri.has_prefix ("http"))
{
var result_icon = video.icon;
if (video.category == CAT_INDEX_MORE && video.price != null && video.price != "")
{
var anno_icon = new Unity.AnnotatedIcon (new FileIcon (File.new_for_uri (result_icon)));
anno_icon.category = Unity.CategoryType.MOVIE;
anno_icon.ribbon = video.price;
result_icon = anno_icon.to_string ();
}
// aggregator scope remaps categories, so we won't get real category back;
// put real category into metadata
var realcat = new Variant.dict_entry (RESULT_PREVIEW_ON_LMB,
new Variant.variant (video.category == CAT_INDEX_MORE));
var details_uri = new Variant.dict_entry (RESULT_DETAILS_URI,
new Variant.variant (video.details_uri));
var metadata = new Variant.array (VariantType.VARDICT.element (), {realcat, details_uri});
var result = new Variant ("(ssuussss@a{sv})", video.uri,
result_icon, video.category,
ResultType.DEFAULT, "text/html",
video.title, video.comment,
video.uri, metadata);
result_set.add_result_from_variant (result);
}
}
}
private void zeitgeist_init () throws Error
{
zg_sources = new Zeitgeist.DataSourceRegistry ();
var templates = new PtrArray.sized(1);
var ev = new Zeitgeist.Event.full (Zeitgeist.ZG_ACCESS_EVENT, Zeitgeist.ZG_USER_ACTIVITY, "lens://unity-lens-video");
templates.add ((ev as GLib.Object).ref());
var data_source = new Zeitgeist.DataSource.full ("98898", "Unity Video Lens", "", templates);
zg_sources.register_data_source.begin (data_source, null);
}
private void zeitgeist_insert_event (string uri, string title, string icon)
{
if (!use_zeitgeist) return;
var subject = new Zeitgeist.Subject.full (uri, Zeitgeist.NFO_VIDEO, Zeitgeist.NFO_REMOTE_DATA_OBJECT, "", uri, title, icon);
var event = new Zeitgeist.Event.full (Zeitgeist.ZG_ACCESS_EVENT, Zeitgeist.ZG_USER_ACTIVITY, "lens://unity-lens-video");
event.add_subject (subject);
var ev_array = new PtrArray.sized(1);
ev_array.add ((event as GLib.Object).ref ());
Zeitgeist.Log.get_default ().insert_events_from_ptrarray.begin (ev_array, null);
}
}
}
unity-lens-video-0.3.15+16.04.20160212.1/src/utils.vala 0000644 0000156 0000165 00000004410 12657432760 022317 0 ustar pbuser pbgroup 0000000 0000000 /*
* 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
* based on python code by David Calle
*/
namespace Unity.Utils
{
public bool is_regular_file (string path)
{
var file = GLib.File.new_for_path (path);
if (file.query_exists (null))
return file.query_file_type (GLib.FileQueryInfoFlags.NONE, null) == GLib.FileType.REGULAR;
return false;
}
public bool is_video (string path) throws Error
{
var file = GLib.File.new_for_path (path);
if (file.query_exists (null))
{
if (file.query_file_type (GLib.FileQueryInfoFlags.NONE, null) == GLib.FileType.REGULAR)
{
var content_type = file.query_info ("standard::content-type", GLib.FileQueryInfoFlags.NONE, null).get_content_type ();
return content_type.contains ("video");
}
}
return false;
}
private bool is_hidden (string path) throws Error
{
var file = GLib.File.new_for_path (path);
return file.query_info (GLib.FileAttribute.STANDARD_IS_HIDDEN, GLib.FileQueryInfoFlags.NONE, null).get_is_hidden ();
}
public string get_name (string path) throws Error
{
var file = GLib.File.new_for_path (path);
var finfo = file.query_info (GLib.FileAttribute.STANDARD_DISPLAY_NAME, GLib.FileQueryInfoFlags.NONE, null);
return finfo.get_attribute_as_string (GLib.FileAttribute.STANDARD_DISPLAY_NAME);
}
public uint gcd (uint a, uint b)
requires (a > 0 && b > 0)
ensures (result > 0)
{
for (;;)
{
if (a > b)
{
a = a % b;
if (a == 0)
return b;
}
else
{
b = b % a;
if (b == 0)
return a;
}
}
}
} unity-lens-video-0.3.15+16.04.20160212.1/src/blacklist-tracker.vala 0000644 0000156 0000165 00000007341 12657432760 024566 0 ustar pbuser pbgroup 0000000 0000000 /*
* 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 Michal Hruby
*
*/
using Zeitgeist;
using Config;
using Gee;
namespace Unity.VideoLens
{
/* Libzeitgeist currently doesn't expose any blacklist API, so we need to
* use direct dbus calls */
[DBus (name = "org.gnome.zeitgeist.Blacklist")]
public interface Blacklist : Object
{
[DBus (signature = "a{s(asaasay)}")]
public abstract async Variant get_templates () throws Error;
public signal void template_added (string template_id,
[DBus (signature = "(asassay)")] Variant template);
public signal void template_removed (string template_id,
[DBus (signature = "(asassay)")] Variant template);
}
public class BlacklistTracker : Object
{
private HashTable event_templates;
private Blacklist blacklist_proxy;
private Set blacklisted_uris;
private bool cached_uris_dirty;
construct
{
event_templates = new HashTable (str_hash, str_equal);
blacklisted_uris = new HashSet ();
Bus.get_proxy (BusType.SESSION, "org.gnome.zeitgeist.Engine",
"/org/gnome/zeitgeist/blacklist", 0, null, (src, res) =>
{
try
{
blacklist_proxy = (src as DBusConnection).get_proxy.end (res);
fetch_blacklists ();
}
catch (GLib.Error err)
{
warning ("%s", err.message);
}
});
}
private async void fetch_blacklists ()
{
blacklist_proxy.template_added.connect (this.template_added);
blacklist_proxy.template_removed.connect (this.template_removed);
Variant all_templates = yield blacklist_proxy.get_templates ();
VariantIter iter = new VariantIter (all_templates);
string template_id;
Variant event_variant;
while (iter.next ("{s@(asaasay)}", out template_id, out event_variant))
{
Event e = new Event.from_variant (event_variant);
event_templates[template_id] = e;
}
cached_uris_dirty = true;
}
private void template_added (string id, Variant template)
{
Event e = new Event.from_variant (template);
event_templates[id] = e;
cached_uris_dirty = true;
}
private void template_removed (string id, Variant template)
{
event_templates.remove (id);
cached_uris_dirty = true;
}
private void update_uris ()
{
var iter = HashTableIter (event_templates);
unowned Event e;
while (iter.next (null, out e))
{
if (e.num_subjects () > 0)
{
unowned Subject s = e.get_subject (0);
unowned string uri = s.get_uri ();
if (uri == null || uri == "") continue;
if (uri.has_suffix ("*"))
{
blacklisted_uris.add (uri.substring (0, uri.length - 1));
}
}
}
}
public unowned Set get_blacklisted_uris ()
{
if (cached_uris_dirty)
{
blacklisted_uris.clear ();
update_uris ();
cached_uris_dirty = false;
}
return blacklisted_uris;
}
}
} /* namespace */
unity-lens-video-0.3.15+16.04.20160212.1/src/scope.vala 0000644 0000156 0000165 00000032237 12657432763 022303 0 ustar pbuser pbgroup 0000000 0000000 /*
* 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
* based on python code by David Calle
*
*/
using Config;
namespace Unity.VideoLens
{
public class VideoScope : Unity.DeprecatedScope
{
private static const int MAX_ZG_EVENTS = 24;
private static const int CAT_INDEX_MY_VIDEOS = 0;
private static const int CAT_INDEX_ONLINE = 1;
private static const int REFRESH_TIMEOUT = 30;
private static string cache_directory;
private string videos_folder;
private Unity.Extras.PreviewPlayer preview_player;
private Thumbnailer thumbnailer;
private Locate locate;
private BlacklistTracker blacklist_tracker;
private Variant empty_asv;
public VideoScope ()
{
Object (dbus_path: "/net/launchpad/scope/localvideos", id: "video-local.scope");
empty_asv = new Variant.array (VariantType.VARDICT.element (), {});
videos_folder = GLib.Environment.get_user_special_dir (GLib.UserDirectory.VIDEOS);
cache_directory = GLib.Environment.get_user_cache_dir () + "/unity-lens-video";
// create cache directory
try
{
var cache_dir = GLib.File.new_for_path (cache_directory);
if (! cache_dir.query_exists (null))
cache_dir.make_directory (null);
}
catch (Error e)
{
error ("Failed to create cache directory: %s", e.message);
}
blacklist_tracker = new BlacklistTracker ();
thumbnailer = new Thumbnailer (cache_directory);
locate = new Locate (cache_directory, videos_folder);
search_in_global = true;
search_hint = _("Search videos");
visible = true;
sources.add_option ("local", _("My videos"), null);
populate_categories ();
GLib.Timeout.add_seconds (REFRESH_TIMEOUT, refresh_results);
search_changed.connect ((search, search_type, cancellable) =>
{
dispatch_search (search, search_type, cancellable);
});
}
private void populate_categories ()
{
var categories = new Unity.CategorySet ();
var icon_dir = File.new_for_path (Config.ICON_PATH);
categories.add(new Unity.Category ("local", _("My videos"), new FileIcon (icon_dir.get_child ("group-videos.svg")), Unity.CategoryRenderer.VERTICAL_TILE));
categories.add(new Unity.Category ("online", _("Online"), new FileIcon (icon_dir.get_child ("group-internet.svg")), Unity.CategoryRenderer.VERTICAL_TILE));
this.categories = categories;
}
private bool refresh_results ()
{
debug ("Queuing new search because of timeout");
queue_search_changed (Unity.SearchType.DEFAULT);
return true;
}
private async void dispatch_search (DeprecatedScopeSearch search, SearchType search_type, GLib.Cancellable cancellable)
{
var search_string = search.search_string.strip ();
var search_status = search;
var model = search.results_model;
debug ("Search changed to '%s'", search_string);
if (source_activated ("local"))
{
if (search_type == Unity.SearchType.GLOBAL)
{
if (search_string == "")
{
model.clear ();
if (search != null)
search_status.finished ();
debug ("Global view without search string : hide");
}
else
{
update_results_model (search_string, model, "global", cancellable, search_status);
}
}
else
{
if (search_string == null || search_string == "")
{
try
{
zg_call (cancellable, search_status);
}
catch (GLib.Error e)
{
warning ("Failed to call zeitgeist: %s", e.message);
}
}
else
{
update_results_model (search_string, model, "lens", cancellable, search_status);
}
}
}
}
private void update_results_model (string search_string, Dee.Model model, string cat, GLib.Cancellable? cancellable, DeprecatedScopeSearch search, bool clear_model = true)
{
var home_folder = GLib.Environment.get_home_dir ();
if (videos_folder != home_folder)
{
locate.updatedb ();
}
var result_list = locate.run_locate (search_string, thumbnailer, video_filter);
if (result_list != null)
{
GLib.Idle.add (() =>
{
result_list.sort ((a, b) => { return a.lc_title.collate (b.lc_title); });
add_results (search, model, cat, cancellable, result_list, search_string, clear_model);
return false;
});
}
}
internal void add_results (DeprecatedScopeSearch search_status, Dee.Model model, string cat, GLib.Cancellable? cancellable, Gee.ArrayList result_list, string search, bool clear_model)
{
if (cancellable != null && !cancellable.is_cancelled ())
{
var results_model = search_status.results_model;
if (clear_model)
results_model.clear ();
foreach (var video in result_list)
{
results_model.append (video.uri, video.icon, video.category, ResultType.PERSONAL, "text/html", video.title, video.comment, video.uri, empty_asv);
}
if (search_status != null)
{
debug ("Search finished");
search_status.finished ();
}
}
}
private async void zg_call (GLib.Cancellable? cancellable, DeprecatedScopeSearch search_status) throws Error
{
bool active = sources.get_option ("local").active;
bool filtering = sources.filtering;
string uri = active && filtering ? "file:*" : "*";
var time_range = new Zeitgeist.TimeRange.to_now ();
var event_template = new Zeitgeist.Event ();
var subject = new Zeitgeist.Subject.full (uri, Zeitgeist.NFO_VIDEO, "", "", "", "", "");
event_template.add_subject (subject);
var templates = new PtrArray.sized (1);
templates.add ((event_template as GLib.Object).ref());
var results = yield Zeitgeist.Log.get_default ().find_events (time_range, templates, Zeitgeist.StorageState.ANY, MAX_ZG_EVENTS, Zeitgeist.ResultType.MOST_RECENT_SUBJECTS, cancellable);
process_zg_events (results, cancellable, search_status);
}
internal bool video_filter (string path)
{
try
{
if (Utils.is_video (path) && !Utils.is_hidden (path))
{
var file = File.new_for_path (path);
if (!is_blacklisted(file.get_uri ()))
return true;
}
}
catch (Error e)
{
warning ("Failed to get properties of '%s': %s", path, e.message);
}
return false;
}
internal void process_zg_events (Zeitgeist.ResultSet events, GLib.Cancellable cancellable, DeprecatedScopeSearch search_status)
{
var result_list = new Gee.ArrayList ();
foreach (var event in events)
{
if (cancellable.is_cancelled ())
return;
var event_uri = event.get_subject (0).get_uri ();
if (event_uri.has_prefix ("file://"))
{
try
{
// If the file is local, we use the same methods
// as other result items.
var file = GLib.File.new_for_uri (event_uri);
var path = file.get_path ();
if (video_filter (path))
{
var finfo = file.query_info (GLib.FileAttribute.STANDARD_DISPLAY_NAME, GLib.FileQueryInfoFlags.NONE, null);
VideoFile video = VideoFile ()
{
title = finfo.get_display_name (),
lc_title = finfo.get_display_name ().down (),
comment = "",
uri = event_uri,
icon = thumbnailer.get_icon (path),
category = CAT_INDEX_MY_VIDEOS
};
result_list.add (video);
}
}
catch (GLib.Error e)
{
warning ("Failed to access file '%s': %s", event_uri, e.message);
}
}
else if (event_uri.has_prefix ("http"))
{
// If the file is distant, we take
// all we need from Zeitgeist
// this one can be any unicode string:
VideoFile video = VideoFile ()
{
title = event.get_subject (0).get_text (),
comment = "",
uri = event_uri,
icon = event.get_subject (0).get_storage (),
category = CAT_INDEX_ONLINE
};
result_list.add (video);
}
}
var results_model = search_status.results_model;
results_model.clear ();
foreach (var video in result_list)
{
results_model.append (video.uri, video.icon, video.category, ResultType.PERSONAL, "text/html", video.title, video.comment, video.uri, empty_asv);
}
update_results_model ("", search_status.results_model, "lens", cancellable, search_status, false);
}
private Unity.ActivationResponse show_in_folder (string uri)
{
try
{
Unity.Extras.show_in_folder (uri);
return new Unity.ActivationResponse (Unity.HandledType.HIDE_DASH);
}
catch (GLib.Error e)
{
warning ("Failed to show in folder '%s': %s", uri, e.message);
}
return new Unity.ActivationResponse (Unity.HandledType.NOT_HANDLED);
}
public override async Preview? preview_result (ScopeResult result)
{
debug ("Preview uri: %s", result.uri);
Unity.MoviePreview preview = null;
string subtitle = "";
int64 file_size = 0;
bool local_video = result.uri.has_prefix ("file://");
if (local_video)
{
var file = GLib.File.new_for_uri (result.uri);
try
{
var finfo = file.query_info (GLib.FileAttribute.TIME_MODIFIED + "," + GLib.FileAttribute.STANDARD_SIZE, GLib.FileQueryInfoFlags.NONE, null);
file_size = finfo.get_size ();
var tval = finfo.get_modification_time ();
var dt = new DateTime.from_timeval_local (tval);
subtitle = dt.format ("%x, %X");
}
catch (Error e)
{
// empty subtitle
}
}
preview = new Unity.MoviePreview (result.title, subtitle, result.comment, null);
preview.set_rating (-1.0f, 0);
var play_video = new Unity.PreviewAction ("play", _("Play"), null);
preview.add_action (play_video);
preview.image_source_uri = result.icon_hint;
if (local_video)
{
var show_folder = new Unity.PreviewAction ("show-in-folder", _("Show in Folder"), null);
show_folder.activated.connect (show_in_folder);
preview.add_action (show_folder);
}
// we may get remote uris from zeitgeist - fetch details for local files only
if (local_video)
{
preview.image_source_uri = result.uri;
if (preview_player == null)
preview_player = new Unity.Extras.PreviewPlayer ();
try
{
var props = yield preview_player.video_properties (result.uri);
if ("width" in props && "height" in props && "codec" in props)
{
var width = props["width"].get_uint32 ();
var height = props["height"].get_uint32 ();
var codec = props["codec"].get_string ();
string dimensions = "%u*%u".printf (width, height);
if (width > 0 && height > 0)
{
var gcd = Utils.gcd (width, height);
dimensions += ", %u:%u".printf (width / gcd, height / gcd);
}
preview.add_info (new Unity.InfoHint ("format", _("Format"), null, codec));
preview.add_info (new Unity.InfoHint ("dimensions", _("Dimensions"), null, dimensions));
preview.add_info (new Unity.InfoHint ("size", _("Size"), null, GLib.format_size (file_size)));
}
}
catch (Error e)
{
warning ("Couldn't get video details: %s", e.message);
}
try
{
yield preview_player.close();
}
catch (Error e)
{
warning ("Failed to close preview player: %s", e.message);
}
}
return preview;
}
private bool is_blacklisted (string uri)
{
foreach (var blacklisted_uri in blacklist_tracker.get_blacklisted_uris ())
{
if (uri.has_prefix (blacklisted_uri))
return true;
}
return false;
}
private bool source_activated (string source)
{
// Return the state of a sources filter option
var active = sources.get_option (source).active;
var filtering = sources.filtering;
return (active && filtering) || (!active && !filtering);
}
}
}
unity-lens-video-0.3.15+16.04.20160212.1/README 0000644 0000156 0000165 00000000202 12657432760 020376 0 ustar pbuser pbgroup 0000000 0000000
#Install
sudo mkdir /usr/share/unity/lenses/video
sudo cp video.lens /usr/share/unity/lenses/video
#Run
./src/unity-lens-video
unity-lens-video-0.3.15+16.04.20160212.1/po/ 0000755 0000156 0000165 00000000000 12657433655 020146 5 ustar pbuser pbgroup 0000000 0000000 unity-lens-video-0.3.15+16.04.20160212.1/po/POTFILES.skip 0000644 0000156 0000165 00000000247 12657432760 022262 0 ustar pbuser pbgroup 0000000 0000000 src/daemon.c
src/scope.c
src/remote-scope.c
src/ubuntu-video-search.c
tests/unit/test-ubuntu-video-search.c
tests/unit/ubuntu-video-search.c
tests/unit/remote-scope.c
unity-lens-video-0.3.15+16.04.20160212.1/po/en_US.po 0000644 0000156 0000165 00000001725 12657432760 021520 0 ustar pbuser pbgroup 0000000 0000000 # English translations for PACKAGE package.
# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# David Callé , 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-02-06 11:27+0100\n"
"PO-Revision-Date: 2012-02-06 11:28+0100\n"
"Last-Translator: David Call \n"
"Language-Team: English\n"
"Language: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ASCII\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../src/unity-lens-video:65
msgid "On this computer"
msgstr "On this computer"
#: ../src/unity-lens-video:66
msgid "Online"
msgstr "Online"
#: ../src/unity-lens-video:67
msgid "Videos"
msgstr "Videos"
#: ../src/unity-lens-video:68
msgid "Search Videos"
msgstr "Search Videos"
#: ../src/unity-lens-video:69
msgid "Sources"
msgstr "Sources"
unity-lens-video-0.3.15+16.04.20160212.1/po/POTFILES.in 0000644 0000156 0000165 00000000413 12657432760 021715 0 ustar pbuser pbgroup 0000000 0000000 [encoding: UTF-8]
src/daemon.vala
src/main.vala
src/remote-scope.vala
src/remote-video-main.vala
src/scope.vala
src/ubuntu-video-search.vala
tests/unit/test-ubuntu-video-search.vala
[type: gettext/ini]data/local.scope.in.in
[type: gettext/ini]data/remote.scope.in.in
unity-lens-video-0.3.15+16.04.20160212.1/Makefile.am 0000644 0000156 0000165 00000000205 12657432760 021555 0 ustar pbuser pbgroup 0000000 0000000 SUBDIRS = src po tests/unit vapi data
DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall
include $(top_srcdir)/Makefile.am.coverage
unity-lens-video-0.3.15+16.04.20160212.1/COPYING 0000644 0000156 0000165 00000104513 12657432760 020563 0 ustar pbuser pbgroup 0000000 0000000 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-video-0.3.15+16.04.20160212.1/AUTHORS 0000644 0000156 0000165 00000000000 12657432760 020562 0 ustar pbuser pbgroup 0000000 0000000 unity-lens-video-0.3.15+16.04.20160212.1/m4/ 0000755 0000156 0000165 00000000000 12657433655 020050 5 ustar pbuser pbgroup 0000000 0000000 unity-lens-video-0.3.15+16.04.20160212.1/m4/gcov.m4 0000644 0000156 0000165 00000004705 12657432760 021252 0 ustar pbuser pbgroup 0000000 0000000 # 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"
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-video-0.3.15+16.04.20160212.1/MANIFEST.in 0000644 0000156 0000165 00000000257 12657432760 021266 0 ustar pbuser pbgroup 0000000 0000000 include unity-lens-video.service
include video.lens.in
include src/unity-lens-video
include unity-lens-video.desktop
include unity-lens-video.png
include po/*
include COPYING
unity-lens-video-0.3.15+16.04.20160212.1/acinclude.m4 0000644 0000156 0000165 00000001707 12657432760 021722 0 ustar pbuser pbgroup 0000000 0000000 dnl 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-video-0.3.15+16.04.20160212.1/data/ 0000755 0000156 0000165 00000000000 12657433655 020441 5 ustar pbuser pbgroup 0000000 0000000 unity-lens-video-0.3.15+16.04.20160212.1/data/unity-scope-video-remote.service.in 0000644 0000156 0000165 00000000144 12657432760 027277 0 ustar pbuser pbgroup 0000000 0000000 [D-BUS Service]
Name=net.launchpad.scope.RemoteVideos
Exec=@pkglibexecdir@/unity-scope-video-remote
unity-lens-video-0.3.15+16.04.20160212.1/data/local.scope.in.in 0000644 0000156 0000165 00000000716 12657432760 023600 0 ustar pbuser pbgroup 0000000 0000000 [Scope]
DBusName=net.launchpad.scope.LocalVideos
DBusPath=/net/launchpad/scope/localvideos
_Name=Videos
Type=video
Icon=@prefix@/share/unity/icons/lens-nav-video.svg
_Description=This is an Ubuntu search plugin that enables local videos to be searched and displayed in the Dash underneath the Video header. If you do not wish to search this content source, you can disable this search plugin.
Shortcut=v
[Desktop Entry]
X-Ubuntu-Gettext-Domain=unity-lens-video
unity-lens-video-0.3.15+16.04.20160212.1/data/Makefile.am 0000644 0000156 0000165 00000001212 12657432760 022465 0 ustar pbuser pbgroup 0000000 0000000 dbus_servicesdir = $(DBUSSERVICEDIR)
service_in_files = \
unity-scope-video-remote.service.in \
unity-scope-video-local.service.in \
$(NULL)
dbus_services_DATA = $(service_in_files:.service.in=.service)
%.service: %.service.in
$(AM_V_GEN)sed -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@
scope_in_files = local.scope.in remote.scope.in
scopedir = $(SCOPESDIR)/video
scope_DATA = $(scope_in_files:.scope.in=.scope)
@INTLTOOL_SCOPE_RULE@
EXTRA_DIST = \
$(service_in_files) \
$(scope_in_files) \
$(NULL)
CLEANFILES = \
unity-scope-video-remote.service \
unity-lens-video.service \
local.scope \
remote.scope \
$(NULL)
unity-lens-video-0.3.15+16.04.20160212.1/data/unity-scope-video-local.service.in 0000644 0000156 0000165 00000000142 12657432760 027074 0 ustar pbuser pbgroup 0000000 0000000 [D-BUS Service]
Name=net.launchpad.scope.LocalVideos
Exec=@pkglibexecdir@/unity-video-lens-daemon
unity-lens-video-0.3.15+16.04.20160212.1/data/unity-lens-video.png 0000644 0000156 0000165 00000007476 12657432760 024374 0 ustar pbuser pbgroup 0000000 0000000 PNG
IHDR 0 0 W tEXtSoftware Adobe ImageReadyqe<