]> git.parisson.com Git - telemeta.git/commitdiff
Removed old/
authoryomguy <>
Fri, 25 May 2007 16:28:56 +0000 (16:28 +0000)
committeryomguy <>
Fri, 25 May 2007 16:28:56 +0000 (16:28 +0000)
old/audio_marking.py [deleted file]
old/audio_tools.py [deleted file]
old/collection.py [deleted file]
old/consts.py [deleted file]
old/default.py [deleted file]
old/default_options.py [deleted file]
old/default_tags.py [deleted file]
old/tag_tools.py [deleted file]
old/telemeta.py [deleted file]
old/typeToolBox.py [deleted file]

diff --git a/old/audio_marking.py b/old/audio_marking.py
deleted file mode 100644 (file)
index a24ba7f..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/python
-# *coding: utf-8*
-#
-# Copyright (c) 2006-2007 Guillaume Pellerin <pellerin@parisson.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
-
-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/old/audio_tools.py b/old/audio_tools.py
deleted file mode 100644 (file)
index ffbaee8..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-#!/usr/bin/python
-# *coding: utf-8*
-#
-# Copyright (c) 2006-2007 Guillaume Pellerin <pellerin@parisson.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
-
-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 -f -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_md5_key(dir_in,file_in):
-    media_in = dir_in+file_in
-    os.system('md5sum -b "'+media_in+'" "'+media_in+'.md5"')
-
-def check_md5_key(dir_in,file_in):
-    media_in = dir_in+file_in
-    md5_log = os.popen4('md5sum -c "'+media_in+'" "'+media_in+'.md5"')
-    if 'OK' in md5_log.split(':'):
-        return True
-    else:
-        return False
-
-def compare_md5_key(file_in,file_out):
-    media_in = file_in
-    media_out = file_out
-    if not os.path.exists(media_in):
-        return False
-    else:
-        print 'Checking md5sums...'
-        file_in_in, file_in_out = os.popen4('md5sum -b "'+media_in+'"')
-        file_out_in, file_out_out = os.popen4('md5sum -b "'+media_out+'"')
-        for line in file_in_out.readlines():
-            line = line.split('*')
-            line = line[0]
-            #print line
-            for file_out_out_line in file_out_out.readlines():
-                file_out_out_line= file_out_out_line.split('*')
-                file_out_out_line= file_out_out_line[0]
-                #print file_out_out_line    
-                if line == file_out_out_line:
-                    print 'Files are equal...\n'
-                    return True
-                    exit
-                else:
-                    print 'Files are different...\n'
-                    return False
-                    exit
-        
-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/old/collection.py b/old/collection.py
deleted file mode 100644 (file)
index 042a4cf..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/python
-# *coding: utf-8*
-#
-# Copyright (c) 2006-2007 Guillaume Pellerin <pellerin@parisson.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
-
-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/old/consts.py b/old/consts.py
deleted file mode 100644 (file)
index dc204f7..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/python
-# *coding: utf-8*
-#
-# Copyright (c) 2006-2007 Guillaume Pellerin <pellerin@parisson.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
-
-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/old/default.py b/old/default.py
deleted file mode 100644 (file)
index 1db0e06..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2007 Parisson SARL
-# Copyright (c) 2006-2007 Guillaume Pellerin <pellerin@parisson.com>
-# All rights reserved.
-#
-# This software is licensed as described in the file COPYING, which
-# you should have received as part of this distribution. The terms
-# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
-#
-# Author: Guillaume Pellerin <pellerin@parisson.com>
-
-import os
-
-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'
-
-
-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
-
-
-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/'
-
diff --git a/old/default_options.py b/old/default_options.py
deleted file mode 100644 (file)
index f03f966..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/python
-# *coding: utf-8*
-#
-# Copyright (c) 2006-2007 Guillaume Pellerin <pellerin@parisson.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
-
-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/old/default_tags.py b/old/default_tags.py
deleted file mode 100644 (file)
index 8cec941..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/python
-# *coding: utf-8*
-#
-# Copyright (c) 2006-2007 Guillaume Pellerin <pellerin@parisson.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
-
-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/old/tag_tools.py b/old/tag_tools.py
deleted file mode 100644 (file)
index 2b784aa..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-#!/usr/bin/python
-# *coding: utf-8*
-#
-# Copyright (c) 2006-2007 Guillaume Pellerin <pellerin@parisson.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 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/old/telemeta.py b/old/telemeta.py
deleted file mode 100644 (file)
index 3ae4853..0000000
+++ /dev/null
@@ -1,461 +0,0 @@
-#!/usr/bin/python
-# *-* coding: utf-8 *-*
-"""
-   telemeta
-
-   Copyright (c) 2006-2007 Guillaume Pellerin <yomguy@altern.org>
-
-   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.7'
-
-# 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-2007 Guillaume Pellerin <yomguy@altern.org>>"
-    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-2007 Guillaume Pellerin <yomguy@altern.org>\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 <yomguy@altern.org>\n"
-    print "URL:"
-    print "         http://svn.parisson.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://svn.parisson.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-2007 Guillaume Pellerin <yomguy@altern.org>"
-    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)
-            if isaudio(master_dir+file) and ( not audio_tools.compare_md5_key(master_dir+file,album_dir+file) or mode_force ) :
-                print 'Copying files into: '+album_dir+''
-                os.system('cp -ra "'+master_dir+file+'" '+album_dir)
-                print 'OK\n'
-            #else:
-            #   sys.exit(master_dir+file+' is not an audio file...')
-            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/old/typeToolBox.py b/old/typeToolBox.py
deleted file mode 100644 (file)
index a6f2cb2..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/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'