From: yomguy Date: Mon, 16 May 2011 09:52:58 +0000 (+0200) Subject: add special CREM alt_ids table importer, add /change copyrights, cleanup X-Git-Tag: 1.1~191 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=8e62947feb9a467e2bb778d234e674dc54a3b019;p=telemeta.git add special CREM alt_ids table importer, add /change copyrights, cleanup --- diff --git a/INSTALL b/INSTALL index c0670861..f733097f 100644 --- a/INSTALL +++ b/INSTALL @@ -24,7 +24,8 @@ Install the dependencies Install all dependencies like this:: sudo aptitude install python python-django python-xml python-mysqldb mysql-server \ - python-ctypes python-setuptools python-support python-docutils + python-ctypes python-setuptools python-support python-docutils \ + python-libxml2 To get MP3 reading and writing, just add these lines to your /etc/apt/sources-list:: diff --git a/setup.py b/setup.py index 17602bd2..ca12b0ce 100644 --- a/setup.py +++ b/setup.py @@ -46,32 +46,28 @@ version = __import__('telemeta').__version__ setup( name = "telemeta", - url = "/http://svn.parisson.org/telemeta", - description = "web frontend to backup, transcode and tag any audio content with metadata", - author = ["Guillaume Pellerin, Olivier Guilyardi"], - author_email = ["pellerin@parisson.com","olivier@samalyse.com"], + url = "http://telemeta.org", + description = "Web Audio Content Management System", + author = ["Guillaume Pellerin, Olivier Guilyardi", "Riccardo Zaccarelli"], + author_email = ["pellerin@parisson.com","olivier@samalyse.com", "riccardo.zaccarrelli@gmail.com"], version = version, packages = packages, data_files = data_files, long_description = """ -Telemeta is a web audio archiving program which introduces useful and secure methods to -backup, index, transcode, analyse and publish any digitalized audio file with its metadata. -It is dedicated to professionnals who wants to easily backup and publish documented sounds -from collections of vinyls, magnetic tapes or audio CDs over a strong database, in accordance -with open standards. +Telemeta is a web audio archiving program which introduces useful and secure methods to backup, index, transcode, analyse and publish any digitalized audio file with its metadata. It is dedicated to professionnals who wants to easily backup and publish documented sounds from collections of vinyls, magnetic tapes or audio CDs over a strong database, in accordance with open standards. Here are the main features of Telemeta: - * Secure archiving, editing and publishing of audio files over internet. - * User friendly web frontend including workflows and high level search methods - * Smart dynamical and skinnable audio player (thanks to Timeside and soundmanager2) - * "On the fly" analyzing, transcoding and metadata embedding based on an easy plugin architecture - * Multi-format support : FLAC, OGG, MP3, WAV and more - * GEO Navigator for audio geolocalization - * DublinCore compatibility - * OAI-PMH data provider - * XML serialized backup - * Strong SQL backend + * Secure archiving, editing and publishing of audio files over internet. + * User friendly web frontend including workflows and high level search methods + * Smart dynamical and skinnable audio player (thanks to Timeside and soundmanager2) + * "On the fly" analyzing, transcoding and metadata embedding based on an easy plugin architecture + * Multi-format support : FLAC, OGG, MP3, WAV and more + * GEO Navigator for audio geolocalization + * DublinCore compatibility + * OAI-PMH data provider + * XML serialized backup + * Strong SQL backend The Telemeta data model is based on 'collections' and 'items'. A collection is described by its metadata and includes original audio items (sounds) and its own metadata. This diff --git a/telemeta/backup/core.py b/telemeta/backup/core.py index 80d3bd2d..9c1e1c08 100644 --- a/telemeta/backup/core.py +++ b/telemeta/backup/core.py @@ -60,13 +60,13 @@ class CollectionSerializer(object): return hash.hexdigest() def __get_media_filename(self, item): - return item.id + ".wav" + return str(item.id) + ".wav" def store(self, dest_dir): """Serialize and store the collection with related items and media files into a subdirectory of the provided directory """ - coll_dir = dest_dir + "/" + self.collection.id + coll_dir = dest_dir + "/" + str(self.collection.id) os.mkdir(coll_dir) xml = self.get_xml() @@ -97,7 +97,7 @@ class CollectionSerializer(object): coll_doc = self.collection.to_dom() coll_node = doc.documentElement.appendChild(coll_doc.documentElement) coll_doc.unlink() - items_node_name = MediaItem.get_dom_element_name() + "List" + items_node_name = MediaItem.get_dom_name() + "List" items_node = doc.createElement(items_node_name) coll_node.appendChild(items_node) diff --git a/telemeta/cache.py b/telemeta/cache.py index 66b82aeb..83946785 100644 --- a/telemeta/cache.py +++ b/telemeta/cache.py @@ -1,9 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- # -# Copyright (C) 2006-2010 Guillaume Pellerin - -# +# Copyright (C) 2006-2010 Guillaume Pellerin, Parisson SARL # This software is a computer program whose purpose is to stream audio # and video data through icecast2 servers. diff --git a/telemeta/models/core.py b/telemeta/models/core.py index ef070462..c341e1ec 100644 --- a/telemeta/models/core.py +++ b/telemeta/models/core.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # # Copyright (C) 2007-2010 Samalyse SARL +# Copyright (C) 2010-2011 Parisson SARL # # This software is a computer program whose purpose is to backup, analyse, # transcode and stream any audio content with its metadata over a web frontend. @@ -32,6 +33,7 @@ # knowledge of the CeCILL license and that you accept its terms. # # Authors: Olivier Guilyardi +# Guillaume Pellerin __all__ = ['ModelCore', 'MetaCore', 'DurationField', 'Duration', 'WeakForeignKey', 'EnhancedModel', 'CharField', 'TextField', 'IntegerField', 'BooleanField', diff --git a/telemeta/models/instrument.py b/telemeta/models/instrument.py index 037d1bad..9b23e71f 100644 --- a/telemeta/models/instrument.py +++ b/telemeta/models/instrument.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (C) 2007-2010 Samalyse SARL +# Copyright (C) 2010-2011 Parisson SARL # This software is a computer program whose purpose is to backup, analyse, # transcode and stream any audio content with its metadata over a web frontend. @@ -32,6 +33,7 @@ # # Authors: Olivier Guilyardi # David LIPSZYC +# Guillaume Pellerin from telemeta.models.core import * from django.utils.translation import ugettext_lazy as _ diff --git a/telemeta/models/media.py b/telemeta/models/media.py index a450550e..29aeace1 100644 --- a/telemeta/models/media.py +++ b/telemeta/models/media.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (C) 2007-2010 Samalyse SARL +# Copyright (C) 2010-2011 Parisson SARL # This software is a computer program whose purpose is to backup, analyse, # transcode and stream any audio content with its metadata over a web frontend. @@ -32,6 +33,7 @@ # # Authors: Olivier Guilyardi # David LIPSZYC +# Guillaume Pellerin from django.contrib.auth.models import User from django.utils.translation import ugettext_lazy as _ @@ -457,7 +459,6 @@ class DublinCoreToFormatMetadata(object): if value: if key == 'date': value = value.split(';')[0].split('=') - print value if len(value) > 1: value = value[1] value = value.split('-')[0] diff --git a/telemeta/models/query.py b/telemeta/models/query.py index 0324abff..26107bbe 100644 --- a/telemeta/models/query.py +++ b/telemeta/models/query.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (C) 2007-2010 Samalyse SARL +# Copyright (C) 2010-2011 Parisson SARL # # This software is a computer program whose purpose is to backup, analyse, # transcode and stream any audio content with its metadata over a web frontend. @@ -32,6 +33,7 @@ # # Authors: Olivier Guilyardi # David LIPSZYC +# Guillaume Pellerin from django.db.models import Q, Max, Min from telemeta.models.core import * diff --git a/telemeta/models/system.py b/telemeta/models/system.py index 40d17235..f6a892e5 100644 --- a/telemeta/models/system.py +++ b/telemeta/models/system.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (C) 2007-2010 Samalyse SARL +# Copyright (C) 2010-2011 Parisson SARL # This software is a computer program whose purpose is to backup, analyse, # transcode and stream any audio content with its metadata over a web frontend. @@ -32,6 +33,7 @@ # # Authors: Olivier Guilyardi # David LIPSZYC +# Guillaume Pellerin from django.contrib.auth.models import User from telemeta.models.core import * diff --git a/telemeta/pages/fr/help.rst b/telemeta/pages/fr/help.rst index f06ce286..fd5ffd68 100644 --- a/telemeta/pages/fr/help.rst +++ b/telemeta/pages/fr/help.rst @@ -10,14 +10,13 @@ Page d'aide de Telemeta Introduction ============== -Telemeta est un système de gestion d'archives sonores. Cette plateforme a été conçue par le CREM et Parisson pour satisfaire les besoins de valorisation des archives audio des laboratoires de recherche mais aussi pour permettre aux chercheurs et aux documentalistes de collaborer autour d'un outil commun en réseau. - - +Telemeta est un système de gestion collaborative d'archives sonores. Il a été conçue par le Centre de Recherche en Ethnomusicologie et la société Parisson pour satisfaire les besoins de valorisation des archives audio des laboratoires de recherche mais aussi pour permettre aux chercheurs et aux documentalistes d'indéxer mutuellement les fonds d'archives. Prise en main ================ + ----------- Connexion ----------- diff --git a/telemeta/templates/telemeta_default/collection_detail.html b/telemeta/templates/telemeta_default/collection_detail.html index 6db326f9..db116d39 100644 --- a/telemeta/templates/telemeta_default/collection_detail.html +++ b/telemeta/templates/telemeta_default/collection_detail.html @@ -145,9 +145,7 @@ {% dl_field collection "metadata_author" %} {% dl_field collection "booklet_description" %} {% dl_field collection "publishing_status" %} - {% dl_field collection "comment" %} {% dl_field collection "metadata_writer" %} {% dl_field collection "travail" %} diff --git a/telemeta/templates/telemeta_default/geo_countries.html b/telemeta/templates/telemeta_default/geo_countries.html index 6e22bdd7..19f15049 100644 --- a/telemeta/templates/telemeta_default/geo_countries.html +++ b/telemeta/templates/telemeta_default/geo_countries.html @@ -10,29 +10,29 @@ {% block content %} - - - - - -{% for country in countries %} - - - - - + + + + + + {% for country in countries %} + + + + + {% endfor %}
{% trans "Country" %}{% trans "Number of collections" %}{% trans "Number of items" %}
{{ country }} - {% with country.collections.count as num %} - - {% blocktrans count num as counter %}1 collection{% plural %}{{ counter }} collections{% endblocktrans %} - - {% endwith %} - - {% with country.items.count as num %} - - {% blocktrans count num as counter %}1 item{% plural %}{{ counter }} items {% endblocktrans %} - - {% endwith %} -
{% trans "Country" %}{% trans "Number of collections" %}{% trans "Number of items" %}
{{ country }} + {% with country.collections.count as num %} + + {% blocktrans count num as counter %}1 collection{% plural %}{{ counter }} collections{% endblocktrans %} + + {% endwith %} + + {% with country.items.count as num %} + + {% blocktrans count num as counter %}1 item{% plural %}{{ counter }} items {% endblocktrans %} + + {% endwith %} +
{% endblock %} diff --git a/telemeta/templates/telemeta_default/home.html b/telemeta/templates/telemeta_default/home.html index a70724c7..99c1c999 100644 --- a/telemeta/templates/telemeta_default/home.html +++ b/telemeta/templates/telemeta_default/home.html @@ -15,15 +15,12 @@ {% endblock %} - {% block content %} -
{% block modules %} {% include "telemeta/inc/module_revisions.html" %} {% endblock %}
- - {% endblock %} diff --git a/telemeta/templates/telemeta_default/inc/dublincore.html b/telemeta/templates/telemeta_default/inc/dublincore.html index ddf09285..9d2a151f 100644 --- a/telemeta/templates/telemeta_default/inc/dublincore.html +++ b/telemeta/templates/telemeta_default/inc/dublincore.html @@ -18,5 +18,4 @@ {% endif %} {% endfor %} - diff --git a/telemeta/templates/telemeta_default/index.html b/telemeta/templates/telemeta_default/index.html index 3a818beb..68348a34 100644 --- a/telemeta/templates/telemeta_default/index.html +++ b/telemeta/templates/telemeta_default/index.html @@ -4,7 +4,6 @@ {% block content %}
-
{% block modules %} @@ -31,17 +30,6 @@ {% include "telemeta/inc/module_revisions.html" %} - - {% endblock %}
diff --git a/telemeta/templates/telemeta_default/instrument_edit.html b/telemeta/templates/telemeta_default/instrument_edit.html index e9bd6ff9..4988a6fa 100644 --- a/telemeta/templates/telemeta_default/instrument_edit.html +++ b/telemeta/templates/telemeta_default/instrument_edit.html @@ -5,7 +5,6 @@ {% block tabcontents %}

{% trans "Instruments" %}

-
{% csrf_token %}
diff --git a/telemeta/templates/telemeta_default/instrument_edit_value.html b/telemeta/templates/telemeta_default/instrument_edit_value.html index 2fcf7074..ca28c254 100644 --- a/telemeta/templates/telemeta_default/instrument_edit_value.html +++ b/telemeta/templates/telemeta_default/instrument_edit_value.html @@ -5,7 +5,6 @@ {% block tabcontents %}

{% trans "Instruments" %}

- {% csrf_token %}
@@ -24,5 +23,4 @@

- {% endblock %} diff --git a/telemeta/templates/telemeta_default/login.html b/telemeta/templates/telemeta_default/login.html index 659df29a..e4c58c07 100644 --- a/telemeta/templates/telemeta_default/login.html +++ b/telemeta/templates/telemeta_default/login.html @@ -6,25 +6,19 @@ {% endblock %} {% block content %} - {% if form.errors %} {% endif %} -
- - {% endblock %} diff --git a/telemeta/templates/telemeta_default/mediaitem_player.html b/telemeta/templates/telemeta_default/mediaitem_player.html index f6a45bf7..957fe203 100644 --- a/telemeta/templates/telemeta_default/mediaitem_player.html +++ b/telemeta/templates/telemeta_default/mediaitem_player.html @@ -18,8 +18,8 @@
{% endif %} diff --git a/telemeta/templates/telemeta_default/profile_edit.html b/telemeta/templates/telemeta_default/profile_edit.html index 31b7693d..3a64c7e5 100644 --- a/telemeta/templates/telemeta_default/profile_edit.html +++ b/telemeta/templates/telemeta_default/profile_edit.html @@ -7,31 +7,29 @@ {% endblock %} {% block content %} -
- -
{% csrf_token %} - - {% for form in forms %} - {% for field in form %} - {% if not field.html_name in user_hidden_fields %} - - - - - {% else %} - - - - {% endif %} +
+ {% csrf_token %} +
{{ field.errors }}
{% trans field.label_tag %} : {{ field }}
{{ field.label_tag.as_hidden }}{{ field.as_hidden }}
+ {% for form in forms %} + {% for field in form %} + {% if not field.html_name in user_hidden_fields %} + + + + + {% else %} + + + + {% endif %} + {% endfor %} {% endfor %} - {% endfor %} -
{{ field.errors }}
{% trans field.label_tag %} : {{ field }}
{{ field.label_tag.as_hidden }}{{ field.as_hidden }}
+ -
- -
+ + {% endblock %} diff --git a/telemeta/templates/telemeta_default/registration/password_reset_complete.html b/telemeta/templates/telemeta_default/registration/password_reset_complete.html index 92eda265..29eb373c 100644 --- a/telemeta/templates/telemeta_default/registration/password_reset_complete.html +++ b/telemeta/templates/telemeta_default/registration/password_reset_complete.html @@ -6,9 +6,6 @@ {% block title %}
{% trans 'Password reset complete' %}{% endblock %} {% block content %} -

{% trans "Your password has been set. You may go ahead and log in now." %}

-

{% trans 'Log in' %}

- {% endblock %} diff --git a/telemeta/templates/telemeta_default/registration/password_reset_confirm.html b/telemeta/templates/telemeta_default/registration/password_reset_confirm.html index 990c45ee..e4e174f7 100644 --- a/telemeta/templates/telemeta_default/registration/password_reset_confirm.html +++ b/telemeta/templates/telemeta_default/registration/password_reset_confirm.html @@ -6,9 +6,7 @@ {% block title %}
{% trans 'Password reset' %}{% endblock %} {% block content %} - {% if validlink %} -

{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}

{% csrf_token %} @@ -20,11 +18,8 @@
{% else %} -

{% trans 'Password reset unsuccessful' %}

-

{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}

{% endif %} - {% endblock %} diff --git a/telemeta/templates/telemeta_default/registration/password_reset_done.html b/telemeta/templates/telemeta_default/registration/password_reset_done.html index 28417954..b8defc19 100644 --- a/telemeta/templates/telemeta_default/registration/password_reset_done.html +++ b/telemeta/templates/telemeta_default/registration/password_reset_done.html @@ -6,7 +6,5 @@ {% block title %}
{% trans 'Password reset successful' %}{% endblock %} {% block content %} -

{% trans "We've e-mailed you instructions for setting your password to the e-mail address you submitted. You should be receiving it shortly." %}

- {% endblock %} diff --git a/telemeta/templates/telemeta_default/registration/password_reset_form.html b/telemeta/templates/telemeta_default/registration/password_reset_form.html index cedf1146..faf6849f 100644 --- a/telemeta/templates/telemeta_default/registration/password_reset_form.html +++ b/telemeta/templates/telemeta_default/registration/password_reset_form.html @@ -6,12 +6,10 @@ {% block title %}
{% trans "Password reset" %}{% endblock %} {% block content %} -

{% trans "Forgotten your password? Enter your e-mail address below, and we'll e-mail instructions for setting a new one." %}

{% csrf_token %} {{ form.email.errors }}

{{ form.email }} {% trans 'Reset my password' %}

- {% endblock %} diff --git a/telemeta/urls.py b/telemeta/urls.py index ad2cd622..fd29301a 100644 --- a/telemeta/urls.py +++ b/telemeta/urls.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- # Copyright (C) 2007 Samalyse SARL -# -# Copyright (c) 2007-2009 Guillaume Pellerin +# Copyright (c) 2007-2011 Parisson SARL # This software is a computer program whose purpose is to backup, analyse, # transcode and stream any audio content with its metadata over a web frontend. @@ -32,7 +31,8 @@ # The fact that you are presently reading this means that you have had # knowledge of the CeCILL license and that you accept its terms. # -# Author: Olivier Guilyardi +# Authors: Olivier Guilyardi +# Guillaume Pellerin from django.conf.urls.defaults import * from telemeta.models import MediaItem, MediaCollection, MediaItemMarker diff --git a/telemeta/web/base.py b/telemeta/web/base.py index a8490832..8e0fbd00 100644 --- a/telemeta/web/base.py +++ b/telemeta/web/base.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007 Samalyse SARL +# Copyright (C) 2007-2010 Samalyse SARL +# Copyright (C) 2010-2011 Parisson SARL # This software is a computer program whose purpose is to backup, analyse, # transcode and stream any audio content with its metadata over a web frontend. @@ -30,7 +31,8 @@ # The fact that you are presently reading this means that you have had # knowledge of the CeCILL license and that you accept its terms. -# Author: Olivier Guilyardi +# Authors: Olivier Guilyardi +# Guillaume Pellerin import re import os @@ -284,8 +286,8 @@ class WebView(object): }) def get_public_access(self, access, date_from, date_to): - # Rolling publishing date : Public access when time between recorded year - # and currant year is over settings value PUBLIC_ACCESS_PERIOD + # Rolling publishing date : public access is given when time between recorded year + # and current year is over the settings value PUBLIC_ACCESS_PERIOD if date_to: date = date_to elif date_from: @@ -470,7 +472,7 @@ class WebView(object): graph = grapher(width = int(width), height = int(height)) pipe = decoder | graph pipe.run() -# graph.watermark('telemeta', opacity=.6, margin=(5,5)) + graph.watermark('telemeta', opacity=.6, margin=(5,5)) f = open(path, 'w') graph.render(path) f.close() diff --git a/tools/scripts/telemeta-crem-import-alt_ids.py b/tools/scripts/telemeta-crem-import-alt_ids.py new file mode 100755 index 00000000..84c673d3 --- /dev/null +++ b/tools/scripts/telemeta-crem-import-alt_ids.py @@ -0,0 +1,97 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2011 Guillaume Pellerin +# 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 +# + +import os +import sys +import xlrd +import logging +import datetime +from django.core.management import setup_environ +from django.core.files.base import ContentFile + +class Logger: + + def __init__(self, file): + self.logger = logging.getLogger('myapp') + self.hdlr = logging.FileHandler(file) + self.formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') + self.hdlr.setFormatter(self.formatter) + self.logger.addHandler(self.hdlr) + self.logger.setLevel(logging.INFO) + + def write_info(self, prefix, message): + self.logger.info(' ' + prefix + ' : ' + message.decode('utf8')) + + def write_error(self, prefix, message): + self.logger.error(prefix + ' : ' + message.decode('utf8')) + + +class TelemetaAltIdsImport: + + def __init__(self, xls_file, log_file): + self.logger = Logger(log_file) + self.xls = xls_file + self.row = 0 + + def alt_ids_import(self): + from telemeta.models import MediaCollection + self.book = xlrd.open_workbook(self.xls) + self.sheet = self.book.sheet_by_index(0) + self.length = len(self.sheet.col(0))-1 + + while True: + ids = [] + self.row += 1 + row = self.sheet.row(self.row) + if self.row == self.length: + break + collection_id = row[0].value + cell_alt_id = row[1] + if cell_alt_id.ctype == 1: + for i in range(1,len(row)): + cell_alt_id = row[i] + if cell_alt_id.ctype == 1: + ids.append(cell_alt_id.value) + alt_ids = ' '.join(ids) + try: + collection = MediaCollection.objects.get(old_code=collection_id) + collection.alt_ids = alt_ids + collection.save() + print self.row, collection_id, alt_ids + except: + msg = 'No collection found for this id' + self.logger.write_error(collection_id, msg) + continue + + +def print_usage(tool_name): + print "Usage: "+tool_name+" " + print " project_dir: the directory of the Django project which hosts Telemeta" + print " xls_file: the excel file containing all collection alt_ids" + +def run(): + if len(sys.argv) < 3: + print_usage(os.path.basename(sys.argv[0])) + sys.exit(1) + else: + project_dir = sys.argv[-3] + xls_file = sys.argv[-2] + log_file = sys.argv[-1] + sys.path.append(project_dir) + import settings + setup_environ(settings) + t = TelemetaAltIdsImport(xls_file, log_file) + t.alt_ids_import() + +if __name__ == '__main__': + run()