From ee6af90b42bdb6ffa7e29613e1a129b51e34853d Mon Sep 17 00:00:00 2001 From: yomguy Date: Wed, 16 May 2012 16:52:37 +0200 Subject: [PATCH] add original format properties to item --- telemeta/models/__init__.py | 1 - telemeta/models/format.py | 89 ------------------------------------- telemeta/models/media.py | 26 ++++++++++- 3 files changed, 25 insertions(+), 91 deletions(-) delete mode 100644 telemeta/models/format.py diff --git a/telemeta/models/__init__.py b/telemeta/models/__init__.py index e4e118c5..7bf7a719 100644 --- a/telemeta/models/__init__.py +++ b/telemeta/models/__init__.py @@ -42,5 +42,4 @@ from system import * from query import * from dublincore import * from language import * -from format import * diff --git a/telemeta/models/format.py b/telemeta/models/format.py deleted file mode 100644 index 54c6747b..00000000 --- a/telemeta/models/format.py +++ /dev/null @@ -1,89 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2010-2012 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. - -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". - -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. - -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. - -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -# Authors: -# Guillaume Pellerin - -import re -import mimetypes -from django.contrib.auth.models import User -from django.utils.translation import ugettext_lazy as _ -from django.core.exceptions import ValidationError -from telemeta.models.core import * -from telemeta.models.enum import ContextKeyword -from telemeta.util.unaccent import unaccent_icmp -from telemeta.models.location import LocationRelation, Location -from telemeta.models.system import Revision -from telemeta.models.query import * -from telemeta.models.instrument import * -from telemeta.models.enum import * -from telemeta.models.language import * -from telemeta.models.media import * -from django.db import models - - -class Format(ModelCore): - """ Physical format object as proposed by the LAM""" - - original_format = WeakForeignKey(OriginalFormat, related_name="format", - verbose_name = _("original format")) - original_code = CharField(_('original code'), required=True) - original_format_number = CharField(_('original format number')) - status = CharField(_('status')) - conservation_state = TextField(_('technical properties / conservation state')) - comments = TextField(_('comments / notes')) - - # Tapes - wheel_diameter = WeakForeignKey(WheelDiameter, related_name="format", - verbose_name = _("tape wheel diameter")) - tape_width = WeakForeignKey(TapeWidth, related_name="format", - verbose_name = _("tape width (inch)")) - tape_thickness = CharField(_('tape thickness (um)')) - tape_diameter = CharField(_('tape diameter (mm)')) - tape_speed = WeakForeignKey(TapeSpeed, related_name="format", verbose_name = _("tape speed (m/s)")) - tape_vendor = WeakForeignKey(TapeVendor, related_name="format", verbose_name = _("tape vendor")) - tape_reference = CharField(_('tape reference')) - sticker_presence = BooleanField(_('sticker presence')) - recording_system = CharField(_('recording system')) - channels = IntegerField(_("number of channels")) - audio_quality = TextField(_('audio quality')) - - class Meta(MetaCore): - db_table = 'media_formats' - verbose_name = _('format') - - def __unicode__(self): - return self.original_format - - @property - def public_id(self): - return self.original_code diff --git a/telemeta/models/media.py b/telemeta/models/media.py index f093a7a0..3b1e386b 100644 --- a/telemeta/models/media.py +++ b/telemeta/models/media.py @@ -358,7 +358,31 @@ class MediaItem(MediaResource): # Technical data approx_duration = DurationField(_('approximative duration')) - # All + original_format = WeakForeignKey(OriginalFormat, related_name="item", + verbose_name = _("original format")) + original_code = CharField(_('original code'), required=True) + original_number = CharField(_('original number')) + original_status = CharField(_('status')) + original_state = TextField(_('technical properties / conservation state')) + original_comments = TextField(_('comments / notes')) + original_location = WeakForeignKey(OriginalLocation, related_name="item", + verbose_name = _("original location")) + original_channels = IntegerField(_("number of channels")) + audio_quality = TextField(_('audio quality')) + recording_system = CharField(_('recording system')) + + # Tapes + tape_wheel_diameter = WeakForeignKey(WheelDiameter, related_name="item", + verbose_name = _("tape wheel diameter (cm)")) + tape_thickness = CharField(_('tape thickness (um)')) + tape_speed = WeakForeignKey(TapeSpeed, related_name="item", + verbose_name = _("tape speed (m/s)")) + tape_vendor = WeakForeignKey(TapeVendor, related_name="item", + verbose_name = _("tape vendor")) + tape_reference = CharField(_('tape reference')) + sticker_presence = BooleanField(_('sticker presence')) + + # Manager objects = MediaItemManager() def keywords(self): -- 2.39.5