From fe3e3e1edfaa19e213ac386df2239f561fb6f071 Mon Sep 17 00:00:00 2001 From: momo <> Date: Mon, 22 Jan 2007 10:11:49 +0000 Subject: [PATCH] First upload --- AUTHORS | 1 + COPYING | 340 ++++++++++++++++++++++++++++++++ INSTALL | 40 ++++ Makefile | 68 +++++++ README | 111 +++++++++++ audio_marking.py | 63 ++++++ audio_marking.pyc | Bin 0 -> 2428 bytes audio_tools.py | 142 ++++++++++++++ audio_tools.pyc | Bin 0 -> 6413 bytes collection.py | 37 ++++ configure-stamp | 0 consts.py | 37 ++++ consts.pyc | Bin 0 -> 1052 bytes debian/README.Debian | 6 + debian/changelog | 82 ++++++++ debian/compat | 1 + debian/control | 27 +++ debian/copyright | 27 +++ debian/dirs | 2 + debian/docs | 1 + debian/pycompat | 1 + debian/rules | 68 +++++++ debian/telemeta.1 | 81 ++++++++ debian/telemeta.sgml | 268 +++++++++++++++++++++++++ default_options.py | 33 ++++ default_options.pyc | Bin 0 -> 800 bytes default_tags.py | 33 ++++ default_tags.pyc | Bin 0 -> 700 bytes doc/html/index.html | 414 ++++++++++++++++++++++++++++++++++++++ install.py | 41 ++++ svn-commit.tmp | 4 + tag_tools.py | 309 +++++++++++++++++++++++++++++ tag_tools.pyc | Bin 0 -> 9152 bytes telemeta.py | 458 +++++++++++++++++++++++++++++++++++++++++++ typeToolBox.py | 41 ++++ typeToolBox.pyc | Bin 0 -> 831 bytes 36 files changed, 2736 insertions(+) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 INSTALL create mode 100644 Makefile create mode 100644 README create mode 100755 audio_marking.py create mode 100644 audio_marking.pyc create mode 100755 audio_tools.py create mode 100644 audio_tools.pyc create mode 100644 collection.py create mode 100644 configure-stamp create mode 100755 consts.py create mode 100644 consts.pyc create mode 100644 debian/README.Debian create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/dirs create mode 100644 debian/docs create mode 100644 debian/pycompat create mode 100755 debian/rules create mode 100644 debian/telemeta.1 create mode 100644 debian/telemeta.sgml create mode 100755 default_options.py create mode 100644 default_options.pyc create mode 100755 default_tags.py create mode 100644 default_tags.pyc create mode 100644 doc/html/index.html create mode 100755 install.py create mode 100644 svn-commit.tmp create mode 100755 tag_tools.py create mode 100644 tag_tools.pyc create mode 100755 telemeta.py create mode 100755 typeToolBox.py create mode 100644 typeToolBox.pyc diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..1e91d5e7 --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Guillaume Pellerin diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..d60c31a9 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + 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 +this service 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. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +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 +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the 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 a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE 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. + + 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 +convey 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 General Public License as published by + the Free Software Foundation; either version 2 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000..54948fec --- /dev/null +++ b/INSTALL @@ -0,0 +1,40 @@ +INSTALL +======= + +Telemeta is written in python. So it doesn't require any compilation step but the installation of some other programs. + +* On debian or Ubuntu just add these lines to your /etc/apt/sources-list: + + deb http://yomix.org/debian/ binary/ + deb-src http://yomix.org/debian/ source/ + + Then, + + sudo apt-get update + sudo apt-get install telemeta + + All the depending packages will be installed. + +* On other platforms, the first thing to do is then to install python for your system with your favorite package manager (Linux based distribution) or download and install it (Windows, MacOS) from http://www.python.org/download/. + + To access the full power of telemeta's useful features, compile and/or install by the same way (you may find them in your package manager) the following programs : + + - python (http://www.python.org) + - python-xml + - python-mutagen + - oggenc (http://www.vorbis.com/) + - sox (http://sox.sourceforge.net/) + - flac (http://flac.sourceforge.net/) + - lame (http://lame.sourceforge.net/) + - ecasound (http://eca.cx/ecasound/) + - wavbreaker (http://huli.org/wavbreaker/) + - festival (http://www.cstr.ed.ac.uk/projects/festival/) + - par2 + + Now, open a shell (console, terminal, etc..), go to the uncompressed directory and type AS ROOT : + + python install.py + + +type telemeta --help for more informations. + diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..569a1dde --- /dev/null +++ b/Makefile @@ -0,0 +1,68 @@ +INSTALL ?= install +MAKE ?= make +RM ?= rm +RMDIR ?= rmdir +prefix ?= /usr/local + + +PREFIX = $(DESTDIR)$(prefix) + +BINDIR = $(PREFIX)/bin +MANDIR = $(PREFIX)/share/man/man1 +DATADIR = $(PREFIX)/share/telemeta +SRCDIR = $(DATADIR) +#PIXDIR = $(DATADIR)/pix +#RESDIR = $(DATADIR)/res + +#APPDIR = $(PREFIX)/share/applications +#ICONDIR = $(PREFIX)/share/pixmaps +#LOCALEDIR = $(PREFIX)/share/locale + +#LANGUAGES = `find locale/ -maxdepth 1 -mindepth 1 -type d -printf "%f "` + +help: + @echo Usage: + @echo "make - not used" + @echo "make clean - removes temporary data" + @echo "make install - installs data" + @echo "make uninstall - uninstalls data" + @echo "make help - prints this help" + @echo + + +install: + echo $(PREFIX) + $(INSTALL) -m 755 -d $(BINDIR) $(MANDIR) $(DATADIR) $(SRCDIR) +#$(PIXDIR) $(RESDIR) $(APPDIR) + $(INSTALL) -m 644 *.py $(SRCDIR) +# $(INSTALL) -m 644 res/*.glade $(RESDIR) + $(INSTALL) -m 644 debian/telemeta.1 $(MANDIR) +# $(INSTALL) -m 644 pix/*.png $(PIXDIR) +# $(INSTALL) -m 644 pix/telemeta.xpm $(ICONDIR) +# $(INSTALL) -m 644 res/telemeta.desktop $(APPDIR) + if test -L $(BINDIR)/telemeta; then ${RM} $(BINDIR)/telemeta; fi + ln -s $(SRCDIR)/telemeta.py $(BINDIR)/telemeta + chmod +x $(SRCDIR)/telemeta.py +# $(MAKE) -C po dist +# for lang in $(LANGUAGES); do \ +# ${INSTALL} -m 755 -d $(LOCALEDIR)/$$lang/LC_MESSAGES;\ +# $(INSTALL) -m 644 locale/$$lang/LC_MESSAGES/telemeta.mo $(LOCALEDIR)/$$lang/LC_MESSAGES/; \ +# done + + +uninstall: + ${RM} $(PREFIX)/bin/telemeta +# ${RM} $(APPDIR)/telemeta.desktop + ${RM} $(MANDIR)/telemeta.1 +# ${RM} $(ICONDIR)/telemeta.xpm + ${RM} -rf $(DATADIR) + $(RMDIR) --ignore-fail-on-non-empty $(BINDIR) $(MANDIR) +#$(APPDIR) +# for lang in $(LANGUAGES); do \ +# ${RM} $(LOCALEDIR)/$$lang/LC_MESSAGES/telemeta.mo; \ +# done + +clean: + ${RM} src/*.py[co] res/*~ res/*.bak + +.PHONY: help clean install diff --git a/README b/README new file mode 100644 index 00000000..62366248 --- /dev/null +++ b/README @@ -0,0 +1,111 @@ +# README +# ====== + +Telemeta: backups, transcodes, tags and marks any audio content with metadata + + +# 1. Introduction +# =============== + +Telemeta is an audio tool which creates audio transcoded databases fast from fresh mastered files. It can be useful to backup digitalized audio media from vinyls, old tapes or whatever. + +Telemeta first creates a simple structure where original sounds will be backuped. The files can be transcoded to WAV, FLAC, MP3 and OGG including the corresponding tags. + +Here are some cool functions: + + - XML generation for metadata tags of backuped WAV + - Audio marking from a given file or from tags thanks to the Festival speech systhesis tool + - File corruption security with par2 recovery files + - Database synchronizing to remote servers (ssh+rsync) + - Modify metadata from XML or interactive shell + + +# 2. Requirements +# =============== + +python (>= 2.3.5-7), python-xml, python-central (>= 0.5), python-mutagen, sox, vorbis-tools, flac, lame, normalize-audio, ecasound, festival, par2 + + +# 3. Installation +# =============== + +Telemeta is written in python. So it doesn't require any compilation step. + +On debian or Ubuntu just add these lines to your /etc/apt/sources-list: + + deb http://yomix.org/debian/ binary/ + deb-src http://yomix.org/debian/ source/ + +Then, + + sudo apt-get update + sudo apt-get install telemeta + +On other linux platforms, uncompress the archive, go into the created directory and just type this with your favorite shell : + + python install.py + +See INSTALL file for more informations. + + +# 4. Usage +# ======== + +In order to backup all original or transcoded files into a collection, telemeta needs first to create his repository. Let's type : + + telemeta --create COLLECTION + +Replacing COLLECTION with the name of your collection. Answer to the questions. A target directory is then created. All answers are saved into YOUR_HOME/.telemeta/default_database.xml and YOUR_HOME/.telemeta/COLLECTION.xml + +To backup a wav file, type : + + telemeta --backup COLLECTION FILE.WAV + +where you have to replace FILE.WAV by the local file of your choice you want to add in the database. Then, answer to the questions. All answers are saved into YOUR_HOME/.telemeta/default_tags.xml and will be use for the next execution. The program will automatically transcode the wav (or aiff) file to the types you have defined (for example FLAC, MP3 and/or OGG) and place them into each directory of the repository (for example flac/, mp3/ and/or ogg/). + +To backup an entire directory, type : + + telemeta --backup COLLECTION --album DIRECTORY + +where you have to replace DIRECTORY by the local directory containing all the audio files you want to add in the database. + +Other options: + + --from-xml takes tags and opts in original xml source + --force forces file conversion (no audio test) + --par2 forces par2 file creation + --all-default chooses default argument for all question + --recover check an repair the backuped media with the previously created "par2" security key + --rsync synchronizes database to a remote server (ssh+rsync) + --erase-media erases the media (flac, ogg, mp3) database + --help gives help page + +# 5. EXAMPLES +# =========== + + telemeta --create my_collection + telemeta --backup my_collection file.wav + telemeta --backup my_collection --album ./ + telemeta --backup my_collection --album --par2 --rsync ./ + telemeta --backup my_collection --album --par2 --rsync --force ./ \n + +# 6. TODO +# ======= + +- HTTP web interface (metadata adding, editing, uploading, searching) +- debug id3 editing +- add media types +- create svn repository + +# 7. Feedback +# =========== + +Please give me some feedback. Tell me if Telemeta suits you or if you would need some other interesting features. +You are welcome to mail me at + +# 8. Contact +# ========== + +Home page : http://yomix.org/telemeta + +Guillaume Pellerin diff --git a/audio_marking.py b/audio_marking.py new file mode 100755 index 00000000..0d30d2ae --- /dev/null +++ b/audio_marking.py @@ -0,0 +1,63 @@ +#!/usr/bin/python +# *coding: utf-8* +# +# Copyright (c) 2006 Guillaume Pellerin +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 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 Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +import os, sys, re, string +import tag_tools +from audio_tools import * + +def make_auto_mark(dir_in,file_in): + media_in = dir_in+file_in + artist_no_ = string.replace(tag_tools.get_tag_value('ARTIST'),'_',' ') + title_no_ = string.replace(tag_tools.get_tag_value('TITLE'),'_',' ') + description_no_ = string.replace(tag_tools.get_tag_value('COMMENT'),'_',' ') + os.system('echo "This is: '+title_no_+'. By '+artist_no_+'. It is '+description_no_+'" | text2wave -f 44100 -o "'+media_in+'_mark.tmp"') + #os.system('normalize-audio "'+media_in+'_mark.tmp"') + os.system('sox "'+media_in+'_mark.tmp" -t wav -c2 "'+media_in+'_mark.wav" vol 10.0 dB compand 50,20 -80,-80,-25,-35,-15,-27,-5,-19,0,-15 15') + os.system('rm '+dir_in+'*.tmp') + +def mark_audio(dir_in,file_in,audio_marking_file,audio_marking_timeline): + media_in = dir_in+file_in + file_length_sec = audio_length_sec(media_in) + audio_mark_length_sec = audio_length_sec(audio_marking_file) + ecasound_phrase = '' + audio_gain = str(100+100*len(audio_marking_timeline)) + + for timeline in audio_marking_timeline: + audio_marking_ecasound_filename = file_in+'_'+timeline+'.ewf' + audio_marking_ecasound_path = dir_in+file_in+'_'+timeline+'.ewf' + audio_marking_ecasound_file=open(audio_marking_ecasound_path,'w') + audio_marking_ecasound_file.write('-- '+audio_marking_ecasound_filename+' --\n') + audio_marking_ecasound_file.write('source = '+audio_marking_file+'\n') + if timeline == 'b': + mark_offset = '0' + ecasound_phrase = '-a:2 -i:"'+audio_marking_ecasound_path+'" -ea:'+audio_gain+' ' + if timeline == 'm': + mark_offset = str(file_length_sec/2) + ecasound_phrase = ecasound_phrase+'-a:3 -i:"'+audio_marking_ecasound_path+'" -ea:'+audio_gain+' ' + if timeline == 'e': + mark_offset = str(file_length_sec-audio_mark_length_sec) + ecasound_phrase = ecasound_phrase+'-a:4 -i:"'+audio_marking_ecasound_path+'" -ea:'+audio_gain+' ' + audio_marking_ecasound_file.write('offset = '+mark_offset+'.0\n') + audio_marking_ecasound_file.write('start-position = 0.0\n') + audio_marking_ecasound_file.write('length = '+str(audio_mark_length_sec)+'.0\n') + audio_marking_ecasound_file.write('looping = false\n') + audio_marking_ecasound_file.write('--cut--\n') + audio_marking_ecasound_file.close() + os.system('ecasound -a:1 -i:"'+media_in+'" -ea:'+audio_gain+' '+ecasound_phrase+' -a:all -o "'+dir_in+'marked_'+file_in+'"') + diff --git a/audio_marking.pyc b/audio_marking.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a0e6165bf3c580962966417fcea0b0a9e4f4c822 GIT binary patch literal 2428 zcmaJ?>uwuG6h3PwaqQf$4h<?-ZbD1;e?0ny*|IAc6fBmo@((Rvv`8y2rBSb`WMs$=f z96EADQ=p@QEQ)kgl*JewjZx&#**LYM0{wxQ35trcD6z-8`WUu5tn==c#nZ3=If223 zR~Y6`h(7)ust$@|ixiKM9j6#OIdp^6N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.py new file mode 100755 index 00000000..f57d0808 --- /dev/null +++ b/audio_tools.py @@ -0,0 +1,142 @@ +#!/usr/bin/python +# *coding: utf-8* +# +# Copyright (c) 2006 Guillaume Pellerin +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 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 Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +import os, sys, re, string +import tag_tools +from audio_tools import * + +def encode(enc_type,dir_in,file_in,dir_out,file_out): + media_in = dir_in+file_in + media_out = dir_out+file_out + + if enc_type == 'flac' : + quality = tag_tools.get_opt_value(enc_type+'_quality') + os.system('flac -V -q '+quality+' -o "'+media_out+'" "'+media_in+'"') + + if enc_type == 'ogg': + bitrate = tag_tools.get_opt_value(enc_type+'_bitrate') + os.system('oggenc -b '+bitrate+' -o "'+media_out+'" "'+media_in+'"') + + if enc_type == 'mp3': + bitrate = tag_tools.get_opt_value(enc_type+'_bitrate') + tag='temp' + os.system('lame -b '+tag+' --ta "'+tag+'" --tt "'+tag+'" --tl "'+tag+'" --ty '+tag+' --tg "Other" --tc "'+tag+'" "'+media_in+'" "'+media_out+'"') + + if enc_type == 'wav': + if iswav16(media_in): + os.system('cp -a "'+media_in+'" "'+media_out+'"') + else: + os.system('sox "'+media_in+'" -w -r 44100 -t wav -c2 "'+media_out+'"') + +# if enc_type == 'ogg' and ismp3(media_in): +# os.system('mp32ogg --verbose "'+file_in+'" "'+file_out+'"') + +def decode(media_in,file_ext): + if ismp3(media_in) or file_ext == 'mp3': + os.system('mpg123 -q -s "'+media_in+'" -w "'+media_in+'.wav"') + if isogg(media_in) or file_ext == 'ogg': + os.system('oggdec -o "'+media_in+'.wav" "'+media_in+'"') + if isflac(media_in) or file_ext == 'flac': + os.system('flac -d "'+media_in+'"') + if iswav(media_in) or file_ext == 'wav': + os.system('sox "'+media_in+'" -w -r 44100 -t wav -c2 "'+media_in+'.wav"') + if isaiff(media_in) or file_ext == 'aiff': + os.system('sox "'+media_in+'" -w -r 44100 -t aiff -c2 "'+media_in+'.wav"') + +def normalize(media_in): + os.system('normalize-audio "'+media_in+'"') + +def create_par_key(dir_in,file_in): + media_in = dir_in+file_in + os.system('par2 c -n1 "'+media_in+'"') + +def recover_par_key(dir_in): + for file in os.listdir(dir_in): + media_in = dir_in+file + if iswav(media_in): + os.system('par2 r "'+media_in+'"') + +def verify_par_key(media_in): + os.system('par2 v "'+media_in+'.par2"') + +def clean_directory(dir_in,type_list): + for enc_type in type_list: + if os.path.exists(dir_in+enc_type): + print 'Removing '+dir_in+enc_type + os.system('rm -rf "'+dir_in+enc_type+'"') + +def audio_length_sec(file) : + file_in, file_out = os.popen4('wavinfo "'+file+'" | grep wavDataSize') + for line in file_out.readlines(): + line_split = line.split(':') + value = int(int(line_split[1])/(4*44100)) + return value + +def ext_is_audio(file): + file_name_woext, file_ext = tag_tools.filename_split(file) + return file_ext == "mp3" or file_ext == "ogg" or file_ext == "flac" or file_ext == "wav" or file_ext == "aif" or file_ext == "aiff" or file_ext == "WAV" or file_ext == "AIFF" or file_ext == "AIF" or file_ext == "MP3" or file_ext == "OGG" or file_ext == "FLAC" + +def isaudio(file) : + file_in, file_out = os.popen4('file "'+file+'"') + for line in file_out.readlines(): + line_split = line.split(' ') + return (iswav16(file) or iswav(file) or ismp3(file) or isogg(file) or isflac(file) or isaiff(file) or isaiff16(file)) + +def iswav(file) : + file_in, file_out = os.popen4('file "'+file+'"') + for line in file_out.readlines(): + line_split = line.split(' ') + return ('WAVE' in line_split) + +def iswav16(file) : + file_in, file_out = os.popen4('file "'+file+'"') + for line in file_out.readlines(): + line_split = line.split(' ') + return ('WAVE' in line_split) and ('16' in line_split) + +def isaiff(file) : + file_in, file_out = os.popen4('file "'+file+'"') + for line in file_out.readlines(): + line_split = line.split(' ') + return ('AIFF' in line_split) + +def isaiff16(file) : + file_in, file_out = os.popen4('file "'+file+'"') + for line in file_out.readlines(): + line_split = line.split(' ') + return ('AIFF' in line_split) and ('16' in line_split) + +def ismp3(file) : + file_in, file_out = os.popen4('file "'+file+'"') + for line in file_out.readlines(): + line_split_space = line.split(' ') + line_split_comma = line.split(',') + return (('MPEG' in line_split_space and ' layer III' in line_split_comma) or 'MP3' in line_split_space) + +def isogg(file) : + file_in, file_out = os.popen4('file "'+file+'"') + for line in file_out.readlines(): + line_split = line.split(',') + return (' Vorbis audio' in line_split) + +def isflac(file) : + file_in, file_out = os.popen4('file "'+file+'"') + for line in file_out.readlines(): + line_split = line.split(' ') + return ('FLAC' in line_split) diff --git a/audio_tools.pyc b/audio_tools.pyc new file mode 100644 index 0000000000000000000000000000000000000000..24a5c0ba8f58090d6acee40bee6f8918aec83697 GIT binary patch literal 6413 zcmc&&-Bugd6+R<`gaiU?L#W;SjODad-3SbJlGU_zObx~~4Nk^cq>DDy8fykTwxk(! zjsc~xdeK~U^$mK_n_hPHUAp=veS&`9J|k(6acp0Z#5rg7KEM0_e4_ooO8LM4{QG)S zrT;nj-a*skc)5#-c2*i%r!m=Hx3 zRhtDq>vqzWd4m{LJWh>8lzLQJb*QivH9ObIcof{G9qR4^^XMHS2l zaY+TULd>b)f)Mj6xG2OM6!c;3613W?QAxw@dUG6o8Ep*hE}A~U__3pob86vaTpf?8 z<2I))V-^(3d_Un<8GRWu<(SoRl3os^U*s|b2veMv0@*mGRKcN||dD9mL}2aN|6 zpFe2A9yHNEsHBcD^sa?q2kM1zB1xRYZ4xG8m9#BmkK!|!zZok_p5>GwkV?aR$C z^%#-=qFnm`*G?yKPn z(@t*6O(tw7nm4ulcF0*>1mo80#>d&5sFE>RrUizpWTxlpxpc>#TYX?2hg}(OLL>@v z=pV@9X5!X)Bn8*;5vVKnh(ovDb#L8TzH!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CBsZ*66LmC4s&`N}dVg8t*N3Z?kjJ32uor5eP82cuI~OrpODkgL#jg0;NHwRjHp8 zP3HJ1%YV-6uw@j9Fg2{@>siacbB5(nj8KxE6f)I^S8NGv%-G8Nn0L{Ph}89(zyN^; zuV}N^GKAPR#9c47z#l2qw_4z%tOeftHVecE9TeqJb1-PmHi!3X-p&FAN1wAr7;;b1 zUTTr=IwrgiA=P-m%Bm?i=1rOAR60_y0P1zkodF ztv#RlzoLz3Ut@i?zb=`3`~w}|g>ESLTbnL^?O4D@WNu%0`JF*2y+mCwB;5kt;X3SI!eL +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 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 Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +import os, string + +class Collection : + + def __init__(self) : + self.collection_name = 'telemeta_default' + self.collection_dir = '/home/'+os.environ["USER"]+'/telemeta/' + self.user_dir = '/home/'+os.environ["USER"]+'/.telemeta/' + self.user_tag_xml = '/home/'+os.environ["USER"]+'/.telemeta/default_tags.xml' + self.user_collection_xml = '/home/'+os.environ["USER"]+'/.telemeta/default_collection.xml' + self.tag_table = 'ARTIST,TITLE,ALBUM,DATE,GENRE,SOURCE,ENCODER,COMMENT' + self.type_list = 'mp3,ogg,flac,wav,aiff' + self.net_backup_host = 'domain.com' + self.net_backup_dir = '/home/'+os.environ["USER"]+'/telemeta/' + +#option_table=['enc_types','flac_bitrate','ogg_bitrate','mp3_bitrate','audio_marking','auto_audio_marking','audio_marking_file','audio_marking_timeline'] + +#questions = ['Output formats','flac_bitrate','ogg_bitrate','mp3_bitrate','Audio marking (y/n)','Auto audio marking (y/n)','Audio marking file path','Audio marking timeline (b)eginning, (m)iddle, (e)nd'] \ No newline at end of file diff --git a/configure-stamp b/configure-stamp new file mode 100644 index 00000000..e69de29b diff --git a/consts.py b/consts.py new file mode 100755 index 00000000..0fa97a37 --- /dev/null +++ b/consts.py @@ -0,0 +1,37 @@ +#!/usr/bin/python +# *coding: utf-8* +# +# Copyright (c) 2006 Guillaume Pellerin +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 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 Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +import os, string + +class Collection : + + def __init__(self) : + self.collection_name = 'telemeta_default' + self.collection_dir = '/home/'+os.environ["USER"]+'/telemeta_default/' + self.user_dir = '/home/'+os.environ["USER"]+'/.telemeta/' + self.default_tag_xml = '/home/'+os.environ["USER"]+'/.telemeta/default_tags.xml' + self.default_collection_xml = '/home/'+os.environ["USER"]+'/.telemeta/default_collection.xml' + self.tag_table = 'ARTIST,TITLE,ALBUM,DATE,GENRE,SOURCE,ENCODER,COMMENT' + self.type_list = 'mp3,ogg,flac,wav,aiff' + self.net_backup_host = 'domain.com' + self.net_backup_dir = '/home/'+os.environ["USER"]+'/telemeta/' + +#option_table=['enc_types','flac_bitrate','ogg_bitrate','mp3_bitrate','audio_marking','auto_audio_marking','audio_marking_file','audio_marking_timeline'] + +#questions = ['Output formats','flac_bitrate','ogg_bitrate','mp3_bitrate','Audio marking (y/n)','Auto audio marking (y/n)','Audio marking file path','Audio marking timeline (b)eginning, (m)iddle, (e)nd'] \ No newline at end of file diff --git a/consts.pyc b/consts.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5cbaa161367f0a9b66a950354c1bbc43f1287f6c GIT binary patch literal 1052 zcmZuwOK;mS45po@lWpC)M?37aTLyS`vB!B!Q)39wIDq0DmW$w8a%$AJf=J0$V7Kju z^f&GojFQtN4Q7Kh`H}i4QgZS4ap!1w7bLKGYWV$%BHy8605<@$%CKN&0ka@Q*M>g; zzX86_Y@Iae>1CnnpdN@k=ZVThx#hGFK1Y$yP$?udJjj5n$)sl^8YVhPi)I?2$U9V6 z?iT>Xd>fPvSq)eXUZ1c!oM^m$h&L*{afml7ym^SXD!c`(Z3?x4ImU2+b&SzDT+*$U zbgRA};U+`%6t&_xFSv>+<7vFgm24vDUyFkKs*dJ#5)gT;vBOMXb~WtX5261bD`lneql2nXYf zfVhM4XcUBze2EK-#Yb1n=Wd$EiTfj7yK$DLQXeoAMVyshA`0Vf+wpsP7^YXr^Hd$7 zx7!gdW1NmYY9Un%KfGLLOHryP57St-RBeP-k}s)tG|k=sDE6;j?O}T*bjZOF&IxCA zmGjEGU2vLbQW>g}D|!_tH>(A`#+{h*dl**i>03zjHSD2ON}Zuq9cCd4;WNJ8^?iSC z@6Wss-e*4%rBu>e+?qZp&B{zsdWr<*_`!0l)6MIk?O5jL*(B>JQEGl9N(;eOIl4sO zuia*hMf6+<3g}@-J=msgm`DR{rEi~9%dDK6q+NtO$4G^tQPCPQrThN!0+nGqw*LX) COyP|H literal 0 HcmV?d00001 diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 00000000..cb94e3e7 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,6 @@ +telemeta for Debian +--------------- + +Soon ! + + -- Guillaume Pellerin , Thu, 17 Aug 2006 22:42:14 +0200 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..1579a6bc --- /dev/null +++ b/debian/changelog @@ -0,0 +1,82 @@ +telemeta (0.2.5-2) unstable; urgency=low + + * Fixed --help page + + -- Guillaume Pellerin Wed, 10 Jan 2007 12:01:13 +0100 + +telemeta (0.2.5-1) unstable; urgency=low + + * Fixed --create and --backup option behaviors, thanks to Olivier Guilyardi + * Created the Collection class and interface + * Fixed error messages + * Made the collection XML file saved in collection dir AND user default dir + + -- Guillaume Pellerin Mon, 8 Jan 2007 02:50:04 +0100 + +telemeta (0.2.4-3) unstable; urgency=low + + * Fixed README and INSTALL pages + + -- Guillaume Pellerin Thu, 4 Jan 2007 18:56:05 +0100 + +telemeta (0.2.4-2) unstable; urgency=low + + * Fixed --help menu and man page + + -- Guillaume Pellerin Wed, 3 Jan 2007 22:18:05 +0100 + +telemeta (0.2.4-1) unstable; urgency=low + + * Rewrited the whole main structure + * Defined a class and xml for consts + * Fixed --erase-media option + * Fixed --recover option + * Added --create option: creates a database repository and default database xml + * Added --backup option: backups a media to the database + * Added --album option: proccesses an entire directory (one shot album) + * Added --from-xml: takes tags and opts in original xml source + * Added --all-default: chooses default argument for all question + * Added --par2 : forces par2 file creation + * Added --rsync : synchronizes database to a remote server (ssh+rsync) + * Added --clean-strings : cleans input strings + + -- Guillaume Pellerin Wed, 3 Jan 2007 18:55:52 +0100 + +telemeta (0.2.3-3) unstable; urgency=low + + * Fixed --force mode bug + + -- Guillaume Pellerin Wed, 22 Nov 2006 12:33:52 +0100 + +telemeta (0.2.3-2) unstable; urgency=low + + * fixed non audio file detection with 'file' command + + -- Guillaume Pellerin Wed, 15 Nov 2006 15:30:10 +0100 + +telemeta (0.2.3-1) unstable; urgency=low + + * Added python-xml parser dependency : + xml tag files are now exported to user default directory and in dir_in. + * Added par2 dependency : creates secure recovery key file with the "par2" method + * Added python-mutagen dependency : new tagging functions + * Cleaned : audio functions + * Fixed : help page + * Debianized + + -- Guillaume Pellerin Tue, 01 Nov 2006 00:25:46 +0100 + +telemeta (0.2.2) unstable; urgency=low + + * Defined : the tag and option lists + * Created : main audio functions + * Created : main tags functions + + -- Guillaume Pellerin Tue, 14 Jul 2006 00:00:01 +0100 + +telemeta (0.1) unstable; urgency=low + + * Initial release + * Created : First flac, ogg, mp3 exporting, tagging with basic functions + + -- Guillaume Pellerin Tue, 01 May 2006 23:45:42 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..7ed6ff82 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..aca57a47 --- /dev/null +++ b/debian/control @@ -0,0 +1,27 @@ +Source: telemeta +Section: sound +Priority: optional +Maintainer: Guillaume Pellerin +Uploaders: Paul Brossier +Build-Depends: debhelper (>= 5.0.0), docbook-to-man, python (>= 2.3.5-7), python-dev (>= 2.3.5-7), python-central (>= 0.5) +Standards-Version: 3.7.2 +XS-Python-Version: >= 2.3 + +Package: telemeta +Architecture: any +Depends: python (>= 2.3.5-7), python-xml, python-central (>= 0.5), python-mutagen, sox, vorbis-tools, flac, lame, normalize-audio, ecasound, festival, par2 +XB-Python-Version: ${python:Versions} +Description: backups, transcodes, tags and marks any audio content with metadata + Telemeta is an audio tool which creates audio transcoded databases fast from + fresh mastered files. It can be useful to backup digitalized audio media from + vinyls, old tapes or whatever. + Telemeta first creates a simple structure where original sounds will be + backuped. The files can be transcoded to WAV, FLAC, MP3 and OGG including + the corresponding tags. + Here are some cool functions: + - XML generation for metadata tags of backuped WAV + - Audio marking from a given file or from tags thanks to the Festival speech + systhesis tool + - File corruption security with par2 recovery files + - Database synchronizing to remote servers (ssh+rsync) + - Modify metadata from XML or interactive shell \ No newline at end of file diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..6780c961 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,27 @@ +This package was debianized by Guillaume Pellerin on +Thu, 17 Aug 2006 22:42:14 +0200. + +It was downloaded from http://yomix.org/telemeta/ + +Upstream Author: Guillaume Pellerin + +Copyright: + + Copyright (C) 2006 Guillaume Pellerin + +License: + + The code is released under the terms of the GNU General Public License: + + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free Software + Foundation; either version 2, or (at your option) any later version. + + The GPL may be found in /usr/share/common-licenses/GPL-2 on a Debian system. + +The Debian packaging is (C) 2006, Guillaume Pellerin and +is licensed under the GPL, see `/usr/share/common-licenses/GPL-2'. + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. + diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 00000000..ca882bbb --- /dev/null +++ b/debian/dirs @@ -0,0 +1,2 @@ +usr/bin +usr/sbin diff --git a/debian/docs b/debian/docs new file mode 100644 index 00000000..e845566c --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README diff --git a/debian/pycompat b/debian/pycompat new file mode 100644 index 00000000..d8263ee9 --- /dev/null +++ b/debian/pycompat @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..b6dbc814 --- /dev/null +++ b/debian/rules @@ -0,0 +1,68 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# This has to be exported to make some magic below work. +export DH_OPTIONS + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +build-stamp: + dh_testdir + touch build-stamp + + +build: build-stamp + docbook-to-man debian/telemeta.sgml > debian/telemeta.1 + db2html -o doc/html debian/telemeta.sgml + rm -rf debian/telemeta + cp debian/changelog ChangeLog + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + $(MAKE) clean + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + $(MAKE) DESTDIR=$(CURDIR)/debian/telemeta prefix=/usr install + +binary-indep: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + #dh_installexamples + dh_installman + #dh_installmenu -i + dh_link usr/share/telemeta/telemeta.py /usr/bin/telemeta + dh_compress + dh_fixperms + chmod +x debian/telemeta/usr/share/telemeta/*.py + dh_pycentral + #dh_python usr/share/telemeta + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb + +binary-arch: build install + +binary: binary-indep binary-arch + +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/debian/telemeta.1 b/debian/telemeta.1 new file mode 100644 index 00000000..a216a415 --- /dev/null +++ b/debian/telemeta.1 @@ -0,0 +1,81 @@ +.TH "telemeta" "1" +.SH "NAME" +telemeta \(em backups, transcodes, tags and marks any audio content with metadata +.SH "SYNOPSIS" +.PP +\fBtelemeta\fR [\fB\fIOPTIONS\fR\fP] [\fB\fIMEDIA\fR\fP] +.SH "DESCRIPTION" +.PP +This manual page documents briefly the +\fBtelemeta\fR command. +.PP +This manual page was written for the \fBDebian\fP distribution +because the original program does not have a manual page. +Instead, it has documentation in the GNU \fBInfo\fP format; see below. +.PP +\fBtelemeta\fR is an audio tool which creates audio transcoded databases fast from fresh mastered files. It can be useful to backup digitalized audio media from vinyls, old tapes or whatever. +.PP +Telemeta first creates a simple structure where original sounds will be backuped. The files can be transcoded to WAV, FLAC, MP3 and OGG including the corresponding tags. +.PP +Here are some cool functions: +.IP "\fB\fP" 10 +\- XML generation for metadata tags of backuped WAV +.IP "" 10 +\- Audio marking from a given file or from tags thanks to the Festival speech systhesis tool +.IP "" 10 +\- File corruption security with par2 recovery files +.IP "" 10 +\- Database synchronizing to remote servers (ssh+rsync) +.IP "" 10 +\- Modify metadata from XML or interactive shell +.SH "OPTIONS" +.PP +These programs follow the usual GNU command line syntax, +with long options starting with two dashes (`\-'). A summary of +options is included below. For a complete description, see the +\fBInfo\fP files. +.IP "\fB\-\-create\fP " 10 +creates a database repository and default database xml +.IP "\fB\-\-backup\fP " 10 +backups a media to the database +.IP "\fB\-\-album\fP " 10 +proccesses an entire directory (one shot album) +.IP "\fB\-\-backup\fP " 10 +backups a media to the database +.IP "\fB\-\-from-xml\fP " 10 +takes tags and opts in original xml source +.IP "\fB\-\-force\fP " 10 +forces file conversion (no audio test) +.IP "\fB\-\-par2\fP " 10 +forces par2 security file creation +.IP "\fB\-\-all-default\fP " 10 +chooses default argument for all question +.IP "\fB\-\-recover\fP " 10 +check an repair the backuped media with the previously created "par2" security files +.IP "\fB\-\-rsync\fP " 10 +synchronizes database to a remote server (ssh+rsync) +.IP "\fB\-\-erase-media\fP " 10 +erases converted database +.IP "\fB\-\-help\fP " 10 +Show summary of options. +.IP "\fB-v\fP \fB\-\-version\fP " 10 +Show version of program. +.SH "SEE ALSO" +.PP +oggenc (1), flac (1), etc... +.PP +The programs are documented fully by Guillaume Pellerin. More info at \fIhttp://yomix.org/telemeta\fP. + +.SH "AUTHOR" +.PP +This manual page was written by Guillaume Pellerin for +the \fBDebian\fP system (but may be used by others). Permission is +granted to copy, distribute and/or modify this document under +the terms of the GNU General Public License, Version 2 any +later version published by the Free Software Foundation. + +.PP +On Debian systems, the complete text of the GNU General Public +License can be found in /usr/share/common-licenses/GPL. + +.\" created by instant / docbook-to-man, Mon 08 Jan 2007, 03:12 diff --git a/debian/telemeta.sgml b/debian/telemeta.sgml new file mode 100644 index 00000000..6f9aac62 --- /dev/null +++ b/debian/telemeta.sgml @@ -0,0 +1,268 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + + Guillaume"> + Pellerin"> + + August 17, 2006"> + + 1"> + pellerin@parisson.com"> + + telemeta"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2006-2007 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + backups, transcodes, tags and marks any audio content with metadata + + + + &dhpackage; + + COLLECTION + + + + + + DESCRIPTION + + &dhpackage; is an audio tool which creates audio transcoded collections fast from fresh mastered files. It can be useful to backup digitalized audio media from vinyls, old tapes or whatever and include them in a database. + Telemeta first creates a simple file structure where the original sounds will be backuped. The files can be transcoded to WAV, FLAC, MP3 and OGG including the corresponding tags. + Here are some cool functions: + + + + + - XML generation for metadata tags of backuped WAV + - Audio marking from a given file or from tags thanks to the Festival speech systhesis tool + - File corruption security with par2 recovery files + - Collection synchronizing to remote servers (ssh+rsync) + - Modify metadata from XML or interactive shell + + + + + + OPTIONS + + These programs follow the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. For a complete description, see the + Info files. + + + + + + + creates a collection repository + + + + + + + backups and transcodes wave files to a collection + + + + + + + proccesses an entire directory (one shot album) + + + + + + + backups a media to the collection + + + + + + + takes tags and opts in original xml source + + + + + + + forces file conversion (no audio test) + + + + + + + forces par2 security file creation + + + + + + + chooses default argument for all question + + + + + + + check an repair the backuped media with the previously created "par2" security files + + + + + + + synchronizes collection to a remote server (ssh+rsync) + + + + + + + erases a collection (flac, ogg, mp3 only !) + + + + + + + Show summary of options. + + + + + + + Show version of program. + + + + + + + EXAMPLES + telemeta --create my_collection + telemeta --backup my_collection file.wav + telemeta --backup my_collection --album /path/to/directory/ + telemeta --backup my_collection --album --par2 --rsync /path/to/directory/ + telemeta --backup my_collection --album --par2 --rsync --force /path/to/directory/ + + + + DOWNLOAD + Telemeta is written in python. So it doesn't require any compilation step. + On Debian or Ubuntu just add these lines to your /etc/apt/sources-list: + + deb http://yomix.org/debian/ binary/ + deb-src http://yomix.org/debian/ source/ + + Then, + + sudo apt-get update + sudo apt-get install telemeta + + On other linux platforms, download the lastest .tar.gz archive, uncompress it, go into the created directory and just type this with your favorite shell : + + python install.py + + See README and INSTALL file for more informations. + + + + DEPENDS + + python (>= 2.3.5-7), python-xml, python-central (>= 0.5), python-mutagen, sox, vorbis-tools, flac, lame, normalize-audio, ecasound, festival, par2 + + + + SEE ALSO + + The program is documented fully by Guillaume Pellerin. More info at http://yomix.org/telemeta/. + + + + AUTHOR + + This manual page was written by &dhusername; <&dhemail;> for + the &debian; system (but may be used by others). Permission is + granted to copy, distribute and/or modify this document under + the terms of the &gnu; General Public License, Version 2 any + later version published by the Free Software Foundation. + + + On Debian systems, the complete text of the GNU General Public + License can be found in /usr/share/common-licenses/GPL. + + + +
+ + + + diff --git a/default_options.py b/default_options.py new file mode 100755 index 00000000..387de38f --- /dev/null +++ b/default_options.py @@ -0,0 +1,33 @@ +#!/usr/bin/python +# *coding: utf-8* +# +# Copyright (c) 2006 Guillaume Pellerin +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 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 Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +class Options : + + def __init__(self) : + self.collection = 'Unknown' + self.enc_types = 'flac, ogg, mp3' + self.ogg_bitrate ='192' + self.mp3_bitrate = '192' + self.flac_quality = '5' + self.audio_marking = False + self.auto_audio_marking = True + self.audio_marking_file = '/path/to/file' + self.audio_marking_timeline = 'b, m, e' + self.par_key = True + self.normalize = False diff --git a/default_options.pyc b/default_options.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1a0c0bf4f5eb80eb636a7aa470c33264e22100be GIT binary patch literal 800 zcmZuvO>fgc5S=(lOVS337Qr<~A3_X8J@fTimDkF>8)UVgG zsjZ(Q&-d)&3|ZxQm=I>Q#H$Q_R%xRGFLFtxv#CnC9R~zKnF_~53U7=m_+W5Eu5yLI zZLIC5gWCQ!kup{>9|%YpF_?wreq!91+nbPTa{UF zeO9V387iZ!Lb)eTp3cwa=aj2tYf$*^wan`+-5XuD&`zTeEGaNRZ}gvk_u9G!C#@19 vp0W_um#rZ;Kc&_`$|B2o{G8W(NEZ019VClx5RTqq(PfA|@y=hwCXW3E +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 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 Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +class Tags : + + def __init__(self) : + self.COLLECTION = 'Unknown' + self.ARTIST = 'Unknown' + self.TITLE = 'Unknown' + self.ALBUM = 'Unknown' + self.GENRE = 'Other' + self.DATE = '1900' + self.SOURCE = 'Here' + self.ENCODER = 'me@domain.com' + self.COMMENT = 'No comment' + self.ORIGINAL_MEDIA = '1/4" tape' + diff --git a/default_tags.pyc b/default_tags.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a207330556d8da52e18225f5369c06f15d7f2d29 GIT binary patch literal 700 zcmZXS&2G~`5P&DnUlUXW5-QiKCtrwD1W25y>#T|^$ClR4fgD&_*$s`z+EsT;g~Y9W z5Z-`y;|Z9Vv;_%UGydjxch+lv?~i|-{}d~@f4cZRL2)lpX@E8A4%`9U0(@Gc5kMJI zlJB9a>M!oGw1bXQ6!)CM0L#vO=`sLWh5>r>6(y07m7uuKsBncJ0E+Vof(K9c0eZAB zh5Deo3 zm2vwRv*tv%w%#<8Rcqat>f1v^YZ~uHXdXvzjt+f&X~HLHaj`SowWrji$TE>sX_5N@ znz5|Xvf?GHw8{iioSiP_OlKmOf*Z`@N^nJ4EMy{h!y-?LnUKs$F`tXP@=vj8A=9%o zk25tFvosFrL?sOsqU@A^hZJ43)N^P2rSLy)Sy+8$>(SPsmChXFi+8U+!1eCI^zTToK=`Q@;6q9_0K1m&^t)rVT W2=d(w +telemeta

telemeta

Name

telemeta -- backups, transcodes, tags and marks any audio content with metadata

Synopsis

telemeta [OPTIONS] [COLLECTION] [OPTIONS] [MEDIA]

DESCRIPTION

This manual page documents briefly the + telemeta command.

This manual page was written for the Debian distribution + because the original program does not have a manual page. + Instead, it has documentation in the GNU Info format; see below.

telemeta is an audio tool which creates audio transcoded collections fast from fresh mastered files. It can be useful to backup digitalized audio media from vinyls, old tapes or whatever and include them in a database.

Telemeta first creates a simple file structure where the original sounds will be backuped. The files can be transcoded to WAV, FLAC, MP3 and OGG including the corresponding tags.

Here are some cool functions:

- XML generation for metadata tags of backuped WAV

- Audio marking from a given file or from tags thanks to the Festival speech systhesis tool

- File corruption security with par2 recovery files

- Collection synchronizing to remote servers (ssh+rsync)

- Modify metadata from XML or interactive shell

OPTIONS

These programs follow the usual GNU command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. For a complete description, see the + Info files.

--create

creates a collection repository

--backup

backups and transcodes wave files to a collection

--album

proccesses an entire directory (one shot album)

--backup

backups a media to the collection

--from-xml

takes tags and opts in original xml source

--force

forces file conversion (no audio test)

--par2

forces par2 security file creation

--all-default

chooses default argument for all question

--recover

check an repair the backuped media with the previously created "par2" security files

--rsync

synchronizes collection to a remote server (ssh+rsync)

--erase

erases a collection (flac, ogg, mp3 only !)

--help

Show summary of options.

--version

Show version of program.

EXAMPLES

telemeta --create my_collection

telemeta --backup my_collection file.wav

telemeta --backup my_collection --album /path/to/directory/

telemeta --backup my_collection --album --par2 --rsync /path/to/directory/

telemeta --backup my_collection --album --par2 --rsync --force /path/to/directory/

DOWNLOAD

Telemeta is written in python. So it doesn't require any compilation step.

On debian or Ubuntu just add these lines to your /etc/apt/sources-list:

deb http://yomix.org/debian/ binary/

deb-src http://yomix.org/debian/ source/

Then,

sudo apt-get update

sudo apt-get install telemeta

On other linux platforms, download the lastest .tar.gz archive, uncompress it, go into the created directory and just type this with your favorite shell :

python install.py

See README and INSTALL file for more informations.

DEPENDS

python (>= 2.3.5-7), python-xml, python-central (>= 0.5), python-mutagen, sox, vorbis-tools, flac, lame, normalize-audio, ecasound, festival, par2

SEE ALSO

The program is documented fully by Guillaume Pellerin. More info at http://yomix.org/telemeta/.

AUTHOR

This manual page was written by Guillaume Pellerin <<pellerin@parisson.com>> for + the Debian system (but may be used by others). Permission is + granted to copy, distribute and/or modify this document under + the terms of the GNU General Public License, Version 2 any + later version published by the Free Software Foundation. +

On Debian systems, the complete text of the GNU General Public + License can be found in /usr/share/common-licenses/GPL. +

\ No newline at end of file diff --git a/install.py b/install.py new file mode 100755 index 00000000..e258d919 --- /dev/null +++ b/install.py @@ -0,0 +1,41 @@ +#!/usr/bin/python +# *coding: utf-8* +# +# Copyright (c) 2006 Guillaume Pellerin +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 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 Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +import os, sys + +if len(sys.argv) == 1: + install_dir = '/usr/' +else: + install_dir = sys.argv[1] + +if not os.path.exists(install_dir): + os.mkdir(install_dir) +if not os.path.exists(install_dir+'/share/'): + os.mkdir(install_dir+'/share/') +if not os.path.exists(install_dir+'/share/telemeta/'): + os.mkdir(install_dir+'/telemeta/') + +os.system('cp -ra ./* '+install_dir+'/share/telemeta/') +os.system('rm -rf '+install_dir+'debian') + +if not os.path.exists(install_dir+'/bin/telemeta'): + os.system('ln -s '+install_dir+'/share/telemeta/telemeta.py '+install_dir+'/bin/telemeta') + +print "Installation successfull ! Type 'telemeta' now..." + diff --git a/svn-commit.tmp b/svn-commit.tmp new file mode 100644 index 00000000..87d5e687 --- /dev/null +++ b/svn-commit.tmp @@ -0,0 +1,4 @@ +q +--Cette ligne, et les suivantes ci-dessous, seront ignorées-- + +A svn+ssh://svn.yomix.org/var/svn/telemeta/trunk diff --git a/tag_tools.py b/tag_tools.py new file mode 100755 index 00000000..970af4cf --- /dev/null +++ b/tag_tools.py @@ -0,0 +1,309 @@ +#!/usr/bin/python +# *coding: utf-8* +# +# Copyright (c) 2006 Guillaume Pellerin +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 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 Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USAA + +import os, sys, re, string +import default_tags +import default_options +import consts +import typeToolBox +import xml.dom.minidom +import xml.dom.ext +from audio_tools import * +from mutagen.flac import FLAC +from mutagen.oggvorbis import OggVorbis +from mutagen.id3 import ID3, TIT2, TP1, TAL, TDA, TCO, COM + +# Default values are used at first +tags = default_tags.Tags() +options = default_options.Options() +collection = consts.Collection() + +# Collection +# ============ + +def write_collection_consts(fic): + doc = xml.dom.minidom.Document() + root = doc.createElement('telemeta') + doc.appendChild(root) + for data in collection.__dict__.keys() : + value = collection.__dict__[data] + node = doc.createElement('data') + node.setAttribute('name', data) + node.setAttribute('value', str(value)) + node.setAttribute('type', typeToolBox.getType(value)) + root.appendChild(node) + file_object = open(fic, "w") + xml.dom.ext.PrettyPrint(doc, file_object) + file_object.close() + +def get_collection_consts(doc): + for data in doc.documentElement.getElementsByTagName('data') : + name = data.getAttribute('name') + value = typeToolBox.cast(data.getAttribute('value'), data.getAttribute('type')) + collection.__dict__[name] = value + +def ask_write_collection(name): + global collection + for data in collection.__dict__.keys() : + if data == 'collection_name' : + def_value = name + type_def_value = typeToolBox.getType(def_value) + value = raw_input(data+' ? ['+str(def_value)+']: ') + elif data == 'default_collection_xml' : + collection_xml = '/home/'+os.environ["USER"]+'/.telemeta/'+name+'.xml' + type_def_collection = typeToolBox.getType(collection_xml) + collection_tmp = typeToolBox.cast(collection_xml,type_def_collection) + collection.__dict__[data] = collection_tmp + value = collection.__dict__[data] + elif data == 'collection_dir' : + collection_dir = '/home/'+os.environ["USER"]+'/'+name + type_def_collection_dir = typeToolBox.getType(collection_dir) + collection_tmp = typeToolBox.cast(collection_dir,type_def_collection_dir) + collection.__dict__[data] = collection_tmp + def_value = collection.__dict__[data] + value = raw_input(data+' ? ['+str(def_value)+']: ') + elif data == 'user_dir' : + def_value = '/home/'+os.environ["USER"]+'/.telemeta/' + type_def_value = typeToolBox.getType(def_value) + value = def_value + elif data == 'default_tag_xml' : + def_value = '/home/'+os.environ["USER"]+'/.telemeta/default_tags.xml' + type_def_value = typeToolBox.getType(def_value) + value = def_value + else : + def_value = collection.__dict__[data] + type_def_value = typeToolBox.getType(def_value) + value = raw_input(data+' ? ['+str(def_value)+']: ') + if not value == '' : + value = typeToolBox.cast(value,type_def_value) + #value = string.replace(in_float,' ','') + collection.__dict__[data] = value + +def get_consts_value(data): + value = collection.__dict__[data] + type_value = typeToolBox.getType(value) + return value + +# TAGS +# ===== + +def write_tags(enc_type,dir_out,file_out): + media_out = dir_out+file_out + + if enc_type == 'flac': + audio = FLAC(media_out) + for tag in tags.__dict__.keys(): + if tag == 'COMMENT': + audio['DESCRIPTION'] = tags.__dict__[tag] + else: + audio[tag] = tags.__dict__[tag] + audio.save() + + if enc_type == 'ogg': + audio = OggVorbis(media_out) + for tag in tags.__dict__.keys(): + audio[tag] = tags.__dict__[tag] + audio.save() + + if enc_type == 'mp3': + audio = ID3(media_out) + #tags = ['ALBUM','DATE','GENRE','SOURCE','ENCODER','COMMENT'] + tag = tags.__dict__['TITLE'] + audio.add(TIT2(encoding=3, text=tag)) + tag = tags.__dict__['ARTIST'] + audio.add(TP1(encoding=3, text=tag)) + tag = tags.__dict__['ALBUM'] + audio.add(TAL(encoding=3, text=tag)) + tag = tags.__dict__['DATE'] + audio.add(TDA(encoding=3, text=tag)) + tag = tags.__dict__['GENRE'] + audio.add(TCO(encoding=3, text=tag)) + tag = tags.__dict__['COMMENT'] + audio.add(COM(encoding=3, text=tag)) + audio.save() + +def write_def_tags(fic): + doc = xml.dom.minidom.Document() + root = doc.createElement('telemeta') + doc.appendChild(root) + for tag in tags.__dict__.keys() : + value = tags.__dict__[tag] + node = doc.createElement('tag') + node.setAttribute('name', tag) + node.setAttribute('value', str(value)) + node.setAttribute('type', typeToolBox.getType(value)) + root.appendChild(node) + for opt in options.__dict__.keys() : + value = options.__dict__[opt] + node = doc.createElement('opt') + node.setAttribute('name', opt) + node.setAttribute('value', str(value)) + node.setAttribute('type', typeToolBox.getType(value)) + root.appendChild(node) + file_object = open(fic, "w") + xml.dom.ext.PrettyPrint(doc, file_object) + file_object.close() + +def ask_write_tag(): + global tags + global options + for tag in tags.__dict__.keys() : + def_value = tags.__dict__[tag] + type_def_value = typeToolBox.getType(def_value) + value = raw_input(tag+' ? ['+str(def_value)+']: ') + if not value == '' : + value = typeToolBox.cast(value,type_def_value) + #value = string.replace(in_float,' ','') + tags.__dict__[tag] = value + for opt in options.__dict__.keys() : + def_value = options.__dict__[opt] + type_def_value = typeToolBox.getType(def_value) + value = raw_input(opt+' ? ['+str(def_value)+']: ') + if not value == '' : + value = typeToolBox.cast(value,type_def_value) + #value = string.replace(in_float,' ','') + options.__dict__[opt] = value + +def get_def_tags(doc): + for tag in doc.documentElement.getElementsByTagName('tag') : + name = tag.getAttribute('name') + value = typeToolBox.cast(tag.getAttribute('value'), tag.getAttribute('type')) + tags.__dict__[name] = value + for opt in doc.documentElement.getElementsByTagName('opt') : + name = opt.getAttribute('name') + value = typeToolBox.cast(opt.getAttribute('value'), opt.getAttribute('type')) + options.__dict__[name] = value + +def rename_tag(old_tag,new_tag): + tag_list = tags.__dict__.keys() + if old_tag in tag_list: + tag_index = tag_list.index(old_tag) + tag_list.remove(old_tag) + tag_list.insert(tag_index,new_tag) + +def get_tag_value(tag): + value = tags.__dict__[tag] + type_value = typeToolBox.getType(value) + return value + +def get_opt_value(opt): + value = options.__dict__[opt] + type_value = typeToolBox.getType(value) + return value + +def add_tag(tag,value): + tag_list = tags.__dict__.keys() + tag_list.insert(0,tag) + tags.__dict__[tag] = value + +def add_opt(opt,value): + opt_list = options.__dict__.keys() + opt_list.insert(0,opt) + options.__dict__[opt] = value + +def rename_file(src_dir,file,file_name): + if (file_name != "" and file_name != file): + print "Renaming: %s -> %s\n" % (file,file_name) + os.rename(src_dir+file, src_dir+file_name) + +def filename_split(file_name): + filename_split = file_name.split('.') + if len(filename_split) > 0: + file_ext = filename_split[len(filename_split)-1] + else: + file_ext = '' + file_name_woext = '.'.join(filename_split[:-1]) + return file_name_woext, file_ext + +#def check_ext(): + #if not ext_is_audio(file): + #file_name_woext = file_name + #if iswav(src_dir+file) : + #file_ext = "wav" + #if isaiff(src_dir+file) : + #file_ext = "aiff" + #if ismp3(src_dir+file) : + #file_ext = "mp3" + #if isogg(src_dir+file) : + #file_ext = "ogg" + #if isflac(src_dir+file) : + #file_ext = "flac" + +def clean_filename(file_name) : + file_name = re.sub("^[^\w]+","",filename) #trim the beginning + file_name = re.sub("[^\w]+$","",file_name) #trim the end + file_name = string.replace(file_name,' ','_') + file_name = re.sub("_+","_",file_name) #squeeze continuous _ to one _ + file_name = re.sub("^[^\w]+","",file_name) #trim the beginning _ + #file_name = string.capitalize(file_name) + return file_name + +def name2tag(src_dir,file_name_woext,file_ext): + # get main tag + tag_list = file_name_woext.split('-') + tag_list_new = range(len(tag_list)) + + #for num_t in tag_list[0]: + # if num_t == str(int(num_t)): + # i_t = 1 + # else: + + # computing main tags if many tags + if len(tag_list) > 1 : + i_t = 0 + artist_tmp = string.replace(tag_list[i_t],' ','_') + artist_tmp = artist_tmp.split('_') + i = 0 + for artist_word in artist_tmp : + artist_tmp[i] = string.capitalize(artist_word) + i = i+1 + artist = '_'.join(artist_tmp[:]) + artist = re.sub("[\_]+$","",artist) #trim the end + tag_list_new[i_t] = artist + artist = string.replace(artist,'_',' ') + + i_t = i_t + 1 + title = string.replace(tag_list[i_t],' ','_') + title = re.sub("^[\_]+","",title) #trim the beginning + title = re.sub("[\_]+$","",title) #trim the end + title_tmp = title.split('_') + title_tmp[0] = string.capitalize(title_tmp[0]) + title = '_'.join(title_tmp[:]) + tag_list_new[i_t] = title + title = string.replace(title,'_',' ') + + # computing main tag if only one tag + if len(tag_list) == 1 : + artist = get_tag_value('ARTIST') + i_t = 0 + title = string.replace(tag_list[i_t],' ','_') + title = re.sub("^[\_]+","",title) #trim the beginning + title = re.sub("[\_]+$","",title) #trim the end + title_tmp = title.split('_') + title_tmp[0] = string.capitalize(title_tmp[0]) + title = '_'.join(title_tmp[:]) + tag_list_new[i_t] = title + title = string.replace(title,'_',' ') + + file_name_new = '-'.join(tag_list_new[:]) + + # renaming main source file + file_name = file_name_new+'.'+file_ext + + return title,artist,file_name_new diff --git a/tag_tools.pyc b/tag_tools.pyc new file mode 100644 index 0000000000000000000000000000000000000000..708daceff525fdadf2e2a16e413e35c1c509898b GIT binary patch literal 9152 zcmc&)&2t<_74O;A*UFOht+f&-QEZ1SQ7k2PLLitVilihC_S%e;7}j>S)|#<0@@hxk z8Ci0WDkS0?a?6zi#eo}DoVZbNzYX@!eEid;Rg?V5;rlgwq7BCw&zL*LRBXdB6-StyspQnin@V1dE>r1JquW%v z)#x#m9yNMRrB{tUQz@v?uZCmp95X9k&fFO=^+8h^G>(@ycaEF-kf{uz(`D`qoBD{U zjF|eUsf?QXn5m4J`nai#oBD*QOqlwlsZ5%B(Nv1Y@w-fL!t5JUn=*d42_8}VQRDZR z;H27*8L!)X8|Qi4cs*)7VZ2^7rj6I9#*@Y?sBy}8{c4;x-Z3@K7;iw0r;InK#^;Q8 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yL>m|7%kZnL1VS0>2HJlZIPgP4@(3VN+Mh4=6M*L6(S8=c zBF`qjChIvu_tF|*e4!rcNzMK?s@*oWa8SQ7%jZJ(E%Ly8rG>@&;644P0rxV8NT4+o zc<0?R`tDVNuMxNe%LFR~?*J&Kt?==Vc^vE?{}Ca1%V35ieOgF=wYI-}JdOePG{K7m zFA=;;@C||r!F7UF0;-DZ6Wk_vpMY`A21o=Q3*&|ULT{lv{aY*){t2gP B&>H{% literal 0 HcmV?d00001 diff --git a/telemeta.py b/telemeta.py new file mode 100755 index 00000000..83fd72e8 --- /dev/null +++ b/telemeta.py @@ -0,0 +1,458 @@ +#!/usr/bin/python +# *-* coding: utf-8 *-* +""" + telemeta + + Copyright (c) 2006-2007 Guillaume Pellerin + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +""" + +# Version +# ======= +version = '0.2.5' + +# Modules and error routines +# ========================== +import os, sys, re, string, shutil +import xml.dom.minidom +import xml.dom.ext +import consts +import audio_marking +import tag_tools +import audio_tools +import default_tags +import default_options +import typeToolBox +from audio_tools import * + + +# Info, error +# =========== +if len(sys.argv) == 1 : + print "telemeta v"+str(version)+" (c) 2006 Guillaume Pellerin " + print "version: "+str(version) + print "depends: python, python-xml, python-mutagen, sox, oggenc, flac, lame, normalize-audio, ecasound, wavbreaker, festival" + print "distributed under the terms of the GNU Public License v2.\n" + print """ 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 General Public License for more details.\n""" + sys.exit('Type telemeta --help for help !\n') + +elif sys.argv[1] == '--help': + print "TELEMETA:" + print " backups, transcodes, tags and marks any audio content with metadata\n" + print "VERSION:" + print " "+str(version)+'\n' + print "DEPENDS:" + print " python, python-xml, python-mutagen, sox, oggenc, flac, lame, normalize-audio, ecasound, wavbreaker, festival\n" + print "COPYRIGHT:" + print " Copyright (c) 2006 Guillaume Pellerin \n" + print "LICENSE:" + print " distributed under the terms of the GNU Public License v2.\n" + print "USAGE:" + print " telemeta [OPTIONS] COLLECTION [OPTIONS] [MEDIA] \n" + print "COLLECTION:" + print " - the name of collection you want to create" + print " - the name of collection you want to backup or process into\n" + print "MEDIA:" + print " - an audio file" + print " - a directory when the --album option is given\n" + print "OPTIONS:" + print " --create creates a collection repository" + print " --backup backups and transcodes wave files to a collection" + print " --album proccesses an entire directory (one shot album)" + print " --from-xml takes tags and opts in original xml source" + print " --force forces file conversion" + print " --add-tag add a tag to a collection" + print ' --par2 forces security "par2" key creation' + print " --all-default chooses default argument for all question" + print ' --recover check an repair the backuped media with the previously created "par2" security key' + print " --rsync synchronizes a collection with a remote server repository (ssh+rsync)" + print " --erase erases a collection (flac, ogg, mp3 only !)" + print " --version gives the program version" + print " --help gives help page\n" + print "EXAMPLES:" + print " telemeta --create my_collection" + print " telemeta --backup my_collection file.wav" + print " telemeta --backup my_collection --album /path/to/directory/" + print " telemeta --backup my_collection --album --par2 --rsync /path/to/directory/" + print " telemeta --backup my_collection --album --par2 --rsync --force /path/to/directory/\n" + print "AUTHOR:" + print " Guillaume Pellerin \n" + print "URL:" + print " http://yomix.org/telemeta\n" + print 'IMPORTANT:' + print " With the '--album' option, it supposed that all your wav files in the directory are named respectively to this scheme :" + print " artist-title[-album-date-genre-description][.wav]" + print " where the 'artist' and 'title' tags are necessary needed." + print " Tags between [] are optional main tags.\n" + print "FOR MORE INFORMATIONS :" + print " - read the README file" + print " - go to http://yomix.org/telemeta" + sys.exit(' - email me !\n') + +elif sys.argv[1] == '--version': + sys.exit('Version: '+str(version)) + +else : + print "telemeta v"+str(version)+" (c) 2006 Guillaume Pellerin " + print """ 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 General Public License for more details.\n""" + + +# Initialisation +# =============== + +argv = sys.argv +len_argv = len(argv) + +# Get collection consts +collection = consts.Collection() + +# Get arguments +if '--recover' in argv : + index = argv.index('--recover') + audio_tools.recover_par_key(argv[index+1]+os.sep) + sys.exit('Directory successfully recovered !') + +if '--erase' in argv : + type_list = tag_tools.get_consts_value('type_list') + type_list = type_list.split(',') + index = argv.index('--erase') + audio_tools.clean_directory(argv[index+1],type_list) + sys.exit('Media directories successfully cleaned !') + +if '--force' in argv : + print 'Warning: forcing file transfert and conversion (no audio test) !\n' + mode_force = True +else : + mode_force = False + +if '--album' in argv : + print 'Warning: album (recusive) mode...\n' + mode_album = True +else : + mode_album = False + +if '--backup' in argv : + print 'Warning: backup mode...\n' + mode_backup = True +else : + mode_backup = False + +if '--tags' in argv : + print 'Warning: making tags...\n' + mode_tags = True +else : + mode_tags = False + +if '--add-tag' in argv : + print 'Warning: adding tags...\n' + mode_add_tag = True +else : + mode_add_tag = False + +if '--from-xml' in argv : + print 'Warning: processing from XML...\n' + mode_from_xml = True +else : + mode_from_xml = False + +if '--clean-strings' in argv : + print 'Warning: Cleaning strings...\n' + mode_clean = True +else : + mode_clean = False + +if '--all-default' in argv : + print 'Warning: default mode enabled...\n' + mode_default = True +else : + mode_default = False + +if '--par2' in argv : + print 'Warning: creates par2 security keys...\n' + mode_par2 = True +else : + mode_par2 = False + +if '--rsync' in argv : + print 'Warning: synchronize with remote host...\n' + mode_rsync = True +else : + mode_rsync = False + +if '--create' in argv : + print 'Warning: creating a telemeta collection...\n' + mode_create = True +else : + mode_create = False + +# Creates user default dir +user_dir = tag_tools.get_consts_value('user_dir') +if not os.path.exists(user_dir): + os.mkdir(user_dir) + +# Create or check the databse config +default_collection_xml = tag_tools.get_consts_value('default_collection_xml') +if not os.access(default_collection_xml, os.F_OK) : + tag_tools.write_collection_consts(default_collection_xml) + +# Create the collection +if mode_create : + if len(argv) == 3 : + index = argv.index('--create') + collection_name = argv[index+1] + tag_tools.ask_write_collection(collection_name) + default_collection_xml = tag_tools.get_consts_value('default_collection_xml') + collection_dir = tag_tools.get_consts_value('collection_dir') + if not os.path.exists(collection_dir): + os.mkdir(collection_dir) + else : + sys.exit('ERROR: the collection '+collection_name+' already exists') + tag_tools.write_collection_consts(default_collection_xml) + tag_tools.write_collection_consts(collection_dir+os.sep+collection_name+'.xml') + # Parses collection data + sys.exit("\nCollection created ! You can now --backup media in it...") + else : + sys.exit("ERROR: no collection name given... : give a name for your collection.") +# Backup into the collection +elif mode_backup : + # Check syntax + if not os.path.exists(sys.argv[len(sys.argv)-1]) : + sys.exit("ERROR: no such media... : give a directory or a file as last argument.") + index = argv.index('--backup') + collection_name = argv[index+1] + collection_xml = user_dir+os.sep+collection_name+'.xml' + if not os.path.exists(collection_xml) : + sys.exit("This collection doesn't exists. Create it first ! (--create)") + else : + doc = xml.dom.minidom.parse(user_dir+os.sep+collection_name+'.xml') + print "Parsing collection XML file..." + tag_tools.get_collection_consts(doc) + collection_dir = tag_tools.get_consts_value('collection_dir') + print "OK\n" + + +# Creates source dir +src_dir = collection_dir+os.sep+'src'+os.sep +if not os.path.exists(src_dir) : + os.mkdir(src_dir) + +# Creates user default tag/opt file and parse it +default_tag_xml = tag_tools.get_consts_value('default_tag_xml') +if not os.access(default_tag_xml, os.F_OK) : + tag_tools.write_def_tags(default_tag_xml) + +# Parses tag data +doc = xml.dom.minidom.parse(default_tag_xml) +tag_tools.get_def_tags(doc) + +# Initializes master file list +file_master_list = range(1) + +# File listing for album mode +if mode_album : + master_dir = argv[len_argv-1]+os.sep + if os.path.isdir(master_dir): + file_master_list = os.listdir(master_dir) + else: + sys.exit('Please give a directory path for the last argument (album mode)...') +# File listing in normal mode +else : + master_dir = argv[len_argv-1] + if os.path.isdir(master_dir): + file_master_list = os.listdir(master_dir) + elif os.path.isfile(master_dir): + master_dir = os.getcwd()+os.sep + file_master_list[0] = str(argv[len_argv-1]) + else: + sys.exit('Please give a directory or a file path for the last argument...') + +# Asks tags if mode album +if mode_album and not mode_from_xml : + tag_tools.ask_write_tag() + tag_tools.write_def_tags(default_tag_xml) + + +# Main loop +# ========= + +for file in file_master_list : + if isaudio(master_dir+os.sep+file) or (mode_force and ext_is_audio(master_dir+os.sep+file)): + print '\n' + print '+------------------------------------------------------------------------------------' + print '| Processing '+master_dir+file + print '+------------------------------------------------------------------------------------' + + # Init + file_name = file + file_in = file + dir_in = src_dir + + # Backup mode + if mode_backup : + album_dir_tmp = tag_tools.get_tag_value('ALBUM') + album_dir = collection_dir+os.sep+'src'+os.sep+album_dir_tmp+os.sep + if not os.path.exists(album_dir) : + os.mkdir(album_dir) + print 'Copying files into: '+album_dir+'\n' + if isaudio(master_dir+file) and ( not os.path.exists(album_dir+file) or mode_force ) : + os.system('cp -ra "'+master_dir+file+'" '+album_dir) + src_dir = album_dir + dir_in = src_dir + else : + dir_in = master_dir + + # Creating par2 key + par_key_value = tag_tools.get_opt_value('par_key') + if mode_par2 and par_key_value : + # Creating "par2" security keys + print 'Creating "par2" security keys...' + audio_tools.create_par_key(dir_in,file) + + # Name, extension + file_name_woext, file_ext = tag_tools.filename_split(file) + tag_tools.add_tag('ORIGINAL_FILENAME',file) + tag_tools.add_tag('ORIGINAL_TYPE',file_ext) + + # Get original XML + if mode_from_xml : + doc = xml.dom.minidom.parse(dir_in+file_name+'.xml') + tag_tools.get_def_tags(doc) + + # Album mode + if mode_album : + # Getting file main tags + title,artist,file_name_new = tag_tools.name2tag(dir_in,file_name_woext,file_ext) + tag_tools.add_tag('ARTIST',artist) + tag_tools.add_tag('TITLE',title) + print "Artist: "+artist + print "Title: "+title+'\n' + #tag_tools.write_def_tags(default_tag_xml) + + # Asks for new metadata and write default user tags/options + if not mode_default and not mode_from_xml and not mode_album: + tag_tools.ask_write_tag() + tag_tools.write_def_tags(default_tag_xml) + + + + # Clean mode + if mode_clean : + file_name = tag_tools.clean_filename(file_name) + # Renaming backup source file + tag_tools.rename_file(dir_in,dir_out,file,file_name) + + # Writing xml data + if not mode_from_xml : + print 'Writing xml data...' + tag_tools.write_def_tags(dir_in+file_name+'.xml') + + # Getting encoding types + enc_types = tag_tools.get_opt_value('enc_types') + enc_types = string.replace(enc_types,' ','').split(',') + + # Checking existing file + for enc_type in enc_types: + dir_out = master_dir+enc_type+os.sep + file_out = file_name_woext+'.'+enc_type + if not os.path.exists(dir_out+file_out): + new_track = True + else : + new_track = False + + # Decoding to a new 16 bits wav file if needed + if not iswav16(dir_in+file_in) and new_track: + print "Decoding to wav 16 bits..." + audio_tools.decode(dir_in+file_in,file_ext) + # Important ! + type_list = tag_tools.get_consts_value('type_list') + type_list = type_list.split(',') + if not file_ext in type_list : + file_in=file_in+'.wav' + + # Normalize file if needed + normalize_value = tag_tools.get_opt_value('normalize') + if normalize_value: + print 'Normalizing...' + audio_tools.normalize(dir_in+file_in) + + # Marking + audio_marking_value = tag_tools.get_opt_value('audio_marking') + auto_audio_marking = tag_tools.get_opt_value('auto_audio_marking') + audio_marking_file = tag_tools.get_opt_value('audio_marking_file') + audio_marking_timeline = tag_tools.get_opt_value('audio_marking_timeline') + audio_marking_timeline = string.replace(audio_marking_timeline,' ','').split(',') + if audio_marking_value and new_track: + if auto_audio_marking: + print 'Creating track audio mark...' + audio_marking.make_auto_mark(dir_in,file_in) + audio_marking_file = dir_in+file_in+'_mark.wav' + print 'Marking '+file_in+' with '+audio_marking_file+'...' + audio_marking.mark_audio(dir_in,file_in,audio_marking_file,audio_marking_timeline) + file_in = 'marked_'+file_in + + # Encoding loop + for enc_type in enc_types: + dir_out = collection_dir+os.sep+enc_type+os.sep + if not os.path.exists(dir_out): + os.mkdir(dir_out) + album = tag_tools.get_tag_value('ALBUM') + dir_out = collection_dir+os.sep+enc_type+os.sep+album+os.sep + if not os.path.exists(dir_out): + os.mkdir(dir_out) + file_out = file_name_woext+'.'+enc_type + + if not os.path.exists(dir_out+file_out) or mode_force : + print 'Converting '+dir_in+file_name+' to '+enc_type+'...' + # Encoding + print 'Encoding file...' + audio_tools.encode(enc_type,dir_in,file_in,dir_out,file_out) + print 'Writing tags to encoded file...' + tag_tools.write_tags(enc_type,dir_out,file_out) + + else : + print dir_out+file_out+' already exists !' + if mode_tags : + print 'But writing tags to encoded file...' + tag_tools.write_tags(enc_type,dir_out,file_out) + + # Remove tmp files + file_list = os.listdir(src_dir) + for file in file_list: + if 'marked_' in file or '.ewf' in file or '_mark.wav' in file or file_ext+'.wav' in file: + os.system('rm "'+dir_in+file+'"') + + else : + print file+" is not an audio file !" + +# Sync to the remote server +if mode_rsync : + net_backup_host = tag_tools.get_consts_value('net_backup_host') + net_backup_dir = tag_tools.get_consts_value('net_backup_dir') + print '+------------------------------------------------------------------------------------' + print '| Synchronizing with '+net_backup_host + print '+------------------------------------------------------------------------------------' + os.system('rsync -avzLp --delete --rsh="ssh -l '+os.environ["USER"]+'" '+collection_dir+' '+os.environ["USER"]+'@'+net_backup_host+':'+net_backup_dir) + print "Collection Synchronized !" + + +# End +# === diff --git a/typeToolBox.py b/typeToolBox.py new file mode 100755 index 00000000..a6f2cb2d --- /dev/null +++ b/typeToolBox.py @@ -0,0 +1,41 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Author: Ingelrest François (Athropos@gmail.com) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 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 Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# Supported types +# 'bool' type must be placed *before* 'int' type, otherwise booleans are detected as integers +types = {bool : 'bool', int : 'int', str : 'str'} + +# Return a String with the type of value +def getType(value) : + for type in types.keys() : + if isinstance(value, type) : + return types[type] + raise TypeError, str(value) + ' has an unsupported type' + +# Return value, casted into type +def cast(value, type) : + if type == 'bool' : + if value == 'True' : + return True + return False + elif type == 'int' : + return int(value) + elif type == 'str' : + return str(value) + raise TypeError, type + ' is an unsupported type' diff --git a/typeToolBox.pyc b/typeToolBox.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f0df147377d07787d3aec48942a03fd86928b1a0 GIT binary patch literal 831 zcmZ`%&r2IY6n?WmVzgZ;J!l0B+n#c1Rs``?Q%1)+!S&d{XI?!=uJF`yUi zU);Z--k%<7# zV=^)QAv#aUBmtykQW_6>$YrVY!?`)f0JDa}?YXTK>2KA4dIcR~?Wi-hyxDXN~8wscZXtoemsZPi11)|RD4#vee_*TQ?U|Gi^1hUF|6dK=$J>+q zYS~5DT~&I{VfdF&;0dRXld0_>qwqn7K_BMRLY@|4bp|zfYzFVcD!W$l-#+X>dHHnT I#G4!c0Qfe8qW}N^ literal 0 HcmV?d00001 -- 2.39.5