| [2444cce] | 1 | # -*- coding: utf-8 -*- |
|---|
| 2 | # Copyright (C) 2010-2012 Parisson SARL |
|---|
| 3 | |
|---|
| 4 | # This software is a computer program whose purpose is to backup, analyse, |
|---|
| 5 | # transcode and stream any audio content with its metadata over a web frontend. |
|---|
| 6 | |
|---|
| 7 | # This software is governed by the CeCILL license under French law and |
|---|
| 8 | # abiding by the rules of distribution of free software. You can use, |
|---|
| 9 | # modify and/ or redistribute the software under the terms of the CeCILL |
|---|
| 10 | # license as circulated by CEA, CNRS and INRIA at the following URL |
|---|
| 11 | # "http://www.cecill.info". |
|---|
| 12 | |
|---|
| 13 | # As a counterpart to the access to the source code and rights to copy, |
|---|
| 14 | # modify and redistribute granted by the license, users are provided only |
|---|
| 15 | # with a limited warranty and the software's author, the holder of the |
|---|
| 16 | # economic rights, and the successive licensors have only limited |
|---|
| 17 | # liability. |
|---|
| 18 | |
|---|
| 19 | # In this respect, the user's attention is drawn to the risks associated |
|---|
| 20 | # with loading, using, modifying and/or developing or reproducing the |
|---|
| 21 | # software by the user in light of its specific status of free software, |
|---|
| 22 | # that may mean that it is complicated to manipulate, and that also |
|---|
| 23 | # therefore means that it is reserved for developers and experienced |
|---|
| 24 | # professionals having in-depth computer knowledge. Users are therefore |
|---|
| 25 | # encouraged to load and test the software's suitability as regards their |
|---|
| 26 | # requirements in conditions enabling the security of their systems and/or |
|---|
| 27 | # data to be ensured and, more generally, to use and operate it in the |
|---|
| 28 | # same conditions as regards security. |
|---|
| 29 | |
|---|
| 30 | # The fact that you are presently reading this means that you have had |
|---|
| 31 | # knowledge of the CeCILL license and that you accept its terms. |
|---|
| 32 | # |
|---|
| 33 | # Authors: |
|---|
| 34 | # Guillaume Pellerin <yomguy@parisson.com> |
|---|
| 35 | |
|---|
| 36 | import re |
|---|
| 37 | import mimetypes |
|---|
| 38 | from django.contrib.auth.models import User |
|---|
| 39 | from django.utils.translation import ugettext_lazy as _ |
|---|
| 40 | from django.core.exceptions import ValidationError |
|---|
| 41 | from telemeta.models.core import * |
|---|
| 42 | from telemeta.models.enum import ContextKeyword |
|---|
| 43 | from telemeta.util.unaccent import unaccent_icmp |
|---|
| 44 | from telemeta.models.location import LocationRelation, Location |
|---|
| 45 | from telemeta.models.system import Revision |
|---|
| 46 | from telemeta.models.query import * |
|---|
| 47 | from telemeta.models.instrument import * |
|---|
| 48 | from telemeta.models.enum import * |
|---|
| 49 | from telemeta.models.language import * |
|---|
| 50 | from telemeta.models.media import * |
|---|
| 51 | from django.db import models |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | class Format(ModelCore): |
|---|
| 55 | """ Physical format object as proposed by the LAM""" |
|---|
| 56 | |
|---|
| 57 | original_format = WeakForeignKey(OriginalFormat, related_name="format", |
|---|
| 58 | verbose_name = _("original format")) |
|---|
| 59 | original_code = CharField(_('original code'), required=True) |
|---|
| 60 | original_format_number = CharField(_('original format number')) |
|---|
| 61 | status = CharField(_('status')) |
|---|
| [c8cdfbe] | 62 | conservation_state = TextField(_('technical properties / conservation state')) |
|---|
| [2444cce] | 63 | comments = TextField(_('comments / notes')) |
|---|
| 64 | |
|---|
| 65 | # Tapes |
|---|
| 66 | wheel_diameter = WeakForeignKey(WheelDiameter, related_name="format", |
|---|
| 67 | verbose_name = _("tape wheel diameter")) |
|---|
| 68 | tape_width = WeakForeignKey(TapeWidth, related_name="format", |
|---|
| 69 | verbose_name = _("tape width (inch)")) |
|---|
| 70 | tape_thickness = CharField(_('tape thickness (um)')) |
|---|
| 71 | tape_diameter = CharField(_('tape diameter (mm)')) |
|---|
| 72 | tape_speed = WeakForeignKey(TapeSpeed, related_name="format", verbose_name = _("tape speed (m/s)")) |
|---|
| 73 | tape_vendor = WeakForeignKey(TapeVendor, related_name="format", verbose_name = _("tape vendor")) |
|---|
| 74 | tape_reference = CharField(_('tape reference')) |
|---|
| 75 | sticker_presence = BooleanField(_('sticker presence')) |
|---|
| 76 | recording_system = CharField(_('recording system')) |
|---|
| 77 | channels = IntegerField(_("number of channels")) |
|---|
| 78 | audio_quality = TextField(_('audio quality')) |
|---|
| 79 | |
|---|
| 80 | class Meta(MetaCore): |
|---|
| 81 | db_table = 'media_formats' |
|---|
| 82 | verbose_name = _('format') |
|---|
| 83 | |
|---|
| 84 | def __unicode__(self): |
|---|
| [57305a5] | 85 | return self.original_format |
|---|
| [2444cce] | 86 | |
|---|
| 87 | @property |
|---|
| 88 | def public_id(self): |
|---|
| 89 | return self.original_code |
|---|