Skip to content

Commit

Permalink
reduced amount of metadata given on upload
Browse files Browse the repository at this point in the history
git-svn-id: http://yolanda.mister-muffin.de/svn@422 7eef14d0-6ed0-489d-bf55-20463b2d70db
  • Loading branch information
erlehmann committed Feb 7, 2009
1 parent 437d38c commit 591ae82
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 57 deletions.
42 changes: 21 additions & 21 deletions trunk/yolanda/controllers/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ def upload(self):
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

Expand All @@ -65,7 +65,7 @@ def upload(self):

# 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(),
Expand All @@ -78,24 +78,24 @@ def upload(self):
# 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_identifier = '',
dc_source = '',
dc_language = request.params['dc_language'],
# 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'],

# 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 = '',

Expand Down
10 changes: 2 additions & 8 deletions trunk/yolanda/lib/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,9 @@ def __call__(self, environ, start_response):

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('_') \
Expand Down
40 changes: 20 additions & 20 deletions trunk/yolanda/model/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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

2 changes: 2 additions & 0 deletions trunk/yolanda/templates/xhtml/base.mako
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
30 changes: 22 additions & 8 deletions trunk/yolanda/templates/xhtml/upload.mako
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand All @@ -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") );
Expand All @@ -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>

Expand Down

0 comments on commit 591ae82

Please sign in to comment.