source: telemeta/models/format.py @ 9fa4646

cremcrem2crem3devdev2diademsdj1.6feature/breadcrumbsfeature/ts-0.5feature/ts-0.5.4feature/writecachegenericlamlam2mapsv3mergenlivemultirelease/1.4.4sabiodsearchserverstoragetelecaster
Last change on this file since 9fa4646 was 9fa4646, checked in by yomguy <yomguy@…>, 2 years ago

add element type for format

  • Property mode set to 100644
File size: 4.6 KB
Line 
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
36import re
37import mimetypes
38from django.contrib.auth.models import User
39from django.utils.translation import ugettext_lazy as _
40from django.core.exceptions import ValidationError
41from telemeta.models.core import *
42from telemeta.util.unaccent import unaccent_icmp
43from telemeta.models.location import *
44from telemeta.models.system import *
45from telemeta.models.query import *
46from telemeta.models.instrument import *
47from telemeta.models.enum import *
48from telemeta.models.language import *
49from telemeta.models.media import *
50from django.db import models
51
52
53class Format(ModelCore):
54    """ Physical format object as proposed by the LAM"""
55
56    element_type          = 'format'
57
58    item                  = ForeignKey('MediaItem', related_name="format", verbose_name = _("item"),
59                                       blank=True, null=True, on_delete=models.SET_NULL)
60    physical_format       = WeakForeignKey(PhysicalFormat, related_name="format",
61                                     verbose_name = _("physical format"))
62    original_code         = CharField(_('original code'))
63    original_number       = CharField(_('original number'))
64    original_status       = CharField(_('original status'))
65    original_state        = TextField(_('technical properties / conservation state'))
66    original_comments     = TextField(_('comments / notes'))
67    original_location     = ForeignKey('Location', related_name="format",
68                                       verbose_name = _("original location"),
69                                       blank=True, null=True, on_delete=models.SET_NULL)
70    original_channels     = WeakForeignKey(NumberOfChannels, related_name="format",
71                                        verbose_name = _("number of channels"))
72    original_audio_quality = TextField(_('audio quality'))
73    recording_system      = CharField(_('recording system'))
74
75    # Tapes
76    tape_wheel_diameter = WeakForeignKey(TapeWheelDiameter, related_name="format",
77                                        verbose_name = _("tape wheel diameter (cm)"))
78    tape_thickness      = CharField(_('tape thickness (um)'))
79    tape_speed          = WeakForeignKey(TapeSpeed, related_name="format",
80                                        verbose_name = _("tape speed (m/s)"))
81    tape_vendor         = WeakForeignKey(TapeVendor, related_name="format",
82                                        verbose_name = _("tape vendor"))
83    tape_reference      = CharField(_('tape reference'))
84    sticker_presence    = BooleanField(_('sticker presence'))
85
86    class Meta(MetaCore):
87        db_table = 'media_formats'
88        verbose_name = _('format')
89
90    def __unicode__(self):
91        if self.physical_format:
92            return ' - '.join([self.physical_format.value, self.original_code,
93                               self.item.public_id])
94        else:
95            return 'Unknown'
96
97    @property
98    def public_id(self):
99        return self.original_code
Note: See TracBrowser for help on using the repository browser.