pax_global_header00006660000000000000000000000064116253673110014517gustar00rootroot0000000000000052 comment=00d59957f0cff45670e9298325cd64fda2595556 .gitignore000066400000000000000000000000061162536731100130470ustar00rootroot00000000000000*.pyc COPYING000066400000000000000000001033301162536731100121160ustar00rootroot00000000000000 GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . INSTALL000066400000000000000000000046531162536731100121240ustar00rootroot00000000000000INSTALLATION INSTRUCTIONS 1. (Optional) Add the directory containing zeya.py to your PATH. 2. Install dependencies: Install the Ogg/Vorbis encoder and the decoders for one or more of the following: Ogg/Vorbis, FLAC, MP3, and M4A. On a Debian/Ubuntu system you can do this with: # Vorbis encoder and decoder (required) aptitude install vorbis-tools # Flac/MP3/M4A decoders (optional; needed for playing music in those # formats) aptitude install flac mpg123 faad Make sure you have Python 2.5 or 2.6 installed: aptitude install python2.6 Python 2.5 users will need to install the simplejson library: aptitude install python-simplejson If you're using the 'dir' (directory) backend, also install tagpy: aptitude install python-tagpy If you're using Fedora, you can install the requisite packages (excluding MP3/M4A support) with: yum install vorbis-tools flac python-simplejson python-tag 3. Run zeya.py. The --help flag shows the available options. We support three backends: 'dir': read all music in a directory and its subdirectories. This is the default. $ zeya.py --path=/path/to/music # If omitted, --path defaults to ./ 'rhythmbox': read files from the current user's Rhythmbox library. $ zeya.py --backend=rhythmbox 'playlist': read files from the specified m3u or PLS playlist file $ zeya.py --backend=playlist --path=/path/to/your/m3u/pls/file CLIENT SUPPORT Zeya works well in Firefox 3.5+ and Chrome 4+. See the section below, titled "NOTES ON SUPPORTED CLIENTS", for more details. We also provide zeyaclient.py, a rudimentary Python client (1) for use when a more lightweight client is needed or when no HTML5-compliant browser is available and (2) as a simple example of programmatic (and non browser-based) access to a Zeya servers. NOTES ON SUPPORTED CLIENTS * Firefox All Firefox versions >= 3.5 should work. Zeya is known to work in Firefox 3.5.3 on GNU/Linux and Windows. * Chrome Zeya should work in Chrome 4.0.223+, on GNU/Linux, Windows, and Mac OS. Known issues: Latency between when you click on a song and when it starts playing is high. Chrome seems to require the Content-Length header to be set on audio data, so we have to finish encoding the entire file before we can send any data to the client. * Internet Explorer (with Chrome Frame plugin) Known Issues: see Chrome KIs above. README000066400000000000000000000012551162536731100117460ustar00rootroot00000000000000Zeya - a web music server. AUTHORS Copyright (C) 2009, 2010 Phil Sung Copyright (C) 2009 Samson Yeung Copyright (C) 2009 Romain Francoise Copyright (C) 2009, 2010 Amit Saha Copyright (C) 2010 Björn Lohrmann Copyright (C) 2010 Rainer Hahnekamp ARTWORK resources/shuffle.png is Copyright (C) 2009 Phil Sung. All of the other icons are public-domain icons from tango-icon-theme. More information: DEVELOPMENT AND TESTING You can invoke our test suite by running zeyatest.py. TODO000066400000000000000000000004401162536731100115510ustar00rootroot00000000000000USER INTERFACE - Add functions for repeat album, repeat song - Add a timer and seek bar - Detect when the server is no longer available and display an appropriate message. ADDITIONAL FEATURES - Allow using a page fragment (/#xyz...) to specify a song. - Remote control of clients backends.py000066400000000000000000000234221162536731100132120ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # Copyright (C) 2009 Phil Sung, Samson Yeung, Romain Francoise # # This file is part of Zeya. # # Zeya is free software: you can redistribute it and/or modify it under the # terms of the GNU Affero General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Zeya is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License # along with Zeya. If not, see . # Common code for library backends. import fcntl import os import signal import socket import subprocess import tagpy import time TITLE='title' ARTIST='artist' ALBUM='album' # For Python2.5 compatibility, we create an equivalent to # subprocess.Popen.terminate (new in Python2.6) and patch it in. try: subprocess.Popen.terminate except AttributeError: def sub_popen_terminate(self): # This will only work on Unix-like systems, but it's better than # nothing. os.kill(self.pid, signal.SIGTERM) subprocess.Popen.terminate = sub_popen_terminate import decoders # Serve data to the client at a rate of no higher than RATE_MULTIPLIER * (the # bitrate of the encoded data). RATE_MULTIPLIER = 2.0 # Attempt to write STREAM_CHUNK_SIZE bytes up to (but possibly less than) # STREAM_WRITE_FREQUENCY times per second. The maximum possible write rate with # these parameters is 8192 bytes * 128 Hz = 1MB/sec. STREAM_CHUNK_SIZE = 8192 #bytes STREAM_WRITE_FREQUENCY = 128.0 #Hz class StreamGenerationError(Exception): """ Indicates an error generating a stream for the requested file. """ def __init__(self, msg): self.msg = msg def __str__(self): return self.msg def filename_to_stream(filename, out_stream, bitrate, buffered=False): print "Handling request for %s" % (filename,) try: decode_command = decoders.get_decoder(filename) except KeyError: raise StreamGenerationError( "Couldn't play specified format: %r" % (filename,)) encoder_path = "/usr/bin/oggenc" if not os.path.exists(encoder_path): raise StreamGenerationError( ("No Vorbis encoder found at %s. " % (encoder_path,)) + \ "Please install 'vorbis-tools'.") encode_command = [encoder_path, "-r", "-Q", "-b", str(bitrate), "-"] # Pipe the decode command into the encode command. p1 = subprocess.Popen(decode_command, stdout=subprocess.PIPE) if buffered: # Read the entire output and then write it to the output stream. p2 = subprocess.Popen(encode_command, stdin=p1.stdout, stdout=subprocess.PIPE) out_stream.write(p2.stdout.read()) else: # Stream the encoder output while limiting the total bandwidth used. We # do this by writing the encoder output to a pipe and reading from the # pipe at a limited rate. (read_fd, write_fd) = os.pipe() p2 = subprocess.Popen(encode_command, stdin=p1.stdout, stdout=os.fdopen(write_fd, 'wb')) # Don't let reads block when we've read to the end of the encoded song # data. fcntl.fcntl(read_fd, fcntl.F_SETFL, os.O_NONBLOCK) try: copy_output_with_shaping(read_fd, out_stream, bitrate, lambda : p2.poll() != None) except socket.error: p1.terminate() p2.terminate() # Close the FIFO we opened. try: os.close(read_fd) except OSError: pass def copy_output_with_shaping(read_fd, out_stream, bitrate, encoder_finished_callback = lambda : True): """ Copies data from the input stream with the specified FD to the given output stream. Do not copy data faster than BITRATE * RATE_MULTIPLIER bits/second. Ceases copying data when the input stream is empty AND encoder_finished_callback() evaluates to True in a boolean context. """ bytes_written = 0 start_time = time.time() # Compute the output rate, converting kilobits/sec to bytes/sec. max_bytes_per_sec = RATE_MULTIPLIER * bitrate * 1024 / 8 encoder_finished = False while True: time.sleep(1/STREAM_WRITE_FREQUENCY) # If the average transfer rate exceeds the threshold, sleep for a # while longer. if bytes_written >= (time.time() - start_time) * max_bytes_per_sec: continue # Detect when the source (encoder) process has finished. We assume that # data written by the encoder is immediately available via os.read. # Therefore, if the encoder has finished, and we subsequently cannot # read data from the input stream, we can conclude that we have read # all the data. if encoder_finished_callback(): encoder_finished = True try: data = os.read(read_fd, STREAM_CHUNK_SIZE) except OSError: # OSError will be thrown if we read before the pipe has had any # data written to it. data = "" if encoder_finished and len(data) == 0: break out_stream.write(data) bytes_written = bytes_written + len(data) # This interface is implemented by all library backends. class LibraryBackend(): """ Object that controls access to a collection of music files. """ def get_library_contents(self): """ Return a list of the available files. The return value should be of the form [ {'key': ..., 'title': ..., 'artist': ..., 'album': ...}, ... ] where each entry represents one file. The values coresponding to 'title', 'artist', and 'album' are strings or unicode strings giving the song attributes. The value corresponding to 'key' may be passed to self.write_content in order to obtain the data for a particular file, and the same key appears in the result of get_playlists(). The items will be displayed to the user in the order that they appear here. """ raise NotImplementedError() def get_playlists(self): """ Return a list of the available playlists. The return value should be of the form [ {'name': ..., 'items': [ ... ] }, ... ] where each entry represents one playlist. The 'name' field contains a string representing the user-displayable name of the playlist. The 'items' field is a list of the song keys identifying the songs in the playlist, in order. NotImplementedError may be thrown if the backend does not have any concept of playlists. """ raise NotImplementedError() def get_content(self, key, out_stream, bitrate, buffered=False): """ Retrieve the file data associated with the specified key and write an audio/ogg encoded version to out_stream. """ # This is a convenience implementation of this method. try: filename = self.get_filename_from_key(key) except KeyError: print "Received invalid request for key %r" % (key,) try: filename_to_stream(filename, out_stream, bitrate, buffered) except StreamGenerationError, e: print "Error: %s" % (e,) def get_filename_from_key(self, key): # Retrieve the filename that 'key' is backed by. This is not part of # the public API, but is used in the default implementation of # get_content. # # Raise KeyError if the key is not valid. raise NotImplementedError() def extract_metadata(filename, tagpy_module=tagpy): """ Returns a metadata dictionary (a dictionary {ARTIST: ..., ...}) containing metadata (artist, title, and album) for the song in question. filename: a string supplying a filename. tagpy_module: a reference to the tagpy module. This can be faked out for unit testing. """ # tagpy can do one of three things: # # * Return legitimate data. We'll load that data. # * Return None. We'll assume this is a music file but that it doesn't have # metadata. Create an entry for it. # * Throw ValueError. We'll assume this is not something we could play. # Don't create an entry for it. try: tag = tagpy_module.FileRef(filename).tag() except: raise ValueError("Error reading metadata from %r" % (filename,)) # If no metadata is available, set the title to be the basename of the # file. (We have to ensure that the title, in particular, is not empty # since the user has to click on it in the web UI.) metadata = { TITLE: os.path.basename(filename).decode("UTF-8"), ARTIST: '', ALBUM: album_name_from_path(tag, filename), } if tag is not None: metadata[ARTIST] = tag.artist # Again, do not allow metadata[TITLE] to be an empty string, even if # tag.title is an empty string. metadata[TITLE] = tag.title or metadata[TITLE] metadata[ALBUM] = tag.album or metadata[ALBUM] return metadata def album_name_from_path(tag, filename): """ Returns an appropriate Unicode string to use for the album name if the tag is empty. """ if tag is not None and (tag.artist or tag.album): return u'' # Use the trailing components of the path. path_components = [x for x in os.path.dirname(filename).split(os.sep) if x] if len(path_components) >= 2: return os.sep.join(path_components[-2:]).decode("UTF-8") elif len(path_components) == 1: return path_components[0].decode("UTF-8") return u'' common.py000066400000000000000000000030421162536731100127240ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # Copyright (C) 2009 Phil Sung # # This file is part of Zeya. # # Zeya is free software: you can redistribute it and/or modify it under the # terms of the GNU Affero General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Zeya is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License # along with Zeya. If not, see . # Utility functions. import re def tokenize_filename(filename): """ Return a list such that sorting a list of filenames by tokenize_filename(f) yields some "reasonable" result. filename: string containing a filename """ # Sort lexicographically by components of the path, except we treat runs of # digits as separate components and sort those by numeric value. That way # we can, for example, sort "9.ogg" and "10.ogg" in the sensible way. def maybe_convert_to_int(s): """ Return int(s) if s represents an integer and s otherwise. s: a string """ try: return int(s) except ValueError: # Normalize case so we alphabetize logically. return s.lower() return [maybe_convert_to_int(s) for s in re.split(r'(/|\d+)', filename)] decoders.py000066400000000000000000000062031162536731100132260ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # Copyright (C) 2009 Phil Sung # # This file is part of Zeya. # # Zeya is free software: you can redistribute it and/or modify it under the # terms of the GNU Affero General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Zeya is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License # along with Zeya. If not, see . # Logic for selecting which decoder to run for a given file. import os # TODO: detect available decoders at startup and disable extensions if they # can't be played. # To use any of the command lines, append a filename as the last argument. decoders = { 'flac': ("/usr/bin/flac", "-d", "-c", "--totally-silent"), 'mp3': ("/usr/bin/mpg123", "-s", "-q"), 'ogg': ("/usr/bin/oggdec", "-Q", "-o", "-"), 'm4a': ("/usr/bin/faad", "-w", "-q"), } decoder_messages = { 'flac': "/usr/bin/flac not found. Please install 'flac' to play .flac files.", 'mp3': "/usr/bin/mpg123 not found. Please install 'mpg123' to play .mp3 files.", 'ogg': "/usr/bin/oggdec not found. Please install 'vorbis-tools' to play .ogg files.", 'm4a': "/usr/bin/faad not found. Please install 'faad' to play .m4a files.", } # The set of extensions for which we've warned the user that the decoder is not # available. We maintain this set so we don't prompt the user more than once # for the same codec. prompts_already_issued = set() def get_extension(filename): # Returns the lowercased extension of the filename (e.g. 'ogg'). # Raises ValueError if the filename is malformed. return filename[filename.rfind('.')+1:].lower() def has_decoder(filename): """ Return whether or not the decoder that would be used to read filename is registered and actually present on the system. If it isn't, print a warning, but only if no previous warning has been issued for the same decoder. """ if not is_decoder_registered(filename): return False extension = get_extension(filename) decoder_path = decoders[extension][0] decoder_installed = os.path.exists(decoder_path) if not decoder_installed and extension not in prompts_already_issued: print "Warning: %s" % (decoder_messages[extension],) prompts_already_issued.add(extension) return decoder_installed def is_decoder_registered(filename): """ Returns True if a decoder is registered for the given filename. """ try: extension = get_extension(filename) except ValueError: return False return decoders.has_key(extension) def get_decoder(filename): """ Returns a command line for decoding the given filename. This command line can be passed to subprocess.Popen, and writes all data to stdout. """ extension = get_extension(filename) return list(decoders[extension] + (filename,)) directory.py000066400000000000000000000216301162536731100134430ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # Copyright (C) 2009 Samson Yeung, Phil Sung # # This file is part of Zeya. # # Zeya is free software: you can redistribute it and/or modify it under the # terms of the GNU Affero General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Zeya is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License # along with Zeya. If not, see . # Directory backend. # # Files in the specified directory are read for artist/title/album tag which is # then saved in a database (zeya.db) stored in that directory. import os import tagpy import pickle from backends import LibraryBackend from backends import extract_metadata from common import tokenize_filename from m3u import M3uPlaylist from pls import PlsPlaylist KEY = 'key' DB = 'db' KEY_FILENAME = 'key_filename' MTIMES = 'mtimes' class DirectoryBackend(LibraryBackend): """ Object that controls access to music in a given directory. """ def __init__(self, media_path, save_db=True): """ Initializes a DirectoryBackend that reads from the specified directory. save_db can be set to False to prevent the db from being written back to disk. This is probably only useful for debugging purposes. """ self._media_path = os.path.expanduser(media_path) self._save_db = save_db # Sequence of dicts containing song metadata (key, artist, title, album) self.db = [] # Playlists self._playlists = [] # Dict mapping keys to source filenames and vice versa self.key_filename = {} self.filename_key = {} # Dict mapping filenames to mtimes self.mtimes = {} self.setup_db() def get_db_filename(self): return os.path.join(self._media_path, 'zeya.db') def setup_db(self): # Load the previous database from file, and convert it to a # representation where it can serve as a metadata cache (keyed by # filename) when we load the file collection. previous_db = self.load_previous_db() self.fill_db(previous_db) if self._save_db: self.save_db() def load_previous_db(self): """ Read the existing database on disk and return a dict mapping each filename to the (mtime, metadata) associated with the filename. """ filename_to_metadata_map = {} try: # Load the old data structures from file. info = pickle.load(open(self.get_db_filename(), 'r')) key_to_metadata_map = {} prev_mtimes = info[MTIMES] # Construct a map from keys to metadata. for db_entry in info[DB]: key_to_metadata_map[db_entry[KEY]] = db_entry # Construct a map from filename to (mtime, metadata) associated # with that file. for (key, filename) in info[KEY_FILENAME].iteritems(): filename_to_metadata_map[filename] = \ (prev_mtimes[filename], key_to_metadata_map[key]) except IOError: # Couldn't read the file. Just return an empty data structure. pass return filename_to_metadata_map def save_db(self): self.info = {DB: self.db, MTIMES: self.mtimes, KEY_FILENAME: self.key_filename} try: pickle.dump(self.info, open(self.get_db_filename(), 'wb+')) except IOError, e: print "Warning: the metadata cache could not be written to disk:" print " " + str(e) print "(Zeya will continue, but the directory will need to be", print "re-scanned the next time Zeya is run.)" def write_metadata(self, filename, previous_db): """ Obtains and writes the metadata for the specified FILENAME to the database. The metadata may be found by looking in the cache (PREVIOUS_DB), and failing that, by pulling the metadata from the file itself. Returns the key associated with the filename. """ if filename in self.filename_key: # First, if the filename is already in our database, we don't have # to do anything. We can encounter the same filename twice if a # playlist contains a reference to a file we've already scanned. key = self.filename_key[filename] else: # The filename is not in the database. We have to obtain a metadata # entry, either by reading it out of our cache, or by calling out # to tagpy. # # previous_db acts as a cache of mtime and metadata, keyed by # filename. rec_mtime, old_metadata = previous_db.get(filename, (None, None)) file_mtime = os.stat(filename).st_mtime if rec_mtime is not None and rec_mtime >= file_mtime: # Use cached data. However, we potentially renumber the keys # every time the program runs, so the old KEY is no good. We'll # fix up the KEY field below. metadata = old_metadata else: # In this branch, we actually need to read the file and # extract its metadata. metadata = extract_metadata(filename) # Assign a key for this song. These are just integers assigned # sequentially. key = len(self.key_filename) metadata[KEY] = key self.db.append(metadata) self.key_filename[key] = filename self.filename_key[filename] = key self.mtimes[filename] = file_mtime return key def fill_db(self, previous_db): """ Populate the database, given the output of load_previous_db. """ # By default, os.walk will happily accept a non-existent directory and # return an empty sequence. Detect the case of a non-existent path and # bail out early. if not os.path.exists(self._media_path): raise IOError("Error: directory %r doesn't exist." % (self._media_path,)) print "Scanning for music in %r..." % (os.path.abspath(self._media_path),) # Iterate over all the files. try: all_files_recursively = os.walk(self._media_path, followlinks=True) except TypeError: # os.walk in Python 2.5 and earlier don't support the followlinks # argument. Fall back to not including it (in this case, Zeya will # not index music underneath symlinked directories). all_files_recursively = os.walk(self._media_path) for path, dirs, files in all_files_recursively: # Sort dirs so that subdirectories will subsequently be visited # alphabetically (see os.walk). dirs.sort(key=tokenize_filename) for filename in sorted(files, key=tokenize_filename): filename = os.path.abspath(os.path.join(path, filename)) # Skip broken symlinks if not os.path.exists(filename): continue if filename.lower().endswith('.m3u') or filename.lower().endswith('.pls'): # Encountered a playlist file. try: fileobj = open(filename) except IOError: print "Error opening playlist file: %r" % (filename,) continue if filename.lower().endswith('.m3u'): playlist = M3uPlaylist(filename, fileobj) elif filename.lower().endswith('.pls'): playlist = PlsPlaylist(filename, fileobj) items = [] for song_filename in playlist.get_filenames(): try: song_key = self.write_metadata( song_filename, previous_db) except (OSError, ValueError): continue items.append(song_key) self._playlists.append( {'name' : playlist.get_title(), 'items': items}) else: # Encountered what is possibly a regular music file. try: self.write_metadata(filename, previous_db) except (OSError, ValueError): continue def get_library_contents(self): return self.db def get_playlists(self): return self._playlists def get_filename_from_key(self, key): return self.key_filename[int(key)] doc/000077500000000000000000000000001162536731100116305ustar00rootroot00000000000000doc/README000066400000000000000000000004461162536731100125140ustar00rootroot00000000000000The man pages (*.1) in this directory are automatically generated from the Docbook XML files. Please regenerate the man pages using $ docbook2x-man zeya.xml $ docbook2x-man zeyaclient.xml whenever you update the XML documentation. (docbook2x-man can be found in the 'docbook2x' package.) doc/zeya.1000066400000000000000000000040261162536731100126640ustar00rootroot00000000000000'\" -*- coding: us-ascii -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH zeya 1 2009-10-19 "" "" .SH NAME zeya \- a web music server .SH SYNOPSIS 'nh .fi .ad l \fBzeya\fR \kx .if (\nx>(\n(.l/2)) .nr x (\n(.l/5) 'in \n(.iu+\nxu [-h | --help] [--backend=\fIbackend\fR] [--path=\fIpath\fR] [-b | --bitrate=\fIbitrate\fR] [-p | --port=\fIport\fR] [--basic_auth_file=\fIfile\fR] 'in \n(.iu-\nxu .ad b 'hy .SH DESCRIPTION Zeya is a streaming music server that brings your music to any computer with a web browser. It reads your music library, lets you browse your files, and streams them on demand. .PP The client runs entirely in the browser using the HTML5 draft standard technologies (no plugins or external players are needed). .SH OPTIONS .TP \*(T<\fB\-h\fR\*(T>, \*(T<\fB\-\-help\fR\*(T> Display help. .TP \*(T<\fB\-\-backend\fR\*(T> Specify the backend to use. .RS .TP dir Read a directory's contents recursively (default). See \*(T<\fB\-\-path\fR\*(T>. .TP rhythmbox Read from current user's Rhythmbox library. .TP playlist Read from the playlist (.m3u or .pls file) specified by \*(T<\fB\-\-path\fR\*(T>. .RE .TP \*(T<\fB\-\-path\fR\*(T> When used with \*(T<\fB\-\-backend\fR\*(T>=dir, the directory in which to look for music (default: ./). When used with \*(T<\fB\-\-backend\fR\*(T>=playlist, the absolute path of the playlist file to be read. .TP \*(T<\fB\-b\fR\*(T>, \*(T<\fB\-\-bitrate\fR\*(T> Specify the bitrate for output streams, in kbps. (default: 64) .TP \*(T<\fB\-p\fR\*(T>, \*(T<\fB\-\-port\fR\*(T> Listen for requests on the specified port. (default: 8080) .TP \*(T<\fB\-\-basic_auth_file\fR\*(T> Require basic HTTP authentication and only allow users named in the specified file. The file should be in \fBhtpasswd\fR format. .SH COPYRIGHT Zeya was written by Phil Sung and Samson Yeung and is licensed under the terms of the GNU Affero GPL license, version 3 or later. .SH "SEE ALSO" \*(T<\fI/usr/share/doc/zeya/README\fR\*(T> .PP \*(T<\fI/usr/share/doc/zeya/TODO\fR\*(T> doc/zeya.xml000066400000000000000000000105151162536731100133240ustar00rootroot00000000000000 Romain Francoise
rfrancoise@debian.org
2009-10-19
zeya 1 zeya a web music server zeya -h --help --backend=backend --path=path -b --bitrate=bitrate -p --port=port --basic_auth_file=file DESCRIPTION Zeya is a streaming music server that brings your music to any computer with a web browser. It reads your music library, lets you browse your files, and streams them on demand. The client runs entirely in the browser using the HTML5 draft standard technologies (no plugins or external players are needed). OPTIONS Display help. Specify the backend to use. dir Read a directory's contents recursively (default). See . rhythmbox Read from current user's Rhythmbox library. playlist Read from the playlist (.m3u or .pls file) specified by . When used with =dir, the directory in which to look for music (default: ./). When used with =playlist, the absolute path of the playlist file to be read. Specify the bitrate for output streams, in kbps. (default: 64) Listen for requests on the specified port. (default: 8080) Require basic HTTP authentication and only allow users named in the specified file. The file should be in htpasswd format. COPYRIGHT Zeya was written by Phil Sung and Samson Yeung and is licensed under the terms of the GNU Affero GPL license, version 3 or later. SEE ALSO /usr/share/doc/zeya/README /usr/share/doc/zeya/TODO
doc/zeyaclient.1000066400000000000000000000017121162536731100140620ustar00rootroot00000000000000'\" -*- coding: us-ascii -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH zeyaclient 1 2009-10-19 "" "" .SH NAME zeyaclient \- command-line client for Zeya .SH SYNOPSIS 'nh .fi .ad l \fBzeyaclient\fR \kx .if (\nx>(\n(.l/2)) .nr x (\n(.l/5) 'in \n(.iu+\nxu {server-url} 'in \n(.iu-\nxu .ad b 'hy .SH DESCRIPTION \fBzeyaclient\fR is a minimal command-line client for Zeya. The user is prompted for a query, and all songs matching it are played. The query may be matched against the title, artist, or album of the song. .PP While a song is playing, the user can press Ctrl+c to skip to the next song matching the query, or Ctrl+c Ctrl+c to return to the prompt. .SH COPYRIGHT \fBzeyaclient\fR was written by Phil Sung and is licensed under the terms of the GNU Affero GPL license, version 3 or later. .SH "SEE ALSO" \*(T<\fI/usr/share/doc/zeya/README\fR\*(T> .PP \*(T<\fI/usr/share/doc/zeya/TODO\fR\*(T> doc/zeyaclient.xml000066400000000000000000000037161162536731100145300ustar00rootroot00000000000000 Romain Francoise
rfrancoise@debian.org
2009-10-19
zeyaclient 1 zeyaclient command-line client for Zeya zeyaclient server-url DESCRIPTION zeyaclient is a minimal command-line client for Zeya. The user is prompted for a query, and all songs matching it are played. The query may be matched against the title, artist, or album of the song. While a song is playing, the user can press Ctrl+c to skip to the next song matching the query, or Ctrl+ c Ctrl+ c to return to the prompt. COPYRIGHT zeyaclient was written by Phil Sung and is licensed under the terms of the GNU Affero GPL license, version 3 or later. SEE ALSO /usr/share/doc/zeya/README /usr/share/doc/zeya/TODO
etc/000077500000000000000000000000001162536731100116365ustar00rootroot00000000000000etc/zeya.conf000066400000000000000000000012271162536731100134570ustar00rootroot00000000000000# --- INSTRUCTIONS ------------ # # This file is a sample Upstart service file. You can use it to automatically # run Zeya on system startup on systems that use Upstart scripts (for example, # Ubuntu Karmic and later). To do so, copy this file to /etc/init/zeya.conf and # change the command line (last line in this file) to set the invocation # options appropriately. # # ----------------------------- # Zeya - music server # # Zeya spawns a web server on the specified port to provide remote access to # music from HTML5-enabled clients. description "Start Zeya music server" start on runlevel [2345] exec python /usr/bin/zeya --path=/var/music --port=8080 m3u.py000066400000000000000000000062561162536731100121520ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # Copyright (C) 2009, 2010 Amit Saha # # This file is part of Zeya. # # Zeya is free software: you can redistribute it and/or modify it under the # terms of the GNU Affero General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Zeya is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License # along with Zeya. If not, see . # m3u backend import os.path import sys from backends import LibraryBackend from backends import extract_metadata class M3uPlaylist(object): def __init__(self, filename, file_obj): """ Parses data from FILE_OBJ (a file-like object), which contains a playlist in M3U format. """ self._filename = filename self._filenames = [] for line in file_obj: if not line.startswith('#'): rel_path = line.rstrip('\r\n') abs_path = os.path.normpath(os.path.join( os.getcwd(), os.path.dirname(filename), rel_path)) self._filenames.append(abs_path) def get_title(self): """ Returns the title of this playlist. """ # M3U doesn't provide for specifying the title. Just use the basename # of the file as the title of the playlist. return os.path.basename(self._filename).decode('UTF-8') def get_filenames(self): """ Returns the sequence of filenames represented by the playlist. """ return self._filenames class M3uBackend(LibraryBackend): def __init__(self, file_path=None): self.m3u_file = file_path # Check if the file exists so that we can fail-fast if necessary. if not os.path.exists(self.m3u_file): print "Error: no m3u file was found at %r." % (self.m3u_file,) print "Please check the m3u file location, or try --backend=dir instead." sys.exit(1) def get_library_contents(self): # Sequence of dicts containing the metadata for all the songs. library = [] # Dict mapping keys to the original filenames. self.file_list = {} next_index = 0 try: playlist = M3uPlaylist(self.m3u_file, open(self.m3u_file)) for filename in playlist.get_filenames(): try: metadata = extract_metadata(os.path.abspath(filename)) except ValueError: continue metadata['key'] = next_index self.file_list[next_index] = filename library.append(metadata) next_index = next_index + 1 return library except IOError: print "Error: could not read the specified playlist (%r)" \ % (self.m3u_file,) sys.exit(1) def get_filename_from_key(self, key): return self.file_list[int(key)] options.py000066400000000000000000000117171162536731100131370ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # Copyright (C) 2009 Phil Sung, Samson Yeung, Romain Francoise # # This file is part of Zeya. # # Zeya is free software: you can redistribute it and/or modify it under the # terms of the GNU Affero General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Zeya is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License # along with Zeya. If not, see . # Code for parsing command-line options. import getopt import os import sys DEFAULT_PORT = 8080 DEFAULT_BITRATE = 64 #kbits/s DEFAULT_BACKEND = 'dir' valid_backends = ['rhythmbox', 'dir', 'playlist'] class BadArgsError(Exception): """ Error due to incorrect command-line invocation of this program. """ def __init__(self, message): self.error_message = message def __str__(self): return "Error: %s" % (self.error_message,) def get_options(remaining_args): """ Parse the arguments and return a tuple (show_help, backend, bitrate, port, path, basic_auth_file), or raise BadArgsError if the invocation was not valid. show_help: whether user requested help information backend: string indicating backend to use bitrate: bitrate for encoded streams (kbits/sec) bind_address: IPv4/IPv6 address to bind to port: port number to listen on path: path from which to read music files (for "dir" and "playlist" backends only) basic_auth_file: file handle from which to read basic auth config, or None. """ # TODO: make this return a more useful data structure, e.g. a dict or an # object. Returning a huge tuple is kind of unwieldy. help_msg = False bind_address = '' port = DEFAULT_PORT backend_type = DEFAULT_BACKEND bitrate = DEFAULT_BITRATE path = None basic_auth_file = None try: opts, file_list = getopt.getopt( remaining_args, "b:hp:", ["help", "backend=", "bitrate=", "bind_address=", "port=", "path=", "basic_auth_file="]) except getopt.GetoptError, e: raise BadArgsError(e.msg) for flag, value in opts: if flag in ("-h", "--help"): help_msg = True if flag in ("--backend",): backend_type = value if backend_type not in valid_backends: raise BadArgsError("Unsupported backend type %r" % (backend_type,)) if flag in ("--basic_auth_file",): try: basic_auth_file = open(value, 'r') except: raise BadArgsError("Could not read auth file %s" % (value,)) if flag in ("-b", "--bitrate"): try: bitrate = int(value) if bitrate <= 0: raise ValueError() except ValueError: raise BadArgsError("Invalid bitrate setting %r" % (value,)) if flag in ("--path",): path = value if flag in ("-p", "--port"): try: port = int(value) except ValueError: raise BadArgsError("Invalid port setting %r" % (value,)) if flag in ("--bind_address",): bind_address = value if backend_type not in ('dir', 'playlist') and path is not None: print "Warning: --path was set but is ignored for --backend=%s" \ % (backend_type,) if backend_type == 'dir' and path is None: path = os.getcwd() if backend_type == 'playlist' and path is None: raise BadArgsError("Specify --path for playlist backend") return (help_msg, backend_type, bitrate, bind_address, port, path, basic_auth_file) def print_usage(): print "Usage: %s [OPTIONS]" % (os.path.basename(sys.argv[0]),) print """ Options: -h, --help Display this help message. --backend=BACKEND Specify the backend to use. Acceptable values: dir: (default) read a directory's contents recursively; see --path rhythmbox: read from current user's Rhythmbox library playlist: read from the playlist (m3u) file specified by --path --path=PATH For --backend=dir, the directory in which to look for music. (Default: ./) For --backend=playlist, the absolute path to a .m3u file, or a .pls file -b, --bitrate=N Specify the bitrate for output streams, in kbits/sec. (default: 64) --bindaddress=bindaddress Specify the IPv4/IPv6 address to bind to (default: bind to everything) -p, --port=PORT Listen for requests on the specified port. (default: 8080) --basic_auth_file=FILENAME Require basic HTTP authentication and only allow users named in the specified file. The file should be in 'htpasswd' format.""" pls.py000066400000000000000000000075351162536731100122450ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # Copyright (C) 2009, 2010 Amit Saha # # This file is part of Zeya. # # Zeya is free software: you can redistribute it and/or modify it under the # terms of the GNU Affero General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Zeya is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License # along with Zeya. If not, see . # pls backend import os.path import sys import urllib from backends import LibraryBackend from backends import extract_metadata class PlsPlaylist(object): def __init__(self, filename, file_obj): """ Parses data from FILE_OBJ (a file-like object), which contains a playlist in PLS format. FILENAME is the path of the input playlist file (used for evaluating the absolute filename of each file). """ self._title = "(Untitled)" self._filenames = [] for line_number, line in enumerate(file_obj): if line.startswith('X-GNOME-Title='): self._title = line[14:].rstrip('\r\n').decode('UTF-8') if line.startswith('File'): try: # Parse the filename from the line. path = line.rstrip('\r\n')[line.index("=") + 1:] if path.startswith("file:///"): # Is this (which leaves a leading '/') going to be # problematic for Windows systems)? abs_path = urllib.unquote(path[7:]) else: abs_path = os.path.normpath( os.path.join(os.getcwd(), os.path.dirname(filename), path)) self._filenames.append(abs_path) except ValueError: print "Warning: malformed line in %s:%d: %r" % \ (filename, line_number+1, line.strip()) continue def get_title(self): """ Returns the title of this playlist. """ return self._title def get_filenames(self): """ Returns the sequence of filenames represented by the playlist. """ return self._filenames class PlsBackend(LibraryBackend): def __init__(self, file_path=None): self.pls_file = file_path # Check if the file exists so that we can fail-fast if necessary. if not os.path.exists(self.pls_file): print "Error: no pls file was found at %r." % (self.pls_file,) print "Please check the pls file location, or try --backend=dir instead." sys.exit(1) def get_library_contents(self): # Sequence of dicts containing the metadata for all the songs. library = [] # Dict mapping keys to the original filenames. self.file_list = {} next_index = 0 try: playlist = PlsPlaylist(self.pls_file, open(self.pls_file)) for filename in playlist.get_filenames(): try: metadata = extract_metadata(os.path.abspath(filename)) except ValueError: continue metadata['key'] = next_index self.file_list[next_index] = filename library.append(metadata) next_index = next_index + 1 return library except IOError: print "Error: could not read the specified playlist (%r)" \ % (self.pls_file,) sys.exit(1) def get_filename_from_key(self, key): return self.file_list[int(key)] resources/000077500000000000000000000000001162536731100130755ustar00rootroot00000000000000resources/clear_search.png000066400000000000000000000014401162536731100162150ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYs  tIMEk\IDAT8KlLaLk-}VQ]!I<F$DI,X`AHD"B`3D*}UELt3wz6D<|99W` {=TrmbxgUϛW\ڱD &[xGlFD쉄)XitM[ԔgV &Y5G,[ב2L]0/ yxg;8]U4Oك3g_#a aD-n𗖖#]zɜk(]H~~_KeR4CG+(+j8rbɩ 0)qxqik#)95C߶"&wU%n< @Qn[Uc7m֧xzSgKVd/0 ?`zN\a"alF<JN7Z;8#6vftjTj5[@mo@uFv=$Q1,ZkE+I/Z3R8*1+i,&NS\K {w/&tW!blNfF}ݔ>;Lo2ΖJ AP,!r^VT.#Z'[IzLW!ICd( ^|_o62QlQUL:11[lU =n)ͤtSUQ@""<X^d)a5CJG,vnS@;dm V053pmznĈedji5C"8VcPĽxm9Ϟ99|J哳QCB3xžC* u\9ZG?iE45v8{gāﭷ,WSq$ 1C*\cS. izָ.s݉VDeAeFT LD$q\Gs+oge1Fb1%Myu15&IENDB`resources/library.html000066400000000000000000000101711162536731100154270ustar00rootroot00000000000000 Zeya
Loading collection...
Zeya requires a browser that supports the HTML 5 draft standard <audio> tag. We recommend Mozilla Firefox 3.5+ or Google Chrome 4.0+.

Keyboard shortcuts

SPACEPlay/pause
jNext track
kPrevious track
/Search
?Show this help message

Search operators

title:Search in track title
artist:Search in artist name
album:Search in album name

Close

resources/next.png000066400000000000000000000021441162536731100145620ustar00rootroot00000000000000PNG  IHDRĴl;sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8U_L[e{ޖK(0`dIIQaas2Lid9, LX4٢f3-B4ƹQqkKooi{? F|7o_9s"+I+"""s9#3s}gw89 fIbfG}uuU"%HecUUڇ6흞DD_^bnںEMiG.3ga]U@m6}`TU; **+~~㻛Ws<3R!e2tvv/(`GGWԌoDi)TU1&'3Eɥ9|! upڃTVV-!1D_NYN;(Jw(2vOU]\[[X7(-E4|nfh^oLk?|d,QryZ+jA"dTIfaٓ"R'lY? Bs$p9em ri5'&sdIENDB`resources/pause.png000066400000000000000000000012171162536731100147210ustar00rootroot00000000000000PNG  IHDRĴl;bKGD pHYs B(xtIME !IDAT8UˊA=+ݩ+71,2 nD$A0?B%HRq.TĝUus={ ^{08K!Dr|r\JyGK)}ws!'Qcf%Zbx:=%|BiJh9tzVӦ֚9v-f@t;M:fGw̯ 55C$I\*i0MS@Ǽ82&"a1oSˢiT0oA~bEe\*2) sx\h*EQ%Yht)QS#cv A,ͬ_RΊvrjP*(jzKw:V} kCNjZxV(A"`0?Yvm`4٭EW'B=yytt񘭵?>_+v̍jc*!GQdh cLZ*(8 %-cۚ!!IENDB`resources/play.png000066400000000000000000000017011162536731100145470ustar00rootroot00000000000000PNG  IHDRĴl;sBIT|dtEXtSoftwarewww.inkscape.org<SIDAT8kW﹓.*mMK*B!l ZcԂ A.k[jbZ&IVmA+S)Mdv̎s|}{;xQVeѲ9;+5Numy}--jxC8OLm|;Ύ?4}1 k6n{fLxm :M[Ů6)n彔GzoƄ?*kV)M4ے U2Mw}7caMn !F(ŸdšPɏ%IJ`f(1}.YOv7mlzm^LfAQ A'lk*sSiYX ۶8fE`i6[>4 20;Bp2 ! @DQ~ِe*##GL̀2HB@ BdY5g[cZ 6o*HWj, $A.=7<}{v E \UUUA%d<|D"$]ֲӆ!ର( =Bki#cMݡ={`y _*Ggԓ,Yr;:^"~?X8'({7Dcc ٢HX @`jirva?8;R*MIENDB`resources/previous.png000066400000000000000000000020301162536731100154520ustar00rootroot00000000000000PNG  IHDRĴl;sBIT|dtEXtSoftwarewww.inkscape.org<IDAT8ML\u} o%"8E364u2P?CXHMh覆 avcXe&.l]čABhlBu λy3c+JVE "@#oD"rSYD4݆(@gXUU-r?jjH{ &dȲ\Px__# 6?0eҺ޷V |,R6J,~G\m<U|*/4H_f$pQZ{WwCϞ;4D#rXA5R(yϜqbZXVS!>'8jhh#@e \w>>A%@iu+I) ˦"!q,*IU9zOjS?"!WU5IENDB`resources/search.png000066400000000000000000000017351162536731100150560ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYs B(xtIME ;0IO]IDAT8[lTEǿssβm 6R 7EF< B 1 Py@j Id_ QKS.!BzkwvwϞo| O曙?okFiM{OzB |bjXiUL͛66[3 p:m\"B߸h$VT|Կ6n୛;y:Z L;˪qB7] I+:+Z^:22zte"S[gwݿ Cz x GOtY3[M:ڿ-S5尞K9%~} 8ͫu"/Ϟ; kVFtiLgΑpfnD/LvwIENDB`resources/shuffle.png000066400000000000000000000010301162536731100152310ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGDC pHYs  tIME .0IDAT8˭jP?}w\8dh7H|;8XD: :t(Z PZpǛx !#P휨C9ݞeߋNMJYzހ 1r&|E ۼ7+%כy'l߰as[VJ[6le4\ߚBL׷BywR F(jorY@LITI (V:F頉X 8:hVP@qZI;ZF9yԡfգwL-qN8 JYbs+*L tvD,Cq4:Am1-z|u T928_D]j(g BKjIENDB`resources/spinner.gif000066400000000000000000000034711162536731100152470ustar00rootroot00000000000000GIF89afff쏏fff{{{qqqhhh! NETSCAPE2.0!Created with ajaxload.info! ,w  !DBAH¬aD@ ^AXP@"UQ# B\; 1 o:2$v@ $|,3 _# d53" s5 e!! ,v i@e9DAA/`ph$Ca%@ pHxFuSx# .݄YfL_" p 3BW ]|L \6{|z87[7!! ,x  e9DE"2r,qPj`8@8bH, *0- mFW9LPE3+ (B"  f{*BW_/ @_$~Kr7Ar7!! ,v 4e9!H"* Q/@-4ép4R+-pȧ`P(6᠝U/  *,)(+/]"lO/*Ak K]A~666!! ,l ie9"* -80H=N; TEqe UoK2_WZ݌V1jgWe@tuH//w`?f~#6#!! ,~ ,e9"* ; pR%#0` 'c(J@@/1i4`VBV u}"caNi/ ] ))-Lel  mi} me[+!! ,y Ie9"M6*¨"7E͖@G((L&pqj@Z %@wZ) pl( ԭqu*R&c `))( s_J>_\'Gm7$+!! ,w Ie9*, (*(B5[1 ZIah!GexzJ0e6@V|U4Dm%$͛p \Gx }@+| =+ 1- Ea5l)+!! ,y )䨞'AKڍ,E\(l&;5 5D03a0--ÃpH4V % i p[R"| #  6iZwcw*!! ,y )䨞,K*0 a;׋аY8b`4n ¨Bbbx,( Ƚ  % >  2*i* /:+$v*!! ,u )䨞l[$ Jq[q 3`Q[5:IX!0rAD8 CvHPfiiQAP@pC %D PQ46  iciNj0w )#!! ,y ). q ,G Jr(J8 C*B,&< h W~-`, ,>; 8RN<, <1T] c' qk$ @)#!;resources/zeya.css000066400000000000000000000106211162536731100145570ustar00rootroot00000000000000body { background-color: #fbfbfb; margin: 0; border: 0; padding: 0; height: 100%; max-height: 100%; font-family: sans-serif; overflow: hidden; } #header { position: absolute; padding: 0px; top: 0; left: 0; width: 100%; height: 71px; overflow: hidden; background-color: #f6f5f4; border-bottom: 1px solid #999; } #navigation-bar { height: 32px; background-color: #b7c4d1; background: -moz-linear-gradient(top, #bfccd9, #aebac6); background: -webkit-gradient(linear, left top, left bottom, from(#bfccd9), to(#aebac6)); border-bottom: 1px #89a solid; } #navigation-bar-left { float: left; margin: 0 0 0 0; padding: 0.25em 0 0 4px; vertical-align: middle; } #corpus-selector { display: none; } #navigation-bar-right { float: right; margin: -0.25em -2px 0 0; padding: 0; } form#search-form { margin: 0; padding: 0; text-align: right; height: 32px; } form#search-form input { width: 160px; height: 1.2em; margin-top: -0.90em; } #header-left { float: left; height: 40px; margin-top: -1px; } #header-right { height: 100%; float: right; width: 250px; margin-top: -1px; padding-right: 2px; text-align: right; } #scrubber-box { display: inline-block; vertical-align: middle; margin-right: 12px; text-align: right; font-size: small; } #header-main { margin-top: 20px; } #header-main-inner { margin-top: -0.70em; } #footer { position: absolute; bottom: 0; left: 0; width: 100%; height: 16px; overflow: hidden; background: #f6f5f4; border-top: 1px solid #999; } #footer-left { padding: 1px; width: 50%; float: left; font-size: 72%; } #footer-right { padding: 1px; width: 30%; float: right; text-align: right; font-size: 72%; } #content { position: fixed; top: 72px; left: 0; bottom: 17px; right: 0; overflow-y: scroll; padding: 1px; } #loading { margin: 3em auto 0 auto; padding: 0.25em; width: 15em; background-color: #f3f2aa; text-align: center; font-weight: bold; -webkit-border-radius: 5px; -moz-border-radius: 5px; } #unsupported { display: none; margin: 3em auto 0 auto; padding: 0.25em; width: 26em; background-color: #ffc6bb; color: #500; text-align: center; -webkit-border-radius: 5px; -moz-border-radius: 5px; } #unsupported a { color: #400; } #helpcontainer { position: fixed; top: 50px; width: 100%; display: none; } #help { -webkit-border-radius: 5px; -moz-border-radius: 5px; padding: 5px; background-color: #333; color: #fff; width: 25em; margin-left: auto; margin-right: auto; } #help a { color: #fff; } #help .heading { text-align: center; font-size: 120%; } #help table { margin-left: auto; margin-right: auto; } #help tr td:first-child { padding-right: 2em; text-align: center; font-family: monospace; } span.control img { width: 22px; height: 22px; border: 1px solid transparent; padding: 4px; margin: 4px 1px; cursor: hand; cursor: pointer; vertical-align: middle; } span#spinner img { width: 16px; height: 16px; border: 1px solid transparent; padding: 4px; margin: 7px 0 7px 7px; vertical-align: middle; } span.control img.activated { border-bottom: 1px solid #b6b3b0; border-right: 1px solid #b6b3b0; border-top: 1px solid #888582; border-left: 1px solid #888582; background-color: #d6d4d2; } span.control img.grayed { opacity: 0.4; cursor: default; } span.title { font-size: large; font-weight: bold; } span.artist { font-size: small; font-style: italic; } a:link { color: #00a; } a:visited { color: #00a; } table#collection_table { width: 100%; table-layout: fixed; border-spacing: 0; } table#collection_table tr.oddrow { background-color: #e6e4e2; } table#collection_table tr.selectedrow { background-color: #46d; color: #fff; } table#collection_table tr.selectedrow a { color: #fff; } table#collection_table td { margin: 0; padding: 1px 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } table#collection_table thead td { background-color: #eeecea; border: 1px outset #eeecea; font-weight: bold; } resources/zeya.js000066400000000000000000000602261162536731100144110ustar00rootroot00000000000000// Javascript implementation for Zeya client. // Map from song key to library item. Each library item is an object with // attributes .title, .artist, .album, and .key. var library; // Representation of the set of available playlists. Maps a playlist ID to a // list of song keys representing that playlist. var playlist_map = {}; // The sequence of songs displayed in the playlist (after selection of // playlist, filtering and shuffling). This is represented as a list of song // keys (which are also keys into library). var displayed_content; // Index (into displayed_content) of the currently playing song, or null if no // song is playing. var current_index = null; // Audio object we'll use for playing songs. var current_audio; var preload_audio; var preload_key; // `key' attribute of the song we've preloaded. var preload_finished = false; // Current application state ('grayed', 'play', 'pause') var current_state = 'grayed'; // Playlist ID of the selected playlist. var current_playlist; // Value of the search box, or null if no search has been performed var search_string = null; // Whether or not the repeat feature is activated. var is_repeating = false; // Whether or not the shuffle feature is activated. var is_shuffled = false; // Information to display in the status area. var status_info = { total_tracks: 0, displayed_tracks: 0, }; // We need to buffer streams for Chrome. var using_webkit = navigator.userAgent.indexOf("AppleWebKit") > -1; // Firefox 3.5 doesn't issue the 'suspend' event, so we need to use a fallback // implementation. var using_gecko_1_9_1 = navigator.userAgent.indexOf("Gecko/") > -1 && navigator.userAgent.indexOf("rv:1.9.1.") > -1; // Return true if the client supports the