reduced amount of metadata given on upload

git-svn-id: http://yolanda.mister-muffin.de/svn@422 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
erlehmann 2009-02-07 07:57:41 +00:00
parent 437d38c948
commit 591ae829df
5 changed files with 66 additions and 56 deletions

View file

@ -48,12 +48,12 @@ class UploadController(BaseController):
upload.file.seek(0)
sha256 = hashlib.sha256(upload.file.read(1024*1024)).hexdigest()
# if model.Video.query.filter_by(sha256=sha256).count():
# c.message = {
# 'type': 'error',
# 'text': 'Your file was already uploaded. Go away.'
# }
# return render('/xhtml/upload.mako')
if model.Video.query.filter_by(sha256=sha256).count():
c.message = {
'type': 'error',
'text': 'Your file was already uploaded. Go away.'
}
return render('/xhtml/upload.mako')
# TODO: set up safeguards against omitted / wrong data
@ -65,7 +65,7 @@ class UploadController(BaseController):
# Dublin Core terms
dc_title = request.params['dc_title'],
dc_alternative = request.params['dc_title'],
# dc_alternative = request.params['dc_title'],
# dc_subject = [model.DC_Subject(name=u'lol'), model.DC_Subject(name=u'wut')],
dc_subject = self.getsubjects(),
@ -78,24 +78,24 @@ class UploadController(BaseController):
# dc_contributor = [model.DC_Contributor(name=u'lol'), model.DC_Contributor(name=u'wut')],
# TODO: insert real data
dc_created = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
dc_valid = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
dc_available = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
dc_issued = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
dc_modified = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
dc_dateAccepted = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
dc_dateCopyrighted = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
dc_dateSubmitted = datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
# dc_created = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
# dc_valid = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
# dc_available = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
# dc_issued = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
# dc_modified = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
# dc_dateAccepted = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
# dc_dateCopyrighted = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
# dc_dateSubmitted = datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
dc_identifier = '',
dc_source = '',
dc_language = request.params['dc_language'],
# dc_identifier = '',
# dc_source = '',
# dc_language = request.params['dc_language'],
# TODO: insert videolength
dc_extent = timedelta(0),
dc_spatial = request.params['dc_spatial'],
dc_temporal = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
# dc_spatial = request.params['dc_spatial'],
# dc_temporal = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"),
dc_rightsHolder = '',

View file

@ -25,15 +25,9 @@ class BaseController(WSGIController):
def __before__(self):
tags = {}
c.tagcloud = {}
for tag in model.DC_Subject.query.all():
if tag.name in tags.keys():
tags[tag.name]+=1
else:
tags[tag.name] = 1
c.tagcloud = tags
print "__before__ %s" % tags
c.tagcloud[tag.name] = tag.videos.__len__()
# Include the '_' function in the public names
__all__ = [__name for __name in locals().keys() if not __name.startswith('_') \

View file

@ -6,31 +6,31 @@ class Video(Entity):
# Dublin Core terms
dc_title = Field(Unicode(255))
dc_alternative = Field(Unicode(255))
# dc_alternative = Field(Unicode(255))
dc_creator = ManyToOne('DC_Creator')
dc_subject = ManyToMany('DC_Subject')
dc_abstract = Field(UnicodeText)
dc_contributor = ManyToMany('DC_Contributor')
# dc_contributor = ManyToMany('DC_Contributor')
dc_created = Field(DateTime)
dc_valid = Field(DateTime)
dc_available = Field(DateTime)
dc_issued = Field(DateTime)
dc_modified = Field(DateTime)
dc_dateAccepted = Field(DateTime)
dc_dateCopyrighted = Field(DateTime)
dc_dateSubmitted = Field(DateTime)
# dc_created = Field(DateTime)
# dc_valid = Field(DateTime)
# dc_available = Field(DateTime)
# dc_issued = Field(DateTime)
# dc_modified = Field(DateTime)
# dc_dateAccepted = Field(DateTime)
# dc_dateCopyrighted = Field(DateTime)
# dc_dateSubmitted = Field(DateTime)
dc_identifier = Field(Unicode(255)) # URI
dc_source = Field(Unicode(255)) # URI
dc_language = Field(Unicode(3)) # see ISO 639-3
# dc_identifier = Field(Unicode(255)) # URI
# dc_source = Field(Unicode(255)) # URI
# dc_language = Field(Unicode(3)) # see ISO 639-3
dc_extent = Field(Interval)
dc_spatial = Field(Unicode(255))
dc_temporal = Field(DateTime)
# dc_spatial = Field(Unicode(255))
# dc_temporal = Field(DateTime)
dc_rightsHolder = Field(Unicode(255))
@ -58,10 +58,10 @@ class DC_Subject(Entity):
def __repr__(self):
return '<Tag "%s">' % self.name
class DC_Contributor(Entity):
name = Field(Unicode(255), primary_key = True)
videos = ManyToMany('Video')
#class DC_Contributor(Entity):
# name = Field(Unicode(255), primary_key = True)
# videos = ManyToMany('Video')
def __repr__(self):
return '<Contributor "%s">' % self.name
# def __repr__(self):
# return '<Contributor "%s">' % self.name

View file

@ -103,12 +103,14 @@ method="post">
<li id="upload">
<a href="${h.url_for('upload')}">Upload</a>
</li>
<!--
<li id="settings">
<a href="${h.url_for('account-settings')}">Settings</a>
</li>
<li id="logout">
<a href="${h.url_for('logout')}">Logout</a>
</li>
-->
</ul>
</div>

View file

@ -19,26 +19,31 @@
<input name="dc_title" type="text"/>
</div>
<!--
<div>
<label for="dc_alternative">alternative title</label>
<input name="dc_alternative" type="text"/>
</div>
-->
<div>
<label for="dc_abstract">abstract</label>
<textarea name="dc_abstract"/>
<textarea name="dc_abstract" />
</div>
<!--
<div>
<label for="dc_spatial">spatial</label>
<input name="dc_spatial" type="text"/>
</div>
-->
<div>
<label for="dc_subject">keywords (tags), delimited by commas</label>
<input name="dc_subject" type="text"/>
</div>
<!--
<div>
<label for="dc_temporal">time the document describes (YYYY-MM-DD HH:MM:SS)</label>
<input name="dc_temporal" type="datetime"/>
@ -51,16 +56,25 @@
<option value="eng">English</option>
</select>
</div>
-->
<!--
<div>
<label for="dc_creator">creator</label>
<input name="dc_creator" type="text"/>
</div>
<div>
<label for="dc_contributor">contributors, delimited by commas</label>
<input name="dc_contributor" type="text"/>
</div>
-->
<div>
<label for="dc_rightsHolder">rights holder</label>
<input name="dc_rightsHolder" type="text"/>
</div>
<!--
$video->appendChild( getElementDC( "contributor", "xsd:normalizedString") );
@ -79,33 +93,33 @@ $video->appendChild( getElementDC( "license", "xsd:normalizedString") );
-->
<fieldset>
<legend>
Remix ?
Is modifying the video allowed ?
</legend>
<label for="cc_remix">
<input id="cc_remix" type="radio" name="modification" value="remix" />
remix
<strong>Yes</strong>, remixing is allowed.
</label>
<label for="cc_sharealike">
<input id="cc_sharealike" type="radio" name="modification" value="sharealike" />
sharealike
<strong>Yes</strong>, but only if modifications have the same license.
</label>
<label for="cc_noderivatives">
<input id="cc_noderivatives" type="radio" name="modification" value="noderivatives" />
noderivatives
<strong>No</strong>, remixing is prohibited.
</label>
</fieldset>
<fieldset>
<legend>
Commercial ?
Is using the video for commercial purposes allowed ?
</legend>
<label for="cc_commercial">
<input id="cc_commercial" type="radio" name="commercial" value="commercial" />
commercial
<strong>Yes</strong>, commercial use is allowed.
</label>
<label for="cc_noncommercial">
<input id="cc_noncommercial" type="radio" name="commercial" value="noncommercial" />
noncommercial
<strong>No</strong>, commercial use is prohibited.
</label>
</fieldset>