Merge lp:~liuxingcs/test-music-scope/test-music-scope into lp:test-music-scope/1.0

Proposed by liuxing
Status: Merged
Merged at revision: 144657
Proposed branch: lp:~liuxingcs/test-music-scope/test-music-scope
Merge into: lp:test-music-scope/1.0
Diff against target: 3155 lines (+2948/-0) (has conflicts)
36 files modified
.bzr-builddeb/default.conf (+2/-0)
AUTHORS (+4/-0)
COPYING (+676/-0)
MAINTAINERS (+2/-0)
Makefile.am (+45/-0)
NEWS (+2/-0)
TESTS-TODO.txt (+7/-0)
acinclude.m4 (+40/-0)
autogen.sh (+13/-0)
configure.ac (+155/-0)
data/Makefile.am (+19/-0)
data/musicbaidu-scope.service.in (+3/-0)
debian/changelog (+21/-0)
debian/compat (+1/-0)
debian/control (+29/-0)
debian/copyright (+36/-0)
debian/rules (+16/-0)
musicbaidu.scope (+4/-0)
po/LINGUAS (+1/-0)
po/Makefile.in.in (+222/-0)
po/POTFILES.in (+6/-0)
po/POTFILES.skip (+2/-0)
po/zh_CN.po (+26/-0)
src/Makefile.am (+83/-0)
src/album.vala (+32/-0)
src/config.vala.in (+16/-0)
src/filter-parser-decade.vala (+38/-0)
src/filter-parser-genre.vala (+54/-0)
src/filter-parser.vala (+36/-0)
src/genre.vala (+169/-0)
src/musicbaidu-daemon.vala (+274/-0)
src/musicbaidu-search.vala (+607/-0)
src/simple-scope.vala (+137/-0)
src/tdb.deps (+1/-0)
src/tdb.vapi (+125/-0)
src/track.vala (+44/-0)
Conflict adding file AUTHORS.  Moved existing file to AUTHORS.moved.
Conflict adding file COPYING.  Moved existing file to COPYING.moved.
Conflict adding file ChangeLog.  Moved existing file to ChangeLog.moved.
Conflict adding file MAINTAINERS.  Moved existing file to MAINTAINERS.moved.
Conflict adding file Makefile.am.  Moved existing file to Makefile.am.moved.
Conflict adding file NEWS.  Moved existing file to NEWS.moved.
Conflict adding file README.  Moved existing file to README.moved.
Conflict adding file TESTS-TODO.txt.  Moved existing file to TESTS-TODO.txt.moved.
Conflict adding file acinclude.m4.  Moved existing file to acinclude.m4.moved.
Conflict adding file autogen.sh.  Moved existing file to autogen.sh.moved.
Conflict adding file configure.ac.  Moved existing file to configure.ac.moved.
Conflict adding file data.  Moved existing file to data.moved.
Conflict adding file debian.  Moved existing file to debian.moved.
Conflict adding file musicbaidu.scope.  Moved existing file to musicbaidu.scope.moved.
Conflict adding file po.  Moved existing file to po.moved.
Conflict adding file src.  Moved existing file to src.moved.
To merge this branch: bzr merge lp:~liuxingcs/test-music-scope/test-music-scope
Reviewer Review Type Date Requested Status
liuxing Approve
Review via email: mp+144657@code.launchpad.net

Description of the change

 Fix Another instance of the UbuntuOne Music Daemon
 already appears to be running. (LP:1103019)
 Updated file MAINTAINERS
 Updated file AUTHORS
 Updated file autogen.sh
 Updated file configure.ac

To post a comment you must log in.
Revision history for this message
liuxing (liuxingcs) wrote :

ok

review: Approve
Revision history for this message
liuxing (liuxingcs) :
review: Needs Fixing
Revision history for this message
liuxing (liuxingcs) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory '.bzr-builddeb'
=== added file '.bzr-builddeb/default.conf'
--- .bzr-builddeb/default.conf 1970-01-01 00:00:00 +0000
+++ .bzr-builddeb/default.conf 2013-01-24 09:32:23 +0000
@@ -0,0 +1,2 @@
1[BUILDDEB]
2split = True
03
=== added file 'AUTHORS'
--- AUTHORS 1970-01-01 00:00:00 +0000
+++ AUTHORS 2013-01-24 09:32:23 +0000
@@ -0,0 +1,4 @@
1Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com>
2Alex Launi <alex.launi@canonical.com>
3Weihua Zhang <fly2high@126.com>
4LiuXing <liuxingcs@yeah.net>
05
=== renamed file 'AUTHORS' => 'AUTHORS.moved'
=== added file 'COPYING'
--- COPYING 1970-01-01 00:00:00 +0000
+++ COPYING 2013-01-24 09:32:23 +0000
@@ -0,0 +1,676 @@
1
2 GNU GENERAL PUBLIC LICENSE
3 Version 3, 29 June 2007
4
5 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
8
9 Preamble
10
11 The GNU General Public License is a free, copyleft license for
12software and other kinds of works.
13
14 The licenses for most software and other practical works are designed
15to take away your freedom to share and change the works. By contrast,
16the GNU General Public License is intended to guarantee your freedom to
17share and change all versions of a program--to make sure it remains free
18software for all its users. We, the Free Software Foundation, use the
19GNU General Public License for most of our software; it applies also to
20any other work released this way by its authors. You can apply it to
21your programs, too.
22
23 When we speak of free software, we are referring to freedom, not
24price. Our General Public Licenses are designed to make sure that you
25have the freedom to distribute copies of free software (and charge for
26them if you wish), that you receive source code or can get it if you
27want it, that you can change the software or use pieces of it in new
28free programs, and that you know you can do these things.
29
30 To protect your rights, we need to prevent others from denying you
31these rights or asking you to surrender the rights. Therefore, you have
32certain responsibilities if you distribute copies of the software, or if
33you modify it: responsibilities to respect the freedom of others.
34
35 For example, if you distribute copies of such a program, whether
36gratis or for a fee, you must pass on to the recipients the same
37freedoms that you received. You must make sure that they, too, receive
38or can get the source code. And you must show them these terms so they
39know their rights.
40
41 Developers that use the GNU GPL protect your rights with two steps:
42(1) assert copyright on the software, and (2) offer you this License
43giving you legal permission to copy, distribute and/or modify it.
44
45 For the developers' and authors' protection, the GPL clearly explains
46that there is no warranty for this free software. For both users' and
47authors' sake, the GPL requires that modified versions be marked as
48changed, so that their problems will not be attributed erroneously to
49authors of previous versions.
50
51 Some devices are designed to deny users access to install or run
52modified versions of the software inside them, although the manufacturer
53can do so. This is fundamentally incompatible with the aim of
54protecting users' freedom to change the software. The systematic
55pattern of such abuse occurs in the area of products for individuals to
56use, which is precisely where it is most unacceptable. Therefore, we
57have designed this version of the GPL to prohibit the practice for those
58products. If such problems arise substantially in other domains, we
59stand ready to extend this provision to those domains in future versions
60of the GPL, as needed to protect the freedom of users.
61
62 Finally, every program is threatened constantly by software patents.
63States should not allow patents to restrict development and use of
64software on general-purpose computers, but in those that do, we wish to
65avoid the special danger that patents applied to a free program could
66make it effectively proprietary. To prevent this, the GPL assures that
67patents cannot be used to render the program non-free.
68
69 The precise terms and conditions for copying, distribution and
70modification follow.
71
72 TERMS AND CONDITIONS
73
74 0. Definitions.
75
76 "This License" refers to version 3 of the GNU General Public License.
77
78 "Copyright" also means copyright-like laws that apply to other kinds of
79works, such as semiconductor masks.
80
81 "The Program" refers to any copyrightable work licensed under this
82License. Each licensee is addressed as "you". "Licensees" and
83"recipients" may be individuals or organizations.
84
85 To "modify" a work means to copy from or adapt all or part of the work
86in a fashion requiring copyright permission, other than the making of an
87exact copy. The resulting work is called a "modified version" of the
88earlier work or a work "based on" the earlier work.
89
90 A "covered work" means either the unmodified Program or a work based
91on the Program.
92
93 To "propagate" a work means to do anything with it that, without
94permission, would make you directly or secondarily liable for
95infringement under applicable copyright law, except executing it on a
96computer or modifying a private copy. Propagation includes copying,
97distribution (with or without modification), making available to the
98public, and in some countries other activities as well.
99
100 To "convey" a work means any kind of propagation that enables other
101parties to make or receive copies. Mere interaction with a user through
102a computer network, with no transfer of a copy, is not conveying.
103
104 An interactive user interface displays "Appropriate Legal Notices"
105to the extent that it includes a convenient and prominently visible
106feature that (1) displays an appropriate copyright notice, and (2)
107tells the user that there is no warranty for the work (except to the
108extent that warranties are provided), that licensees may convey the
109work under this License, and how to view a copy of this License. If
110the interface presents a list of user commands or options, such as a
111menu, a prominent item in the list meets this criterion.
112
113 1. Source Code.
114
115 The "source code" for a work means the preferred form of the work
116for making modifications to it. "Object code" means any non-source
117form of a work.
118
119 A "Standard Interface" means an interface that either is an official
120standard defined by a recognized standards body, or, in the case of
121interfaces specified for a particular programming language, one that
122is widely used among developers working in that language.
123
124 The "System Libraries" of an executable work include anything, other
125than the work as a whole, that (a) is included in the normal form of
126packaging a Major Component, but which is not part of that Major
127Component, and (b) serves only to enable use of the work with that
128Major Component, or to implement a Standard Interface for which an
129implementation is available to the public in source code form. A
130"Major Component", in this context, means a major essential component
131(kernel, window system, and so on) of the specific operating system
132(if any) on which the executable work runs, or a compiler used to
133produce the work, or an object code interpreter used to run it.
134
135 The "Corresponding Source" for a work in object code form means all
136the source code needed to generate, install, and (for an executable
137work) run the object code and to modify the work, including scripts to
138control those activities. However, it does not include the work's
139System Libraries, or general-purpose tools or generally available free
140programs which are used unmodified in performing those activities but
141which are not part of the work. For example, Corresponding Source
142includes interface definition files associated with source files for
143the work, and the source code for shared libraries and dynamically
144linked subprograms that the work is specifically designed to require,
145such as by intimate data communication or control flow between those
146subprograms and other parts of the work.
147
148 The Corresponding Source need not include anything that users
149can regenerate automatically from other parts of the Corresponding
150Source.
151
152 The Corresponding Source for a work in source code form is that
153same work.
154
155 2. Basic Permissions.
156
157 All rights granted under this License are granted for the term of
158copyright on the Program, and are irrevocable provided the stated
159conditions are met. This License explicitly affirms your unlimited
160permission to run the unmodified Program. The output from running a
161covered work is covered by this License only if the output, given its
162content, constitutes a covered work. This License acknowledges your
163rights of fair use or other equivalent, as provided by copyright law.
164
165 You may make, run and propagate covered works that you do not
166convey, without conditions so long as your license otherwise remains
167in force. You may convey covered works to others for the sole purpose
168of having them make modifications exclusively for you, or provide you
169with facilities for running those works, provided that you comply with
170the terms of this License in conveying all material for which you do
171not control copyright. Those thus making or running the covered works
172for you must do so exclusively on your behalf, under your direction
173and control, on terms that prohibit them from making any copies of
174your copyrighted material outside their relationship with you.
175
176 Conveying under any other circumstances is permitted solely under
177the conditions stated below. Sublicensing is not allowed; section 10
178makes it unnecessary.
179
180 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
181
182 No covered work shall be deemed part of an effective technological
183measure under any applicable law fulfilling obligations under article
18411 of the WIPO copyright treaty adopted on 20 December 1996, or
185similar laws prohibiting or restricting circumvention of such
186measures.
187
188 When you convey a covered work, you waive any legal power to forbid
189circumvention of technological measures to the extent such circumvention
190is effected by exercising rights under this License with respect to
191the covered work, and you disclaim any intention to limit operation or
192modification of the work as a means of enforcing, against the work's
193users, your or third parties' legal rights to forbid circumvention of
194technological measures.
195
196 4. Conveying Verbatim Copies.
197
198 You may convey verbatim copies of the Program's source code as you
199receive it, in any medium, provided that you conspicuously and
200appropriately publish on each copy an appropriate copyright notice;
201keep intact all notices stating that this License and any
202non-permissive terms added in accord with section 7 apply to the code;
203keep intact all notices of the absence of any warranty; and give all
204recipients a copy of this License along with the Program.
205
206 You may charge any price or no price for each copy that you convey,
207and you may offer support or warranty protection for a fee.
208
209 5. Conveying Modified Source Versions.
210
211 You may convey a work based on the Program, or the modifications to
212produce it from the Program, in the form of source code under the
213terms of section 4, provided that you also meet all of these conditions:
214
215 a) The work must carry prominent notices stating that you modified
216 it, and giving a relevant date.
217
218 b) The work must carry prominent notices stating that it is
219 released under this License and any conditions added under section
220 7. This requirement modifies the requirement in section 4 to
221 "keep intact all notices".
222
223 c) You must license the entire work, as a whole, under this
224 License to anyone who comes into possession of a copy. This
225 License will therefore apply, along with any applicable section 7
226 additional terms, to the whole of the work, and all its parts,
227 regardless of how they are packaged. This License gives no
228 permission to license the work in any other way, but it does not
229 invalidate such permission if you have separately received it.
230
231 d) If the work has interactive user interfaces, each must display
232 Appropriate Legal Notices; however, if the Program has interactive
233 interfaces that do not display Appropriate Legal Notices, your
234 work need not make them do so.
235
236 A compilation of a covered work with other separate and independent
237works, which are not by their nature extensions of the covered work,
238and which are not combined with it such as to form a larger program,
239in or on a volume of a storage or distribution medium, is called an
240"aggregate" if the compilation and its resulting copyright are not
241used to limit the access or legal rights of the compilation's users
242beyond what the individual works permit. Inclusion of a covered work
243in an aggregate does not cause this License to apply to the other
244parts of the aggregate.
245
246 6. Conveying Non-Source Forms.
247
248 You may convey a covered work in object code form under the terms
249of sections 4 and 5, provided that you also convey the
250machine-readable Corresponding Source under the terms of this License,
251in one of these ways:
252
253 a) Convey the object code in, or embodied in, a physical product
254 (including a physical distribution medium), accompanied by the
255 Corresponding Source fixed on a durable physical medium
256 customarily used for software interchange.
257
258 b) Convey the object code in, or embodied in, a physical product
259 (including a physical distribution medium), accompanied by a
260 written offer, valid for at least three years and valid for as
261 long as you offer spare parts or customer support for that product
262 model, to give anyone who possesses the object code either (1) a
263 copy of the Corresponding Source for all the software in the
264 product that is covered by this License, on a durable physical
265 medium customarily used for software interchange, for a price no
266 more than your reasonable cost of physically performing this
267 conveying of source, or (2) access to copy the
268 Corresponding Source from a network server at no charge.
269
270 c) Convey individual copies of the object code with a copy of the
271 written offer to provide the Corresponding Source. This
272 alternative is allowed only occasionally and noncommercially, and
273 only if you received the object code with such an offer, in accord
274 with subsection 6b.
275
276 d) Convey the object code by offering access from a designated
277 place (gratis or for a charge), and offer equivalent access to the
278 Corresponding Source in the same way through the same place at no
279 further charge. You need not require recipients to copy the
280 Corresponding Source along with the object code. If the place to
281 copy the object code is a network server, the Corresponding Source
282 may be on a different server (operated by you or a third party)
283 that supports equivalent copying facilities, provided you maintain
284 clear directions next to the object code saying where to find the
285 Corresponding Source. Regardless of what server hosts the
286 Corresponding Source, you remain obligated to ensure that it is
287 available for as long as needed to satisfy these requirements.
288
289 e) Convey the object code using peer-to-peer transmission, provided
290 you inform other peers where the object code and Corresponding
291 Source of the work are being offered to the general public at no
292 charge under subsection 6d.
293
294 A separable portion of the object code, whose source code is excluded
295from the Corresponding Source as a System Library, need not be
296included in conveying the object code work.
297
298 A "User Product" is either (1) a "consumer product", which means any
299tangible personal property which is normally used for personal, family,
300or household purposes, or (2) anything designed or sold for incorporation
301into a dwelling. In determining whether a product is a consumer product,
302doubtful cases shall be resolved in favor of coverage. For a particular
303product received by a particular user, "normally used" refers to a
304typical or common use of that class of product, regardless of the status
305of the particular user or of the way in which the particular user
306actually uses, or expects or is expected to use, the product. A product
307is a consumer product regardless of whether the product has substantial
308commercial, industrial or non-consumer uses, unless such uses represent
309the only significant mode of use of the product.
310
311 "Installation Information" for a User Product means any methods,
312procedures, authorization keys, or other information required to install
313and execute modified versions of a covered work in that User Product from
314a modified version of its Corresponding Source. The information must
315suffice to ensure that the continued functioning of the modified object
316code is in no case prevented or interfered with solely because
317modification has been made.
318
319 If you convey an object code work under this section in, or with, or
320specifically for use in, a User Product, and the conveying occurs as
321part of a transaction in which the right of possession and use of the
322User Product is transferred to the recipient in perpetuity or for a
323fixed term (regardless of how the transaction is characterized), the
324Corresponding Source conveyed under this section must be accompanied
325by the Installation Information. But this requirement does not apply
326if neither you nor any third party retains the ability to install
327modified object code on the User Product (for example, the work has
328been installed in ROM).
329
330 The requirement to provide Installation Information does not include a
331requirement to continue to provide support service, warranty, or updates
332for a work that has been modified or installed by the recipient, or for
333the User Product in which it has been modified or installed. Access to a
334network may be denied when the modification itself materially and
335adversely affects the operation of the network or violates the rules and
336protocols for communication across the network.
337
338 Corresponding Source conveyed, and Installation Information provided,
339in accord with this section must be in a format that is publicly
340documented (and with an implementation available to the public in
341source code form), and must require no special password or key for
342unpacking, reading or copying.
343
344 7. Additional Terms.
345
346 "Additional permissions" are terms that supplement the terms of this
347License by making exceptions from one or more of its conditions.
348Additional permissions that are applicable to the entire Program shall
349be treated as though they were included in this License, to the extent
350that they are valid under applicable law. If additional permissions
351apply only to part of the Program, that part may be used separately
352under those permissions, but the entire Program remains governed by
353this License without regard to the additional permissions.
354
355 When you convey a copy of a covered work, you may at your option
356remove any additional permissions from that copy, or from any part of
357it. (Additional permissions may be written to require their own
358removal in certain cases when you modify the work.) You may place
359additional permissions on material, added by you to a covered work,
360for which you have or can give appropriate copyright permission.
361
362 Notwithstanding any other provision of this License, for material you
363add to a covered work, you may (if authorized by the copyright holders of
364that material) supplement the terms of this License with terms:
365
366 a) Disclaiming warranty or limiting liability differently from the
367 terms of sections 15 and 16 of this License; or
368
369 b) Requiring preservation of specified reasonable legal notices or
370 author attributions in that material or in the Appropriate Legal
371 Notices displayed by works containing it; or
372
373 c) Prohibiting misrepresentation of the origin of that material, or
374 requiring that modified versions of such material be marked in
375 reasonable ways as different from the original version; or
376
377 d) Limiting the use for publicity purposes of names of licensors or
378 authors of the material; or
379
380 e) Declining to grant rights under trademark law for use of some
381 trade names, trademarks, or service marks; or
382
383 f) Requiring indemnification of licensors and authors of that
384 material by anyone who conveys the material (or modified versions of
385 it) with contractual assumptions of liability to the recipient, for
386 any liability that these contractual assumptions directly impose on
387 those licensors and authors.
388
389 All other non-permissive additional terms are considered "further
390restrictions" within the meaning of section 10. If the Program as you
391received it, or any part of it, contains a notice stating that it is
392governed by this License along with a term that is a further
393restriction, you may remove that term. If a license document contains
394a further restriction but permits relicensing or conveying under this
395License, you may add to a covered work material governed by the terms
396of that license document, provided that the further restriction does
397not survive such relicensing or conveying.
398
399 If you add terms to a covered work in accord with this section, you
400must place, in the relevant source files, a statement of the
401additional terms that apply to those files, or a notice indicating
402where to find the applicable terms.
403
404 Additional terms, permissive or non-permissive, may be stated in the
405form of a separately written license, or stated as exceptions;
406the above requirements apply either way.
407
408 8. Termination.
409
410 You may not propagate or modify a covered work except as expressly
411provided under this License. Any attempt otherwise to propagate or
412modify it is void, and will automatically terminate your rights under
413this License (including any patent licenses granted under the third
414paragraph of section 11).
415
416 However, if you cease all violation of this License, then your
417license from a particular copyright holder is reinstated (a)
418provisionally, unless and until the copyright holder explicitly and
419finally terminates your license, and (b) permanently, if the copyright
420holder fails to notify you of the violation by some reasonable means
421prior to 60 days after the cessation.
422
423 Moreover, your license from a particular copyright holder is
424reinstated permanently if the copyright holder notifies you of the
425violation by some reasonable means, this is the first time you have
426received notice of violation of this License (for any work) from that
427copyright holder, and you cure the violation prior to 30 days after
428your receipt of the notice.
429
430 Termination of your rights under this section does not terminate the
431licenses of parties who have received copies or rights from you under
432this License. If your rights have been terminated and not permanently
433reinstated, you do not qualify to receive new licenses for the same
434material under section 10.
435
436 9. Acceptance Not Required for Having Copies.
437
438 You are not required to accept this License in order to receive or
439run a copy of the Program. Ancillary propagation of a covered work
440occurring solely as a consequence of using peer-to-peer transmission
441to receive a copy likewise does not require acceptance. However,
442nothing other than this License grants you permission to propagate or
443modify any covered work. These actions infringe copyright if you do
444not accept this License. Therefore, by modifying or propagating a
445covered work, you indicate your acceptance of this License to do so.
446
447 10. Automatic Licensing of Downstream Recipients.
448
449 Each time you convey a covered work, the recipient automatically
450receives a license from the original licensors, to run, modify and
451propagate that work, subject to this License. You are not responsible
452for enforcing compliance by third parties with this License.
453
454 An "entity transaction" is a transaction transferring control of an
455organization, or substantially all assets of one, or subdividing an
456organization, or merging organizations. If propagation of a covered
457work results from an entity transaction, each party to that
458transaction who receives a copy of the work also receives whatever
459licenses to the work the party's predecessor in interest had or could
460give under the previous paragraph, plus a right to possession of the
461Corresponding Source of the work from the predecessor in interest, if
462the predecessor has it or can get it with reasonable efforts.
463
464 You may not impose any further restrictions on the exercise of the
465rights granted or affirmed under this License. For example, you may
466not impose a license fee, royalty, or other charge for exercise of
467rights granted under this License, and you may not initiate litigation
468(including a cross-claim or counterclaim in a lawsuit) alleging that
469any patent claim is infringed by making, using, selling, offering for
470sale, or importing the Program or any portion of it.
471
472 11. Patents.
473
474 A "contributor" is a copyright holder who authorizes use under this
475License of the Program or a work on which the Program is based. The
476work thus licensed is called the contributor's "contributor version".
477
478 A contributor's "essential patent claims" are all patent claims
479owned or controlled by the contributor, whether already acquired or
480hereafter acquired, that would be infringed by some manner, permitted
481by this License, of making, using, or selling its contributor version,
482but do not include claims that would be infringed only as a
483consequence of further modification of the contributor version. For
484purposes of this definition, "control" includes the right to grant
485patent sublicenses in a manner consistent with the requirements of
486this License.
487
488 Each contributor grants you a non-exclusive, worldwide, royalty-free
489patent license under the contributor's essential patent claims, to
490make, use, sell, offer for sale, import and otherwise run, modify and
491propagate the contents of its contributor version.
492
493 In the following three paragraphs, a "patent license" is any express
494agreement or commitment, however denominated, not to enforce a patent
495(such as an express permission to practice a patent or covenant not to
496sue for patent infringement). To "grant" such a patent license to a
497party means to make such an agreement or commitment not to enforce a
498patent against the party.
499
500 If you convey a covered work, knowingly relying on a patent license,
501and the Corresponding Source of the work is not available for anyone
502to copy, free of charge and under the terms of this License, through a
503publicly available network server or other readily accessible means,
504then you must either (1) cause the Corresponding Source to be so
505available, or (2) arrange to deprive yourself of the benefit of the
506patent license for this particular work, or (3) arrange, in a manner
507consistent with the requirements of this License, to extend the patent
508license to downstream recipients. "Knowingly relying" means you have
509actual knowledge that, but for the patent license, your conveying the
510covered work in a country, or your recipient's use of the covered work
511in a country, would infringe one or more identifiable patents in that
512country that you have reason to believe are valid.
513
514 If, pursuant to or in connection with a single transaction or
515arrangement, you convey, or propagate by procuring conveyance of, a
516covered work, and grant a patent license to some of the parties
517receiving the covered work authorizing them to use, propagate, modify
518or convey a specific copy of the covered work, then the patent license
519you grant is automatically extended to all recipients of the covered
520work and works based on it.
521
522 A patent license is "discriminatory" if it does not include within
523the scope of its coverage, prohibits the exercise of, or is
524conditioned on the non-exercise of one or more of the rights that are
525specifically granted under this License. You may not convey a covered
526work if you are a party to an arrangement with a third party that is
527in the business of distributing software, under which you make payment
528to the third party based on the extent of your activity of conveying
529the work, and under which the third party grants, to any of the
530parties who would receive the covered work from you, a discriminatory
531patent license (a) in connection with copies of the covered work
532conveyed by you (or copies made from those copies), or (b) primarily
533for and in connection with specific products or compilations that
534contain the covered work, unless you entered into that arrangement,
535or that patent license was granted, prior to 28 March 2007.
536
537 Nothing in this License shall be construed as excluding or limiting
538any implied license or other defenses to infringement that may
539otherwise be available to you under applicable patent law.
540
541 12. No Surrender of Others' Freedom.
542
543 If conditions are imposed on you (whether by court order, agreement or
544otherwise) that contradict the conditions of this License, they do not
545excuse you from the conditions of this License. If you cannot convey a
546covered work so as to satisfy simultaneously your obligations under this
547License and any other pertinent obligations, then as a consequence you may
548not convey it at all. For example, if you agree to terms that obligate you
549to collect a royalty for further conveying from those to whom you convey
550the Program, the only way you could satisfy both those terms and this
551License would be to refrain entirely from conveying the Program.
552
553 13. Use with the GNU Affero General Public License.
554
555 Notwithstanding any other provision of this License, you have
556permission to link or combine any covered work with a work licensed
557under version 3 of the GNU Affero General Public License into a single
558combined work, and to convey the resulting work. The terms of this
559License will continue to apply to the part which is the covered work,
560but the special requirements of the GNU Affero General Public License,
561section 13, concerning interaction through a network will apply to the
562combination as such.
563
564 14. Revised Versions of this License.
565
566 The Free Software Foundation may publish revised and/or new versions of
567the GNU General Public License from time to time. Such new versions will
568be similar in spirit to the present version, but may differ in detail to
569address new problems or concerns.
570
571 Each version is given a distinguishing version number. If the
572Program specifies that a certain numbered version of the GNU General
573Public License "or any later version" applies to it, you have the
574option of following the terms and conditions either of that numbered
575version or of any later version published by the Free Software
576Foundation. If the Program does not specify a version number of the
577GNU General Public License, you may choose any version ever published
578by the Free Software Foundation.
579
580 If the Program specifies that a proxy can decide which future
581versions of the GNU General Public License can be used, that proxy's
582public statement of acceptance of a version permanently authorizes you
583to choose that version for the Program.
584
585 Later license versions may give you additional or different
586permissions. However, no additional obligations are imposed on any
587author or copyright holder as a result of your choosing to follow a
588later version.
589
590 15. Disclaimer of Warranty.
591
592 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
593APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
594HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
595OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
596THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
597PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
598IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
599ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
600
601 16. Limitation of Liability.
602
603 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
604WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
605THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
606GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
607USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
608DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
609PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
610EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
611SUCH DAMAGES.
612
613 17. Interpretation of Sections 15 and 16.
614
615 If the disclaimer of warranty and limitation of liability provided
616above cannot be given local legal effect according to their terms,
617reviewing courts shall apply local law that most closely approximates
618an absolute waiver of all civil liability in connection with the
619Program, unless a warranty or assumption of liability accompanies a
620copy of the Program in return for a fee.
621
622 END OF TERMS AND CONDITIONS
623
624 How to Apply These Terms to Your New Programs
625
626 If you develop a new program, and you want it to be of the greatest
627possible use to the public, the best way to achieve this is to make it
628free software which everyone can redistribute and change under these terms.
629
630 To do so, attach the following notices to the program. It is safest
631to attach them to the start of each source file to most effectively
632state the exclusion of warranty; and each file should have at least
633the "copyright" line and a pointer to where the full notice is found.
634
635 <one line to give the program's name and a brief idea of what it does.>
636 Copyright (C) <year> <name of author>
637
638 This program is free software: you can redistribute it and/or modify
639 it under the terms of the GNU General Public License as published by
640 the Free Software Foundation, either version 3 of the License, or
641 (at your option) any later version.
642
643 This program is distributed in the hope that it will be useful,
644 but WITHOUT ANY WARRANTY; without even the implied warranty of
645 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
646 GNU General Public License for more details.
647
648 You should have received a copy of the GNU General Public License
649 along with this program. If not, see <http://www.gnu.org/licenses/>.
650
651Also add information on how to contact you by electronic and paper mail.
652
653 If the program does terminal interaction, make it output a short
654notice like this when it starts in an interactive mode:
655
656 <program> Copyright (C) <year> <name of author>
657 This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
658 This is free software, and you are welcome to redistribute it
659 under certain conditions; type `show c' for details.
660
661The hypothetical commands `show w' and `show c' should show the appropriate
662parts of the General Public License. Of course, your program's commands
663might be different; for a GUI interface, you would use an "about box".
664
665 You should also get your employer (if you work as a programmer) or school,
666if any, to sign a "copyright disclaimer" for the program, if necessary.
667For more information on this, and how to apply and follow the GNU GPL, see
668<http://www.gnu.org/licenses/>.
669
670 The GNU General Public License does not permit incorporating your program
671into proprietary programs. If your program is a subroutine library, you
672may consider it more useful to permit linking proprietary applications with
673the library. If this is what you want to do, use the GNU Lesser General
674Public License instead of this License. But first, please read
675<http://www.gnu.org/philosophy/why-not-lgpl.html>.
676
0677
=== renamed file 'COPYING' => 'COPYING.moved'
=== added file 'ChangeLog'
=== renamed file 'ChangeLog' => 'ChangeLog.moved'
=== added file 'MAINTAINERS'
--- MAINTAINERS 1970-01-01 00:00:00 +0000
+++ MAINTAINERS 2013-01-24 09:32:23 +0000
@@ -0,0 +1,2 @@
1whzhang-kylin <fly2high@126.com>
2liuxing-kylin <liuxingcs@yeah.net>
03
=== renamed file 'MAINTAINERS' => 'MAINTAINERS.moved'
=== added file 'Makefile.am'
--- Makefile.am 1970-01-01 00:00:00 +0000
+++ Makefile.am 2013-01-24 09:32:23 +0000
@@ -0,0 +1,45 @@
1SUBDIRS = src data po #tests
2
3#
4# Install the music.lens and musicstore.scope files
5#
6# lens_in_files = music.lens.in
7lensdir = $(LENSESDIR)/music
8#lens_DATA = $(lens_in_files:.lens.in=.lens)
9
10scopedir = $(lensdir)
11scope_DATA = musicbaidu.scope
12
13icondir = $(datadir)/unity/themes
14
15@INTLTOOL_LENS_RULE@
16
17DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall
18
19# ChangeLog file created at distcheck time
20dist-hook:
21 @if test -d "$(srcdir)/.bzr"; \
22 then \
23 echo Creating ChangeLog && \
24 ( cd "$(top_srcdir)" && \
25 echo '# Generated by Makefile. Do not edit.'; echo; \
26 $(top_srcdir)/missing --run bzr log --gnu-changelog ) > ChangeLog.tmp \
27 && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
28 || (rm -f ChangeLog.tmp; \
29 echo Failed to generate ChangeLog >&2 ); \
30 else \
31 echo Failed to generate ChangeLog: not a branch >&2; \
32 fi
33
34EXTRA_DIST = \
35 autogen.sh \
36 $(lens_in_music) \
37 $(scope_DATA) \
38 AUTHORS \
39 COPYING \
40 MAINTAINERS \
41 README
42
43# $(lens_DATA)
44CLEANFILES =
45
046
=== renamed file 'Makefile.am' => 'Makefile.am.moved'
=== added file 'NEWS'
--- NEWS 1970-01-01 00:00:00 +0000
+++ NEWS 2013-01-24 09:32:23 +0000
@@ -0,0 +1,2 @@
1
2
03
=== renamed file 'NEWS' => 'NEWS.moved'
=== added file 'README'
=== renamed file 'README' => 'README.moved'
=== added file 'TESTS-TODO.txt'
--- TESTS-TODO.txt 1970-01-01 00:00:00 +0000
+++ TESTS-TODO.txt 2013-01-24 09:32:23 +0000
@@ -0,0 +1,7 @@
1Since testing lenses is dependant on multiple components in the system,
2we use the `libunity-tool` which is able to talk to the lenses and examine
3results they return.
4
5Currently this is not hooked into the build system, but you can run the tests
6by invoking `libunity-tool --test-server-mode ./tests`
7
08
=== renamed file 'TESTS-TODO.txt' => 'TESTS-TODO.txt.moved'
=== added file 'acinclude.m4'
--- acinclude.m4 1970-01-01 00:00:00 +0000
+++ acinclude.m4 2013-01-24 09:32:23 +0000
@@ -0,0 +1,40 @@
1dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
2dnl
3dnl example
4dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
5dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
6
7AC_DEFUN([AS_AC_EXPAND],
8[
9 EXP_VAR=[$1]
10 FROM_VAR=[$2]
11
12 dnl first expand prefix and exec_prefix if necessary
13 prefix_save=$prefix
14 exec_prefix_save=$exec_prefix
15
16 dnl if no prefix given, then use /usr/local, the default prefix
17 if test "x$prefix" = "xNONE"; then
18 prefix=$ac_default_prefix
19 fi
20 dnl if no exec_prefix given, then use prefix
21 if test "x$exec_prefix" = "xNONE"; then
22 exec_prefix=$prefix
23 fi
24
25 full_var="$FROM_VAR"
26 dnl loop until it doesn't change anymore
27 while true; do
28 new_full_var="`eval echo $full_var`"
29 if test "x$new_full_var"="x$full_var"; then break; fi
30 full_var=$new_full_var
31 done
32
33 dnl clean up
34 full_var=$new_full_var
35 AC_SUBST([$1], "$full_var")
36
37 dnl restore prefix and exec_prefix
38 prefix=$prefix_save
39 exec_prefix=$exec_prefix_save
40])
041
=== renamed file 'acinclude.m4' => 'acinclude.m4.moved'
=== added file 'autogen.sh'
--- autogen.sh 1970-01-01 00:00:00 +0000
+++ autogen.sh 2013-01-24 09:32:23 +0000
@@ -0,0 +1,13 @@
1#!/bin/sh
2
3srcdir=`dirname $0`
4
5PKG_NAME="unity-china-music-scope"
6
7which gnome-autogen.sh || {
8 echo "You need gnome-common from GNOME SVN"
9 exit 1
10}
11
12USE_GNOME2_MACROS=1 \
13. gnome-autogen.sh
014
=== renamed file 'autogen.sh' => 'autogen.sh.moved'
=== added file 'configure.ac'
--- configure.ac 1970-01-01 00:00:00 +0000
+++ configure.ac 2013-01-24 09:32:23 +0000
@@ -0,0 +1,155 @@
1AC_INIT(unity-china-music-scope, 1.0.0, https://code.launchpad.net/unity-china-music-scope)
2AC_COPYRIGHT([Copyright 2012-2013 Kylin Ltd
32011 Canonical Ltd])
4
5AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
6
7#####################################################
8# Silent build rules
9#####################################################
10m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
11
12AC_PREREQ(2.59)
13
14AC_CONFIG_HEADERS([config.h])
15
16#####################################################
17# Init the other things we depend on
18#####################################################
19AM_MAINTAINER_MODE
20AM_PROG_VALAC([0.16.0])
21AS_IF([test -z "$VALAC"], [AC_MSG_ERROR(["No valac compiler found."])])
22AC_PROG_CC
23AM_PROG_CC_C_O
24AC_HEADER_STDC
25
26LT_INIT
27AC_CONFIG_MACRO_DIR([m4])
28
29#############################################
30# Gettext
31#############################################
32GETTEXT_PACKAGE="$PACKAGE"
33AC_SUBST(GETTEXT_PACKAGE)
34AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/po/LINGUAS'])
35AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [gettext domain])
36AM_GLIB_GNU_GETTEXT
37
38# AM_GNOME_GETTEXT above substs $DATADIRNAME
39# this is the directory where the *.{mo,gmo} files are installed
40localedir='${prefix}/${DATADIRNAME}/locale'
41AC_SUBST(localedir)
42
43IT_PROG_INTLTOOL([0.40.0])
44
45AC_DEFINE_UNQUOTED(LOCALE_DIR, "${PREFIX}/${DATADIRNAME}/locale",[Locale directory])
46AC_DEFINE_UNQUOTED(DATADIR, "${PREFIX}/${DATADIRNAME}",[Data directory])
47AC_DEFINE_UNQUOTED(PREFIXDIR, "${PREFIX}",[Prefix directory])
48
49AC_SUBST([libexecdir],['${PREFIX}/lib'])
50# AC_DEFINE_UNQUOTED(libexecdir, "${PREFIX}",[Libexecdir directory])
51
52######################################################
53# intltool rule for generating translated .lens file
54######################################################
55INTLTOOL_LENS_RULE='%.lens: %.lens.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
56AC_SUBST(INTLTOOL_LENS_RULE)
57
58#####################################################
59# Check for module and library dependancies
60#####################################################
61GLIB_REQUIRED=2.27
62PKG_CHECK_MODULES(LENS_DAEMON,
63 glib-2.0 >= $GLIB_REQUIRED
64 gobject-2.0 >= $GLIB_REQUIRED
65 gio-2.0 >= $GLIB_REQUIRED
66 gio-unix-2.0 >= $GLIB_REQUIRED
67 dee-1.0 >= 1.0.7
68 sqlite3 >= 3.7.7
69 gee-1.0
70 json-glib-1.0
71 unity >= 6.7
72 tdb >= 1.2.6)
73
74PKG_CHECK_MODULES(PREVIEW_PLAYER,
75 glib-2.0 >= $GLIB_REQUIRED
76 gobject-2.0 >= $GLIB_REQUIRED
77 gio-2.0 >= $GLIB_REQUIRED
78 )
79
80AC_SUBST(LENS_DAEMON_CFLAGS)
81AC_SUBST(LENS_DAEMON_LIBS)
82AC_SUBST(PREVIEW_PLAYER_CFLAGS)
83AC_SUBST(PREVIEW_PLAYER_LIBS)
84
85#####################################################
86# local install for distcheck and stand-alone running
87#####################################################
88with_localinstall="no"
89AC_ARG_ENABLE(localinstall,
90 AS_HELP_STRING([--enable-localinstall],
91 [Install all of the files locally instead of in system directories (for distcheck)]),
92 with_localinstall=$enableval,
93 with_localinstall=no)
94
95AM_CONDITIONAL([HAVE_LOCALINSTALL], [test "x$with_localinstall" = "xyes"])
96
97#####################################################
98# Expand variables needed for config.vala
99#####################################################
100AS_AC_EXPAND(PREFIX, $prefix)
101AC_SUBST(PREFIX)
102
103AS_AC_EXPAND(DATADIR, $datarootdir)
104AC_SUBST(DATADIR)
105
106#####################################################
107# Look for dbus service dir
108#####################################################
109if test "x$with_localinstall" = "xyes"; then
110 DBUSSERVICEDIR="${datadir}/dbus-1/services/"
111else
112 DBUSSERVICEDIR=`$PKG_CONFIG --variable=session_bus_services_dir dbus-1`
113fi
114AC_SUBST(DBUSSERVICEDIR)
115
116#####################################################
117# Look for correct Lenses dir
118#####################################################
119if test "x$with_localinstall" = "xyes"; then
120 LENSESDIR="${datadir}/unity/lenses"
121else
122 LENSESDIR=`$PKG_CONFIG --variable=lensesdir unity`
123fi
124AC_SUBST(LENSESDIR)
125
126#####################################################
127# Create the Makefiles
128#####################################################
129# music.lens.in
130AC_CONFIG_FILES([
131 Makefile
132 data/Makefile
133 src/Makefile
134 src/config.vala
135 po/Makefile.in
136])
137AC_OUTPUT
138
139#####################################################
140# Output the results
141#####################################################
142AC_MSG_NOTICE([
143
144 Unity China Music Scope Daemon $VERSION
145 -------------------------------
146
147 Prefix : ${prefix}
148
149 Local install : ${with_localinstall}
150
151 Extra CFlags : ${CPPFLAGS} $MAINTAINER_CFLAGS
152 Extra ValaFlags : ${CPPFLAGS} $MAINTAINER_VALAFLAGS
153
154 Lenses Directory: ${LENSESDIR}
155])
0156
=== renamed file 'configure.ac' => 'configure.ac.moved'
=== added directory 'data'
=== renamed directory 'data' => 'data.moved'
=== added file 'data/Makefile.am'
--- data/Makefile.am 1970-01-01 00:00:00 +0000
+++ data/Makefile.am 2013-01-24 09:32:23 +0000
@@ -0,0 +1,19 @@
1dbus_servicesdir = $(DBUSSERVICEDIR)
2service_in_files = \
3 musicbaidu-scope.service.in
4
5icondir = $(datadir)/unity/themes
6icon_DATA = baidu_song_missing.png
7
8dbus_services_DATA = $(service_in_files:.service.in=.service)
9
10%.service: %.service.in
11 sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
12
13EXTRA_DIST = \
14 $(icon_DATA) \
15 $(service_in_files)
16
17CLEANFILES = \
18 musicbaidu-scope.service
19
020
=== added file 'data/baidu_song_missing.png'
1Binary files data/baidu_song_missing.png 1970-01-01 00:00:00 +0000 and data/baidu_song_missing.png 2013-01-24 09:32:23 +0000 differ21Binary files data/baidu_song_missing.png 1970-01-01 00:00:00 +0000 and data/baidu_song_missing.png 2013-01-24 09:32:23 +0000 differ
=== added file 'data/musicbaidu-scope.service.in'
--- data/musicbaidu-scope.service.in 1970-01-01 00:00:00 +0000
+++ data/musicbaidu-scope.service.in 2013-01-24 09:32:23 +0000
@@ -0,0 +1,3 @@
1[D-BUS Service]
2Name=com.canonical.Unity.Scope.MusicBaidu
3Exec=@libexecdir@/unity-musicbaidu-daemon
04
=== added directory 'debian'
=== renamed directory 'debian' => 'debian.moved'
=== added file 'debian/changelog'
--- debian/changelog 1970-01-01 00:00:00 +0000
+++ debian/changelog 2013-01-24 09:32:23 +0000
@@ -0,0 +1,21 @@
1unity-china-music-scope (1.0.1-0ubuntu2) raring; urgency=low
2
3 * Updated file MAINTAINERS
4 * Updated file AUTHORS
5 * Updated file autogen.sh
6 * Updated file configure.ac
7
8 -- liuxing-kylin <liuxingcs@yeah.net> Tue, 24 Jan 2013 14:56:23 +0800
9
10unity-china-music-scope (1.0.1-0ubuntu1) raring; urgency=low
11
12 * Fix Another instance of the UbuntuOne Music Daemon
13 * already appears to be running. (LP:1103019)
14
15 -- whzhang-kylin <fly2high@126.com> Tue, 22 Jan 2013 16:42:57 +0800
16
17unity-china-music-scope (1.0.0-0ubuntu1) raring; urgency=low
18
19 * Upload to Ubuntu
20
21 -- whzhang-kylin <fly2high@126.com> Thu, 13 Dec 2012 09:29:34 +0800
022
=== added file 'debian/compat'
--- debian/compat 1970-01-01 00:00:00 +0000
+++ debian/compat 2013-01-24 09:32:23 +0000
@@ -0,0 +1,1 @@
19
02
=== added file 'debian/control'
--- debian/control 1970-01-01 00:00:00 +0000
+++ debian/control 2013-01-24 09:32:23 +0000
@@ -0,0 +1,29 @@
1Source: unity-china-music-scope
2Section: gnome
3Priority: optional
4Maintainer: Ubuntu Kylin Team <ubuntukylin-members@lists.launchpad.net>
5Build-Depends: debhelper (>= 9),
6 pkg-config,
7 dh-translations,
8 dh-autoreconf,
9 valac (>= 0.16),
10 libglib2.0-dev,
11 libgee-dev,
12 libjson-glib-dev,
13 libdee-dev (>= 1.0.7),
14 libsqlite3-dev (>= 3.7.7),
15 libunity-dev (>= 6.8.0),
16 libtdb-dev (>= 1.2.6),
17 unity-lens-music (>= 6.8.1),
18Standards-Version: 3.9.4
19Homepage: https://launchpad.net/unity-china-music-scope
20Vcs-Bzr: https://code.launchpad.net/~ubuntukylin-members/unity-china-music-scope/unity-china-music-scope
21
22Package: unity-china-music-scope
23Architecture: any
24Depends: ${shlibs:Depends},
25 ${misc:Depends},
26Breaks: unity (<< 6.0)
27Description: China Music Online.
28 This package is used in Dash of Unity to show China music results
29 searched by Baidu.
030
=== added file 'debian/copyright'
--- debian/copyright 1970-01-01 00:00:00 +0000
+++ debian/copyright 2013-01-24 09:32:23 +0000
@@ -0,0 +1,36 @@
1Format: http://dep.debian.net/deps/dep5/
2Upstream-Name: unity-china-music-scope
3Upstream-Contact: Jonas Zhang <fly2high@126.com>
4 liuxing <liuxingcs@yeah.net>
5Source: https://launchpad.net/unity-china-music-scope/
6
7Files: *
8Copyright: 2011 Canonical Ltd
9License: GPL-3
10 This program is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License version 3 as
12 published by the Free Software Foundation.
13 .
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 .
19 On Debian/Ubuntu systems, the full text of the GPL v3 can be found in
20 `/usr/share/common-licenses/GPL-3'
21
22Files: musicbaidu-daemon.vala musicbaidu-search.vala
23Copyright: 2013 Kylin Ltd
24License: GPL-3
25 This program is free software: you can redistribute it and/or modify
26 it under the terms of the GNU General Public License version 3 as
27 published by the Free Software Foundation.
28 .
29 This program is distributed in the hope that it will be useful,
30 but WITHOUT ANY WARRANTY; without even the implied warranty of
31 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 GNU General Public License for more details.
33 .
34 On Debian/Ubuntu systems, the full text of the GPL v3 can be found in
35 `/usr/share/common-licenses/GPL-3'
36
037
=== added file 'debian/rules'
--- debian/rules 1970-01-01 00:00:00 +0000
+++ debian/rules 2013-01-24 09:32:23 +0000
@@ -0,0 +1,16 @@
1#!/usr/bin/make -f
2# -*- makefile -*-
3
4# Uncomment this to turn on verbose mode.
5#export DH_VERBOSE=1
6
7export DEB_LDFLAGS_MAINT_APPEND = -Wl,-z,defs -Wl,--as-needed
8
9%:
10 dh $@ --with autoreconf
11
12# override_dh_autoreconf:
13# NOCONFIGURE=1 dh_autoreconf ./autogen.sh
14
15override_dh_install:
16 dh_install --fail-missing
017
=== added file 'musicbaidu.scope'
--- musicbaidu.scope 1970-01-01 00:00:00 +0000
+++ musicbaidu.scope 2013-01-24 09:32:23 +0000
@@ -0,0 +1,4 @@
1[Scope]
2DBusName=com.canonical.Unity.Scope.MusicBaidu
3DBusPath=/com/canonical/unity/scope/musicbaidu
4
05
=== renamed file 'musicbaidu.scope' => 'musicbaidu.scope.moved'
=== added directory 'po'
=== renamed directory 'po' => 'po.moved'
=== added file 'po/LINGUAS'
--- po/LINGUAS 1970-01-01 00:00:00 +0000
+++ po/LINGUAS 2013-01-24 09:32:23 +0000
@@ -0,0 +1,1 @@
1zh_CN
02
=== added file 'po/Makefile.in.in'
--- po/Makefile.in.in 1970-01-01 00:00:00 +0000
+++ po/Makefile.in.in 2013-01-24 09:32:23 +0000
@@ -0,0 +1,222 @@
1# Makefile for program source directory in GNU NLS utilities package.
2# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
3# Copyright (C) 2004-2008 Rodney Dawes <dobey.pwns@gmail.com>
4#
5# This file may be copied and used freely without restrictions. It may
6# be used in projects which are not available under a GNU Public License,
7# but which still want to provide support for the GNU gettext functionality.
8#
9# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
10# instead of PACKAGE and to look for po2tbl in ./ not in intl/
11#
12# - Modified by jacob berkman <jacob@ximian.com> to install
13# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
14#
15# - Modified by Rodney Dawes <dobey.pwns@gmail.com> for use with intltool
16#
17# We have the following line for use by intltoolize:
18# INTLTOOL_MAKEFILE
19
20GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
21PACKAGE = @PACKAGE@
22VERSION = @VERSION@
23
24SHELL = @SHELL@
25
26srcdir = @srcdir@
27top_srcdir = @top_srcdir@
28top_builddir = @top_builddir@
29VPATH = @srcdir@
30
31prefix = @prefix@
32exec_prefix = @exec_prefix@
33datadir = @datadir@
34datarootdir = @datarootdir@
35libdir = @libdir@
36DATADIRNAME = @DATADIRNAME@
37itlocaledir = $(prefix)/$(DATADIRNAME)/locale
38subdir = po
39install_sh = @install_sh@
40# Automake >= 1.8 provides @mkdir_p@.
41# Until it can be supposed, use the safe fallback:
42mkdir_p = $(install_sh) -d
43
44INSTALL = @INSTALL@
45INSTALL_DATA = @INSTALL_DATA@
46
47GMSGFMT = @GMSGFMT@
48MSGFMT = @MSGFMT@
49XGETTEXT = @XGETTEXT@
50INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
51INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
52MSGMERGE = INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
53GENPOT = INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
54
55ALL_LINGUAS = @ALL_LINGUAS@
56
57PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; else echo "$(ALL_LINGUAS)"; fi)
58
59USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep \^$$lang$$ $(srcdir)/LINGUAS 2>/dev/null`" -o -n "`echo $$ALINGUAS|tr ' ' '\n'|grep \^$$lang$$`"; then printf "$$lang "; fi; done; fi)
60
61USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)" -o -n "$(LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done)
62
63POFILES=$(shell LINGUAS="$(PO_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done)
64
65DISTFILES = Makefile.in.in POTFILES.in $(POFILES)
66EXTRA_DISTFILES = ChangeLog POTFILES.skip Makevars LINGUAS
67
68POTFILES = \
69# This comment gets stripped out
70
71CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done)
72
73.SUFFIXES:
74.SUFFIXES: .po .pox .gmo .mo .msg .cat
75
76AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
77INTLTOOL_V_MSGFMT = $(INTLTOOL__v_MSGFMT_$(V))
78INTLTOOL__v_MSGFMT_= $(INTLTOOL__v_MSGFMT_$(AM_DEFAULT_VERBOSITY))
79INTLTOOL__v_MSGFMT_0 = @echo " MSGFMT" $@;
80
81.po.pox:
82 $(MAKE) $(GETTEXT_PACKAGE).pot
83 $(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
84
85.po.mo:
86 $(INTLTOOL_V_MSGFMT)$(MSGFMT) -o $@ $<
87
88.po.gmo:
89 $(INTLTOOL_V_MSGFMT)file=`echo $* | sed 's,.*/,,'`.gmo \
90 && rm -f $$file && $(GMSGFMT) -o $$file $<
91
92.po.cat:
93 sed -f ../intl/po2msg.sed < $< > $*.msg \
94 && rm -f $@ && gencat $@ $*.msg
95
96
97all: all-@USE_NLS@
98
99all-yes: $(CATALOGS)
100all-no:
101
102$(GETTEXT_PACKAGE).pot: $(POTFILES)
103 $(GENPOT)
104
105install: install-data
106install-data: install-data-@USE_NLS@
107install-data-no: all
108install-data-yes: all
109 linguas="$(USE_LINGUAS)"; \
110 for lang in $$linguas; do \
111 dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
112 $(mkdir_p) $$dir; \
113 if test -r $$lang.gmo; then \
114 $(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
115 echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \
116 else \
117 $(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
118 echo "installing $(srcdir)/$$lang.gmo as" \
119 "$$dir/$(GETTEXT_PACKAGE).mo"; \
120 fi; \
121 if test -r $$lang.gmo.m; then \
122 $(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \
123 echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \
124 else \
125 if test -r $(srcdir)/$$lang.gmo.m ; then \
126 $(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \
127 $$dir/$(GETTEXT_PACKAGE).mo.m; \
128 echo "installing $(srcdir)/$$lang.gmo.m as" \
129 "$$dir/$(GETTEXT_PACKAGE).mo.m"; \
130 else \
131 true; \
132 fi; \
133 fi; \
134 done
135
136# Empty stubs to satisfy archaic automake needs
137dvi info ctags tags CTAGS TAGS ID:
138
139# Define this as empty until I found a useful application.
140install-exec installcheck:
141
142uninstall:
143 linguas="$(USE_LINGUAS)"; \
144 for lang in $$linguas; do \
145 rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
146 rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
147 done
148
149check: all $(GETTEXT_PACKAGE).pot
150 rm -f missing notexist
151 srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m
152 if [ -r missing -o -r notexist ]; then \
153 exit 1; \
154 fi
155
156mostlyclean:
157 rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
158 rm -f .intltool-merge-cache
159
160clean: mostlyclean
161
162distclean: clean
163 rm -f Makefile Makefile.in POTFILES stamp-it
164 rm -f *.mo *.msg *.cat *.cat.m *.gmo
165
166maintainer-clean: distclean
167 @echo "This command is intended for maintainers to use;"
168 @echo "it deletes files that may require special tools to rebuild."
169 rm -f Makefile.in.in
170
171distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
172dist distdir: $(DISTFILES)
173 dists="$(DISTFILES)"; \
174 extra_dists="$(EXTRA_DISTFILES)"; \
175 for file in $$extra_dists; do \
176 test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \
177 done; \
178 for file in $$dists; do \
179 test -f $$file || file="$(srcdir)/$$file"; \
180 ln $$file $(distdir) 2> /dev/null \
181 || cp -p $$file $(distdir); \
182 done
183
184update-po: Makefile
185 $(MAKE) $(GETTEXT_PACKAGE).pot
186 tmpdir=`pwd`; \
187 linguas="$(USE_LINGUAS)"; \
188 for lang in $$linguas; do \
189 echo "$$lang:"; \
190 result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \
191 if $$result; then \
192 if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
193 rm -f $$tmpdir/$$lang.new.po; \
194 else \
195 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
196 :; \
197 else \
198 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
199 rm -f $$tmpdir/$$lang.new.po; \
200 exit 1; \
201 fi; \
202 fi; \
203 else \
204 echo "msgmerge for $$lang.gmo failed!"; \
205 rm -f $$tmpdir/$$lang.new.po; \
206 fi; \
207 done
208
209Makefile POTFILES: stamp-it
210 @if test ! -f $@; then \
211 rm -f stamp-it; \
212 $(MAKE) stamp-it; \
213 fi
214
215stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in
216 cd $(top_builddir) \
217 && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \
218 $(SHELL) ./config.status
219
220# Tell versions [3.59,3.63) of GNU make not to export all variables.
221# Otherwise a system limit (for SysV at least) may be exceeded.
222.NOEXPORT:
0223
=== added file 'po/POTFILES.in'
--- po/POTFILES.in 1970-01-01 00:00:00 +0000
+++ po/POTFILES.in 2013-01-24 09:32:23 +0000
@@ -0,0 +1,6 @@
1[encoding: UTF-8]
2src/musicbaidu-daemon.vala
3src/musicbaidu-search.vala
4src/simple-scope.vala
5[type: gettext/ini]
6
07
=== added file 'po/POTFILES.skip'
--- po/POTFILES.skip 1970-01-01 00:00:00 +0000
+++ po/POTFILES.skip 2013-01-24 09:32:23 +0000
@@ -0,0 +1,2 @@
1src/musicbaidu-daemon.c
2src/simple-scope.c
03
=== added file 'po/zh_CN.po'
--- po/zh_CN.po 1970-01-01 00:00:00 +0000
+++ po/zh_CN.po 2013-01-24 09:32:23 +0000
@@ -0,0 +1,26 @@
1# Chinese (Simplified) translation for unity-china-music-scope
2# Copyright (c) 2013 Ubuntu Kylin Members Team Contributors and Canonical Ltd 2011
3# This file is distributed under the same license as the unity-china-music-scope package.
4# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
5#
6msgid ""
7msgstr ""
8"Project-Id-Version: unity-china-music-scope\n"
9"Report-Msgid-Bugs-To: Weihua Zhang <fly2high@126.com>\n"
10"POT-Creation-Date: 2012-04-27 13:03+0000\n"
11"PO-Revision-Date: 2012-04-06 08:20+0000\n"
12"Last-Translator: Weihua Zhang <fly2high@126.com>\n"
13"Language-Team: Chinese (Simplified) <zh_CN@li.org>\n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
17"X-Launchpad-Export-Date: 2012-05-08 10:33+0000\n"
18"X-Generator: Launchpad (build 15204)\n"
19
20#: ../src/musicbaidu-daemon.vala:159
21msgid "Download"
22msgstr "下载"
23
24#: ../src/simple-scope.vala:125
25msgid "Sorry, there is no music that matches your search."
26msgstr "对不起,没有找到匹配的音乐。"
027
=== added directory 'src'
=== renamed directory 'src' => 'src.moved'
=== added file 'src/Makefile.am'
--- src/Makefile.am 1970-01-01 00:00:00 +0000
+++ src/Makefile.am 2013-01-24 09:32:23 +0000
@@ -0,0 +1,83 @@
1NULL =
2BUILT_SOURCES =
3CLEANFILES =
4EXTRA_DIST =
5
6DATADIR = $(datadir)
7
8libexec_PROGRAMS = \
9 unity-musicbaidu-daemon
10
11#===============================================
12# add musicbaidu defs
13unity_musicbaidu_daemon_CPPFLAGS = \
14 -DDATADIR=\"$(DATADIR)\" \
15 -DPKGDATADIR=\"$(PKGDATADIR)\" \
16 -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
17 -DG_LOG_DOMAIN=\"unity-musicbaidu-daemon\" \
18 $(LENS_DAEMON_CFLAGS) \
19 $(MAINTAINER_CFLAGS) \
20 -I$(srcdir) \
21 -g
22
23unity_musicbaidu_daemon_VALAFLAGS = \
24 --pkg json-glib-1.0 \
25 -C \
26 --pkg dee-1.0 \
27 --pkg sqlite3 \
28 --pkg unity \
29 --pkg gee-1.0 \
30 --pkg gio-2.0 \
31 --pkg gio-unix-2.0 \
32 --pkg glib-2.0 \
33 --vapidir $(srcdir) \
34 --pkg tdb \
35 --target-glib=2.26 \
36 $(MAINTAINER_VALAFLAGS)
37
38unity_musicbaidu_daemon_LDADD = \
39 $(LENS_DAEMON_LIBS) \
40 $(NULL)
41
42
43unity_musicbaidu_daemon_VALASOURCES = \
44 album.vala \
45 config.vala \
46 genre.vala \
47 filter-parser.vala \
48 filter-parser-decade.vala \
49 filter-parser-genre.vala \
50 musicbaidu-search.vala \
51 musicbaidu-daemon.vala \
52 simple-scope.vala \
53 track.vala
54
55unity_musicbaidu_daemon_SOURCES = \
56 $(unity_musicbaidu_daemon_VALASOURCES:.vala=.c) \
57 $(NULL)
58
59# end add musicbaidu defs
60#===============================================
61
62
63
64BUILT_SOURCES += \
65 unity_musicbaidu_daemon.vala.stamp
66
67EXTRA_DIST += \
68 unity_musicbaidu_daemon.vala.stamp \
69 $(unity_musicbaidu_daemon_VALASOURCES) \
70 tdb.vapi \
71 tdb.deps \
72 $(NULL)
73
74
75unity_musicbaidu_daemon.vala.stamp: $(unity_musicbaidu_daemon_VALASOURCES)
76 $(AM_V_GEN) $(VALAC) $(unity_musicbaidu_daemon_VALAFLAGS) $^
77 touch unity_musicbaidu_daemon.vala.stamp
78
79CLEANFILES += \
80 *.stamp \
81 $(unity_musicbaidu_daemon_VALASOURCES:.vala=.c) \
82 $(NULL)
83
084
=== added file 'src/album.vala'
--- src/album.vala 1970-01-01 00:00:00 +0000
+++ src/album.vala 2013-01-24 09:32:23 +0000
@@ -0,0 +1,32 @@
1/*
2 * Copyright (C) 2011 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by Alex Launi <alex.launi@canonical.com>
17 *
18 */
19
20using GLib;
21
22namespace Unity.MusicLens {
23
24 public class Album : GLib.Object
25 {
26 public string title { get; set; }
27 public string artist { get; set; }
28 public string uri { get; set; }
29 public string artwork_path { get; set; }
30 public string formatted_price { get; set; }
31 }
32}
0\ No newline at end of file33\ No newline at end of file
134
=== added file 'src/config.vala.in'
--- src/config.vala.in 1970-01-01 00:00:00 +0000
+++ src/config.vala.in 2013-01-24 09:32:23 +0000
@@ -0,0 +1,16 @@
1namespace Config {
2
3 const string PREFIX = "@prefix@";
4
5 const string DATADIR = "@DATADIR@";
6
7 const string PKGDATADIR = "@DATADIR@/unity";
8
9 const string BINDIR = "@prefix@/bin";
10
11 const string LOCALEDIR = "@DATADIR@/locale";
12
13 const string PACKAGE = "@PACKAGE@";
14
15 const string VERSION = "@VERSION@";
16}
017
=== added file 'src/filter-parser-decade.vala'
--- src/filter-parser-decade.vala 1970-01-01 00:00:00 +0000
+++ src/filter-parser-decade.vala 2013-01-24 09:32:23 +0000
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2011 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by Alex Launi <alex.launi@canonical.com>
17 *
18 */
19
20using GLib;
21
22namespace Unity.MusicLens {
23
24 public class DecadeFilterParser : FilterParser
25 {
26 public DecadeFilterParser (MultiRangeFilter filter)
27 {
28 base (filter);
29 }
30
31 public override string parse ()
32 {
33 return "";
34 }
35
36 protected override string id { get { return "decade"; } }
37 }
38}
0\ No newline at end of file39\ No newline at end of file
140
=== added file 'src/filter-parser-genre.vala'
--- src/filter-parser-genre.vala 1970-01-01 00:00:00 +0000
+++ src/filter-parser-genre.vala 2013-01-24 09:32:23 +0000
@@ -0,0 +1,54 @@
1/*
2 * Copyright (C) 2011 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by Alex Launi <alex.launi@canonical.com>
17 *
18 */
19
20using GLib;
21
22namespace Unity.MusicLens {
23
24 public class GenreFilterParser : FilterParser
25 {
26 public GenreFilterParser (CheckOptionFilterCompact filter)
27 {
28 base (filter);
29 map = new Genre ();
30 }
31
32 public override string parse ()
33 {
34 return "";
35 }
36
37 protected override string id { get { return "genre"; } }
38 protected Genre map { get; private set; }
39
40 protected List<FilterOption> get_all_selected_genres ()
41 {
42 unowned List<FilterOption> options = (filter as CheckOptionFilterCompact).options;
43 var active = new List<FilterOption> ();
44
45 foreach (FilterOption option in options)
46 {
47 if (option.active)
48 active.append (option);
49 }
50
51 return active;
52 }
53 }
54}
055
=== added file 'src/filter-parser.vala'
--- src/filter-parser.vala 1970-01-01 00:00:00 +0000
+++ src/filter-parser.vala 2013-01-24 09:32:23 +0000
@@ -0,0 +1,36 @@
1/*
2 * Copyright (C) 2011 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by Alex Launi <alex.launi@canonical.com>
17 *
18 */
19
20using GLib;
21
22namespace Unity.MusicLens {
23
24 public abstract class FilterParser : Object
25 {
26 public FilterParser (Filter filter)
27 {
28 this.filter = filter;
29 }
30
31 public Filter filter { get; protected set; }
32
33 public abstract string id { get;}
34 public abstract string parse ();
35 }
36}
0\ No newline at end of file37\ No newline at end of file
138
=== added file 'src/genre.vala'
--- src/genre.vala 1970-01-01 00:00:00 +0000
+++ src/genre.vala 2013-01-24 09:32:23 +0000
@@ -0,0 +1,169 @@
1/*
2 * Copyright (C) 2011 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by Alex Launi <alex.launi@canonical.com>
17 *
18 */
19
20using Gee;
21
22namespace Unity.MusicLens {
23
24 public class Genre : GLib.Object
25 {
26 public static const string BLUES_ID = "blues";
27 public static const string CLASSIC_ID = "classic";
28 public static const string COUNTRY_ID = "country";
29 public static const string DISCO_ID = "disco";
30 public static const string FUNK_ID = "funk";
31 public static const string ROCK_ID = "rock";
32 public static const string METAL_ID = "metal";
33 public static const string HIPHOP_ID = "hip-hop";
34 public static const string HOUSE_ID = "house";
35 public static const string NEWWAVE_ID = "new-wave";
36 public static const string RANDB_ID = "r-and-b";
37 public static const string PUNK_ID = "punk";
38 public static const string JAZZ_ID = "jazz";
39 public static const string POP_ID = "pop";
40 public static const string REGGAE_ID = "reggae";
41 public static const string SOUL_ID = "soul";
42 public static const string TECHNO_ID = "techno";
43 public static const string OTHER_ID = "other";
44
45 private static TreeMultiMap<string, string> map;
46 private static Map<string, string> inverted_map;
47
48 static construct
49 {
50 map = new TreeMultiMap<string, string> ();
51
52 /* blues */
53 map.set (BLUES_ID, "blues");
54
55 /* classic */
56 map.set (CLASSIC_ID, "classic");
57 map.set (CLASSIC_ID, "classical");
58 map.set (CLASSIC_ID, "opera");
59
60 /* country */
61 map.set (COUNTRY_ID, "country");
62
63 /* disco */
64 map.set (DISCO_ID, "disco");
65
66 /* funk */
67 map.set (FUNK_ID, "funk");
68
69 /* rock */
70 map.set (ROCK_ID, "rock");
71 map.set (ROCK_ID, "heavy");
72 map.set (ROCK_ID, "hard");
73 map.set (ROCK_ID, "rock and roll");
74
75 /* metal */
76 map.set (METAL_ID, "metal");
77 map.set (METAL_ID, "heavy");
78 map.set (METAL_ID, "heavy metal");
79
80 /*hip hop */
81 map.set (HIPHOP_ID, "hip-hop");
82 map.set (HIPHOP_ID, "rap");
83 map.set (HIPHOP_ID, "rap & hip hop");
84
85 /*house*/
86 map.set (HOUSE_ID, "house");
87 map.set (HOUSE_ID, "chillout");
88 map.set (HOUSE_ID, "minimal");
89 map.set (HOUSE_ID, "hard");
90 map.set (HOUSE_ID, "electronic");
91 map.set (HOUSE_ID, "dance");
92
93 /*new wave*/
94 map.set (NEWWAVE_ID, "new-wave");
95
96 /*r-and-b*/
97 map.set (RANDB_ID, "r-and-b");
98 map.set (RANDB_ID, "r&b");
99
100 /*punk*/
101 map.set (PUNK_ID, "punk");
102 map.set (PUNK_ID, "punk rock");
103 map.set (PUNK_ID, "hardcore");
104 map.set (PUNK_ID, "heavy");
105
106 /*jazz*/
107 map.set (JAZZ_ID, "jazz");
108
109 /*pop*/
110 map.set (POP_ID, "pop");
111
112 /*reggae*/
113 map.set (REGGAE_ID, "reggae");
114
115 /*soul*/
116 map.set (SOUL_ID, "soul");
117 map.set (SOUL_ID, "gospel");
118
119 /*techno*/
120 map.set (TECHNO_ID, "techno");
121 map.set (TECHNO_ID, "minimal");
122 map.set (TECHNO_ID, "trance");
123 map.set (TECHNO_ID, "chillout");
124 map.set (TECHNO_ID, "electronic");
125 map.set (TECHNO_ID, "electronica");
126 map.set (TECHNO_ID, "dance");
127
128 /*other*/
129 map.set (OTHER_ID, "other");
130 map.set (OTHER_ID, "african");
131 map.set (OTHER_ID, "alternative");
132 map.set (OTHER_ID, "ambient");
133 map.set (OTHER_ID, "asian");
134 map.set (OTHER_ID, "brazilian");
135 map.set (OTHER_ID, "celtic");
136 map.set (OTHER_ID, "christmas");
137 map.set (OTHER_ID, "folk");
138 map.set (OTHER_ID, "latin");
139 map.set (OTHER_ID, "oldies");
140 map.set (OTHER_ID, "soundtrack");
141 map.set (OTHER_ID, "traditional");
142 map.set (OTHER_ID, "world");
143
144 inverted_map = new HashMap<string, string> ();
145 foreach (var key in map.get_keys ())
146 {
147 var values_collection = map[key];
148 foreach (var val in values_collection)
149 {
150 inverted_map[val] = key;
151 }
152 }
153 }
154
155 public Collection<string> get_genre_synonyms (string genre_id)
156 {
157 if (map.contains (genre_id))
158 return map.get (genre_id);
159
160 return new LinkedList<string> ();
161 }
162
163 public string get_id_for_genre (string genre)
164 {
165 return inverted_map[genre] ?? OTHER_ID;
166 }
167 }
168}
169
0170
=== added file 'src/musicbaidu-daemon.vala'
--- src/musicbaidu-daemon.vala 1970-01-01 00:00:00 +0000
+++ src/musicbaidu-daemon.vala 2013-01-24 09:32:23 +0000
@@ -0,0 +1,274 @@
1/*
2 * Copyright (C) 2013 Kylin Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by Weihua Zhang <fly2high@126.com>
17 * Authored by liuxing <liuxingcs@yeah.net>
18 * Modified Information:
19 * Rewrite perform_search to search China music from music.baidu.com
20 */
21
22/*
23 * Copyright (C) 2011 Canonical Ltd
24 *
25 * This program is free software: you can redistribute it and/or modify
26 * it under the terms of the GNU General Public License version 3 as
27 * published by the Free Software Foundation.
28 *
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
33 *
34 * You should have received a copy of the GNU General Public License
35 * along with this program. If not, see <http://www.gnu.org/licenses/>.
36 *
37 * Authored by Alex Launi <alex.launi@canonical.com>
38 *
39 */
40using GLib;
41using Config;
42
43namespace Unity.MusicLens
44{
45
46static Application? app = null;
47static MusicBaiduScopeProxy? daemon = null;
48
49
50public class MusicBaiduScopeProxy : SimpleScope
51{
52 private MusicBaiduCollection collection;
53 private Unity.MusicPreview? music_preview;
54
55 public MusicBaiduScopeProxy ()
56 {
57 base ();
58
59 scope = new Unity.Scope ("/com/canonical/unity/scope/musicbaidu");
60 scope.search_in_global = true;
61 scope.activate_uri.connect (activate);
62 scope.preview_uri.connect (preview);
63
64 base.initialize ();
65
66 collection = new MusicBaiduCollection ();
67
68 try
69 {
70 scope.export ();
71 }
72 catch (GLib.IOError e)
73 {
74 stdout.printf (e.message);
75 }
76
77 }
78
79 protected override int num_results_without_search { get { return 100;
80 }
81 }
82 protected override int num_results_global_search { get { return 20;
83 }
84 }
85 protected override int num_results_lens_search { get { return 50;
86 }
87 }
88
89
90 public Unity.ActivationResponse activate (string uri)
91 {
92 /* launch the music baidu streaming client */
93 try
94 {
95
96 if(uri.has_prefix ("song://"))
97 {
98 AppInfo.launch_default_for_uri (uri.substring (7), null);//strip off "song://" from the uri
99 }
100 else if(uri.has_prefix ("album://"))
101 {
102 AppInfo.launch_default_for_uri (uri.substring (8), null);//strip off "album://" from the uri
103 }
104 }
105 catch (GLib.Error e)
106 {
107 warning ("Failed to open uri %s. %s", uri, e.message);
108 }
109 return new Unity.ActivationResponse (Unity.HandledType.HIDE_DASH);
110 }
111
112 public Unity.ActivationResponse download_album (string uri)
113 {
114 return activate (uri);
115 }
116
117 public Unity.Preview preview (string uri)
118 {
119 music_preview = null;
120 Album album = null;
121 SList<Track> tracks = null;
122
123
124 if(uri.has_prefix ("album://"))
125 {
126 collection.get_album_details(uri, out album, out tracks,null);
127 }
128 else if(uri.has_prefix ("song://"))
129 {
130 collection.get_song_details (uri, out album, out tracks,null);
131 }
132
133 if (album != null)
134 {
135
136 GLib.Icon? icon_file = null;
137 int i = 1;
138
139
140 var artwork_path = album.artwork_path;
141 icon_file = new GLib.FileIcon(File.new_for_uri (artwork_path));
142 music_preview = new Unity.MusicPreview (album.title, album.artist, icon_file);
143
144
145 if (tracks != null)
146 {
147 foreach (Track track in tracks)
148 {
149 TrackMetadata tm = new TrackMetadata ();
150 tm.uri = track.uri;
151 tm.track_no = i++; //FIXME: u1ms search doesn't provide track numbers *yet*, this will change soon
152 tm.title = track.title;
153 tm.length = track.duration;
154 music_preview.add_track (tm);
155 }
156 }
157
158 GLib.Icon? icon = new GLib.FileIcon (File.new_for_path (Config.DATADIR + "/icons/unity-icon-theme/places/svg/service-u1.svg"));
159 var download_action = new Unity.PreviewAction ("download_album", _("Download"), icon);
160
161 download_action.activated.connect (download_album);
162 music_preview.add_action (download_action);
163 }
164 return music_preview;
165 }
166
167 public override async void perform_search (LensSearch search,
168 SearchType search_type,
169 owned List<FilterParser> filters,
170 int max_results = -1,
171 Cancellable? cancellable = null)
172 {
173 if (is_search_empty (search))
174 return;
175
176 try
177 { debug ("model has %u rows before search", search.results_model.get_n_rows ());
178 yield collection.search (search,
179 search_type,
180 (owned) filters,
181 max_results,
182 cancellable);
183 debug ("model has %u rows after search", search.results_model.get_n_rows ());
184 }
185 catch (IOError e)
186 {
187 warning ("Failed to search for '%s': %s", search.search_string, e.message);
188 }
189 }
190
191}
192
193/* Check if a given well known DBus is owned.
194 * WARNING: This does sync IO! */
195public static bool dbus_name_has_owner (string name)
196{
197 try
198 {
199 bool has_owner;
200 DBusConnection bus = Bus.get_sync (BusType.SESSION);
201 Variant result = bus.call_sync ("org.freedesktop.DBus",
202 "/org/freedesktop/dbus",
203 "org.freedesktop.DBus",
204 "NameHasOwner",
205 new Variant ("(s)", name),
206 new VariantType ("(b)"),
207 DBusCallFlags.NO_AUTO_START,
208 -1);
209 result.get ("(b)", out has_owner);
210 return has_owner;
211 }
212 catch (Error e)
213 {
214 warning ("Unable to decide whether '%s' is running: %s", name, e.message);
215 }
216 return false;
217}
218
219
220public static int main (string[] args)
221{
222 GLib.Environment.set_prgname ("unity-musicbaidu-daemon");
223
224 /* Sort up locale to get translations but also sorting and
225 * punctuation right */
226 GLib.Intl.textdomain (Config.PACKAGE);
227 GLib.Intl.bindtextdomain (Config.PACKAGE, Config.LOCALEDIR);
228 GLib.Intl.bind_textdomain_codeset (Config.PACKAGE, "UTF-8");
229 GLib.Intl.setlocale(GLib.LocaleCategory.ALL, "");
230
231 /* Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=640714
232 * GApplication.register() call owns our DBus name in a sync manner
233 * making it race against GDBus' worker thread to export our
234 * objects on the bus before/after owning our name and receiving
235 * method calls on our objects (which may not yet be up!)*/
236 if (dbus_name_has_owner ("com.canonical.Unity.Scope.MusicBaidu"))
237 {
238 print ("Another instance of the China Music Daemon " +
239 "already appears to be running.\nBailing out.\n");
240 return 2;
241 }
242
243 /* Now register our DBus objects *before* acquiring the name!
244 * See above for reasons */
245 daemon = new MusicBaiduScopeProxy ();
246
247 /* Use GApplication directly for single instance app functionality */
248 app = new Application ("com.canonical.Unity.Scope.MusicBaidu",
249 ApplicationFlags.IS_SERVICE);
250 try
251 {
252 app.register ();
253 }
254 catch (Error e)
255 {
256 /* FIXME: We get this error if another daemon is already running,
257 * but it uses a generic error so we can't detect this reliably... */
258 print ("Failed to start the China music daemon: %s\n", e.message);
259 return 1;
260 }
261
262 if (app.get_is_remote ())
263 {
264 print ("Another instance of the China Music Daemon " +
265 "already appears to be running.\nBailing out.\n");
266 return 2;
267 }
268
269 /* Hold()ing the app makes sure the GApplication doesn't exit */
270 app.hold();
271 return app.run ();
272}
273
274} /* namespace */
0275
=== added file 'src/musicbaidu-search.vala'
--- src/musicbaidu-search.vala 1970-01-01 00:00:00 +0000
+++ src/musicbaidu-search.vala 2013-01-24 09:32:23 +0000
@@ -0,0 +1,607 @@
1/*
2 * Copyright (C) 2012 Kylin Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by Weihua Zhang <fly2high@126.com>
17 * Authored by liuxing <liuxingcs@yeah.net>
18 * Modified Information:
19 * 1. Add is_in_China to decide wether you are in China
20 * 2. Add MusicBaiduCollection.collection function to search China music from music.baidu.com
21 */
22
23/*
24 * Copyright (C) 2011 Canonical Ltd
25 *
26 * This program is free software: you can redistribute it and/or modify
27 * it under the terms of the GNU General Public License version 3 as
28 * published by the Free Software Foundation.
29 *
30 * This program is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
34 *
35 * You should have received a copy of the GNU General Public License
36 * along with this program. If not, see <http://www.gnu.org/licenses/>.
37 *
38 * Authored by Alex Launi <alex.launi@canonical.com>
39 *
40 */
41
42using GLib;
43
44
45namespace Unity.MusicLens
46{
47
48public class MusicBaiduCollection : Object
49{
50
51 private const string MUSICBAIDU_BASE_URI = "http://music.baidu.com/search/";
52 private static string IS_IN_CHINA = "Unknown";
53 private const string ASK_IP_SERVER_URI_ONE = "http://ip.chinaz.com/";
54 private const string ASK_IP_SERVER_URI_TWO = "http://www.123myip.co.uk/";
55
56 const string SONG_MISSING_ICON_PATH = "/usr/share/unity/themes/baidu_song_missing.png";
57
58
59 public MusicBaiduCollection ()
60 {
61
62 }
63
64 private bool is_in_China (Cancellable? cancellable = null)
65 {
66
67 if(IS_IN_CHINA == "Unknown")
68 {
69
70
71 File file = File.new_for_uri (ASK_IP_SERVER_URI_ONE);
72
73
74 uint8[] data;
75 string content;
76 string etag_out;
77
78
79 if( file.load_contents(cancellable, out data, out etag_out))
80 {
81
82 //Convert uint8[] to string.
83 content = (string) data;
84
85 var location = content.index_of("北京") + content.index_of("上海") + content.index_of("天津") + content.index_of("重庆") +
86 content.index_of("黑龙江") + content.index_of("吉林") + content.index_of("辽宁") + content.index_of("江苏") +
87 content.index_of("山东") + content.index_of("安徽") + content.index_of("河北") + content.index_of("河南") +
88 content.index_of("湖北") + content.index_of("湖南") + content.index_of("江西") + content.index_of("陕西") +
89 content.index_of("山西") + content.index_of("四川") + content.index_of("青海") + content.index_of("海南") +
90 content.index_of("广东") + content.index_of("贵州") + content.index_of("浙江") + content.index_of("福建") +
91 content.index_of("台湾") + content.index_of("甘肃") + content.index_of("云南") + content.index_of("内蒙古") +
92 content.index_of("宁夏") +content.index_of("新疆") + content.index_of("西藏") + content.index_of("广西") +
93 content.index_of("香港") + content.index_of("澳门");
94
95
96
97 if(location <0 )
98 {
99 //if ASK_IP_SERVER_URI_ONE server reposended failed,ask ASK_IP_SERVER_URI_TWO server.
100 file = File.new_for_uri (ASK_IP_SERVER_URI_TWO);
101
102 try
103 {
104
105 if( file.load_contents(cancellable, out data, out etag_out))
106 {
107
108 //Convert uint8[] to string.
109 content = (string) data;
110
111 location = content.index_of("China") ;
112 if(location > 0 )
113 {
114 IS_IN_CHINA = "Yes";
115 return true;
116 }
117 }
118
119 }
120 catch (Error e)
121 {
122 warning ("Error reading URL '%s': %s", file.get_uri (), e.message);
123 }
124 }
125 else
126 {
127 IS_IN_CHINA = "Yes";
128 return true;
129
130 }
131
132 }
133
134 }
135 else
136 {
137 return true;
138 }
139
140 return false;
141 }
142
143
144 public async void search (LensSearch search, SearchType search_type,
145 owned List<FilterParser> filters, int max_results = -1, Cancellable cancellable) throws IOError
146 {
147 File song_file;
148 File album_file;
149 uint8[] song_data;
150 uint8[] album_data;
151 string uri;
152 string etag_out;
153
154 if(!is_in_China(cancellable))
155 {
156 warning("Error can not search music from Baidu !");
157 return;
158 }
159
160 try {
161 //Search the first page song from Baidu music
162 uri = build_search_uri(search.search_string, filters, 0, 0);
163 if(uri != null)
164 {
165 song_file = File.new_for_uri (uri);
166 if(yield song_file.load_contents_async(cancellable, out song_data, out etag_out))
167 read_song_search_result_from_Baidu(search,song_data);
168 }
169 //Search the next page song from Baidu music
170 uri = build_search_uri(search.search_string, filters, 0, 1);
171 if(uri != null)
172 {
173 song_file = File.new_for_uri (uri);
174 if(yield song_file.load_contents_async(cancellable, out song_data, out etag_out))
175 read_song_search_result_from_Baidu(search,song_data);
176 }
177
178 //Search the first page album from Baidu music
179 uri = build_search_uri(search.search_string, filters, 1, 0);
180 if(uri != null)
181 {
182 album_file = File.new_for_uri (uri);
183 if(yield album_file.load_contents_async(cancellable, out album_data, out etag_out))
184 read_album_search_result_from_Baidu(search,album_data);
185 }
186 //Search the next page album from Baidu music
187 uri = build_search_uri(search.search_string, filters, 1, 1);
188 if(uri != null)
189 {
190 album_file = File.new_for_uri (uri);
191 if(yield album_file.load_contents_async(cancellable, out album_data, out etag_out))
192 read_album_search_result_from_Baidu(search,album_data);
193 }
194
195 }
196 catch (Error e)
197 {
198 warning ("Error getting result from baidu: %s(Failed to Search music from Baidu)!", e.message);
199 }
200
201 }
202
203 public void get_song_details (string uri, out Album album,out SList<Track> tracks,Cancellable? cancellable = null)
204 {
205
206 album = new Album ();
207 tracks = new SList<Track> ();
208 File song_file;
209 uint8[] song_data;
210 string http_uri = uri.substring (7);// strip off "song://" from the uri
211 string etag_out;
212
213
214 try
215 {
216
217 if(http_uri != null)
218 {
219 song_file = File.new_for_uri (http_uri);
220 if(song_file.load_contents(cancellable, out song_data, out etag_out))
221 {
222
223
224 string content;
225 //Convert uint8[] to string.
226 content = (string) song_data;
227
228 //Parse the contents to get results.
229
230 var iIndex = content.index_of("<div class=\"song");
231 if( iIndex == -1)
232 return;
233
234 var iEnd = content.index_of("</div>");
235 string song_name = content.substring(iIndex, iEnd-iIndex);
236 iIndex=-1;
237 iEnd=-1;
238 iIndex = song_name.index_of("name") + 6;
239 iEnd = song_name.substring(iIndex).index_of("</span>");
240 if( iIndex == -1)
241 return;
242
243 album.title = song_name.substring(iIndex, iEnd);
244 //Maybe song name append like this '审批文号:WJXXXXX',so must deal with.
245 iEnd = album.title.index_of("审批文号");
246 if( iEnd != -1)
247 album.title = album.title.substring(0,iEnd);
248
249
250 iIndex=-1;
251 iEnd=-1;
252 iIndex = content.index_of("<span class=\"author_list");
253 if( iIndex == -1)
254 return;
255
256 iEnd = content.index_of("</span>");
257 content = content.substring(iIndex, iEnd-iIndex);
258 iIndex=-1;
259 iEnd=-1;
260 iIndex = content.index_of("title=") + 7;
261 iEnd = content.substring(iIndex).index_of("\"");
262 if( iIndex == -1)
263 return;
264 album.artist = content.substring(iIndex,iEnd);
265
266 //Because song icon_hint in Baidu no exist,so set SONG_MISSING_ICON_PATH.
267 album.artwork_path = SONG_MISSING_ICON_PATH;
268
269 album.uri = uri;
270
271 var track = new Track ();
272 track.uri = uri;
273 track.title = album.title ;
274 tracks.append (track);
275
276
277 }
278 }
279 }
280 catch (Error e)
281 {
282 warning ("Error fetching details for '%s': %s", uri, e.message);
283 }
284
285 }
286
287 public void get_album_details(string uri, out Album album, out SList<Track> tracks,Cancellable? cancellable = null)
288 {
289 album = new Album ();
290 tracks = new SList<Track> ();
291 File song_file;
292 uint8[] song_data;
293 string http_uri = uri.substring (8);// strip off "album://" from the uri
294
295 string etag_out;
296
297
298 try
299 {
300
301 if(http_uri != null)
302 {
303 song_file = File.new_for_uri (http_uri);
304 if(song_file.load_contents(cancellable, out song_data, out etag_out))
305 {
306
307
308 string content;
309 //Convert uint8[] to string.
310 content = (string) song_data;
311
312 //Parse the contents to get results.
313 string album_content=content;
314
315
316 var iIndex = album_content.index_of("<div class=\"album-info");
317 if( iIndex == -1)
318 return;
319
320 var iEnd = album_content.substring(iIndex).index_of("</li>");
321 album_content = album_content.substring(iIndex, iEnd+5);
322 iIndex=-1;
323 iEnd=-1;
324
325 iIndex = album_content.index_of("img src=") + 9;
326 iEnd = album_content.substring(iIndex).index_of("\"");
327 if( iIndex == -1)
328 return;
329
330 album.artwork_path = album_content.substring(iIndex,iEnd);
331 album_content= album_content.substring(iIndex);
332
333
334 iIndex = album_content.index_of("album-name") + 12;
335 iEnd = album_content.substring(iIndex).index_of("</h2>");
336 if( iIndex == -1)
337 return;
338 album.title = album_content.substring(iIndex, iEnd);
339
340 iIndex = album_content.index_of("title=") + 7;
341 iEnd = album_content.substring(iIndex).index_of("\"");
342 if( iIndex == -1)
343 return;
344 album.artist = album_content.substring(iIndex,iEnd);
345
346 iIndex=-1;
347 iEnd=-1;
348 iIndex = content.index_of("<li data-songitem");
349 if( iIndex == -1)
350 return;
351
352 iEnd = content.last_index_of("<li data-songitem");
353 content = content.substring(iIndex, iEnd+3500- iIndex);
354 List<string> lilist = new List<string> ();
355 var liIndex = content.index_of("</li>");
356 while(liIndex != -1)
357 {
358 lilist.append(content.substring(0,liIndex));
359 content = content.substring(liIndex+5);
360 liIndex = content.index_of("</li>");
361 }
362
363
364 //Get album information.
365 foreach (string li in lilist)
366 {
367 //Get album uri.
368 iIndex = li.index_of("/song");
369 iEnd = li.substring(iIndex).index_of("\"");
370 if(iIndex==-1||iEnd==-1)
371 continue;
372
373 var track = new Track ();
374 //FIXME drag n drop uri needs to be the song:// link
375 track.uri = string.join("","song://http://music.baidu.com",li.substring(iIndex, iEnd));
376
377 //Get album title.
378 li = li.substring(iIndex);
379 iIndex = li.index_of("title=") + 7;
380 iEnd = li.substring(iIndex).index_of("\"");
381 track.title = li.substring(iIndex,iEnd);
382 //Maybe song name append like this '审批文号:WJXXXXX',so must deal with.
383 iEnd = track.title.index_of("审批文号");
384 if( iEnd != -1)
385 track.title = track.title.substring(0,iEnd);
386
387 tracks.append (track);
388 }
389
390 }
391 }
392 }
393 catch (Error e)
394 {
395 warning ("Error fetching details for '%s': %s", uri, e.message);
396 }
397
398 }
399
400
401
402 private void read_song_search_result_from_Baidu(LensSearch search, uint8[] data)
403 {
404 var results_model = search.results_model;
405
406 Track track = new Track ();
407 string content;
408 //Convert uint8[] to string)
409 content = (string) data;
410 //Parse the contents to get results
411 var iIndex = content.index_of("<li data-songitem");
412 if( iIndex == -1)
413 return;
414 var iEnd = content.last_index_of("<li data-songitem");
415 content = content.substring(iIndex, iEnd+3500- iIndex);
416
417 List<string> lilist = new List<string> ();
418 var liIndex = content.index_of("</li>");
419 while(liIndex != -1)
420 {
421 lilist.append(content.substring(0,liIndex));
422 content = content.substring(liIndex+5);
423 liIndex = content.index_of("</li>");
424 }
425
426 //Get song information.
427 foreach (string li in lilist)
428 {
429 iIndex = li.index_of("/song");
430 iEnd = li.substring(iIndex).index_of("\"");
431 if(iIndex==-1||iEnd==-1)
432 continue;
433 //FIXME drag n drop uri needs to be the song:// link
434 track.uri = string.join("","song://http://music.baidu.com",li.substring(iIndex, iEnd));
435
436 li = li.substring(iIndex);
437 iIndex = li.index_of("title=") + 7;
438 iEnd = li.substring(iIndex).index_of("\"");
439 track.title = li.substring(iIndex,iEnd);
440 //Maybe song name append like this '审批文号:WJXXXXX',so must deal with.
441 iEnd = track.title.index_of("审批文号");
442 if( iEnd != -1)
443 track.title = track.title.substring(0,iEnd);
444
445 li = li.substring(iIndex);
446 iIndex = li.index_of("title=") + 7;
447 iEnd = li.substring(iIndex).index_of("\"");
448 track.artist = li.substring(iIndex,iEnd);
449
450 li = li.substring(iIndex);
451 //Maybe song album no exist,so get album name between ">" and "<".
452 //Get album-title from behind the second ">".
453 iIndex = li.index_of("album-title");
454 li = li.substring(iIndex);
455 li = li.substring(li.index_of(">")+1);
456 iIndex = li.index_of(">") + 1;
457 iEnd = li.substring(iIndex).index_of("<");
458 var albumMaybe = li.substring(iIndex,iEnd);
459 li = li.substring(iIndex);
460 if(albumMaybe == null)
461 {
462 iIndex = li.index_of(">") + 1;
463 iEnd = li.substring(iIndex).index_of("</span>");
464 track.album = li.substring(iIndex,iEnd);
465 li = li.substring(iIndex);
466 }
467 else
468 track.album = albumMaybe;
469
470 var comment = string.join("",track.artist,track.album);
471
472 //Because song icon_hint in Baidu no exist,so add SONG_MISSING_ICON_PATH.
473 var icon_hint = SONG_MISSING_ICON_PATH;
474
475 if(track.title.up().index_of(search.search_string.up()) != -1)
476 {
477 results_model.append (
478 track.uri,
479 icon_hint,
480 0,
481 "text/html",
482 track.title,
483 comment,
484 track.uri);
485 }
486 }
487 }
488
489 private void read_album_search_result_from_Baidu(LensSearch search, uint8[] data)
490 {
491 var results_model = search.results_model;
492 Album album = new Album ();
493
494 string content;
495 //Convert uint8[] to string.
496 content = (string) data;
497 //Parse the contents to get results.
498
499 //Get album icon_hint.
500 var iIndex = content.index_of("<img org_src=");
501 if(iIndex == -1)
502 return;
503 var iEnd = content.last_index_of("<img org_src=");
504 content = content.substring(iIndex,iEnd+3200-iIndex);
505 List<string> lilist = new List<string> ();
506 var liIndex = content.index_of("</li>");
507 while(liIndex != -1)
508 {
509 lilist.append(content.substring(0,liIndex));
510 content = content.substring(liIndex+5);
511 liIndex = content.index_of("</li>");
512 }
513
514 //Get album information.
515 foreach (string li in lilist)
516 {
517 //Get album uri.
518 iIndex = li.index_of("img org_src=") + 13;
519 iEnd = li.substring(iIndex).index_of("\"");
520 var icon_hint = li.substring(iIndex,iEnd);
521 li = li.substring(iIndex);
522
523 iIndex = li.index_of("/album");
524 iEnd = li.substring(iIndex).index_of("\"");
525 // no found album
526 if(iIndex==-1||iEnd==-1)
527 continue;
528
529 //FIXME drag n drop uri needs to be the u1ms:// link.
530 album.uri = string.join("","album://http://music.baidu.com",li.substring(iIndex,iEnd));
531 li = li.substring(iIndex);
532
533 //Get album title.
534 iIndex = li.index_of("title=") + 7;
535 iEnd = li.substring(iIndex).index_of("\"");
536 album.title = li.substring(iIndex, iEnd);
537 //Maybe album title append like this '审批文号:WJXXXXX',so must deal with.
538 iEnd = album.title.index_of("审批文号");
539 if(iIndex != -1)
540 {
541 album.title = album.title.substring(0,iEnd);
542 }
543 li = li.substring(iIndex);
544
545 //Get album artist.
546 iIndex = li.index_of("title=") + 7;
547 iEnd = li.substring(iIndex).index_of("\"");
548 album.artist = li.substring(iIndex,iEnd);
549 li = li.substring(iIndex);
550
551 if(album.title.up().index_of(search.search_string.up()) != -1)
552 {
553 results_model.append (album.uri,
554 icon_hint,
555 1,
556 "audio-x-generic",
557 album.title,
558 album.artist,
559 album.uri);
560 }
561 }
562 }
563
564 /*
565 * Index = 0, songs
566 * Indes = 1, albums
567 */
568 private string? build_search_uri (string query, List<FilterParser> filters, int index, int page)
569 {
570
571 if(query.strip() == "")
572 return null;
573
574 string musicbaidu_base_uri = MUSICBAIDU_BASE_URI;
575 if (GLib.Environment.get_variable("MUSICBAIDU_URI") != null)
576 musicbaidu_base_uri = GLib.Environment.get_variable("MUSICBAIDU_URI");
577
578 StringBuilder uri = new StringBuilder (musicbaidu_base_uri);
579 if (index == 0)
580 uri.append ("song?key=");
581 else
582 uri.append ("album?key=");
583
584 //add query key
585 uri.append (Uri.escape_string (query, "", false));
586
587 //TODO: add filters of Chinese music
588 // no implement.
589
590 //At this moment, Baidu doesn't release API for filter and more search results
591 //20 results each time
592 if(page < 0)
593 {
594 uri.append ("&start=0&size=20");
595 }
596 else
597 {
598 string? str="";
599 str = "&start=%d&size=20".printf(page*20);
600 uri.append(str);
601 }
602
603 return uri.str;
604 }
605}
606
607}
0608
=== added file 'src/simple-scope.vala'
--- src/simple-scope.vala 1970-01-01 00:00:00 +0000
+++ src/simple-scope.vala 2013-01-24 09:32:23 +0000
@@ -0,0 +1,137 @@
1/*
2 * Copyright (C) 2011 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by Alex Launi <alex.launi@canonical.com>
17 *
18 */
19
20using GLib;
21
22namespace Unity.MusicLens
23{
24 public abstract class SimpleScope : Object
25 {
26 public Unity.Scope scope { get; protected set; }
27
28 protected abstract int num_results_without_search { get; }
29 protected abstract int num_results_global_search { get; }
30 protected abstract int num_results_lens_search { get; }
31
32 protected abstract async void perform_search (LensSearch search,
33 SearchType search_type,
34 owned List<FilterParser> filters,
35 int max_results = -1,
36 Cancellable? cancellable = null);
37
38 public SimpleScope ()
39 {
40 }
41
42 protected void initialize ()
43 {
44 /* Listen for filter changes */
45 scope.filters_changed.connect (() => {
46 scope.queue_search_changed (SearchType.DEFAULT);
47 });
48
49 scope.active_sources_changed.connect (() => {
50 scope.queue_search_changed (SearchType.DEFAULT);
51 });
52
53 /* No need to search if only the whitespace changes */
54 scope.generate_search_key.connect ((lens_search) => {
55 return lens_search.search_string.strip ();
56 });
57
58 /* Listen for changes to the lens search entry */
59 scope.search_changed.connect ((search, search_type, cancellable) => {
60 update_search_async.begin (search, search_type, cancellable);
61 });
62 }
63
64 private async void update_search_async (LensSearch search,
65 SearchType search_type,
66 Cancellable cancellable)
67 {
68 int max_results;
69 /*
70 * results for a global search from just hitting Super.
71 * Here we want to return a smaller number of results with 0 filters.
72 */
73 if (search_type == SearchType.GLOBAL)
74 max_results = num_results_global_search;
75 else if (is_search_empty (search))
76 max_results = num_results_without_search;
77 else
78 max_results = num_results_lens_search;
79
80 yield prepare_search (search, search_type, max_results, cancellable);
81 }
82
83 private async void prepare_search (LensSearch search,
84 SearchType search_type,
85 int max_results,
86 Cancellable cancellable)
87 {
88 var results_model = search.results_model;
89
90 List<FilterParser> filters = new List<FilterParser> ();
91 // don't apply filters to global searches
92 if (search_type != SearchType.GLOBAL)
93 {
94 Filter filter = scope.get_filter ("genre");
95 if (filter.filtering)
96 filters.append (new GenreFilterParser (filter as CheckOptionFilterCompact));
97
98 filter = scope.get_filter ("decade");
99 if (filter.filtering)
100 filters.append (new DecadeFilterParser (filter as MultiRangeFilter));
101 }
102
103 results_model.clear ();
104
105 // don't perform search is all sources are inactive
106 if (scope.sources.options.length () > 0 && scope.sources.filtering)
107 {
108 bool any_active = false;
109 foreach (var source in scope.sources.options)
110 {
111 if (source.active) any_active = true;
112 }
113 if (!any_active)
114 {
115 search.finished ();
116 return;
117 }
118 }
119
120 yield perform_search (search, search_type, (owned) filters, max_results, cancellable);
121
122 if (results_model.get_n_rows () == 0)
123 {
124 search.set_reply_hint ("no-results-hint",
125 _("Sorry, there is no music that matches your search."));
126 }
127
128 search.finished ();
129 }
130
131 protected bool is_search_empty (LensSearch search)
132 requires (search.search_string != null)
133 {
134 return search.search_string.strip () == "";
135 }
136 }
137}
0138
=== added file 'src/tdb.deps'
--- src/tdb.deps 1970-01-01 00:00:00 +0000
+++ src/tdb.deps 2013-01-24 09:32:23 +0000
@@ -0,0 +1,1 @@
1posix
02
=== added file 'src/tdb.vapi'
--- src/tdb.vapi 1970-01-01 00:00:00 +0000
+++ src/tdb.vapi 2013-01-24 09:32:23 +0000
@@ -0,0 +1,125 @@
1/* tdb.vapi
2 *
3 * Copyright (C) 2012 Canonical Ltd.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * Author:
20 * Michal Hruby <michal.hruby@canonical.com>
21 */
22
23[CCode (lower_case_cprefix = "tdb_", cheader_filename = "tdb.h")]
24namespace TDB {
25 /* Database Connection Handle */
26 [Compact]
27 [CCode (free_function = "tdb_close", cname = "TDB_CONTEXT", cprefix = "tdb_")]
28 public class Database {
29 [CCode (cname = "tdb_open")]
30 public Database (string name, int hash_size, TDB.OpenFlags tdb_flags, int open_flags, Posix.mode_t mode);
31 [CCode (cname = "tdb_open_ex")]
32 public Database.open_ex (string name, int hash_size, int tdb_flags, int open_flags, Posix.mode_t mode, TDB.LogFunc log_fn);
33
34 public int reopen ();
35 public static int reopen_all ();
36
37 public TDB.Error error ();
38 public unowned string errorstr ();
39
40 public TDB.Data fetch (TDB.Data key);
41 public int @delete (TDB.Data key);
42 public int store (TDB.Data key, TDB.Data dbuf, TDB.StoreType type_flag);
43 public TDB.Data firstkey ();
44 public TDB.Data nextkey (TDB.Data key);
45 public int traverse (TDB.TraverseFunc traverse_func);
46 public int exists (TDB.Data key);
47 public int lockkeys (TDB.Data[] keys);
48 public void unlockkeys ();
49 public int lockall ();
50 public void unlockall ();
51
52 public int chainlock (TDB.Data key);
53 public void chainunlock (TDB.Data key);
54 }
55
56 [CCode (cname = "TDB_DATA")]
57 [SimpleType]
58 public struct Data {
59 [CCode (array_length_cname = "dsize", array_length_type = "size_t", cname = "dptr")]
60 public unowned uint8[] data;
61 [CCode (cname = "dsize")]
62 public size_t data_size;
63 }
64
65 [CCode (cname = "tdb_null")]
66 public const TDB.Data NULL_DATA;
67
68 [CCode (has_target = false)]
69 public delegate void LogFunc (TDB.Database db, TDB.DebugLevel debug_level, string format, ...);
70
71 public delegate int TraverseFunc (TDB.Database db, TDB.Data key, TDB.Data @value);
72
73 [CCode (cname = "SQLITE_ANY")]
74 public const int ANY;
75
76 [CCode (cname = "enum tdb_debug_level", cprefix = "TDB_DEBUG_")]
77 public enum DebugLevel {
78 FATAL,
79 ERROR,
80 WARNING,
81 TRACE
82 }
83
84 [CCode (cname = "int", cprefix = "TDB_")]
85 public enum StoreType {
86 REPLACE,
87 INSERT,
88 MODIFY
89 }
90
91 [CCode (cname = "int", cprefix = "TDB_")]
92 public enum OpenFlags {
93 DEFAULT,
94 CLEAR_IF_FIRST,
95 INTERNAL,
96 NOLOCK,
97 NOMMAP,
98 CONVERT,
99 BIGENDIAN,
100 NOSYNC,
101 SEQNUM,
102 VOLATILE,
103 ALLOW_NESTING,
104 DISALLOW_NESTING,
105 INCOMPATIBLE_HASH
106 }
107
108 [CCode (cname = "enum TDB_ERROR", cprefix = "TDB_ERR_")]
109 public enum Error {
110 [CCode (cname = "TDB_SUCCESS")]
111 SUCCESS,
112 CORRUPT,
113 IO,
114 LOCK,
115 OOM,
116 EXISTS,
117 NOLOCK,
118 LOCK_TIMEOUT,
119 NOEXISTS,
120 EINVAL,
121 RDONLY,
122 NESTING
123 }
124}
125
0126
=== added file 'src/track.vala'
--- src/track.vala 1970-01-01 00:00:00 +0000
+++ src/track.vala 2013-01-24 09:32:23 +0000
@@ -0,0 +1,44 @@
1/*
2 * Copyright (C) 2011 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by Alex Launi <alex.launi@canonical.com>
17 *
18 */
19
20namespace Unity.MusicLens {
21
22 public enum TrackType
23 {
24 SONG,
25 RADIO
26 }
27
28 public class Track : GLib.Object
29 {
30 public TrackType type_track { get; set; }
31 public string title { get; set; }
32 public string uri { get; set; }
33 public string artist { get; set; }
34 public string mime_type { get; set; }
35 public string artwork_path { get; set; }
36 public string album { get; set; }
37 public string album_artist { get; set; }
38 public string genre { get; set; }
39 public int track_number { get; set; }
40 public int year { get; set; }
41 public int play_count { get; set; }
42 public int duration { get; set; }
43 }
44}

Subscribers

People subscribed via source and target branches

to all changes: