Merge lp:~davidc3/unity-lens-video/stop-looking-for-recommendations-when-no-remote into lp:unity-lens-video/remote-videos-scope-trunk

Proposed by David Callé on 2012-10-11
Status: Merged
Approved by: David Callé on 2012-10-12
Approved revision: 57
Merged at revision: 56
Proposed branch: lp:~davidc3/unity-lens-video/stop-looking-for-recommendations-when-no-remote
Merge into: lp:unity-lens-video/remote-videos-scope-trunk
Diff against target: 31 lines (+5/-1)
1 file modified
src/unity-scope-video-remote (+5/-1)
To merge this branch: bzr merge lp:~davidc3/unity-lens-video/stop-looking-for-recommendations-when-no-remote
Reviewer Review Type Date Requested Status
John Lenton Approve on 2012-10-11
Unity Videos lens 2012-10-11 Pending
Review via email: mp+129309@code.launchpad.net

Commit Message

Disable initial recommendations and sources requests when remote calls are not allowed.

Description of the Change

Don't call for new recommendations if remote content search is disabled in Privacy settings. Results were not fetched but the initial call was still there.

To post a comment you must log in.
Alan Pope 🍺🐧🐱 🦄 (popey) wrote :

Tested & works. No traffic with the privacy option set.

John Lenton (chipaca) :
review: Approve
Unity Merger (unity-merger) wrote :

No commit message specified.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/unity-scope-video-remote'
2--- src/unity-scope-video-remote 2012-09-28 12:57:58 +0000
3+++ src/unity-scope-video-remote 2012-10-11 21:29:20 +0000
4@@ -91,9 +91,9 @@
5 self.session = Soup.SessionAsync()
6 self.session.props.user_agent = "Unity Video Lens Remote Scope v0.4"
7 self.session.add_feature_by_type(SoupGNOME.ProxyResolverGNOME)
8+ self.preferences = Unity.PreferencesManager.get_default()
9 self.query_list_of_sources()
10 self.update_recommendations()
11- self.preferences = Unity.PreferencesManager.get_default()
12 self.preferences.connect("notify::remote-content-search", self.on_filtering_or_preference_changed)
13 self.scope.export()
14 # refresh the at least once every 30 minutes
15@@ -105,6 +105,8 @@
16 In v0 extended, that means simply do an empty search with Amazon
17 as the source since it's the only paid provider at the moment.
18 """
19+ if self.preferences.props.remote_content_search != Unity.PreferencesManagerRemoteContent.ALL:
20+ return
21 msg = Soup.Message.new("GET", SERVER + "/search?q=&sources=Amazon")
22 self.session.queue_message(msg, self._recs_cb, None)
23
24@@ -121,6 +123,8 @@
25 def query_list_of_sources(self):
26 """Query the server for a list of sources that will be used
27 to build sources filter options and search queries."""
28+ if self.preferences.props.remote_content_search != Unity.PreferencesManagerRemoteContent.ALL:
29+ return
30 msg = Soup.Message.new("GET", SERVER + "/sources")
31 self.session.queue_message(msg, self._sources_cb, None)
32

Subscribers

People subscribed via source and target branches

to all changes: