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

Proposed by liuxing
Status: Merged
Merged at revision: 144664
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+144664@code.launchpad.net
To post a comment you must log in.
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
1=== added directory '.bzr-builddeb'
2=== added file '.bzr-builddeb/default.conf'
3--- .bzr-builddeb/default.conf 1970-01-01 00:00:00 +0000
4+++ .bzr-builddeb/default.conf 2013-01-24 09:58:21 +0000
5@@ -0,0 +1,2 @@
6+[BUILDDEB]
7+split = True
8
9=== added file 'AUTHORS'
10--- AUTHORS 1970-01-01 00:00:00 +0000
11+++ AUTHORS 2013-01-24 09:58:21 +0000
12@@ -0,0 +1,4 @@
13+Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com>
14+Alex Launi <alex.launi@canonical.com>
15+Weihua Zhang <fly2high@126.com>
16+LiuXing <liuxingcs@yeah.net>
17
18=== renamed file 'AUTHORS' => 'AUTHORS.moved'
19=== added file 'COPYING'
20--- COPYING 1970-01-01 00:00:00 +0000
21+++ COPYING 2013-01-24 09:58:21 +0000
22@@ -0,0 +1,676 @@
23+
24+ GNU GENERAL PUBLIC LICENSE
25+ Version 3, 29 June 2007
26+
27+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
28+ Everyone is permitted to copy and distribute verbatim copies
29+ of this license document, but changing it is not allowed.
30+
31+ Preamble
32+
33+ The GNU General Public License is a free, copyleft license for
34+software and other kinds of works.
35+
36+ The licenses for most software and other practical works are designed
37+to take away your freedom to share and change the works. By contrast,
38+the GNU General Public License is intended to guarantee your freedom to
39+share and change all versions of a program--to make sure it remains free
40+software for all its users. We, the Free Software Foundation, use the
41+GNU General Public License for most of our software; it applies also to
42+any other work released this way by its authors. You can apply it to
43+your programs, too.
44+
45+ When we speak of free software, we are referring to freedom, not
46+price. Our General Public Licenses are designed to make sure that you
47+have the freedom to distribute copies of free software (and charge for
48+them if you wish), that you receive source code or can get it if you
49+want it, that you can change the software or use pieces of it in new
50+free programs, and that you know you can do these things.
51+
52+ To protect your rights, we need to prevent others from denying you
53+these rights or asking you to surrender the rights. Therefore, you have
54+certain responsibilities if you distribute copies of the software, or if
55+you modify it: responsibilities to respect the freedom of others.
56+
57+ For example, if you distribute copies of such a program, whether
58+gratis or for a fee, you must pass on to the recipients the same
59+freedoms that you received. You must make sure that they, too, receive
60+or can get the source code. And you must show them these terms so they
61+know their rights.
62+
63+ Developers that use the GNU GPL protect your rights with two steps:
64+(1) assert copyright on the software, and (2) offer you this License
65+giving you legal permission to copy, distribute and/or modify it.
66+
67+ For the developers' and authors' protection, the GPL clearly explains
68+that there is no warranty for this free software. For both users' and
69+authors' sake, the GPL requires that modified versions be marked as
70+changed, so that their problems will not be attributed erroneously to
71+authors of previous versions.
72+
73+ Some devices are designed to deny users access to install or run
74+modified versions of the software inside them, although the manufacturer
75+can do so. This is fundamentally incompatible with the aim of
76+protecting users' freedom to change the software. The systematic
77+pattern of such abuse occurs in the area of products for individuals to
78+use, which is precisely where it is most unacceptable. Therefore, we
79+have designed this version of the GPL to prohibit the practice for those
80+products. If such problems arise substantially in other domains, we
81+stand ready to extend this provision to those domains in future versions
82+of the GPL, as needed to protect the freedom of users.
83+
84+ Finally, every program is threatened constantly by software patents.
85+States should not allow patents to restrict development and use of
86+software on general-purpose computers, but in those that do, we wish to
87+avoid the special danger that patents applied to a free program could
88+make it effectively proprietary. To prevent this, the GPL assures that
89+patents cannot be used to render the program non-free.
90+
91+ The precise terms and conditions for copying, distribution and
92+modification follow.
93+
94+ TERMS AND CONDITIONS
95+
96+ 0. Definitions.
97+
98+ "This License" refers to version 3 of the GNU General Public License.
99+
100+ "Copyright" also means copyright-like laws that apply to other kinds of
101+works, such as semiconductor masks.
102+
103+ "The Program" refers to any copyrightable work licensed under this
104+License. Each licensee is addressed as "you". "Licensees" and
105+"recipients" may be individuals or organizations.
106+
107+ To "modify" a work means to copy from or adapt all or part of the work
108+in a fashion requiring copyright permission, other than the making of an
109+exact copy. The resulting work is called a "modified version" of the
110+earlier work or a work "based on" the earlier work.
111+
112+ A "covered work" means either the unmodified Program or a work based
113+on the Program.
114+
115+ To "propagate" a work means to do anything with it that, without
116+permission, would make you directly or secondarily liable for
117+infringement under applicable copyright law, except executing it on a
118+computer or modifying a private copy. Propagation includes copying,
119+distribution (with or without modification), making available to the
120+public, and in some countries other activities as well.
121+
122+ To "convey" a work means any kind of propagation that enables other
123+parties to make or receive copies. Mere interaction with a user through
124+a computer network, with no transfer of a copy, is not conveying.
125+
126+ An interactive user interface displays "Appropriate Legal Notices"
127+to the extent that it includes a convenient and prominently visible
128+feature that (1) displays an appropriate copyright notice, and (2)
129+tells the user that there is no warranty for the work (except to the
130+extent that warranties are provided), that licensees may convey the
131+work under this License, and how to view a copy of this License. If
132+the interface presents a list of user commands or options, such as a
133+menu, a prominent item in the list meets this criterion.
134+
135+ 1. Source Code.
136+
137+ The "source code" for a work means the preferred form of the work
138+for making modifications to it. "Object code" means any non-source
139+form of a work.
140+
141+ A "Standard Interface" means an interface that either is an official
142+standard defined by a recognized standards body, or, in the case of
143+interfaces specified for a particular programming language, one that
144+is widely used among developers working in that language.
145+
146+ The "System Libraries" of an executable work include anything, other
147+than the work as a whole, that (a) is included in the normal form of
148+packaging a Major Component, but which is not part of that Major
149+Component, and (b) serves only to enable use of the work with that
150+Major Component, or to implement a Standard Interface for which an
151+implementation is available to the public in source code form. A
152+"Major Component", in this context, means a major essential component
153+(kernel, window system, and so on) of the specific operating system
154+(if any) on which the executable work runs, or a compiler used to
155+produce the work, or an object code interpreter used to run it.
156+
157+ The "Corresponding Source" for a work in object code form means all
158+the source code needed to generate, install, and (for an executable
159+work) run the object code and to modify the work, including scripts to
160+control those activities. However, it does not include the work's
161+System Libraries, or general-purpose tools or generally available free
162+programs which are used unmodified in performing those activities but
163+which are not part of the work. For example, Corresponding Source
164+includes interface definition files associated with source files for
165+the work, and the source code for shared libraries and dynamically
166+linked subprograms that the work is specifically designed to require,
167+such as by intimate data communication or control flow between those
168+subprograms and other parts of the work.
169+
170+ The Corresponding Source need not include anything that users
171+can regenerate automatically from other parts of the Corresponding
172+Source.
173+
174+ The Corresponding Source for a work in source code form is that
175+same work.
176+
177+ 2. Basic Permissions.
178+
179+ All rights granted under this License are granted for the term of
180+copyright on the Program, and are irrevocable provided the stated
181+conditions are met. This License explicitly affirms your unlimited
182+permission to run the unmodified Program. The output from running a
183+covered work is covered by this License only if the output, given its
184+content, constitutes a covered work. This License acknowledges your
185+rights of fair use or other equivalent, as provided by copyright law.
186+
187+ You may make, run and propagate covered works that you do not
188+convey, without conditions so long as your license otherwise remains
189+in force. You may convey covered works to others for the sole purpose
190+of having them make modifications exclusively for you, or provide you
191+with facilities for running those works, provided that you comply with
192+the terms of this License in conveying all material for which you do
193+not control copyright. Those thus making or running the covered works
194+for you must do so exclusively on your behalf, under your direction
195+and control, on terms that prohibit them from making any copies of
196+your copyrighted material outside their relationship with you.
197+
198+ Conveying under any other circumstances is permitted solely under
199+the conditions stated below. Sublicensing is not allowed; section 10
200+makes it unnecessary.
201+
202+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
203+
204+ No covered work shall be deemed part of an effective technological
205+measure under any applicable law fulfilling obligations under article
206+11 of the WIPO copyright treaty adopted on 20 December 1996, or
207+similar laws prohibiting or restricting circumvention of such
208+measures.
209+
210+ When you convey a covered work, you waive any legal power to forbid
211+circumvention of technological measures to the extent such circumvention
212+is effected by exercising rights under this License with respect to
213+the covered work, and you disclaim any intention to limit operation or
214+modification of the work as a means of enforcing, against the work's
215+users, your or third parties' legal rights to forbid circumvention of
216+technological measures.
217+
218+ 4. Conveying Verbatim Copies.
219+
220+ You may convey verbatim copies of the Program's source code as you
221+receive it, in any medium, provided that you conspicuously and
222+appropriately publish on each copy an appropriate copyright notice;
223+keep intact all notices stating that this License and any
224+non-permissive terms added in accord with section 7 apply to the code;
225+keep intact all notices of the absence of any warranty; and give all
226+recipients a copy of this License along with the Program.
227+
228+ You may charge any price or no price for each copy that you convey,
229+and you may offer support or warranty protection for a fee.
230+
231+ 5. Conveying Modified Source Versions.
232+
233+ You may convey a work based on the Program, or the modifications to
234+produce it from the Program, in the form of source code under the
235+terms of section 4, provided that you also meet all of these conditions:
236+
237+ a) The work must carry prominent notices stating that you modified
238+ it, and giving a relevant date.
239+
240+ b) The work must carry prominent notices stating that it is
241+ released under this License and any conditions added under section
242+ 7. This requirement modifies the requirement in section 4 to
243+ "keep intact all notices".
244+
245+ c) You must license the entire work, as a whole, under this
246+ License to anyone who comes into possession of a copy. This
247+ License will therefore apply, along with any applicable section 7
248+ additional terms, to the whole of the work, and all its parts,
249+ regardless of how they are packaged. This License gives no
250+ permission to license the work in any other way, but it does not
251+ invalidate such permission if you have separately received it.
252+
253+ d) If the work has interactive user interfaces, each must display
254+ Appropriate Legal Notices; however, if the Program has interactive
255+ interfaces that do not display Appropriate Legal Notices, your
256+ work need not make them do so.
257+
258+ A compilation of a covered work with other separate and independent
259+works, which are not by their nature extensions of the covered work,
260+and which are not combined with it such as to form a larger program,
261+in or on a volume of a storage or distribution medium, is called an
262+"aggregate" if the compilation and its resulting copyright are not
263+used to limit the access or legal rights of the compilation's users
264+beyond what the individual works permit. Inclusion of a covered work
265+in an aggregate does not cause this License to apply to the other
266+parts of the aggregate.
267+
268+ 6. Conveying Non-Source Forms.
269+
270+ You may convey a covered work in object code form under the terms
271+of sections 4 and 5, provided that you also convey the
272+machine-readable Corresponding Source under the terms of this License,
273+in one of these ways:
274+
275+ a) Convey the object code in, or embodied in, a physical product
276+ (including a physical distribution medium), accompanied by the
277+ Corresponding Source fixed on a durable physical medium
278+ customarily used for software interchange.
279+
280+ b) Convey the object code in, or embodied in, a physical product
281+ (including a physical distribution medium), accompanied by a
282+ written offer, valid for at least three years and valid for as
283+ long as you offer spare parts or customer support for that product
284+ model, to give anyone who possesses the object code either (1) a
285+ copy of the Corresponding Source for all the software in the
286+ product that is covered by this License, on a durable physical
287+ medium customarily used for software interchange, for a price no
288+ more than your reasonable cost of physically performing this
289+ conveying of source, or (2) access to copy the
290+ Corresponding Source from a network server at no charge.
291+
292+ c) Convey individual copies of the object code with a copy of the
293+ written offer to provide the Corresponding Source. This
294+ alternative is allowed only occasionally and noncommercially, and
295+ only if you received the object code with such an offer, in accord
296+ with subsection 6b.
297+
298+ d) Convey the object code by offering access from a designated
299+ place (gratis or for a charge), and offer equivalent access to the
300+ Corresponding Source in the same way through the same place at no
301+ further charge. You need not require recipients to copy the
302+ Corresponding Source along with the object code. If the place to
303+ copy the object code is a network server, the Corresponding Source
304+ may be on a different server (operated by you or a third party)
305+ that supports equivalent copying facilities, provided you maintain
306+ clear directions next to the object code saying where to find the
307+ Corresponding Source. Regardless of what server hosts the
308+ Corresponding Source, you remain obligated to ensure that it is
309+ available for as long as needed to satisfy these requirements.
310+
311+ e) Convey the object code using peer-to-peer transmission, provided
312+ you inform other peers where the object code and Corresponding
313+ Source of the work are being offered to the general public at no
314+ charge under subsection 6d.
315+
316+ A separable portion of the object code, whose source code is excluded
317+from the Corresponding Source as a System Library, need not be
318+included in conveying the object code work.
319+
320+ A "User Product" is either (1) a "consumer product", which means any
321+tangible personal property which is normally used for personal, family,
322+or household purposes, or (2) anything designed or sold for incorporation
323+into a dwelling. In determining whether a product is a consumer product,
324+doubtful cases shall be resolved in favor of coverage. For a particular
325+product received by a particular user, "normally used" refers to a
326+typical or common use of that class of product, regardless of the status
327+of the particular user or of the way in which the particular user
328+actually uses, or expects or is expected to use, the product. A product
329+is a consumer product regardless of whether the product has substantial
330+commercial, industrial or non-consumer uses, unless such uses represent
331+the only significant mode of use of the product.
332+
333+ "Installation Information" for a User Product means any methods,
334+procedures, authorization keys, or other information required to install
335+and execute modified versions of a covered work in that User Product from
336+a modified version of its Corresponding Source. The information must
337+suffice to ensure that the continued functioning of the modified object
338+code is in no case prevented or interfered with solely because
339+modification has been made.
340+
341+ If you convey an object code work under this section in, or with, or
342+specifically for use in, a User Product, and the conveying occurs as
343+part of a transaction in which the right of possession and use of the
344+User Product is transferred to the recipient in perpetuity or for a
345+fixed term (regardless of how the transaction is characterized), the
346+Corresponding Source conveyed under this section must be accompanied
347+by the Installation Information. But this requirement does not apply
348+if neither you nor any third party retains the ability to install
349+modified object code on the User Product (for example, the work has
350+been installed in ROM).
351+
352+ The requirement to provide Installation Information does not include a
353+requirement to continue to provide support service, warranty, or updates
354+for a work that has been modified or installed by the recipient, or for
355+the User Product in which it has been modified or installed. Access to a
356+network may be denied when the modification itself materially and
357+adversely affects the operation of the network or violates the rules and
358+protocols for communication across the network.
359+
360+ Corresponding Source conveyed, and Installation Information provided,
361+in accord with this section must be in a format that is publicly
362+documented (and with an implementation available to the public in
363+source code form), and must require no special password or key for
364+unpacking, reading or copying.
365+
366+ 7. Additional Terms.
367+
368+ "Additional permissions" are terms that supplement the terms of this
369+License by making exceptions from one or more of its conditions.
370+Additional permissions that are applicable to the entire Program shall
371+be treated as though they were included in this License, to the extent
372+that they are valid under applicable law. If additional permissions
373+apply only to part of the Program, that part may be used separately
374+under those permissions, but the entire Program remains governed by
375+this License without regard to the additional permissions.
376+
377+ When you convey a copy of a covered work, you may at your option
378+remove any additional permissions from that copy, or from any part of
379+it. (Additional permissions may be written to require their own
380+removal in certain cases when you modify the work.) You may place
381+additional permissions on material, added by you to a covered work,
382+for which you have or can give appropriate copyright permission.
383+
384+ Notwithstanding any other provision of this License, for material you
385+add to a covered work, you may (if authorized by the copyright holders of
386+that material) supplement the terms of this License with terms:
387+
388+ a) Disclaiming warranty or limiting liability differently from the
389+ terms of sections 15 and 16 of this License; or
390+
391+ b) Requiring preservation of specified reasonable legal notices or
392+ author attributions in that material or in the Appropriate Legal
393+ Notices displayed by works containing it; or
394+
395+ c) Prohibiting misrepresentation of the origin of that material, or
396+ requiring that modified versions of such material be marked in
397+ reasonable ways as different from the original version; or
398+
399+ d) Limiting the use for publicity purposes of names of licensors or
400+ authors of the material; or
401+
402+ e) Declining to grant rights under trademark law for use of some
403+ trade names, trademarks, or service marks; or
404+
405+ f) Requiring indemnification of licensors and authors of that
406+ material by anyone who conveys the material (or modified versions of
407+ it) with contractual assumptions of liability to the recipient, for
408+ any liability that these contractual assumptions directly impose on
409+ those licensors and authors.
410+
411+ All other non-permissive additional terms are considered "further
412+restrictions" within the meaning of section 10. If the Program as you
413+received it, or any part of it, contains a notice stating that it is
414+governed by this License along with a term that is a further
415+restriction, you may remove that term. If a license document contains
416+a further restriction but permits relicensing or conveying under this
417+License, you may add to a covered work material governed by the terms
418+of that license document, provided that the further restriction does
419+not survive such relicensing or conveying.
420+
421+ If you add terms to a covered work in accord with this section, you
422+must place, in the relevant source files, a statement of the
423+additional terms that apply to those files, or a notice indicating
424+where to find the applicable terms.
425+
426+ Additional terms, permissive or non-permissive, may be stated in the
427+form of a separately written license, or stated as exceptions;
428+the above requirements apply either way.
429+
430+ 8. Termination.
431+
432+ You may not propagate or modify a covered work except as expressly
433+provided under this License. Any attempt otherwise to propagate or
434+modify it is void, and will automatically terminate your rights under
435+this License (including any patent licenses granted under the third
436+paragraph of section 11).
437+
438+ However, if you cease all violation of this License, then your
439+license from a particular copyright holder is reinstated (a)
440+provisionally, unless and until the copyright holder explicitly and
441+finally terminates your license, and (b) permanently, if the copyright
442+holder fails to notify you of the violation by some reasonable means
443+prior to 60 days after the cessation.
444+
445+ Moreover, your license from a particular copyright holder is
446+reinstated permanently if the copyright holder notifies you of the
447+violation by some reasonable means, this is the first time you have
448+received notice of violation of this License (for any work) from that
449+copyright holder, and you cure the violation prior to 30 days after
450+your receipt of the notice.
451+
452+ Termination of your rights under this section does not terminate the
453+licenses of parties who have received copies or rights from you under
454+this License. If your rights have been terminated and not permanently
455+reinstated, you do not qualify to receive new licenses for the same
456+material under section 10.
457+
458+ 9. Acceptance Not Required for Having Copies.
459+
460+ You are not required to accept this License in order to receive or
461+run a copy of the Program. Ancillary propagation of a covered work
462+occurring solely as a consequence of using peer-to-peer transmission
463+to receive a copy likewise does not require acceptance. However,
464+nothing other than this License grants you permission to propagate or
465+modify any covered work. These actions infringe copyright if you do
466+not accept this License. Therefore, by modifying or propagating a
467+covered work, you indicate your acceptance of this License to do so.
468+
469+ 10. Automatic Licensing of Downstream Recipients.
470+
471+ Each time you convey a covered work, the recipient automatically
472+receives a license from the original licensors, to run, modify and
473+propagate that work, subject to this License. You are not responsible
474+for enforcing compliance by third parties with this License.
475+
476+ An "entity transaction" is a transaction transferring control of an
477+organization, or substantially all assets of one, or subdividing an
478+organization, or merging organizations. If propagation of a covered
479+work results from an entity transaction, each party to that
480+transaction who receives a copy of the work also receives whatever
481+licenses to the work the party's predecessor in interest had or could
482+give under the previous paragraph, plus a right to possession of the
483+Corresponding Source of the work from the predecessor in interest, if
484+the predecessor has it or can get it with reasonable efforts.
485+
486+ You may not impose any further restrictions on the exercise of the
487+rights granted or affirmed under this License. For example, you may
488+not impose a license fee, royalty, or other charge for exercise of
489+rights granted under this License, and you may not initiate litigation
490+(including a cross-claim or counterclaim in a lawsuit) alleging that
491+any patent claim is infringed by making, using, selling, offering for
492+sale, or importing the Program or any portion of it.
493+
494+ 11. Patents.
495+
496+ A "contributor" is a copyright holder who authorizes use under this
497+License of the Program or a work on which the Program is based. The
498+work thus licensed is called the contributor's "contributor version".
499+
500+ A contributor's "essential patent claims" are all patent claims
501+owned or controlled by the contributor, whether already acquired or
502+hereafter acquired, that would be infringed by some manner, permitted
503+by this License, of making, using, or selling its contributor version,
504+but do not include claims that would be infringed only as a
505+consequence of further modification of the contributor version. For
506+purposes of this definition, "control" includes the right to grant
507+patent sublicenses in a manner consistent with the requirements of
508+this License.
509+
510+ Each contributor grants you a non-exclusive, worldwide, royalty-free
511+patent license under the contributor's essential patent claims, to
512+make, use, sell, offer for sale, import and otherwise run, modify and
513+propagate the contents of its contributor version.
514+
515+ In the following three paragraphs, a "patent license" is any express
516+agreement or commitment, however denominated, not to enforce a patent
517+(such as an express permission to practice a patent or covenant not to
518+sue for patent infringement). To "grant" such a patent license to a
519+party means to make such an agreement or commitment not to enforce a
520+patent against the party.
521+
522+ If you convey a covered work, knowingly relying on a patent license,
523+and the Corresponding Source of the work is not available for anyone
524+to copy, free of charge and under the terms of this License, through a
525+publicly available network server or other readily accessible means,
526+then you must either (1) cause the Corresponding Source to be so
527+available, or (2) arrange to deprive yourself of the benefit of the
528+patent license for this particular work, or (3) arrange, in a manner
529+consistent with the requirements of this License, to extend the patent
530+license to downstream recipients. "Knowingly relying" means you have
531+actual knowledge that, but for the patent license, your conveying the
532+covered work in a country, or your recipient's use of the covered work
533+in a country, would infringe one or more identifiable patents in that
534+country that you have reason to believe are valid.
535+
536+ If, pursuant to or in connection with a single transaction or
537+arrangement, you convey, or propagate by procuring conveyance of, a
538+covered work, and grant a patent license to some of the parties
539+receiving the covered work authorizing them to use, propagate, modify
540+or convey a specific copy of the covered work, then the patent license
541+you grant is automatically extended to all recipients of the covered
542+work and works based on it.
543+
544+ A patent license is "discriminatory" if it does not include within
545+the scope of its coverage, prohibits the exercise of, or is
546+conditioned on the non-exercise of one or more of the rights that are
547+specifically granted under this License. You may not convey a covered
548+work if you are a party to an arrangement with a third party that is
549+in the business of distributing software, under which you make payment
550+to the third party based on the extent of your activity of conveying
551+the work, and under which the third party grants, to any of the
552+parties who would receive the covered work from you, a discriminatory
553+patent license (a) in connection with copies of the covered work
554+conveyed by you (or copies made from those copies), or (b) primarily
555+for and in connection with specific products or compilations that
556+contain the covered work, unless you entered into that arrangement,
557+or that patent license was granted, prior to 28 March 2007.
558+
559+ Nothing in this License shall be construed as excluding or limiting
560+any implied license or other defenses to infringement that may
561+otherwise be available to you under applicable patent law.
562+
563+ 12. No Surrender of Others' Freedom.
564+
565+ If conditions are imposed on you (whether by court order, agreement or
566+otherwise) that contradict the conditions of this License, they do not
567+excuse you from the conditions of this License. If you cannot convey a
568+covered work so as to satisfy simultaneously your obligations under this
569+License and any other pertinent obligations, then as a consequence you may
570+not convey it at all. For example, if you agree to terms that obligate you
571+to collect a royalty for further conveying from those to whom you convey
572+the Program, the only way you could satisfy both those terms and this
573+License would be to refrain entirely from conveying the Program.
574+
575+ 13. Use with the GNU Affero General Public License.
576+
577+ Notwithstanding any other provision of this License, you have
578+permission to link or combine any covered work with a work licensed
579+under version 3 of the GNU Affero General Public License into a single
580+combined work, and to convey the resulting work. The terms of this
581+License will continue to apply to the part which is the covered work,
582+but the special requirements of the GNU Affero General Public License,
583+section 13, concerning interaction through a network will apply to the
584+combination as such.
585+
586+ 14. Revised Versions of this License.
587+
588+ The Free Software Foundation may publish revised and/or new versions of
589+the GNU General Public License from time to time. Such new versions will
590+be similar in spirit to the present version, but may differ in detail to
591+address new problems or concerns.
592+
593+ Each version is given a distinguishing version number. If the
594+Program specifies that a certain numbered version of the GNU General
595+Public License "or any later version" applies to it, you have the
596+option of following the terms and conditions either of that numbered
597+version or of any later version published by the Free Software
598+Foundation. If the Program does not specify a version number of the
599+GNU General Public License, you may choose any version ever published
600+by the Free Software Foundation.
601+
602+ If the Program specifies that a proxy can decide which future
603+versions of the GNU General Public License can be used, that proxy's
604+public statement of acceptance of a version permanently authorizes you
605+to choose that version for the Program.
606+
607+ Later license versions may give you additional or different
608+permissions. However, no additional obligations are imposed on any
609+author or copyright holder as a result of your choosing to follow a
610+later version.
611+
612+ 15. Disclaimer of Warranty.
613+
614+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
615+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
616+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
617+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
618+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
619+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
620+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
621+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
622+
623+ 16. Limitation of Liability.
624+
625+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
626+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
627+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
628+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
629+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
630+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
631+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
632+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
633+SUCH DAMAGES.
634+
635+ 17. Interpretation of Sections 15 and 16.
636+
637+ If the disclaimer of warranty and limitation of liability provided
638+above cannot be given local legal effect according to their terms,
639+reviewing courts shall apply local law that most closely approximates
640+an absolute waiver of all civil liability in connection with the
641+Program, unless a warranty or assumption of liability accompanies a
642+copy of the Program in return for a fee.
643+
644+ END OF TERMS AND CONDITIONS
645+
646+ How to Apply These Terms to Your New Programs
647+
648+ If you develop a new program, and you want it to be of the greatest
649+possible use to the public, the best way to achieve this is to make it
650+free software which everyone can redistribute and change under these terms.
651+
652+ To do so, attach the following notices to the program. It is safest
653+to attach them to the start of each source file to most effectively
654+state the exclusion of warranty; and each file should have at least
655+the "copyright" line and a pointer to where the full notice is found.
656+
657+ <one line to give the program's name and a brief idea of what it does.>
658+ Copyright (C) <year> <name of author>
659+
660+ This program is free software: you can redistribute it and/or modify
661+ it under the terms of the GNU General Public License as published by
662+ the Free Software Foundation, either version 3 of the License, or
663+ (at your option) any later version.
664+
665+ This program is distributed in the hope that it will be useful,
666+ but WITHOUT ANY WARRANTY; without even the implied warranty of
667+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
668+ GNU General Public License for more details.
669+
670+ You should have received a copy of the GNU General Public License
671+ along with this program. If not, see <http://www.gnu.org/licenses/>.
672+
673+Also add information on how to contact you by electronic and paper mail.
674+
675+ If the program does terminal interaction, make it output a short
676+notice like this when it starts in an interactive mode:
677+
678+ <program> Copyright (C) <year> <name of author>
679+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
680+ This is free software, and you are welcome to redistribute it
681+ under certain conditions; type `show c' for details.
682+
683+The hypothetical commands `show w' and `show c' should show the appropriate
684+parts of the General Public License. Of course, your program's commands
685+might be different; for a GUI interface, you would use an "about box".
686+
687+ You should also get your employer (if you work as a programmer) or school,
688+if any, to sign a "copyright disclaimer" for the program, if necessary.
689+For more information on this, and how to apply and follow the GNU GPL, see
690+<http://www.gnu.org/licenses/>.
691+
692+ The GNU General Public License does not permit incorporating your program
693+into proprietary programs. If your program is a subroutine library, you
694+may consider it more useful to permit linking proprietary applications with
695+the library. If this is what you want to do, use the GNU Lesser General
696+Public License instead of this License. But first, please read
697+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
698+
699
700=== renamed file 'COPYING' => 'COPYING.moved'
701=== added file 'ChangeLog'
702=== renamed file 'ChangeLog' => 'ChangeLog.moved'
703=== added file 'MAINTAINERS'
704--- MAINTAINERS 1970-01-01 00:00:00 +0000
705+++ MAINTAINERS 2013-01-24 09:58:21 +0000
706@@ -0,0 +1,2 @@
707+whzhang-kylin <fly2high@126.com>
708+liuxing-kylin <liuxingcs@yeah.net>
709
710=== renamed file 'MAINTAINERS' => 'MAINTAINERS.moved'
711=== added file 'Makefile.am'
712--- Makefile.am 1970-01-01 00:00:00 +0000
713+++ Makefile.am 2013-01-24 09:58:21 +0000
714@@ -0,0 +1,45 @@
715+SUBDIRS = src data po #tests
716+
717+#
718+# Install the music.lens and musicstore.scope files
719+#
720+# lens_in_files = music.lens.in
721+lensdir = $(LENSESDIR)/music
722+#lens_DATA = $(lens_in_files:.lens.in=.lens)
723+
724+scopedir = $(lensdir)
725+scope_DATA = musicbaidu.scope
726+
727+icondir = $(datadir)/unity/themes
728+
729+@INTLTOOL_LENS_RULE@
730+
731+DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall
732+
733+# ChangeLog file created at distcheck time
734+dist-hook:
735+ @if test -d "$(srcdir)/.bzr"; \
736+ then \
737+ echo Creating ChangeLog && \
738+ ( cd "$(top_srcdir)" && \
739+ echo '# Generated by Makefile. Do not edit.'; echo; \
740+ $(top_srcdir)/missing --run bzr log --gnu-changelog ) > ChangeLog.tmp \
741+ && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
742+ || (rm -f ChangeLog.tmp; \
743+ echo Failed to generate ChangeLog >&2 ); \
744+ else \
745+ echo Failed to generate ChangeLog: not a branch >&2; \
746+ fi
747+
748+EXTRA_DIST = \
749+ autogen.sh \
750+ $(lens_in_music) \
751+ $(scope_DATA) \
752+ AUTHORS \
753+ COPYING \
754+ MAINTAINERS \
755+ README
756+
757+# $(lens_DATA)
758+CLEANFILES =
759+
760
761=== renamed file 'Makefile.am' => 'Makefile.am.moved'
762=== added file 'NEWS'
763--- NEWS 1970-01-01 00:00:00 +0000
764+++ NEWS 2013-01-24 09:58:21 +0000
765@@ -0,0 +1,2 @@
766+
767+
768
769=== renamed file 'NEWS' => 'NEWS.moved'
770=== added file 'README'
771=== renamed file 'README' => 'README.moved'
772=== added file 'TESTS-TODO.txt'
773--- TESTS-TODO.txt 1970-01-01 00:00:00 +0000
774+++ TESTS-TODO.txt 2013-01-24 09:58:21 +0000
775@@ -0,0 +1,7 @@
776+Since testing lenses is dependant on multiple components in the system,
777+we use the `libunity-tool` which is able to talk to the lenses and examine
778+results they return.
779+
780+Currently this is not hooked into the build system, but you can run the tests
781+by invoking `libunity-tool --test-server-mode ./tests`
782+
783
784=== renamed file 'TESTS-TODO.txt' => 'TESTS-TODO.txt.moved'
785=== added file 'acinclude.m4'
786--- acinclude.m4 1970-01-01 00:00:00 +0000
787+++ acinclude.m4 2013-01-24 09:58:21 +0000
788@@ -0,0 +1,40 @@
789+dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
790+dnl
791+dnl example
792+dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
793+dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
794+
795+AC_DEFUN([AS_AC_EXPAND],
796+[
797+ EXP_VAR=[$1]
798+ FROM_VAR=[$2]
799+
800+ dnl first expand prefix and exec_prefix if necessary
801+ prefix_save=$prefix
802+ exec_prefix_save=$exec_prefix
803+
804+ dnl if no prefix given, then use /usr/local, the default prefix
805+ if test "x$prefix" = "xNONE"; then
806+ prefix=$ac_default_prefix
807+ fi
808+ dnl if no exec_prefix given, then use prefix
809+ if test "x$exec_prefix" = "xNONE"; then
810+ exec_prefix=$prefix
811+ fi
812+
813+ full_var="$FROM_VAR"
814+ dnl loop until it doesn't change anymore
815+ while true; do
816+ new_full_var="`eval echo $full_var`"
817+ if test "x$new_full_var"="x$full_var"; then break; fi
818+ full_var=$new_full_var
819+ done
820+
821+ dnl clean up
822+ full_var=$new_full_var
823+ AC_SUBST([$1], "$full_var")
824+
825+ dnl restore prefix and exec_prefix
826+ prefix=$prefix_save
827+ exec_prefix=$exec_prefix_save
828+])
829
830=== renamed file 'acinclude.m4' => 'acinclude.m4.moved'
831=== added file 'autogen.sh'
832--- autogen.sh 1970-01-01 00:00:00 +0000
833+++ autogen.sh 2013-01-24 09:58:21 +0000
834@@ -0,0 +1,13 @@
835+#!/bin/sh
836+
837+srcdir=`dirname $0`
838+
839+PKG_NAME="unity-china-music-scope"
840+
841+which gnome-autogen.sh || {
842+ echo "You need gnome-common from GNOME SVN"
843+ exit 1
844+}
845+
846+USE_GNOME2_MACROS=1 \
847+. gnome-autogen.sh
848
849=== renamed file 'autogen.sh' => 'autogen.sh.moved'
850=== added file 'configure.ac'
851--- configure.ac 1970-01-01 00:00:00 +0000
852+++ configure.ac 2013-01-24 09:58:21 +0000
853@@ -0,0 +1,155 @@
854+AC_INIT(unity-china-music-scope, 1.0.0, https://code.launchpad.net/unity-china-music-scope)
855+AC_COPYRIGHT([Copyright 2012-2013 Kylin Ltd
856+2011 Canonical Ltd])
857+
858+AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
859+
860+#####################################################
861+# Silent build rules
862+#####################################################
863+m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
864+
865+AC_PREREQ(2.59)
866+
867+AC_CONFIG_HEADERS([config.h])
868+
869+#####################################################
870+# Init the other things we depend on
871+#####################################################
872+AM_MAINTAINER_MODE
873+AM_PROG_VALAC([0.16.0])
874+AS_IF([test -z "$VALAC"], [AC_MSG_ERROR(["No valac compiler found."])])
875+AC_PROG_CC
876+AM_PROG_CC_C_O
877+AC_HEADER_STDC
878+
879+LT_INIT
880+AC_CONFIG_MACRO_DIR([m4])
881+
882+#############################################
883+# Gettext
884+#############################################
885+GETTEXT_PACKAGE="$PACKAGE"
886+AC_SUBST(GETTEXT_PACKAGE)
887+AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/po/LINGUAS'])
888+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [gettext domain])
889+AM_GLIB_GNU_GETTEXT
890+
891+# AM_GNOME_GETTEXT above substs $DATADIRNAME
892+# this is the directory where the *.{mo,gmo} files are installed
893+localedir='${prefix}/${DATADIRNAME}/locale'
894+AC_SUBST(localedir)
895+
896+IT_PROG_INTLTOOL([0.40.0])
897+
898+AC_DEFINE_UNQUOTED(LOCALE_DIR, "${PREFIX}/${DATADIRNAME}/locale",[Locale directory])
899+AC_DEFINE_UNQUOTED(DATADIR, "${PREFIX}/${DATADIRNAME}",[Data directory])
900+AC_DEFINE_UNQUOTED(PREFIXDIR, "${PREFIX}",[Prefix directory])
901+
902+AC_SUBST([libexecdir],['${PREFIX}/lib'])
903+# AC_DEFINE_UNQUOTED(libexecdir, "${PREFIX}",[Libexecdir directory])
904+
905+######################################################
906+# intltool rule for generating translated .lens file
907+######################################################
908+INTLTOOL_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 $< [$]@'
909+AC_SUBST(INTLTOOL_LENS_RULE)
910+
911+#####################################################
912+# Check for module and library dependancies
913+#####################################################
914+GLIB_REQUIRED=2.27
915+PKG_CHECK_MODULES(LENS_DAEMON,
916+ glib-2.0 >= $GLIB_REQUIRED
917+ gobject-2.0 >= $GLIB_REQUIRED
918+ gio-2.0 >= $GLIB_REQUIRED
919+ gio-unix-2.0 >= $GLIB_REQUIRED
920+ dee-1.0 >= 1.0.7
921+ sqlite3 >= 3.7.7
922+ gee-1.0
923+ json-glib-1.0
924+ unity >= 6.7
925+ tdb >= 1.2.6)
926+
927+PKG_CHECK_MODULES(PREVIEW_PLAYER,
928+ glib-2.0 >= $GLIB_REQUIRED
929+ gobject-2.0 >= $GLIB_REQUIRED
930+ gio-2.0 >= $GLIB_REQUIRED
931+ )
932+
933+AC_SUBST(LENS_DAEMON_CFLAGS)
934+AC_SUBST(LENS_DAEMON_LIBS)
935+AC_SUBST(PREVIEW_PLAYER_CFLAGS)
936+AC_SUBST(PREVIEW_PLAYER_LIBS)
937+
938+#####################################################
939+# local install for distcheck and stand-alone running
940+#####################################################
941+with_localinstall="no"
942+AC_ARG_ENABLE(localinstall,
943+ AS_HELP_STRING([--enable-localinstall],
944+ [Install all of the files locally instead of in system directories (for distcheck)]),
945+ with_localinstall=$enableval,
946+ with_localinstall=no)
947+
948+AM_CONDITIONAL([HAVE_LOCALINSTALL], [test "x$with_localinstall" = "xyes"])
949+
950+#####################################################
951+# Expand variables needed for config.vala
952+#####################################################
953+AS_AC_EXPAND(PREFIX, $prefix)
954+AC_SUBST(PREFIX)
955+
956+AS_AC_EXPAND(DATADIR, $datarootdir)
957+AC_SUBST(DATADIR)
958+
959+#####################################################
960+# Look for dbus service dir
961+#####################################################
962+if test "x$with_localinstall" = "xyes"; then
963+ DBUSSERVICEDIR="${datadir}/dbus-1/services/"
964+else
965+ DBUSSERVICEDIR=`$PKG_CONFIG --variable=session_bus_services_dir dbus-1`
966+fi
967+AC_SUBST(DBUSSERVICEDIR)
968+
969+#####################################################
970+# Look for correct Lenses dir
971+#####################################################
972+if test "x$with_localinstall" = "xyes"; then
973+ LENSESDIR="${datadir}/unity/lenses"
974+else
975+ LENSESDIR=`$PKG_CONFIG --variable=lensesdir unity`
976+fi
977+AC_SUBST(LENSESDIR)
978+
979+#####################################################
980+# Create the Makefiles
981+#####################################################
982+# music.lens.in
983+AC_CONFIG_FILES([
984+ Makefile
985+ data/Makefile
986+ src/Makefile
987+ src/config.vala
988+ po/Makefile.in
989+])
990+AC_OUTPUT
991+
992+#####################################################
993+# Output the results
994+#####################################################
995+AC_MSG_NOTICE([
996+
997+ Unity China Music Scope Daemon $VERSION
998+ -------------------------------
999+
1000+ Prefix : ${prefix}
1001+
1002+ Local install : ${with_localinstall}
1003+
1004+ Extra CFlags : ${CPPFLAGS} $MAINTAINER_CFLAGS
1005+ Extra ValaFlags : ${CPPFLAGS} $MAINTAINER_VALAFLAGS
1006+
1007+ Lenses Directory: ${LENSESDIR}
1008+])
1009
1010=== renamed file 'configure.ac' => 'configure.ac.moved'
1011=== added directory 'data'
1012=== renamed directory 'data' => 'data.moved'
1013=== added file 'data/Makefile.am'
1014--- data/Makefile.am 1970-01-01 00:00:00 +0000
1015+++ data/Makefile.am 2013-01-24 09:58:21 +0000
1016@@ -0,0 +1,19 @@
1017+dbus_servicesdir = $(DBUSSERVICEDIR)
1018+service_in_files = \
1019+ musicbaidu-scope.service.in
1020+
1021+icondir = $(datadir)/unity/themes
1022+icon_DATA = baidu_song_missing.png
1023+
1024+dbus_services_DATA = $(service_in_files:.service.in=.service)
1025+
1026+%.service: %.service.in
1027+ sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
1028+
1029+EXTRA_DIST = \
1030+ $(icon_DATA) \
1031+ $(service_in_files)
1032+
1033+CLEANFILES = \
1034+ musicbaidu-scope.service
1035+
1036
1037=== added file 'data/baidu_song_missing.png'
1038Binary files data/baidu_song_missing.png 1970-01-01 00:00:00 +0000 and data/baidu_song_missing.png 2013-01-24 09:58:21 +0000 differ
1039=== added file 'data/musicbaidu-scope.service.in'
1040--- data/musicbaidu-scope.service.in 1970-01-01 00:00:00 +0000
1041+++ data/musicbaidu-scope.service.in 2013-01-24 09:58:21 +0000
1042@@ -0,0 +1,3 @@
1043+[D-BUS Service]
1044+Name=com.canonical.Unity.Scope.MusicBaidu
1045+Exec=@libexecdir@/unity-musicbaidu-daemon
1046
1047=== added directory 'debian'
1048=== renamed directory 'debian' => 'debian.moved'
1049=== added file 'debian/changelog'
1050--- debian/changelog 1970-01-01 00:00:00 +0000
1051+++ debian/changelog 2013-01-24 09:58:21 +0000
1052@@ -0,0 +1,21 @@
1053+unity-china-music-scope (1.0.1-0ubuntu2) raring; urgency=low
1054+
1055+ * Updated file MAINTAINERS
1056+ * Updated file AUTHORS
1057+ * Updated file autogen.sh
1058+ * Updated file configure.ac
1059+
1060+ -- liuxing-kylin <liuxingcs@yeah.net> Tue, 24 Jan 2013 14:56:23 +0800
1061+
1062+unity-china-music-scope (1.0.1-0ubuntu1) raring; urgency=low
1063+
1064+ * Fix Another instance of the UbuntuOne Music Daemon
1065+ * already appears to be running. (LP:1103019)
1066+
1067+ -- whzhang-kylin <fly2high@126.com> Tue, 22 Jan 2013 16:42:57 +0800
1068+
1069+unity-china-music-scope (1.0.0-0ubuntu1) raring; urgency=low
1070+
1071+ * Upload to Ubuntu
1072+
1073+ -- whzhang-kylin <fly2high@126.com> Thu, 13 Dec 2012 09:29:34 +0800
1074
1075=== added file 'debian/compat'
1076--- debian/compat 1970-01-01 00:00:00 +0000
1077+++ debian/compat 2013-01-24 09:58:21 +0000
1078@@ -0,0 +1,1 @@
1079+9
1080
1081=== added file 'debian/control'
1082--- debian/control 1970-01-01 00:00:00 +0000
1083+++ debian/control 2013-01-24 09:58:21 +0000
1084@@ -0,0 +1,29 @@
1085+Source: unity-china-music-scope
1086+Section: gnome
1087+Priority: optional
1088+Maintainer: Ubuntu Kylin Team <ubuntukylin-members@lists.launchpad.net>
1089+Build-Depends: debhelper (>= 9),
1090+ pkg-config,
1091+ dh-translations,
1092+ dh-autoreconf,
1093+ valac (>= 0.16),
1094+ libglib2.0-dev,
1095+ libgee-dev,
1096+ libjson-glib-dev,
1097+ libdee-dev (>= 1.0.7),
1098+ libsqlite3-dev (>= 3.7.7),
1099+ libunity-dev (>= 6.8.0),
1100+ libtdb-dev (>= 1.2.6),
1101+ unity-lens-music (>= 6.8.1),
1102+Standards-Version: 3.9.4
1103+Homepage: https://launchpad.net/unity-china-music-scope
1104+Vcs-Bzr: https://code.launchpad.net/~ubuntukylin-members/unity-china-music-scope/unity-china-music-scope
1105+
1106+Package: unity-china-music-scope
1107+Architecture: any
1108+Depends: ${shlibs:Depends},
1109+ ${misc:Depends},
1110+Breaks: unity (<< 6.0)
1111+Description: China Music Online.
1112+ This package is used in Dash of Unity to show China music results
1113+ searched by Baidu.
1114
1115=== added file 'debian/copyright'
1116--- debian/copyright 1970-01-01 00:00:00 +0000
1117+++ debian/copyright 2013-01-24 09:58:21 +0000
1118@@ -0,0 +1,36 @@
1119+Format: http://dep.debian.net/deps/dep5/
1120+Upstream-Name: unity-china-music-scope
1121+Upstream-Contact: Jonas Zhang <fly2high@126.com>
1122+ liuxing <liuxingcs@yeah.net>
1123+Source: https://launchpad.net/unity-china-music-scope/
1124+
1125+Files: *
1126+Copyright: 2011 Canonical Ltd
1127+License: GPL-3
1128+ This program is free software: you can redistribute it and/or modify
1129+ it under the terms of the GNU General Public License version 3 as
1130+ published by the Free Software Foundation.
1131+ .
1132+ This program is distributed in the hope that it will be useful,
1133+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1134+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1135+ GNU General Public License for more details.
1136+ .
1137+ On Debian/Ubuntu systems, the full text of the GPL v3 can be found in
1138+ `/usr/share/common-licenses/GPL-3'
1139+
1140+Files: musicbaidu-daemon.vala musicbaidu-search.vala
1141+Copyright: 2013 Kylin Ltd
1142+License: GPL-3
1143+ This program is free software: you can redistribute it and/or modify
1144+ it under the terms of the GNU General Public License version 3 as
1145+ published by the Free Software Foundation.
1146+ .
1147+ This program is distributed in the hope that it will be useful,
1148+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1149+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1150+ GNU General Public License for more details.
1151+ .
1152+ On Debian/Ubuntu systems, the full text of the GPL v3 can be found in
1153+ `/usr/share/common-licenses/GPL-3'
1154+
1155
1156=== added file 'debian/rules'
1157--- debian/rules 1970-01-01 00:00:00 +0000
1158+++ debian/rules 2013-01-24 09:58:21 +0000
1159@@ -0,0 +1,16 @@
1160+#!/usr/bin/make -f
1161+# -*- makefile -*-
1162+
1163+# Uncomment this to turn on verbose mode.
1164+#export DH_VERBOSE=1
1165+
1166+export DEB_LDFLAGS_MAINT_APPEND = -Wl,-z,defs -Wl,--as-needed
1167+
1168+%:
1169+ dh $@ --with autoreconf
1170+
1171+# override_dh_autoreconf:
1172+# NOCONFIGURE=1 dh_autoreconf ./autogen.sh
1173+
1174+override_dh_install:
1175+ dh_install --fail-missing
1176
1177=== added file 'musicbaidu.scope'
1178--- musicbaidu.scope 1970-01-01 00:00:00 +0000
1179+++ musicbaidu.scope 2013-01-24 09:58:21 +0000
1180@@ -0,0 +1,4 @@
1181+[Scope]
1182+DBusName=com.canonical.Unity.Scope.MusicBaidu
1183+DBusPath=/com/canonical/unity/scope/musicbaidu
1184+
1185
1186=== renamed file 'musicbaidu.scope' => 'musicbaidu.scope.moved'
1187=== added directory 'po'
1188=== renamed directory 'po' => 'po.moved'
1189=== added file 'po/LINGUAS'
1190--- po/LINGUAS 1970-01-01 00:00:00 +0000
1191+++ po/LINGUAS 2013-01-24 09:58:21 +0000
1192@@ -0,0 +1,1 @@
1193+zh_CN
1194
1195=== added file 'po/Makefile.in.in'
1196--- po/Makefile.in.in 1970-01-01 00:00:00 +0000
1197+++ po/Makefile.in.in 2013-01-24 09:58:21 +0000
1198@@ -0,0 +1,222 @@
1199+# Makefile for program source directory in GNU NLS utilities package.
1200+# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
1201+# Copyright (C) 2004-2008 Rodney Dawes <dobey.pwns@gmail.com>
1202+#
1203+# This file may be copied and used freely without restrictions. It may
1204+# be used in projects which are not available under a GNU Public License,
1205+# but which still want to provide support for the GNU gettext functionality.
1206+#
1207+# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
1208+# instead of PACKAGE and to look for po2tbl in ./ not in intl/
1209+#
1210+# - Modified by jacob berkman <jacob@ximian.com> to install
1211+# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
1212+#
1213+# - Modified by Rodney Dawes <dobey.pwns@gmail.com> for use with intltool
1214+#
1215+# We have the following line for use by intltoolize:
1216+# INTLTOOL_MAKEFILE
1217+
1218+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
1219+PACKAGE = @PACKAGE@
1220+VERSION = @VERSION@
1221+
1222+SHELL = @SHELL@
1223+
1224+srcdir = @srcdir@
1225+top_srcdir = @top_srcdir@
1226+top_builddir = @top_builddir@
1227+VPATH = @srcdir@
1228+
1229+prefix = @prefix@
1230+exec_prefix = @exec_prefix@
1231+datadir = @datadir@
1232+datarootdir = @datarootdir@
1233+libdir = @libdir@
1234+DATADIRNAME = @DATADIRNAME@
1235+itlocaledir = $(prefix)/$(DATADIRNAME)/locale
1236+subdir = po
1237+install_sh = @install_sh@
1238+# Automake >= 1.8 provides @mkdir_p@.
1239+# Until it can be supposed, use the safe fallback:
1240+mkdir_p = $(install_sh) -d
1241+
1242+INSTALL = @INSTALL@
1243+INSTALL_DATA = @INSTALL_DATA@
1244+
1245+GMSGFMT = @GMSGFMT@
1246+MSGFMT = @MSGFMT@
1247+XGETTEXT = @XGETTEXT@
1248+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
1249+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
1250+MSGMERGE = INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
1251+GENPOT = INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
1252+
1253+ALL_LINGUAS = @ALL_LINGUAS@
1254+
1255+PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; else echo "$(ALL_LINGUAS)"; fi)
1256+
1257+USER_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)
1258+
1259+USE_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)
1260+
1261+POFILES=$(shell LINGUAS="$(PO_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done)
1262+
1263+DISTFILES = Makefile.in.in POTFILES.in $(POFILES)
1264+EXTRA_DISTFILES = ChangeLog POTFILES.skip Makevars LINGUAS
1265+
1266+POTFILES = \
1267+# This comment gets stripped out
1268+
1269+CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done)
1270+
1271+.SUFFIXES:
1272+.SUFFIXES: .po .pox .gmo .mo .msg .cat
1273+
1274+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
1275+INTLTOOL_V_MSGFMT = $(INTLTOOL__v_MSGFMT_$(V))
1276+INTLTOOL__v_MSGFMT_= $(INTLTOOL__v_MSGFMT_$(AM_DEFAULT_VERBOSITY))
1277+INTLTOOL__v_MSGFMT_0 = @echo " MSGFMT" $@;
1278+
1279+.po.pox:
1280+ $(MAKE) $(GETTEXT_PACKAGE).pot
1281+ $(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
1282+
1283+.po.mo:
1284+ $(INTLTOOL_V_MSGFMT)$(MSGFMT) -o $@ $<
1285+
1286+.po.gmo:
1287+ $(INTLTOOL_V_MSGFMT)file=`echo $* | sed 's,.*/,,'`.gmo \
1288+ && rm -f $$file && $(GMSGFMT) -o $$file $<
1289+
1290+.po.cat:
1291+ sed -f ../intl/po2msg.sed < $< > $*.msg \
1292+ && rm -f $@ && gencat $@ $*.msg
1293+
1294+
1295+all: all-@USE_NLS@
1296+
1297+all-yes: $(CATALOGS)
1298+all-no:
1299+
1300+$(GETTEXT_PACKAGE).pot: $(POTFILES)
1301+ $(GENPOT)
1302+
1303+install: install-data
1304+install-data: install-data-@USE_NLS@
1305+install-data-no: all
1306+install-data-yes: all
1307+ linguas="$(USE_LINGUAS)"; \
1308+ for lang in $$linguas; do \
1309+ dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
1310+ $(mkdir_p) $$dir; \
1311+ if test -r $$lang.gmo; then \
1312+ $(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
1313+ echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \
1314+ else \
1315+ $(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
1316+ echo "installing $(srcdir)/$$lang.gmo as" \
1317+ "$$dir/$(GETTEXT_PACKAGE).mo"; \
1318+ fi; \
1319+ if test -r $$lang.gmo.m; then \
1320+ $(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \
1321+ echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \
1322+ else \
1323+ if test -r $(srcdir)/$$lang.gmo.m ; then \
1324+ $(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \
1325+ $$dir/$(GETTEXT_PACKAGE).mo.m; \
1326+ echo "installing $(srcdir)/$$lang.gmo.m as" \
1327+ "$$dir/$(GETTEXT_PACKAGE).mo.m"; \
1328+ else \
1329+ true; \
1330+ fi; \
1331+ fi; \
1332+ done
1333+
1334+# Empty stubs to satisfy archaic automake needs
1335+dvi info ctags tags CTAGS TAGS ID:
1336+
1337+# Define this as empty until I found a useful application.
1338+install-exec installcheck:
1339+
1340+uninstall:
1341+ linguas="$(USE_LINGUAS)"; \
1342+ for lang in $$linguas; do \
1343+ rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
1344+ rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
1345+ done
1346+
1347+check: all $(GETTEXT_PACKAGE).pot
1348+ rm -f missing notexist
1349+ srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m
1350+ if [ -r missing -o -r notexist ]; then \
1351+ exit 1; \
1352+ fi
1353+
1354+mostlyclean:
1355+ rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
1356+ rm -f .intltool-merge-cache
1357+
1358+clean: mostlyclean
1359+
1360+distclean: clean
1361+ rm -f Makefile Makefile.in POTFILES stamp-it
1362+ rm -f *.mo *.msg *.cat *.cat.m *.gmo
1363+
1364+maintainer-clean: distclean
1365+ @echo "This command is intended for maintainers to use;"
1366+ @echo "it deletes files that may require special tools to rebuild."
1367+ rm -f Makefile.in.in
1368+
1369+distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
1370+dist distdir: $(DISTFILES)
1371+ dists="$(DISTFILES)"; \
1372+ extra_dists="$(EXTRA_DISTFILES)"; \
1373+ for file in $$extra_dists; do \
1374+ test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \
1375+ done; \
1376+ for file in $$dists; do \
1377+ test -f $$file || file="$(srcdir)/$$file"; \
1378+ ln $$file $(distdir) 2> /dev/null \
1379+ || cp -p $$file $(distdir); \
1380+ done
1381+
1382+update-po: Makefile
1383+ $(MAKE) $(GETTEXT_PACKAGE).pot
1384+ tmpdir=`pwd`; \
1385+ linguas="$(USE_LINGUAS)"; \
1386+ for lang in $$linguas; do \
1387+ echo "$$lang:"; \
1388+ result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \
1389+ if $$result; then \
1390+ if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
1391+ rm -f $$tmpdir/$$lang.new.po; \
1392+ else \
1393+ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
1394+ :; \
1395+ else \
1396+ echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
1397+ rm -f $$tmpdir/$$lang.new.po; \
1398+ exit 1; \
1399+ fi; \
1400+ fi; \
1401+ else \
1402+ echo "msgmerge for $$lang.gmo failed!"; \
1403+ rm -f $$tmpdir/$$lang.new.po; \
1404+ fi; \
1405+ done
1406+
1407+Makefile POTFILES: stamp-it
1408+ @if test ! -f $@; then \
1409+ rm -f stamp-it; \
1410+ $(MAKE) stamp-it; \
1411+ fi
1412+
1413+stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in
1414+ cd $(top_builddir) \
1415+ && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \
1416+ $(SHELL) ./config.status
1417+
1418+# Tell versions [3.59,3.63) of GNU make not to export all variables.
1419+# Otherwise a system limit (for SysV at least) may be exceeded.
1420+.NOEXPORT:
1421
1422=== added file 'po/POTFILES.in'
1423--- po/POTFILES.in 1970-01-01 00:00:00 +0000
1424+++ po/POTFILES.in 2013-01-24 09:58:21 +0000
1425@@ -0,0 +1,6 @@
1426+[encoding: UTF-8]
1427+src/musicbaidu-daemon.vala
1428+src/musicbaidu-search.vala
1429+src/simple-scope.vala
1430+[type: gettext/ini]
1431+
1432
1433=== added file 'po/POTFILES.skip'
1434--- po/POTFILES.skip 1970-01-01 00:00:00 +0000
1435+++ po/POTFILES.skip 2013-01-24 09:58:21 +0000
1436@@ -0,0 +1,2 @@
1437+src/musicbaidu-daemon.c
1438+src/simple-scope.c
1439
1440=== added file 'po/zh_CN.po'
1441--- po/zh_CN.po 1970-01-01 00:00:00 +0000
1442+++ po/zh_CN.po 2013-01-24 09:58:21 +0000
1443@@ -0,0 +1,26 @@
1444+# Chinese (Simplified) translation for unity-china-music-scope
1445+# Copyright (c) 2013 Ubuntu Kylin Members Team Contributors and Canonical Ltd 2011
1446+# This file is distributed under the same license as the unity-china-music-scope package.
1447+# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
1448+#
1449+msgid ""
1450+msgstr ""
1451+"Project-Id-Version: unity-china-music-scope\n"
1452+"Report-Msgid-Bugs-To: Weihua Zhang <fly2high@126.com>\n"
1453+"POT-Creation-Date: 2012-04-27 13:03+0000\n"
1454+"PO-Revision-Date: 2012-04-06 08:20+0000\n"
1455+"Last-Translator: Weihua Zhang <fly2high@126.com>\n"
1456+"Language-Team: Chinese (Simplified) <zh_CN@li.org>\n"
1457+"MIME-Version: 1.0\n"
1458+"Content-Type: text/plain; charset=UTF-8\n"
1459+"Content-Transfer-Encoding: 8bit\n"
1460+"X-Launchpad-Export-Date: 2012-05-08 10:33+0000\n"
1461+"X-Generator: Launchpad (build 15204)\n"
1462+
1463+#: ../src/musicbaidu-daemon.vala:159
1464+msgid "Download"
1465+msgstr "下载"
1466+
1467+#: ../src/simple-scope.vala:125
1468+msgid "Sorry, there is no music that matches your search."
1469+msgstr "对不起,没有找到匹配的音乐。"
1470
1471=== added directory 'src'
1472=== renamed directory 'src' => 'src.moved'
1473=== added file 'src/Makefile.am'
1474--- src/Makefile.am 1970-01-01 00:00:00 +0000
1475+++ src/Makefile.am 2013-01-24 09:58:21 +0000
1476@@ -0,0 +1,83 @@
1477+NULL =
1478+BUILT_SOURCES =
1479+CLEANFILES =
1480+EXTRA_DIST =
1481+
1482+DATADIR = $(datadir)
1483+
1484+libexec_PROGRAMS = \
1485+ unity-musicbaidu-daemon
1486+
1487+#===============================================
1488+# add musicbaidu defs
1489+unity_musicbaidu_daemon_CPPFLAGS = \
1490+ -DDATADIR=\"$(DATADIR)\" \
1491+ -DPKGDATADIR=\"$(PKGDATADIR)\" \
1492+ -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
1493+ -DG_LOG_DOMAIN=\"unity-musicbaidu-daemon\" \
1494+ $(LENS_DAEMON_CFLAGS) \
1495+ $(MAINTAINER_CFLAGS) \
1496+ -I$(srcdir) \
1497+ -g
1498+
1499+unity_musicbaidu_daemon_VALAFLAGS = \
1500+ --pkg json-glib-1.0 \
1501+ -C \
1502+ --pkg dee-1.0 \
1503+ --pkg sqlite3 \
1504+ --pkg unity \
1505+ --pkg gee-1.0 \
1506+ --pkg gio-2.0 \
1507+ --pkg gio-unix-2.0 \
1508+ --pkg glib-2.0 \
1509+ --vapidir $(srcdir) \
1510+ --pkg tdb \
1511+ --target-glib=2.26 \
1512+ $(MAINTAINER_VALAFLAGS)
1513+
1514+unity_musicbaidu_daemon_LDADD = \
1515+ $(LENS_DAEMON_LIBS) \
1516+ $(NULL)
1517+
1518+
1519+unity_musicbaidu_daemon_VALASOURCES = \
1520+ album.vala \
1521+ config.vala \
1522+ genre.vala \
1523+ filter-parser.vala \
1524+ filter-parser-decade.vala \
1525+ filter-parser-genre.vala \
1526+ musicbaidu-search.vala \
1527+ musicbaidu-daemon.vala \
1528+ simple-scope.vala \
1529+ track.vala
1530+
1531+unity_musicbaidu_daemon_SOURCES = \
1532+ $(unity_musicbaidu_daemon_VALASOURCES:.vala=.c) \
1533+ $(NULL)
1534+
1535+# end add musicbaidu defs
1536+#===============================================
1537+
1538+
1539+
1540+BUILT_SOURCES += \
1541+ unity_musicbaidu_daemon.vala.stamp
1542+
1543+EXTRA_DIST += \
1544+ unity_musicbaidu_daemon.vala.stamp \
1545+ $(unity_musicbaidu_daemon_VALASOURCES) \
1546+ tdb.vapi \
1547+ tdb.deps \
1548+ $(NULL)
1549+
1550+
1551+unity_musicbaidu_daemon.vala.stamp: $(unity_musicbaidu_daemon_VALASOURCES)
1552+ $(AM_V_GEN) $(VALAC) $(unity_musicbaidu_daemon_VALAFLAGS) $^
1553+ touch unity_musicbaidu_daemon.vala.stamp
1554+
1555+CLEANFILES += \
1556+ *.stamp \
1557+ $(unity_musicbaidu_daemon_VALASOURCES:.vala=.c) \
1558+ $(NULL)
1559+
1560
1561=== added file 'src/album.vala'
1562--- src/album.vala 1970-01-01 00:00:00 +0000
1563+++ src/album.vala 2013-01-24 09:58:21 +0000
1564@@ -0,0 +1,32 @@
1565+/*
1566+ * Copyright (C) 2011 Canonical Ltd
1567+ *
1568+ * This program is free software: you can redistribute it and/or modify
1569+ * it under the terms of the GNU General Public License version 3 as
1570+ * published by the Free Software Foundation.
1571+ *
1572+ * This program is distributed in the hope that it will be useful,
1573+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1574+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1575+ * GNU General Public License for more details.
1576+ *
1577+ * You should have received a copy of the GNU General Public License
1578+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1579+ *
1580+ * Authored by Alex Launi <alex.launi@canonical.com>
1581+ *
1582+ */
1583+
1584+using GLib;
1585+
1586+namespace Unity.MusicLens {
1587+
1588+ public class Album : GLib.Object
1589+ {
1590+ public string title { get; set; }
1591+ public string artist { get; set; }
1592+ public string uri { get; set; }
1593+ public string artwork_path { get; set; }
1594+ public string formatted_price { get; set; }
1595+ }
1596+}
1597\ No newline at end of file
1598
1599=== added file 'src/config.vala.in'
1600--- src/config.vala.in 1970-01-01 00:00:00 +0000
1601+++ src/config.vala.in 2013-01-24 09:58:21 +0000
1602@@ -0,0 +1,16 @@
1603+namespace Config {
1604+
1605+ const string PREFIX = "@prefix@";
1606+
1607+ const string DATADIR = "@DATADIR@";
1608+
1609+ const string PKGDATADIR = "@DATADIR@/unity";
1610+
1611+ const string BINDIR = "@prefix@/bin";
1612+
1613+ const string LOCALEDIR = "@DATADIR@/locale";
1614+
1615+ const string PACKAGE = "@PACKAGE@";
1616+
1617+ const string VERSION = "@VERSION@";
1618+}
1619
1620=== added file 'src/filter-parser-decade.vala'
1621--- src/filter-parser-decade.vala 1970-01-01 00:00:00 +0000
1622+++ src/filter-parser-decade.vala 2013-01-24 09:58:21 +0000
1623@@ -0,0 +1,38 @@
1624+/*
1625+ * Copyright (C) 2011 Canonical Ltd
1626+ *
1627+ * This program is free software: you can redistribute it and/or modify
1628+ * it under the terms of the GNU General Public License version 3 as
1629+ * published by the Free Software Foundation.
1630+ *
1631+ * This program is distributed in the hope that it will be useful,
1632+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1633+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1634+ * GNU General Public License for more details.
1635+ *
1636+ * You should have received a copy of the GNU General Public License
1637+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1638+ *
1639+ * Authored by Alex Launi <alex.launi@canonical.com>
1640+ *
1641+ */
1642+
1643+using GLib;
1644+
1645+namespace Unity.MusicLens {
1646+
1647+ public class DecadeFilterParser : FilterParser
1648+ {
1649+ public DecadeFilterParser (MultiRangeFilter filter)
1650+ {
1651+ base (filter);
1652+ }
1653+
1654+ public override string parse ()
1655+ {
1656+ return "";
1657+ }
1658+
1659+ protected override string id { get { return "decade"; } }
1660+ }
1661+}
1662\ No newline at end of file
1663
1664=== added file 'src/filter-parser-genre.vala'
1665--- src/filter-parser-genre.vala 1970-01-01 00:00:00 +0000
1666+++ src/filter-parser-genre.vala 2013-01-24 09:58:21 +0000
1667@@ -0,0 +1,54 @@
1668+/*
1669+ * Copyright (C) 2011 Canonical Ltd
1670+ *
1671+ * This program is free software: you can redistribute it and/or modify
1672+ * it under the terms of the GNU General Public License version 3 as
1673+ * published by the Free Software Foundation.
1674+ *
1675+ * This program is distributed in the hope that it will be useful,
1676+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1677+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1678+ * GNU General Public License for more details.
1679+ *
1680+ * You should have received a copy of the GNU General Public License
1681+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1682+ *
1683+ * Authored by Alex Launi <alex.launi@canonical.com>
1684+ *
1685+ */
1686+
1687+using GLib;
1688+
1689+namespace Unity.MusicLens {
1690+
1691+ public class GenreFilterParser : FilterParser
1692+ {
1693+ public GenreFilterParser (CheckOptionFilterCompact filter)
1694+ {
1695+ base (filter);
1696+ map = new Genre ();
1697+ }
1698+
1699+ public override string parse ()
1700+ {
1701+ return "";
1702+ }
1703+
1704+ protected override string id { get { return "genre"; } }
1705+ protected Genre map { get; private set; }
1706+
1707+ protected List<FilterOption> get_all_selected_genres ()
1708+ {
1709+ unowned List<FilterOption> options = (filter as CheckOptionFilterCompact).options;
1710+ var active = new List<FilterOption> ();
1711+
1712+ foreach (FilterOption option in options)
1713+ {
1714+ if (option.active)
1715+ active.append (option);
1716+ }
1717+
1718+ return active;
1719+ }
1720+ }
1721+}
1722
1723=== added file 'src/filter-parser.vala'
1724--- src/filter-parser.vala 1970-01-01 00:00:00 +0000
1725+++ src/filter-parser.vala 2013-01-24 09:58:21 +0000
1726@@ -0,0 +1,36 @@
1727+/*
1728+ * Copyright (C) 2011 Canonical Ltd
1729+ *
1730+ * This program is free software: you can redistribute it and/or modify
1731+ * it under the terms of the GNU General Public License version 3 as
1732+ * published by the Free Software Foundation.
1733+ *
1734+ * This program is distributed in the hope that it will be useful,
1735+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1736+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1737+ * GNU General Public License for more details.
1738+ *
1739+ * You should have received a copy of the GNU General Public License
1740+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1741+ *
1742+ * Authored by Alex Launi <alex.launi@canonical.com>
1743+ *
1744+ */
1745+
1746+using GLib;
1747+
1748+namespace Unity.MusicLens {
1749+
1750+ public abstract class FilterParser : Object
1751+ {
1752+ public FilterParser (Filter filter)
1753+ {
1754+ this.filter = filter;
1755+ }
1756+
1757+ public Filter filter { get; protected set; }
1758+
1759+ public abstract string id { get;}
1760+ public abstract string parse ();
1761+ }
1762+}
1763\ No newline at end of file
1764
1765=== added file 'src/genre.vala'
1766--- src/genre.vala 1970-01-01 00:00:00 +0000
1767+++ src/genre.vala 2013-01-24 09:58:21 +0000
1768@@ -0,0 +1,169 @@
1769+/*
1770+ * Copyright (C) 2011 Canonical Ltd
1771+ *
1772+ * This program is free software: you can redistribute it and/or modify
1773+ * it under the terms of the GNU General Public License version 3 as
1774+ * published by the Free Software Foundation.
1775+ *
1776+ * This program is distributed in the hope that it will be useful,
1777+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1778+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1779+ * GNU General Public License for more details.
1780+ *
1781+ * You should have received a copy of the GNU General Public License
1782+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1783+ *
1784+ * Authored by Alex Launi <alex.launi@canonical.com>
1785+ *
1786+ */
1787+
1788+using Gee;
1789+
1790+namespace Unity.MusicLens {
1791+
1792+ public class Genre : GLib.Object
1793+ {
1794+ public static const string BLUES_ID = "blues";
1795+ public static const string CLASSIC_ID = "classic";
1796+ public static const string COUNTRY_ID = "country";
1797+ public static const string DISCO_ID = "disco";
1798+ public static const string FUNK_ID = "funk";
1799+ public static const string ROCK_ID = "rock";
1800+ public static const string METAL_ID = "metal";
1801+ public static const string HIPHOP_ID = "hip-hop";
1802+ public static const string HOUSE_ID = "house";
1803+ public static const string NEWWAVE_ID = "new-wave";
1804+ public static const string RANDB_ID = "r-and-b";
1805+ public static const string PUNK_ID = "punk";
1806+ public static const string JAZZ_ID = "jazz";
1807+ public static const string POP_ID = "pop";
1808+ public static const string REGGAE_ID = "reggae";
1809+ public static const string SOUL_ID = "soul";
1810+ public static const string TECHNO_ID = "techno";
1811+ public static const string OTHER_ID = "other";
1812+
1813+ private static TreeMultiMap<string, string> map;
1814+ private static Map<string, string> inverted_map;
1815+
1816+ static construct
1817+ {
1818+ map = new TreeMultiMap<string, string> ();
1819+
1820+ /* blues */
1821+ map.set (BLUES_ID, "blues");
1822+
1823+ /* classic */
1824+ map.set (CLASSIC_ID, "classic");
1825+ map.set (CLASSIC_ID, "classical");
1826+ map.set (CLASSIC_ID, "opera");
1827+
1828+ /* country */
1829+ map.set (COUNTRY_ID, "country");
1830+
1831+ /* disco */
1832+ map.set (DISCO_ID, "disco");
1833+
1834+ /* funk */
1835+ map.set (FUNK_ID, "funk");
1836+
1837+ /* rock */
1838+ map.set (ROCK_ID, "rock");
1839+ map.set (ROCK_ID, "heavy");
1840+ map.set (ROCK_ID, "hard");
1841+ map.set (ROCK_ID, "rock and roll");
1842+
1843+ /* metal */
1844+ map.set (METAL_ID, "metal");
1845+ map.set (METAL_ID, "heavy");
1846+ map.set (METAL_ID, "heavy metal");
1847+
1848+ /*hip hop */
1849+ map.set (HIPHOP_ID, "hip-hop");
1850+ map.set (HIPHOP_ID, "rap");
1851+ map.set (HIPHOP_ID, "rap & hip hop");
1852+
1853+ /*house*/
1854+ map.set (HOUSE_ID, "house");
1855+ map.set (HOUSE_ID, "chillout");
1856+ map.set (HOUSE_ID, "minimal");
1857+ map.set (HOUSE_ID, "hard");
1858+ map.set (HOUSE_ID, "electronic");
1859+ map.set (HOUSE_ID, "dance");
1860+
1861+ /*new wave*/
1862+ map.set (NEWWAVE_ID, "new-wave");
1863+
1864+ /*r-and-b*/
1865+ map.set (RANDB_ID, "r-and-b");
1866+ map.set (RANDB_ID, "r&b");
1867+
1868+ /*punk*/
1869+ map.set (PUNK_ID, "punk");
1870+ map.set (PUNK_ID, "punk rock");
1871+ map.set (PUNK_ID, "hardcore");
1872+ map.set (PUNK_ID, "heavy");
1873+
1874+ /*jazz*/
1875+ map.set (JAZZ_ID, "jazz");
1876+
1877+ /*pop*/
1878+ map.set (POP_ID, "pop");
1879+
1880+ /*reggae*/
1881+ map.set (REGGAE_ID, "reggae");
1882+
1883+ /*soul*/
1884+ map.set (SOUL_ID, "soul");
1885+ map.set (SOUL_ID, "gospel");
1886+
1887+ /*techno*/
1888+ map.set (TECHNO_ID, "techno");
1889+ map.set (TECHNO_ID, "minimal");
1890+ map.set (TECHNO_ID, "trance");
1891+ map.set (TECHNO_ID, "chillout");
1892+ map.set (TECHNO_ID, "electronic");
1893+ map.set (TECHNO_ID, "electronica");
1894+ map.set (TECHNO_ID, "dance");
1895+
1896+ /*other*/
1897+ map.set (OTHER_ID, "other");
1898+ map.set (OTHER_ID, "african");
1899+ map.set (OTHER_ID, "alternative");
1900+ map.set (OTHER_ID, "ambient");
1901+ map.set (OTHER_ID, "asian");
1902+ map.set (OTHER_ID, "brazilian");
1903+ map.set (OTHER_ID, "celtic");
1904+ map.set (OTHER_ID, "christmas");
1905+ map.set (OTHER_ID, "folk");
1906+ map.set (OTHER_ID, "latin");
1907+ map.set (OTHER_ID, "oldies");
1908+ map.set (OTHER_ID, "soundtrack");
1909+ map.set (OTHER_ID, "traditional");
1910+ map.set (OTHER_ID, "world");
1911+
1912+ inverted_map = new HashMap<string, string> ();
1913+ foreach (var key in map.get_keys ())
1914+ {
1915+ var values_collection = map[key];
1916+ foreach (var val in values_collection)
1917+ {
1918+ inverted_map[val] = key;
1919+ }
1920+ }
1921+ }
1922+
1923+ public Collection<string> get_genre_synonyms (string genre_id)
1924+ {
1925+ if (map.contains (genre_id))
1926+ return map.get (genre_id);
1927+
1928+ return new LinkedList<string> ();
1929+ }
1930+
1931+ public string get_id_for_genre (string genre)
1932+ {
1933+ return inverted_map[genre] ?? OTHER_ID;
1934+ }
1935+ }
1936+}
1937+
1938
1939=== added file 'src/musicbaidu-daemon.vala'
1940--- src/musicbaidu-daemon.vala 1970-01-01 00:00:00 +0000
1941+++ src/musicbaidu-daemon.vala 2013-01-24 09:58:21 +0000
1942@@ -0,0 +1,274 @@
1943+/*
1944+ * Copyright (C) 2013 Kylin Ltd
1945+ *
1946+ * This program is free software: you can redistribute it and/or modify
1947+ * it under the terms of the GNU General Public License version 3 as
1948+ * published by the Free Software Foundation.
1949+ *
1950+ * This program is distributed in the hope that it will be useful,
1951+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1952+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1953+ * GNU General Public License for more details.
1954+ *
1955+ * You should have received a copy of the GNU General Public License
1956+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1957+ *
1958+ * Authored by Weihua Zhang <fly2high@126.com>
1959+ * Authored by liuxing <liuxingcs@yeah.net>
1960+ * Modified Information:
1961+ * Rewrite perform_search to search China music from music.baidu.com
1962+ */
1963+
1964+/*
1965+ * Copyright (C) 2011 Canonical Ltd
1966+ *
1967+ * This program is free software: you can redistribute it and/or modify
1968+ * it under the terms of the GNU General Public License version 3 as
1969+ * published by the Free Software Foundation.
1970+ *
1971+ * This program is distributed in the hope that it will be useful,
1972+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1973+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1974+ * GNU General Public License for more details.
1975+ *
1976+ * You should have received a copy of the GNU General Public License
1977+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1978+ *
1979+ * Authored by Alex Launi <alex.launi@canonical.com>
1980+ *
1981+ */
1982+using GLib;
1983+using Config;
1984+
1985+namespace Unity.MusicLens
1986+{
1987+
1988+static Application? app = null;
1989+static MusicBaiduScopeProxy? daemon = null;
1990+
1991+
1992+public class MusicBaiduScopeProxy : SimpleScope
1993+{
1994+ private MusicBaiduCollection collection;
1995+ private Unity.MusicPreview? music_preview;
1996+
1997+ public MusicBaiduScopeProxy ()
1998+ {
1999+ base ();
2000+
2001+ scope = new Unity.Scope ("/com/canonical/unity/scope/musicbaidu");
2002+ scope.search_in_global = true;
2003+ scope.activate_uri.connect (activate);
2004+ scope.preview_uri.connect (preview);
2005+
2006+ base.initialize ();
2007+
2008+ collection = new MusicBaiduCollection ();
2009+
2010+ try
2011+ {
2012+ scope.export ();
2013+ }
2014+ catch (GLib.IOError e)
2015+ {
2016+ stdout.printf (e.message);
2017+ }
2018+
2019+ }
2020+
2021+ protected override int num_results_without_search { get { return 100;
2022+ }
2023+ }
2024+ protected override int num_results_global_search { get { return 20;
2025+ }
2026+ }
2027+ protected override int num_results_lens_search { get { return 50;
2028+ }
2029+ }
2030+
2031+
2032+ public Unity.ActivationResponse activate (string uri)
2033+ {
2034+ /* launch the music baidu streaming client */
2035+ try
2036+ {
2037+
2038+ if(uri.has_prefix ("song://"))
2039+ {
2040+ AppInfo.launch_default_for_uri (uri.substring (7), null);//strip off "song://" from the uri
2041+ }
2042+ else if(uri.has_prefix ("album://"))
2043+ {
2044+ AppInfo.launch_default_for_uri (uri.substring (8), null);//strip off "album://" from the uri
2045+ }
2046+ }
2047+ catch (GLib.Error e)
2048+ {
2049+ warning ("Failed to open uri %s. %s", uri, e.message);
2050+ }
2051+ return new Unity.ActivationResponse (Unity.HandledType.HIDE_DASH);
2052+ }
2053+
2054+ public Unity.ActivationResponse download_album (string uri)
2055+ {
2056+ return activate (uri);
2057+ }
2058+
2059+ public Unity.Preview preview (string uri)
2060+ {
2061+ music_preview = null;
2062+ Album album = null;
2063+ SList<Track> tracks = null;
2064+
2065+
2066+ if(uri.has_prefix ("album://"))
2067+ {
2068+ collection.get_album_details(uri, out album, out tracks,null);
2069+ }
2070+ else if(uri.has_prefix ("song://"))
2071+ {
2072+ collection.get_song_details (uri, out album, out tracks,null);
2073+ }
2074+
2075+ if (album != null)
2076+ {
2077+
2078+ GLib.Icon? icon_file = null;
2079+ int i = 1;
2080+
2081+
2082+ var artwork_path = album.artwork_path;
2083+ icon_file = new GLib.FileIcon(File.new_for_uri (artwork_path));
2084+ music_preview = new Unity.MusicPreview (album.title, album.artist, icon_file);
2085+
2086+
2087+ if (tracks != null)
2088+ {
2089+ foreach (Track track in tracks)
2090+ {
2091+ TrackMetadata tm = new TrackMetadata ();
2092+ tm.uri = track.uri;
2093+ tm.track_no = i++; //FIXME: u1ms search doesn't provide track numbers *yet*, this will change soon
2094+ tm.title = track.title;
2095+ tm.length = track.duration;
2096+ music_preview.add_track (tm);
2097+ }
2098+ }
2099+
2100+ GLib.Icon? icon = new GLib.FileIcon (File.new_for_path (Config.DATADIR + "/icons/unity-icon-theme/places/svg/service-u1.svg"));
2101+ var download_action = new Unity.PreviewAction ("download_album", _("Download"), icon);
2102+
2103+ download_action.activated.connect (download_album);
2104+ music_preview.add_action (download_action);
2105+ }
2106+ return music_preview;
2107+ }
2108+
2109+ public override async void perform_search (LensSearch search,
2110+ SearchType search_type,
2111+ owned List<FilterParser> filters,
2112+ int max_results = -1,
2113+ Cancellable? cancellable = null)
2114+ {
2115+ if (is_search_empty (search))
2116+ return;
2117+
2118+ try
2119+ { debug ("model has %u rows before search", search.results_model.get_n_rows ());
2120+ yield collection.search (search,
2121+ search_type,
2122+ (owned) filters,
2123+ max_results,
2124+ cancellable);
2125+ debug ("model has %u rows after search", search.results_model.get_n_rows ());
2126+ }
2127+ catch (IOError e)
2128+ {
2129+ warning ("Failed to search for '%s': %s", search.search_string, e.message);
2130+ }
2131+ }
2132+
2133+}
2134+
2135+/* Check if a given well known DBus is owned.
2136+ * WARNING: This does sync IO! */
2137+public static bool dbus_name_has_owner (string name)
2138+{
2139+ try
2140+ {
2141+ bool has_owner;
2142+ DBusConnection bus = Bus.get_sync (BusType.SESSION);
2143+ Variant result = bus.call_sync ("org.freedesktop.DBus",
2144+ "/org/freedesktop/dbus",
2145+ "org.freedesktop.DBus",
2146+ "NameHasOwner",
2147+ new Variant ("(s)", name),
2148+ new VariantType ("(b)"),
2149+ DBusCallFlags.NO_AUTO_START,
2150+ -1);
2151+ result.get ("(b)", out has_owner);
2152+ return has_owner;
2153+ }
2154+ catch (Error e)
2155+ {
2156+ warning ("Unable to decide whether '%s' is running: %s", name, e.message);
2157+ }
2158+ return false;
2159+}
2160+
2161+
2162+public static int main (string[] args)
2163+{
2164+ GLib.Environment.set_prgname ("unity-musicbaidu-daemon");
2165+
2166+ /* Sort up locale to get translations but also sorting and
2167+ * punctuation right */
2168+ GLib.Intl.textdomain (Config.PACKAGE);
2169+ GLib.Intl.bindtextdomain (Config.PACKAGE, Config.LOCALEDIR);
2170+ GLib.Intl.bind_textdomain_codeset (Config.PACKAGE, "UTF-8");
2171+ GLib.Intl.setlocale(GLib.LocaleCategory.ALL, "");
2172+
2173+ /* Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=640714
2174+ * GApplication.register() call owns our DBus name in a sync manner
2175+ * making it race against GDBus' worker thread to export our
2176+ * objects on the bus before/after owning our name and receiving
2177+ * method calls on our objects (which may not yet be up!)*/
2178+ if (dbus_name_has_owner ("com.canonical.Unity.Scope.MusicBaidu"))
2179+ {
2180+ print ("Another instance of the China Music Daemon " +
2181+ "already appears to be running.\nBailing out.\n");
2182+ return 2;
2183+ }
2184+
2185+ /* Now register our DBus objects *before* acquiring the name!
2186+ * See above for reasons */
2187+ daemon = new MusicBaiduScopeProxy ();
2188+
2189+ /* Use GApplication directly for single instance app functionality */
2190+ app = new Application ("com.canonical.Unity.Scope.MusicBaidu",
2191+ ApplicationFlags.IS_SERVICE);
2192+ try
2193+ {
2194+ app.register ();
2195+ }
2196+ catch (Error e)
2197+ {
2198+ /* FIXME: We get this error if another daemon is already running,
2199+ * but it uses a generic error so we can't detect this reliably... */
2200+ print ("Failed to start the China music daemon: %s\n", e.message);
2201+ return 1;
2202+ }
2203+
2204+ if (app.get_is_remote ())
2205+ {
2206+ print ("Another instance of the China Music Daemon " +
2207+ "already appears to be running.\nBailing out.\n");
2208+ return 2;
2209+ }
2210+
2211+ /* Hold()ing the app makes sure the GApplication doesn't exit */
2212+ app.hold();
2213+ return app.run ();
2214+}
2215+
2216+} /* namespace */
2217
2218=== added file 'src/musicbaidu-search.vala'
2219--- src/musicbaidu-search.vala 1970-01-01 00:00:00 +0000
2220+++ src/musicbaidu-search.vala 2013-01-24 09:58:21 +0000
2221@@ -0,0 +1,607 @@
2222+/*
2223+ * Copyright (C) 2012 Kylin Ltd
2224+ *
2225+ * This program is free software: you can redistribute it and/or modify
2226+ * it under the terms of the GNU General Public License version 3 as
2227+ * published by the Free Software Foundation.
2228+ *
2229+ * This program is distributed in the hope that it will be useful,
2230+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2231+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2232+ * GNU General Public License for more details.
2233+ *
2234+ * You should have received a copy of the GNU General Public License
2235+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2236+ *
2237+ * Authored by Weihua Zhang <fly2high@126.com>
2238+ * Authored by liuxing <liuxingcs@yeah.net>
2239+ * Modified Information:
2240+ * 1. Add is_in_China to decide wether you are in China
2241+ * 2. Add MusicBaiduCollection.collection function to search China music from music.baidu.com
2242+ */
2243+
2244+/*
2245+ * Copyright (C) 2011 Canonical Ltd
2246+ *
2247+ * This program is free software: you can redistribute it and/or modify
2248+ * it under the terms of the GNU General Public License version 3 as
2249+ * published by the Free Software Foundation.
2250+ *
2251+ * This program is distributed in the hope that it will be useful,
2252+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2253+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2254+ * GNU General Public License for more details.
2255+ *
2256+ * You should have received a copy of the GNU General Public License
2257+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2258+ *
2259+ * Authored by Alex Launi <alex.launi@canonical.com>
2260+ *
2261+ */
2262+
2263+using GLib;
2264+
2265+
2266+namespace Unity.MusicLens
2267+{
2268+
2269+public class MusicBaiduCollection : Object
2270+{
2271+
2272+ private const string MUSICBAIDU_BASE_URI = "http://music.baidu.com/search/";
2273+ private static string IS_IN_CHINA = "Unknown";
2274+ private const string ASK_IP_SERVER_URI_ONE = "http://ip.chinaz.com/";
2275+ private const string ASK_IP_SERVER_URI_TWO = "http://www.123myip.co.uk/";
2276+
2277+ const string SONG_MISSING_ICON_PATH = "/usr/share/unity/themes/baidu_song_missing.png";
2278+
2279+
2280+ public MusicBaiduCollection ()
2281+ {
2282+
2283+ }
2284+
2285+ private bool is_in_China (Cancellable? cancellable = null)
2286+ {
2287+
2288+ if(IS_IN_CHINA == "Unknown")
2289+ {
2290+
2291+
2292+ File file = File.new_for_uri (ASK_IP_SERVER_URI_ONE);
2293+
2294+
2295+ uint8[] data;
2296+ string content;
2297+ string etag_out;
2298+
2299+
2300+ if( file.load_contents(cancellable, out data, out etag_out))
2301+ {
2302+
2303+ //Convert uint8[] to string.
2304+ content = (string) data;
2305+
2306+ var location = content.index_of("北京") + content.index_of("上海") + content.index_of("天津") + content.index_of("重庆") +
2307+ content.index_of("黑龙江") + content.index_of("吉林") + content.index_of("辽宁") + content.index_of("江苏") +
2308+ content.index_of("山东") + content.index_of("安徽") + content.index_of("河北") + content.index_of("河南") +
2309+ content.index_of("湖北") + content.index_of("湖南") + content.index_of("江西") + content.index_of("陕西") +
2310+ content.index_of("山西") + content.index_of("四川") + content.index_of("青海") + content.index_of("海南") +
2311+ content.index_of("广东") + content.index_of("贵州") + content.index_of("浙江") + content.index_of("福建") +
2312+ content.index_of("台湾") + content.index_of("甘肃") + content.index_of("云南") + content.index_of("内蒙古") +
2313+ content.index_of("宁夏") +content.index_of("新疆") + content.index_of("西藏") + content.index_of("广西") +
2314+ content.index_of("香港") + content.index_of("澳门");
2315+
2316+
2317+
2318+ if(location <0 )
2319+ {
2320+ //if ASK_IP_SERVER_URI_ONE server reposended failed,ask ASK_IP_SERVER_URI_TWO server.
2321+ file = File.new_for_uri (ASK_IP_SERVER_URI_TWO);
2322+
2323+ try
2324+ {
2325+
2326+ if( file.load_contents(cancellable, out data, out etag_out))
2327+ {
2328+
2329+ //Convert uint8[] to string.
2330+ content = (string) data;
2331+
2332+ location = content.index_of("China") ;
2333+ if(location > 0 )
2334+ {
2335+ IS_IN_CHINA = "Yes";
2336+ return true;
2337+ }
2338+ }
2339+
2340+ }
2341+ catch (Error e)
2342+ {
2343+ warning ("Error reading URL '%s': %s", file.get_uri (), e.message);
2344+ }
2345+ }
2346+ else
2347+ {
2348+ IS_IN_CHINA = "Yes";
2349+ return true;
2350+
2351+ }
2352+
2353+ }
2354+
2355+ }
2356+ else
2357+ {
2358+ return true;
2359+ }
2360+
2361+ return false;
2362+ }
2363+
2364+
2365+ public async void search (LensSearch search, SearchType search_type,
2366+ owned List<FilterParser> filters, int max_results = -1, Cancellable cancellable) throws IOError
2367+ {
2368+ File song_file;
2369+ File album_file;
2370+ uint8[] song_data;
2371+ uint8[] album_data;
2372+ string uri;
2373+ string etag_out;
2374+
2375+ if(!is_in_China(cancellable))
2376+ {
2377+ warning("Error can not search music from Baidu !");
2378+ return;
2379+ }
2380+
2381+ try {
2382+ //Search the first page song from Baidu music
2383+ uri = build_search_uri(search.search_string, filters, 0, 0);
2384+ if(uri != null)
2385+ {
2386+ song_file = File.new_for_uri (uri);
2387+ if(yield song_file.load_contents_async(cancellable, out song_data, out etag_out))
2388+ read_song_search_result_from_Baidu(search,song_data);
2389+ }
2390+ //Search the next page song from Baidu music
2391+ uri = build_search_uri(search.search_string, filters, 0, 1);
2392+ if(uri != null)
2393+ {
2394+ song_file = File.new_for_uri (uri);
2395+ if(yield song_file.load_contents_async(cancellable, out song_data, out etag_out))
2396+ read_song_search_result_from_Baidu(search,song_data);
2397+ }
2398+
2399+ //Search the first page album from Baidu music
2400+ uri = build_search_uri(search.search_string, filters, 1, 0);
2401+ if(uri != null)
2402+ {
2403+ album_file = File.new_for_uri (uri);
2404+ if(yield album_file.load_contents_async(cancellable, out album_data, out etag_out))
2405+ read_album_search_result_from_Baidu(search,album_data);
2406+ }
2407+ //Search the next page album from Baidu music
2408+ uri = build_search_uri(search.search_string, filters, 1, 1);
2409+ if(uri != null)
2410+ {
2411+ album_file = File.new_for_uri (uri);
2412+ if(yield album_file.load_contents_async(cancellable, out album_data, out etag_out))
2413+ read_album_search_result_from_Baidu(search,album_data);
2414+ }
2415+
2416+ }
2417+ catch (Error e)
2418+ {
2419+ warning ("Error getting result from baidu: %s(Failed to Search music from Baidu)!", e.message);
2420+ }
2421+
2422+ }
2423+
2424+ public void get_song_details (string uri, out Album album,out SList<Track> tracks,Cancellable? cancellable = null)
2425+ {
2426+
2427+ album = new Album ();
2428+ tracks = new SList<Track> ();
2429+ File song_file;
2430+ uint8[] song_data;
2431+ string http_uri = uri.substring (7);// strip off "song://" from the uri
2432+ string etag_out;
2433+
2434+
2435+ try
2436+ {
2437+
2438+ if(http_uri != null)
2439+ {
2440+ song_file = File.new_for_uri (http_uri);
2441+ if(song_file.load_contents(cancellable, out song_data, out etag_out))
2442+ {
2443+
2444+
2445+ string content;
2446+ //Convert uint8[] to string.
2447+ content = (string) song_data;
2448+
2449+ //Parse the contents to get results.
2450+
2451+ var iIndex = content.index_of("<div class=\"song");
2452+ if( iIndex == -1)
2453+ return;
2454+
2455+ var iEnd = content.index_of("</div>");
2456+ string song_name = content.substring(iIndex, iEnd-iIndex);
2457+ iIndex=-1;
2458+ iEnd=-1;
2459+ iIndex = song_name.index_of("name") + 6;
2460+ iEnd = song_name.substring(iIndex).index_of("</span>");
2461+ if( iIndex == -1)
2462+ return;
2463+
2464+ album.title = song_name.substring(iIndex, iEnd);
2465+ //Maybe song name append like this '审批文号:WJXXXXX',so must deal with.
2466+ iEnd = album.title.index_of("审批文号");
2467+ if( iEnd != -1)
2468+ album.title = album.title.substring(0,iEnd);
2469+
2470+
2471+ iIndex=-1;
2472+ iEnd=-1;
2473+ iIndex = content.index_of("<span class=\"author_list");
2474+ if( iIndex == -1)
2475+ return;
2476+
2477+ iEnd = content.index_of("</span>");
2478+ content = content.substring(iIndex, iEnd-iIndex);
2479+ iIndex=-1;
2480+ iEnd=-1;
2481+ iIndex = content.index_of("title=") + 7;
2482+ iEnd = content.substring(iIndex).index_of("\"");
2483+ if( iIndex == -1)
2484+ return;
2485+ album.artist = content.substring(iIndex,iEnd);
2486+
2487+ //Because song icon_hint in Baidu no exist,so set SONG_MISSING_ICON_PATH.
2488+ album.artwork_path = SONG_MISSING_ICON_PATH;
2489+
2490+ album.uri = uri;
2491+
2492+ var track = new Track ();
2493+ track.uri = uri;
2494+ track.title = album.title ;
2495+ tracks.append (track);
2496+
2497+
2498+ }
2499+ }
2500+ }
2501+ catch (Error e)
2502+ {
2503+ warning ("Error fetching details for '%s': %s", uri, e.message);
2504+ }
2505+
2506+ }
2507+
2508+ public void get_album_details(string uri, out Album album, out SList<Track> tracks,Cancellable? cancellable = null)
2509+ {
2510+ album = new Album ();
2511+ tracks = new SList<Track> ();
2512+ File song_file;
2513+ uint8[] song_data;
2514+ string http_uri = uri.substring (8);// strip off "album://" from the uri
2515+
2516+ string etag_out;
2517+
2518+
2519+ try
2520+ {
2521+
2522+ if(http_uri != null)
2523+ {
2524+ song_file = File.new_for_uri (http_uri);
2525+ if(song_file.load_contents(cancellable, out song_data, out etag_out))
2526+ {
2527+
2528+
2529+ string content;
2530+ //Convert uint8[] to string.
2531+ content = (string) song_data;
2532+
2533+ //Parse the contents to get results.
2534+ string album_content=content;
2535+
2536+
2537+ var iIndex = album_content.index_of("<div class=\"album-info");
2538+ if( iIndex == -1)
2539+ return;
2540+
2541+ var iEnd = album_content.substring(iIndex).index_of("</li>");
2542+ album_content = album_content.substring(iIndex, iEnd+5);
2543+ iIndex=-1;
2544+ iEnd=-1;
2545+
2546+ iIndex = album_content.index_of("img src=") + 9;
2547+ iEnd = album_content.substring(iIndex).index_of("\"");
2548+ if( iIndex == -1)
2549+ return;
2550+
2551+ album.artwork_path = album_content.substring(iIndex,iEnd);
2552+ album_content= album_content.substring(iIndex);
2553+
2554+
2555+ iIndex = album_content.index_of("album-name") + 12;
2556+ iEnd = album_content.substring(iIndex).index_of("</h2>");
2557+ if( iIndex == -1)
2558+ return;
2559+ album.title = album_content.substring(iIndex, iEnd);
2560+
2561+ iIndex = album_content.index_of("title=") + 7;
2562+ iEnd = album_content.substring(iIndex).index_of("\"");
2563+ if( iIndex == -1)
2564+ return;
2565+ album.artist = album_content.substring(iIndex,iEnd);
2566+
2567+ iIndex=-1;
2568+ iEnd=-1;
2569+ iIndex = content.index_of("<li data-songitem");
2570+ if( iIndex == -1)
2571+ return;
2572+
2573+ iEnd = content.last_index_of("<li data-songitem");
2574+ content = content.substring(iIndex, iEnd+3500- iIndex);
2575+ List<string> lilist = new List<string> ();
2576+ var liIndex = content.index_of("</li>");
2577+ while(liIndex != -1)
2578+ {
2579+ lilist.append(content.substring(0,liIndex));
2580+ content = content.substring(liIndex+5);
2581+ liIndex = content.index_of("</li>");
2582+ }
2583+
2584+
2585+ //Get album information.
2586+ foreach (string li in lilist)
2587+ {
2588+ //Get album uri.
2589+ iIndex = li.index_of("/song");
2590+ iEnd = li.substring(iIndex).index_of("\"");
2591+ if(iIndex==-1||iEnd==-1)
2592+ continue;
2593+
2594+ var track = new Track ();
2595+ //FIXME drag n drop uri needs to be the song:// link
2596+ track.uri = string.join("","song://http://music.baidu.com",li.substring(iIndex, iEnd));
2597+
2598+ //Get album title.
2599+ li = li.substring(iIndex);
2600+ iIndex = li.index_of("title=") + 7;
2601+ iEnd = li.substring(iIndex).index_of("\"");
2602+ track.title = li.substring(iIndex,iEnd);
2603+ //Maybe song name append like this '审批文号:WJXXXXX',so must deal with.
2604+ iEnd = track.title.index_of("审批文号");
2605+ if( iEnd != -1)
2606+ track.title = track.title.substring(0,iEnd);
2607+
2608+ tracks.append (track);
2609+ }
2610+
2611+ }
2612+ }
2613+ }
2614+ catch (Error e)
2615+ {
2616+ warning ("Error fetching details for '%s': %s", uri, e.message);
2617+ }
2618+
2619+ }
2620+
2621+
2622+
2623+ private void read_song_search_result_from_Baidu(LensSearch search, uint8[] data)
2624+ {
2625+ var results_model = search.results_model;
2626+
2627+ Track track = new Track ();
2628+ string content;
2629+ //Convert uint8[] to string)
2630+ content = (string) data;
2631+ //Parse the contents to get results
2632+ var iIndex = content.index_of("<li data-songitem");
2633+ if( iIndex == -1)
2634+ return;
2635+ var iEnd = content.last_index_of("<li data-songitem");
2636+ content = content.substring(iIndex, iEnd+3500- iIndex);
2637+
2638+ List<string> lilist = new List<string> ();
2639+ var liIndex = content.index_of("</li>");
2640+ while(liIndex != -1)
2641+ {
2642+ lilist.append(content.substring(0,liIndex));
2643+ content = content.substring(liIndex+5);
2644+ liIndex = content.index_of("</li>");
2645+ }
2646+
2647+ //Get song information.
2648+ foreach (string li in lilist)
2649+ {
2650+ iIndex = li.index_of("/song");
2651+ iEnd = li.substring(iIndex).index_of("\"");
2652+ if(iIndex==-1||iEnd==-1)
2653+ continue;
2654+ //FIXME drag n drop uri needs to be the song:// link
2655+ track.uri = string.join("","song://http://music.baidu.com",li.substring(iIndex, iEnd));
2656+
2657+ li = li.substring(iIndex);
2658+ iIndex = li.index_of("title=") + 7;
2659+ iEnd = li.substring(iIndex).index_of("\"");
2660+ track.title = li.substring(iIndex,iEnd);
2661+ //Maybe song name append like this '审批文号:WJXXXXX',so must deal with.
2662+ iEnd = track.title.index_of("审批文号");
2663+ if( iEnd != -1)
2664+ track.title = track.title.substring(0,iEnd);
2665+
2666+ li = li.substring(iIndex);
2667+ iIndex = li.index_of("title=") + 7;
2668+ iEnd = li.substring(iIndex).index_of("\"");
2669+ track.artist = li.substring(iIndex,iEnd);
2670+
2671+ li = li.substring(iIndex);
2672+ //Maybe song album no exist,so get album name between ">" and "<".
2673+ //Get album-title from behind the second ">".
2674+ iIndex = li.index_of("album-title");
2675+ li = li.substring(iIndex);
2676+ li = li.substring(li.index_of(">")+1);
2677+ iIndex = li.index_of(">") + 1;
2678+ iEnd = li.substring(iIndex).index_of("<");
2679+ var albumMaybe = li.substring(iIndex,iEnd);
2680+ li = li.substring(iIndex);
2681+ if(albumMaybe == null)
2682+ {
2683+ iIndex = li.index_of(">") + 1;
2684+ iEnd = li.substring(iIndex).index_of("</span>");
2685+ track.album = li.substring(iIndex,iEnd);
2686+ li = li.substring(iIndex);
2687+ }
2688+ else
2689+ track.album = albumMaybe;
2690+
2691+ var comment = string.join("",track.artist,track.album);
2692+
2693+ //Because song icon_hint in Baidu no exist,so add SONG_MISSING_ICON_PATH.
2694+ var icon_hint = SONG_MISSING_ICON_PATH;
2695+
2696+ if(track.title.up().index_of(search.search_string.up()) != -1)
2697+ {
2698+ results_model.append (
2699+ track.uri,
2700+ icon_hint,
2701+ 0,
2702+ "text/html",
2703+ track.title,
2704+ comment,
2705+ track.uri);
2706+ }
2707+ }
2708+ }
2709+
2710+ private void read_album_search_result_from_Baidu(LensSearch search, uint8[] data)
2711+ {
2712+ var results_model = search.results_model;
2713+ Album album = new Album ();
2714+
2715+ string content;
2716+ //Convert uint8[] to string.
2717+ content = (string) data;
2718+ //Parse the contents to get results.
2719+
2720+ //Get album icon_hint.
2721+ var iIndex = content.index_of("<img org_src=");
2722+ if(iIndex == -1)
2723+ return;
2724+ var iEnd = content.last_index_of("<img org_src=");
2725+ content = content.substring(iIndex,iEnd+3200-iIndex);
2726+ List<string> lilist = new List<string> ();
2727+ var liIndex = content.index_of("</li>");
2728+ while(liIndex != -1)
2729+ {
2730+ lilist.append(content.substring(0,liIndex));
2731+ content = content.substring(liIndex+5);
2732+ liIndex = content.index_of("</li>");
2733+ }
2734+
2735+ //Get album information.
2736+ foreach (string li in lilist)
2737+ {
2738+ //Get album uri.
2739+ iIndex = li.index_of("img org_src=") + 13;
2740+ iEnd = li.substring(iIndex).index_of("\"");
2741+ var icon_hint = li.substring(iIndex,iEnd);
2742+ li = li.substring(iIndex);
2743+
2744+ iIndex = li.index_of("/album");
2745+ iEnd = li.substring(iIndex).index_of("\"");
2746+ // no found album
2747+ if(iIndex==-1||iEnd==-1)
2748+ continue;
2749+
2750+ //FIXME drag n drop uri needs to be the u1ms:// link.
2751+ album.uri = string.join("","album://http://music.baidu.com",li.substring(iIndex,iEnd));
2752+ li = li.substring(iIndex);
2753+
2754+ //Get album title.
2755+ iIndex = li.index_of("title=") + 7;
2756+ iEnd = li.substring(iIndex).index_of("\"");
2757+ album.title = li.substring(iIndex, iEnd);
2758+ //Maybe album title append like this '审批文号:WJXXXXX',so must deal with.
2759+ iEnd = album.title.index_of("审批文号");
2760+ if(iIndex != -1)
2761+ {
2762+ album.title = album.title.substring(0,iEnd);
2763+ }
2764+ li = li.substring(iIndex);
2765+
2766+ //Get album artist.
2767+ iIndex = li.index_of("title=") + 7;
2768+ iEnd = li.substring(iIndex).index_of("\"");
2769+ album.artist = li.substring(iIndex,iEnd);
2770+ li = li.substring(iIndex);
2771+
2772+ if(album.title.up().index_of(search.search_string.up()) != -1)
2773+ {
2774+ results_model.append (album.uri,
2775+ icon_hint,
2776+ 1,
2777+ "audio-x-generic",
2778+ album.title,
2779+ album.artist,
2780+ album.uri);
2781+ }
2782+ }
2783+ }
2784+
2785+ /*
2786+ * Index = 0, songs
2787+ * Indes = 1, albums
2788+ */
2789+ private string? build_search_uri (string query, List<FilterParser> filters, int index, int page)
2790+ {
2791+
2792+ if(query.strip() == "")
2793+ return null;
2794+
2795+ string musicbaidu_base_uri = MUSICBAIDU_BASE_URI;
2796+ if (GLib.Environment.get_variable("MUSICBAIDU_URI") != null)
2797+ musicbaidu_base_uri = GLib.Environment.get_variable("MUSICBAIDU_URI");
2798+
2799+ StringBuilder uri = new StringBuilder (musicbaidu_base_uri);
2800+ if (index == 0)
2801+ uri.append ("song?key=");
2802+ else
2803+ uri.append ("album?key=");
2804+
2805+ //add query key
2806+ uri.append (Uri.escape_string (query, "", false));
2807+
2808+ //TODO: add filters of Chinese music
2809+ // no implement.
2810+
2811+ //At this moment, Baidu doesn't release API for filter and more search results
2812+ //20 results each time
2813+ if(page < 0)
2814+ {
2815+ uri.append ("&start=0&size=20");
2816+ }
2817+ else
2818+ {
2819+ string? str="";
2820+ str = "&start=%d&size=20".printf(page*20);
2821+ uri.append(str);
2822+ }
2823+
2824+ return uri.str;
2825+ }
2826+}
2827+
2828+}
2829
2830=== added file 'src/simple-scope.vala'
2831--- src/simple-scope.vala 1970-01-01 00:00:00 +0000
2832+++ src/simple-scope.vala 2013-01-24 09:58:21 +0000
2833@@ -0,0 +1,137 @@
2834+/*
2835+ * Copyright (C) 2011 Canonical Ltd
2836+ *
2837+ * This program is free software: you can redistribute it and/or modify
2838+ * it under the terms of the GNU General Public License version 3 as
2839+ * published by the Free Software Foundation.
2840+ *
2841+ * This program is distributed in the hope that it will be useful,
2842+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2843+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2844+ * GNU General Public License for more details.
2845+ *
2846+ * You should have received a copy of the GNU General Public License
2847+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2848+ *
2849+ * Authored by Alex Launi <alex.launi@canonical.com>
2850+ *
2851+ */
2852+
2853+using GLib;
2854+
2855+namespace Unity.MusicLens
2856+{
2857+ public abstract class SimpleScope : Object
2858+ {
2859+ public Unity.Scope scope { get; protected set; }
2860+
2861+ protected abstract int num_results_without_search { get; }
2862+ protected abstract int num_results_global_search { get; }
2863+ protected abstract int num_results_lens_search { get; }
2864+
2865+ protected abstract async void perform_search (LensSearch search,
2866+ SearchType search_type,
2867+ owned List<FilterParser> filters,
2868+ int max_results = -1,
2869+ Cancellable? cancellable = null);
2870+
2871+ public SimpleScope ()
2872+ {
2873+ }
2874+
2875+ protected void initialize ()
2876+ {
2877+ /* Listen for filter changes */
2878+ scope.filters_changed.connect (() => {
2879+ scope.queue_search_changed (SearchType.DEFAULT);
2880+ });
2881+
2882+ scope.active_sources_changed.connect (() => {
2883+ scope.queue_search_changed (SearchType.DEFAULT);
2884+ });
2885+
2886+ /* No need to search if only the whitespace changes */
2887+ scope.generate_search_key.connect ((lens_search) => {
2888+ return lens_search.search_string.strip ();
2889+ });
2890+
2891+ /* Listen for changes to the lens search entry */
2892+ scope.search_changed.connect ((search, search_type, cancellable) => {
2893+ update_search_async.begin (search, search_type, cancellable);
2894+ });
2895+ }
2896+
2897+ private async void update_search_async (LensSearch search,
2898+ SearchType search_type,
2899+ Cancellable cancellable)
2900+ {
2901+ int max_results;
2902+ /*
2903+ * results for a global search from just hitting Super.
2904+ * Here we want to return a smaller number of results with 0 filters.
2905+ */
2906+ if (search_type == SearchType.GLOBAL)
2907+ max_results = num_results_global_search;
2908+ else if (is_search_empty (search))
2909+ max_results = num_results_without_search;
2910+ else
2911+ max_results = num_results_lens_search;
2912+
2913+ yield prepare_search (search, search_type, max_results, cancellable);
2914+ }
2915+
2916+ private async void prepare_search (LensSearch search,
2917+ SearchType search_type,
2918+ int max_results,
2919+ Cancellable cancellable)
2920+ {
2921+ var results_model = search.results_model;
2922+
2923+ List<FilterParser> filters = new List<FilterParser> ();
2924+ // don't apply filters to global searches
2925+ if (search_type != SearchType.GLOBAL)
2926+ {
2927+ Filter filter = scope.get_filter ("genre");
2928+ if (filter.filtering)
2929+ filters.append (new GenreFilterParser (filter as CheckOptionFilterCompact));
2930+
2931+ filter = scope.get_filter ("decade");
2932+ if (filter.filtering)
2933+ filters.append (new DecadeFilterParser (filter as MultiRangeFilter));
2934+ }
2935+
2936+ results_model.clear ();
2937+
2938+ // don't perform search is all sources are inactive
2939+ if (scope.sources.options.length () > 0 && scope.sources.filtering)
2940+ {
2941+ bool any_active = false;
2942+ foreach (var source in scope.sources.options)
2943+ {
2944+ if (source.active) any_active = true;
2945+ }
2946+ if (!any_active)
2947+ {
2948+ search.finished ();
2949+ return;
2950+ }
2951+ }
2952+
2953+ yield perform_search (search, search_type, (owned) filters, max_results, cancellable);
2954+
2955+ if (results_model.get_n_rows () == 0)
2956+ {
2957+ search.set_reply_hint ("no-results-hint",
2958+ _("Sorry, there is no music that matches your search."));
2959+ }
2960+
2961+ search.finished ();
2962+ }
2963+
2964+ protected bool is_search_empty (LensSearch search)
2965+ requires (search.search_string != null)
2966+ {
2967+ return search.search_string.strip () == "";
2968+ }
2969+ }
2970+}
2971
2972=== added file 'src/tdb.deps'
2973--- src/tdb.deps 1970-01-01 00:00:00 +0000
2974+++ src/tdb.deps 2013-01-24 09:58:21 +0000
2975@@ -0,0 +1,1 @@
2976+posix
2977
2978=== added file 'src/tdb.vapi'
2979--- src/tdb.vapi 1970-01-01 00:00:00 +0000
2980+++ src/tdb.vapi 2013-01-24 09:58:21 +0000
2981@@ -0,0 +1,125 @@
2982+/* tdb.vapi
2983+ *
2984+ * Copyright (C) 2012 Canonical Ltd.
2985+ *
2986+ * This library is free software; you can redistribute it and/or
2987+ * modify it under the terms of the GNU Lesser General Public
2988+ * License as published by the Free Software Foundation; either
2989+ * version 2.1 of the License, or (at your option) any later version.
2990+
2991+ * This library is distributed in the hope that it will be useful,
2992+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2993+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2994+ * Lesser General Public License for more details.
2995+
2996+ * You should have received a copy of the GNU Lesser General Public
2997+ * License along with this library; if not, write to the Free Software
2998+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2999+ *
3000+ * Author:
3001+ * Michal Hruby <michal.hruby@canonical.com>
3002+ */
3003+
3004+[CCode (lower_case_cprefix = "tdb_", cheader_filename = "tdb.h")]
3005+namespace TDB {
3006+ /* Database Connection Handle */
3007+ [Compact]
3008+ [CCode (free_function = "tdb_close", cname = "TDB_CONTEXT", cprefix = "tdb_")]
3009+ public class Database {
3010+ [CCode (cname = "tdb_open")]
3011+ public Database (string name, int hash_size, TDB.OpenFlags tdb_flags, int open_flags, Posix.mode_t mode);
3012+ [CCode (cname = "tdb_open_ex")]
3013+ public Database.open_ex (string name, int hash_size, int tdb_flags, int open_flags, Posix.mode_t mode, TDB.LogFunc log_fn);
3014+
3015+ public int reopen ();
3016+ public static int reopen_all ();
3017+
3018+ public TDB.Error error ();
3019+ public unowned string errorstr ();
3020+
3021+ public TDB.Data fetch (TDB.Data key);
3022+ public int @delete (TDB.Data key);
3023+ public int store (TDB.Data key, TDB.Data dbuf, TDB.StoreType type_flag);
3024+ public TDB.Data firstkey ();
3025+ public TDB.Data nextkey (TDB.Data key);
3026+ public int traverse (TDB.TraverseFunc traverse_func);
3027+ public int exists (TDB.Data key);
3028+ public int lockkeys (TDB.Data[] keys);
3029+ public void unlockkeys ();
3030+ public int lockall ();
3031+ public void unlockall ();
3032+
3033+ public int chainlock (TDB.Data key);
3034+ public void chainunlock (TDB.Data key);
3035+ }
3036+
3037+ [CCode (cname = "TDB_DATA")]
3038+ [SimpleType]
3039+ public struct Data {
3040+ [CCode (array_length_cname = "dsize", array_length_type = "size_t", cname = "dptr")]
3041+ public unowned uint8[] data;
3042+ [CCode (cname = "dsize")]
3043+ public size_t data_size;
3044+ }
3045+
3046+ [CCode (cname = "tdb_null")]
3047+ public const TDB.Data NULL_DATA;
3048+
3049+ [CCode (has_target = false)]
3050+ public delegate void LogFunc (TDB.Database db, TDB.DebugLevel debug_level, string format, ...);
3051+
3052+ public delegate int TraverseFunc (TDB.Database db, TDB.Data key, TDB.Data @value);
3053+
3054+ [CCode (cname = "SQLITE_ANY")]
3055+ public const int ANY;
3056+
3057+ [CCode (cname = "enum tdb_debug_level", cprefix = "TDB_DEBUG_")]
3058+ public enum DebugLevel {
3059+ FATAL,
3060+ ERROR,
3061+ WARNING,
3062+ TRACE
3063+ }
3064+
3065+ [CCode (cname = "int", cprefix = "TDB_")]
3066+ public enum StoreType {
3067+ REPLACE,
3068+ INSERT,
3069+ MODIFY
3070+ }
3071+
3072+ [CCode (cname = "int", cprefix = "TDB_")]
3073+ public enum OpenFlags {
3074+ DEFAULT,
3075+ CLEAR_IF_FIRST,
3076+ INTERNAL,
3077+ NOLOCK,
3078+ NOMMAP,
3079+ CONVERT,
3080+ BIGENDIAN,
3081+ NOSYNC,
3082+ SEQNUM,
3083+ VOLATILE,
3084+ ALLOW_NESTING,
3085+ DISALLOW_NESTING,
3086+ INCOMPATIBLE_HASH
3087+ }
3088+
3089+ [CCode (cname = "enum TDB_ERROR", cprefix = "TDB_ERR_")]
3090+ public enum Error {
3091+ [CCode (cname = "TDB_SUCCESS")]
3092+ SUCCESS,
3093+ CORRUPT,
3094+ IO,
3095+ LOCK,
3096+ OOM,
3097+ EXISTS,
3098+ NOLOCK,
3099+ LOCK_TIMEOUT,
3100+ NOEXISTS,
3101+ EINVAL,
3102+ RDONLY,
3103+ NESTING
3104+ }
3105+}
3106+
3107
3108=== added file 'src/track.vala'
3109--- src/track.vala 1970-01-01 00:00:00 +0000
3110+++ src/track.vala 2013-01-24 09:58:21 +0000
3111@@ -0,0 +1,44 @@
3112+/*
3113+ * Copyright (C) 2011 Canonical Ltd
3114+ *
3115+ * This program is free software: you can redistribute it and/or modify
3116+ * it under the terms of the GNU General Public License version 3 as
3117+ * published by the Free Software Foundation.
3118+ *
3119+ * This program is distributed in the hope that it will be useful,
3120+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3121+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3122+ * GNU General Public License for more details.
3123+ *
3124+ * You should have received a copy of the GNU General Public License
3125+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3126+ *
3127+ * Authored by Alex Launi <alex.launi@canonical.com>
3128+ *
3129+ */
3130+
3131+namespace Unity.MusicLens {
3132+
3133+ public enum TrackType
3134+ {
3135+ SONG,
3136+ RADIO
3137+ }
3138+
3139+ public class Track : GLib.Object
3140+ {
3141+ public TrackType type_track { get; set; }
3142+ public string title { get; set; }
3143+ public string uri { get; set; }
3144+ public string artist { get; set; }
3145+ public string mime_type { get; set; }
3146+ public string artwork_path { get; set; }
3147+ public string album { get; set; }
3148+ public string album_artist { get; set; }
3149+ public string genre { get; set; }
3150+ public int track_number { get; set; }
3151+ public int year { get; set; }
3152+ public int play_count { get; set; }
3153+ public int duration { get; set; }
3154+ }
3155+}

Subscribers

People subscribed via source and target branches

to all changes: