Merge lp:~submarine/unity-scope-songsterr/general-misc-update into lp:unity-scope-songsterr
- general-misc-update
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Guillermo Gonzalez |
Approved revision: | 12 |
Merged at revision: | 8 |
Proposed branch: | lp:~submarine/unity-scope-songsterr/general-misc-update |
Merge into: | lp:unity-scope-songsterr |
Diff against target: |
316 lines (+96/-50) 9 files modified
data/songsterr.scope.in (+4/-4) data/unity-scope-songsterr.service (+1/-1) debian/changelog (+6/-2) debian/control (+9/-6) po/unity-scope-songsterr.pot (+25/-6) setup.cfg (+1/-1) setup.py (+1/-3) src/unity_songsterr_daemon.py (+48/-26) tests/data/mock_songsterr_pass (+1/-1) |
To merge this branch: | bzr merge lp:~submarine/unity-scope-songsterr/general-misc-update |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Guillermo Gonzalez | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
David Callé | Approve | ||
Review via email: mp+168617@code.launchpad.net |
Commit message
Install fixes, more metadata and simple previews
Description of the change
General update, since I noticed it was tested on the server:
- a few install fixes
- Use icon everywhere
- More metadata
- Preview draft
PS Jenkins bot (ps-jenkins) wrote : | # |
- 9. By Mark Tully
-
Updated dependencies in debian/control
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:9
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
David Callé (davidc3) : | # |
- 10. By David Callé
-
Bump again
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:10
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
David Callé (davidc3) wrote : | # |
Raring, heh.
- 11. By David Callé
-
Dummy commit
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:11
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 12. By David Callé
-
Bump changelog to use Saucy
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:12
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:12
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:12
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Guillermo Gonzalez (verterok) wrote : | # |
looks good
Preview Diff
1 | === modified file 'data/songsterr.scope.in' |
2 | --- data/songsterr.scope.in 2013-02-21 01:16:56 +0000 |
3 | +++ data/songsterr.scope.in 2013-07-02 08:52:27 +0000 |
4 | @@ -1,15 +1,15 @@ |
5 | [Scope] |
6 | DBusName=com.canonical.Unity.Scope.Music.Songsterr |
7 | DBusPath=/com/canonical/unity/scope/music/songsterr |
8 | -Icon= |
9 | +Icon=/usr/share/icons/unity-icon-theme/places/svg/service-songsterr.svg |
10 | _Keywords=songsterr; |
11 | RequiredMetadata= |
12 | -OptionalMetadata= |
13 | -Loader=/usr/lib/ubuntu-scopes/songsterr/unity_songsterr_daemon.py |
14 | +OptionalMetadata=artist[s];tabs[s]; |
15 | +Loader=/usr/share/unity-scopes/songsterr/unity_songsterr_daemon.py |
16 | RemoteContent=true |
17 | Type=music |
18 | _Name=Songsterr |
19 | -_Description=Find Songsterr items |
20 | +_Description=This is an Ubuntu search plugin that enables tabs from Songsterr to be searched and displayed in the Dash underneath the Music header. If you do not wish to search this content source, you can disable this search plugin. |
21 | _SearchHint=Search Songsterr |
22 | |
23 | [Desktop Entry] |
24 | |
25 | === modified file 'data/unity-scope-songsterr.service' |
26 | --- data/unity-scope-songsterr.service 2013-02-05 00:44:46 +0000 |
27 | +++ data/unity-scope-songsterr.service 2013-07-02 08:52:27 +0000 |
28 | @@ -1,3 +1,3 @@ |
29 | [D-BUS Service] |
30 | Name=com.canonical.Unity.Scope.Music.Songsterr |
31 | -Exec=/usr/lib/ubuntu-scopes/songsterr/unity_songsterr_daemon.py |
32 | +Exec=/usr/bin/python3 /usr/share/unity-scopes/scope-runner-dbus.py /usr/share/unity-scopes/songsterr/unity_songsterr_daemon.py |
33 | |
34 | === modified file 'debian/changelog' |
35 | --- debian/changelog 2013-02-13 21:30:36 +0000 |
36 | +++ debian/changelog 2013-07-02 08:52:27 +0000 |
37 | @@ -1,5 +1,9 @@ |
38 | -unity-scope-songsterr (0.1) UNRELEASED; urgency=low |
39 | +unity-scope-songsterr (0.1) saucy; urgency=low |
40 | |
41 | + [ Mark Tully ] |
42 | * Initial release |
43 | + |
44 | + [ David Callé ] |
45 | + * Misc integration fixes and cleaning |
46 | |
47 | - -- Mark Tully <markjtully@gmail.com> Wed, 13 Feb 2013 21:26:48 +0000 |
48 | + -- David Callé <david@aristote> Tue, 02 Jul 2013 10:49:20 +0200 |
49 | |
50 | === modified file 'debian/control' |
51 | --- debian/control 2013-02-13 21:30:36 +0000 |
52 | +++ debian/control 2013-07-02 08:52:27 +0000 |
53 | @@ -5,21 +5,24 @@ |
54 | Build-Depends: debhelper (>= 9), |
55 | python3, |
56 | python3-distutils-extra, |
57 | + python3-gi, |
58 | pkg-config, |
59 | python3-nose, |
60 | - gir1.2-unity-5.0 (>= 6.8), |
61 | - gir1.2-dee-1.0, |
62 | + gir1.2-unity-5.0 (>= 7), |
63 | + gir1.2-dee-1.0 (>= 1.2.5), |
64 | gir1.2-glib-2.0, |
65 | -Standards-Version: 3.9.3 |
66 | -Homepage: https://launchpad.net/ubuntu-scopes |
67 | +Standards-Version: 3.9.4 |
68 | +Homepage: https://launchpad.net/unity-scope-songsterr |
69 | |
70 | Package: unity-scope-songsterr |
71 | Architecture: all |
72 | Depends: ${misc:Depends}, |
73 | ${python3:Depends}, |
74 | python3, |
75 | - gir1.2-unity-5.0 (>= 6.8), |
76 | - gir1.2-dee-1.0, |
77 | + python3-gi, |
78 | + gir1.2-unity-5.0 (>= 7), |
79 | + gir1.2-dee-1.0 (>= 1.2.5), |
80 | + unity-scopes-runner, |
81 | gir1.2-glib-2.0 |
82 | Description: songsterr scope for Unity |
83 | A Dash search plugin for songsterr. |
84 | |
85 | === modified file 'debian/rules' (properties changed: -x to +x) |
86 | === modified file 'po/unity-scope-songsterr.pot' |
87 | --- po/unity-scope-songsterr.pot 2013-02-21 00:57:26 +0000 |
88 | +++ po/unity-scope-songsterr.pot 2013-07-02 08:52:27 +0000 |
89 | @@ -8,7 +8,7 @@ |
90 | msgstr "" |
91 | "Project-Id-Version: PACKAGE VERSION\n" |
92 | "Report-Msgid-Bugs-To: \n" |
93 | -"POT-Creation-Date: 2013-02-21 01:57+0100\n" |
94 | +"POT-Creation-Date: 2013-07-01 17:25+0200\n" |
95 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
96 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
97 | "Language-Team: LANGUAGE <LL@li.org>\n" |
98 | @@ -17,22 +17,38 @@ |
99 | "Content-Type: text/plain; charset=CHARSET\n" |
100 | "Content-Transfer-Encoding: 8bit\n" |
101 | |
102 | -#: ../src/unity_songsterr_daemon.py:32 ../data/songsterr.scope.in.h:4 |
103 | +#: ../src/unity_songsterr_daemon.py:33 ../data/songsterr.scope.in.h:4 |
104 | msgid "Search Songsterr" |
105 | msgstr "" |
106 | |
107 | -#: ../src/unity_songsterr_daemon.py:33 |
108 | +#: ../src/unity_songsterr_daemon.py:34 |
109 | msgid "Sorry, there are no Songsterr results that match your search." |
110 | msgstr "" |
111 | |
112 | -#: ../src/unity_songsterr_daemon.py:34 |
113 | +#: ../src/unity_songsterr_daemon.py:35 |
114 | msgid "Powered by Songsterr" |
115 | msgstr "" |
116 | |
117 | -#: ../src/unity_songsterr_daemon.py:44 |
118 | +#: ../src/unity_songsterr_daemon.py:45 ../src/unity_songsterr_daemon.py:100 |
119 | msgid "Tabs" |
120 | msgstr "" |
121 | |
122 | +#: ../src/unity_songsterr_daemon.py:94 |
123 | +msgid "Guitar" |
124 | +msgstr "" |
125 | + |
126 | +#: ../src/unity_songsterr_daemon.py:94 |
127 | +msgid "Chords" |
128 | +msgstr "" |
129 | + |
130 | +#: ../src/unity_songsterr_daemon.py:94 |
131 | +msgid "Bass" |
132 | +msgstr "" |
133 | + |
134 | +#: ../src/unity_songsterr_daemon.py:102 |
135 | +msgid "View" |
136 | +msgstr "" |
137 | + |
138 | #: ../data/songsterr.scope.in.h:1 |
139 | msgid "songsterr;" |
140 | msgstr "" |
141 | @@ -42,5 +58,8 @@ |
142 | msgstr "" |
143 | |
144 | #: ../data/songsterr.scope.in.h:3 |
145 | -msgid "Find Songsterr items" |
146 | +msgid "" |
147 | +"This is an Ubuntu search plugin that enables tabs from Songsterr to be " |
148 | +"searched and displayed in the Dash underneath the Music header. If you do " |
149 | +"not wish to search this content source, you can disable this search plugin." |
150 | msgstr "" |
151 | |
152 | === modified file 'setup.cfg' |
153 | --- setup.cfg 2013-02-13 21:30:36 +0000 |
154 | +++ setup.cfg 2013-07-02 08:52:27 +0000 |
155 | @@ -3,4 +3,4 @@ |
156 | |
157 | [build_i18n] |
158 | domain=unity-scope-songsterr |
159 | -desktop_files=[('share/unity/scopes', ('data/songsterr.scope.in',))] |
160 | +desktop_files=[('share/unity/scopes/music', ('data/songsterr.scope.in',))] |
161 | |
162 | === modified file 'setup.py' |
163 | --- setup.py 2013-02-13 21:30:36 +0000 |
164 | +++ setup.py 2013-07-02 08:52:27 +0000 |
165 | @@ -16,8 +16,6 @@ |
166 | url='http://launchpad.net/ubuntu-scopes', |
167 | license='GNU General Public License (GPL)', |
168 | data_files=[('share/dbus-1/services', ['data/unity-scope-songsterr.service']), |
169 | - ('share/icons/unity-icon-theme/places/svg', ['data/icons/service-songsterr.svg']), |
170 | - ('lib/ubuntu-scopes/songsterr', ['src/unity_songsterr_daemon.py']), |
171 | - ('lib/ubuntu-scopes/songsterr', ['src/__init__.py']), ], |
172 | + ('share/unity-scopes/songsterr', ['src/unity_songsterr_daemon.py']), ], |
173 | cmdclass={'build': build_extra.build_extra, |
174 | 'build_i18n': build_i18n.build_i18n, }) |
175 | |
176 | === modified file 'src/unity_songsterr_daemon.py' |
177 | --- src/unity_songsterr_daemon.py 2013-02-13 21:25:57 +0000 |
178 | +++ src/unity_songsterr_daemon.py 2013-07-02 08:52:27 +0000 |
179 | @@ -19,6 +19,7 @@ |
180 | import gettext |
181 | import json |
182 | import urllib.request |
183 | +import urllib.parse |
184 | |
185 | APP_NAME = 'unity-scope-songsterr' |
186 | LOCAL_PATH = '/usr/share/locale/' |
187 | @@ -34,13 +35,13 @@ |
188 | PROVIDER_CREDITS = _('Powered by Songsterr') |
189 | SVG_DIR = '/usr/share/icons/unity-icon-theme/places/svg/' |
190 | PROVIDER_ICON = SVG_DIR + 'service-songsterr.svg' |
191 | -DEFAULT_RESULT_ICON = SVG_DIR + 'result-info.svg' |
192 | +DEFAULT_RESULT_ICON = SVG_DIR + 'service-songsterr.svg' |
193 | DEFAULT_RESULT_MIMETYPE = 'text/html' |
194 | DEFAULT_RESULT_TYPE = Unity.ResultType.DEFAULT |
195 | |
196 | SEARCH_URI = 'http://www.songsterr.com/a/ra/songs.json?pattern=%s' |
197 | |
198 | -c1 = {'id': 'tabs', |
199 | +c1 = {'id': 'songs', |
200 | 'name': _('Tabs'), |
201 | 'icon': SVG_DIR + 'group-installed.svg', |
202 | 'renderer': Unity.CategoryRenderer.VERTICAL_TILE} |
203 | @@ -48,32 +49,60 @@ |
204 | |
205 | FILTERS = [] |
206 | |
207 | -EXTRA_METADATA = [] |
208 | +m1 = {'id' :'artist', |
209 | + 'type' :'s', |
210 | + 'field':Unity.SchemaFieldType.OPTIONAL} |
211 | +m2 = {'id' :'tabs', |
212 | + 'type' :'s', |
213 | + 'field':Unity.SchemaFieldType.OPTIONAL} |
214 | +EXTRA_METADATA = [m1, m2] |
215 | |
216 | |
217 | def search(search, filters): |
218 | ''' |
219 | - Search the server for questions and use stackexchange's api for tags |
220 | + Query the songsterr API |
221 | ''' |
222 | results = [] |
223 | - |
224 | + if not search or len(search) < 3: |
225 | + return results |
226 | + search = urllib.parse.quote(search) |
227 | uri = SEARCH_URI % search |
228 | + print(uri) |
229 | try: |
230 | response = urllib.request.urlopen(uri).read() |
231 | - response = response.decode('utf8') |
232 | - json_response = json.loads(response) |
233 | - result = json_response |
234 | + result = json.loads(response.decode('utf8')) |
235 | except: |
236 | result = {} |
237 | if result: |
238 | for item in result: |
239 | + if len(results) > 24: |
240 | + break |
241 | results.append({'uri': 'http://www.songsterr.com/a/wa/song?id=%s' % item['id'], |
242 | - 'icon_hint': '', |
243 | - 'category': 0, |
244 | 'title': item['title'], |
245 | - 'comment': item['artist']['name']}) |
246 | + 'artist': item['artist']['name'], |
247 | + 'tabs': ";".join(item['tabTypes'])}) |
248 | return results |
249 | - |
250 | + |
251 | + |
252 | +class Preview (Unity.ResultPreviewer): |
253 | + |
254 | + def do_run(self): |
255 | + icon = Gio.FileIcon.new(Gio.file_new_for_uri(self.result.icon_hint)) |
256 | + preview = Unity.GenericPreview.new(self.result.title, '', icon) |
257 | + preview.props.subtitle = self.result.metadata['artist'].get_string() |
258 | + tabs = self.result.metadata['tabs'].get_string().split(';') |
259 | + tab_types = {"PLAYER":None,"TEXT_GUITAR_TAB":_("Guitar"),"CHORDS":_("Chords"),"TEXT_BASS_TAB":_("Bass")} |
260 | + tab_list = [] |
261 | + for t in tabs: |
262 | + if tab_types[t]: |
263 | + tab_list.append(tab_types[t]) |
264 | + if len(tab_list) > 0: |
265 | + preview.add_info(Unity.InfoHint.new("tabs", _("Tabs"), None, ', '.join(tab_list))) |
266 | + icon = Gio.FileIcon.new (Gio.file_new_for_path(PROVIDER_ICON)) |
267 | + view_action = Unity.PreviewAction.new("open", _("View"), icon) |
268 | + preview.add_action(view_action) |
269 | + return preview |
270 | + |
271 | |
272 | # Classes below this point establish communication |
273 | # with Unity, you probably shouldn't modify them. |
274 | @@ -108,21 +137,9 @@ |
275 | i['comment'] = '' |
276 | if not 'dnd_uri' in i or not i['dnd_uri'] or i['dnd_uri'] == '': |
277 | i['dnd_uri'] = i['uri'] |
278 | - i['metadata'] = {} |
279 | - if EXTRA_METADATA: |
280 | - for e in i: |
281 | - for m in EXTRA_METADATA: |
282 | - if m['id'] == e: |
283 | - i['metadata'][e] = i[e] |
284 | - i['metadata']['provider_credits'] = GLib.Variant('s', PROVIDER_CREDITS) |
285 | - result = Unity.ScopeResult.create(str(i['uri']), str(i['icon']), |
286 | - i['category'], i['result_type'], |
287 | - str(i['mimetype']), str(i['title']), |
288 | - str(i['comment']), str(i['dnd_uri']), |
289 | - i['metadata']) |
290 | - result_set.add_result(result) |
291 | + result_set.add_result(**i) |
292 | except Exception as error: |
293 | - print(error) |
294 | + print (error) |
295 | |
296 | |
297 | class Scope(Unity.AbstractScope): |
298 | @@ -176,6 +193,11 @@ |
299 | se = MySearch(search_context) |
300 | return se |
301 | |
302 | + def do_create_previewer(self, result, metadata): |
303 | + rp = Preview() |
304 | + rp.set_scope_result(result) |
305 | + rp.set_search_metadata(metadata) |
306 | + return rp |
307 | |
308 | def load_scope(): |
309 | return Scope() |
310 | |
311 | === modified file 'tests/data/mock_songsterr_pass' |
312 | --- tests/data/mock_songsterr_pass 2013-02-13 21:23:53 +0000 |
313 | +++ tests/data/mock_songsterr_pass 2013-07-02 08:52:27 +0000 |
314 | @@ -1,1 +1,1 @@ |
315 | -[{"id":477,"type":"Song","title":"Tears Of The Dragon","artist":{"id":208,"type":"Artist","nameWithoutThePrefix":"Bruce Dickinson","useThePrefix":false,"name":"Bruce Dickinson"},"chordsPresent":true},{"id":6080,"type":"Song","title":"Navigate The Seas Of The Sun","artist":{"id":208,"type":"Artist","nameWithoutThePrefix":"Bruce Dickinson","useThePrefix":false,"name":"Bruce Dickinson"},"chordsPresent":true}] |
316 | +[{"id":477,"type":"Song","title":"Tears Of The Dragon","artist":{"id":208,"type":"Artist","nameWithoutThePrefix":"Bruce Dickinson","useThePrefix":false,"name":"Bruce Dickinson"},"chordsPresent":true,"tabTypes":["PLAYER","TEXT_GUITAR_TAB","CHORDS"]},{"id":6080,"type":"Song","title":"Navigate The Seas Of The Sun","artist":{"id":208,"type":"Artist","nameWithoutThePrefix":"Bruce Dickinson","useThePrefix":false,"name":"Bruce Dickinson"},"chordsPresent":true,"tabTypes":["PLAYER","TEXT_GUITAR_TAB","CHORDS"]}] |
FAILED: Continuous integration, rev:8 jenkins. qa.ubuntu. com/job/ unity-scope- songsterr- ci/1/ jenkins. qa.ubuntu. com/job/ unity-scope- songsterr- raring- amd64-ci/ 1/console jenkins. qa.ubuntu. com/job/ unity-scope- songsterr- raring- armhf-ci/ 1/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ unity-scope- songsterr- ci/1/rebuild
http://