yaz/commit
change for the demo
author | Michiel Hildebrand |
---|---|
Wed Mar 16 15:20:31 2011 +0100 | |
committer | Michiel Hildebrand |
Wed Mar 16 15:20:31 2011 +0100 | |
commit | 9381f1f2c6117dabfc433297ced36d135cbbdb18 |
tree | 2e0215b90cc86a8058c93608213786652bb3a298 |
parent | 530bbaa431a1b12df550b7d0dc292f8cf097b13f |
Diff style: patch stat
diff --git a/api/video_frames.pl b/api/video_frames.pl index d087cde..27a12c4 100644 --- a/api/video_frames.pl +++ b/api/video_frames.pl @@ -37,7 +37,7 @@ user:file_search_path(video, videos). % @TBD How can we know the mimetype serve_video(Request) :- - ensure_logged_on(_), + %ensure_logged_on(_), http_parameters(Request, [ url(URL, [ optional(true), description('URL of video that is stored locally') @@ -105,8 +105,11 @@ serve_video_frame(Request) :- [ description('Time in the video')]) ]), debug(frame, 'Frame for ~w', [VideoURL]), - www_form_encode(VideoURL, LocalVideo0), - absolute_file_name(video(LocalVideo0), VideoFile), + ( atom_concat('/video/', Local, VideoURL) + -> true + ; www_form_encode(VideoURL, Local) + ), + absolute_file_name(video(Local), VideoFile), ( exists_file(VideoFile) -> video_frame(VideoFile, Time, FrameFile) ; http_absolute_location(icon('no_image.jpg'), FrameFile, []) diff --git a/applications/yaz_player.pl b/applications/yaz_player.pl index b627f90..b8e458a 100644 --- a/applications/yaz_player.pl +++ b/applications/yaz_player.pl @@ -122,9 +122,9 @@ role_option(associated, associated). html_page(Video, Annotations, StartTime, Options) :- option(query(Query), Options, ''), option(type(Type), Options, 'filter by type'), - findall(option(V, type, N), type_option(V, N), TypeOptions), + findall(option(V, typefilter, N), type_option(V, N), TypeOptions), option(role(Role), Options, 'filter by role'), - findall(option(V, role, N), role_option(V, N), RoleOptions), + findall(option(V, rolefilter, N), role_option(V, N), RoleOptions), reply_html_page(yaz, [ title(['YAZ - ', Video]) ], @@ -155,7 +155,7 @@ html_page(Video, Annotations, StartTime, Options) :- div(id(videoplayer), []), div([id(videoframes), class(hidden)], []) ]), - div(id(tagEdit), []), + div([id(tagEdit), class(hidden)], []), script(type('text/javascript'), \html_video_page_yui(Video, Annotations, StartTime, Options)) ]). @@ -250,7 +250,8 @@ html_user_list([User|T], Selected, VideoPlayer) --> html_video_page_yui(Video, Annotations, StartTime, Options) --> - { video_source(Video, Src, Duration), + { option(query(Query), Options, ''), + video_source(Video, Src, Duration), option(interval(Interval), Options, 0), http_location_by_id(serve_video_frame, FrameServer), http_absolute_location(js('videoplayer/'), FilePath, []), @@ -260,7 +261,7 @@ html_video_page_yui(Video, Annotations, StartTime, Options) --> http_absolute_location(js('timeline/timeline.js'), Timeline, []), http_absolute_location(js('valueslider/valueslider.js'), Valueslider, []), annotation_to_json(Annotations, JSONTags), - list_limit(JSONTags, 20, JSONFrames, _) + list_limit(JSONTags, 50, JSONFrames, _) }, html_requires(js('videoplayer/swfobject.js')), js_yui3([{modules:{'video-player':{fullpath:Videoplayer}, @@ -337,7 +338,8 @@ html_video_page_yui(Video, Annotations, StartTime, Options) --> \js_yui3_on('Y.one("#toggleFrames")', click, \js_toggle_frames), \js_yui3_on('Y.one("#tagsearch")', keyup, \js_search), \js_yui3_on('Y.one("#tagtype")', change, \js_filter), - \js_yui3_on('Y.one("#tagrole")', change, \js_filter) + \js_yui3_on('Y.one("#tagrole")', change, \js_filter), + \js_call(fetchTagInfo(Query)) ]). js_toggle_options --> @@ -355,11 +357,13 @@ js_toggle_frames --> videoPlayer.pause(); video.addClass("hidden"); frames.removeClass("hidden"); + Y.one("#tagEdit").removeClass("hidden"); }\n', ' else { e.target.setContent("show frames"); frames.addClass("hidden"); video.removeClass("hidden"); + Y.one("#tagEdit").addClass("hidden"); }\n' ]). @@ -372,7 +376,8 @@ js_fetch_tags --> tagPlayer.set("tags", tags); videoFrames.set("frames", tags); videoFrames.set("related", []); - timeline.set("items", tags);\n' + timeline.set("items", tags); + if(Y.params.query) {fetchTagInfo(Y.params.query);}\n' ]), js_function_decl(fetchTags, [conf], @@ -428,10 +433,12 @@ js_fetch_tag_info --> js_function_decl(fetchTagInfo, [entry], \[ -' Y.io("',Server,'", +' if(entry) { + Y.io("',Server,'", { data: {entry:entry, format:"form"}, - on: { success: setTagInfo }});\n' + on: { success: setTagInfo }}) + };\n' ]). js_tag_select --> @@ -515,23 +522,24 @@ js_update_entries(Video) --> }, js_function_decl(updateEntries, [all], \[ -' var entry = Y.tag.annotations[0].uri - entries = [], - as = Y.tag.annotations, - rs = videoFrames.get("related"); - for(var i=0; i<as.length; i++) { entries.push(as[i].uri) } +' var entry = Y.tag ? Y.tag.annotations[0].uri : Y.params.query, + entries = [], + as = videoFrames.get("frames"), + rs = videoFrames.get("related");\n', +' if(Y.tag) { entries.push(Y.tag.annotations[0].uri) } + else { for(var i=0; i<as.length; i++) { + for(var j=0;j<as[i].annotations.length;j++) { entries.push(as[i].annotations[j].uri) }}} if(all) { for(i=0; i<rs.length; i++) { entries.push(rs[i].entry) }}\n', ' var data = {video:"',Video,'", entries:entries, value:Y.one("#value").get("value") }; if( Y.one("[name=concept]:checked")) {data.concept = Y.one("[name=concept]:checked").get("value");} - if( Y.one("[name=role]:checked")) {data.role = Y.one("[name=role]:checked").get("value");}\n', + if( Y.one("[name=role]:checked")) {data.role = Y.one("[name=role]:checked").get("value");}\n', ' Y.io("',Server,'", { data: data, - on: { success: function(e,o) {fetchTagFrames(entry); - updateTags() - }}, + on: { success: function() {if(Y.tag) {fetchTagFrames(entry); updateTags();} + else {fetchTags() }}}, });\n' ]). @@ -540,9 +548,15 @@ js_role_select(Video) --> }, js_function([o], \[ -' var data = {video:"',Video,'", +' var entries = []; + if(o.frame.annotations) { + for(var j=0;j<o.frame.annotations.length;j++) { entries.push(o.frame.annotations[j].uri) }} + else { + entries = [o.frame.entry]; + } + var data = {video:"',Video,'", role:o.type, - entries:[o.frame.entry] + entries:entries };\n', ' Y.io("',Server,'", { data: data, @@ -623,7 +637,7 @@ http_data_related_tags(Request) :- jsonresource, description('tag entry to find related tags for')]), limit(Limit, - [default(20), number, + [default(50), number, description('limit number of tags shown')]), offset(Offset, [default(0), number, @@ -637,6 +651,7 @@ http_data_related_tags(Request) :- findall(Obj, (video_annotation(Video, Id, uri(Tag,Label), Time, _, Options), tag_role(Id, R) ), Entries0), + keysort(Entries0, Entries1), list_offset(Entries1, Offset, Entries2), list_limit(Entries2, Limit, Entries, _), @@ -711,7 +726,10 @@ update_role(E, Role) :- !, %rdf_global_id(pprime:role, URL), rdfh_retractall(E, pprime:role, _), - rdfh_assert(E, pprime:role, literal(Role)). + ( Role == rejected + -> rdfh_retractall(_, pprime:hasAnnotation, E) + ; rdfh_assert(E, pprime:role, literal(Role)) + ). update_role(_, _). new_tag(Value) :- diff --git a/applications/yaz_tag.pl b/applications/yaz_tag.pl index efbb89a..824ca59 100644 --- a/applications/yaz_tag.pl +++ b/applications/yaz_tag.pl @@ -48,8 +48,11 @@ http_yaz_tag_edit(Request) :- description('Return a complete html page or only the form')]) ]), update_tag(Action, Entry, Value, Concept, Role), - annotation_value(Entry, _TagId, Label), - annotation_provenance(Entry, Provenance), + ( rdf(Entry, rdf:type, pprime:'TagEntry') + -> annotation_value(Entry, _TagId, Label) + ; Label = Entry + ), + %annotation_provenance(Entry, Provenance), tag_concepts(Label, Concepts), ( Format = page -> html_page(Entry, Label, Provenance, Concepts, Concept, Role) diff --git a/applications/yaz_user.pl b/applications/yaz_user.pl index 5a4bc9e..8fae59b 100644 --- a/applications/yaz_user.pl +++ b/applications/yaz_user.pl @@ -62,7 +62,7 @@ user_videos(User, Videos) :- 'http://semanticweb.cs.vu.nl/prestoprime/video2726', 'http://semanticweb.cs.vu.nl/prestoprime/video585', 'http://semanticweb.cs.vu.nl/prestoprime/video420', - 'http://semanticweb.cs.vu.nl/prestoprime/video714' + 'http://semanticweb.cs.vu.nl/prestoprime/video743' ]. diff --git a/web/css/player.css b/web/css/player.css index 220381a..fc1c5dd 100644 --- a/web/css/player.css +++ b/web/css/player.css @@ -26,7 +26,9 @@ width: 175px; border: 1px solid #CCC; } - +#tagEdit.hidden { + display:none; +} /* tag list */ /* tag player */ @@ -373,18 +375,22 @@ ul.game-players { text-align: center; padding: 3px 0; background-color: #DDD; + cursor: pointer; } .yui3-video-frames li.hidden { display: none; } .yui3-video-frames .frame-confirm.depicted { background-color: green; + color: white; } .yui3-video-frames .frame-confirm.associated { background-color: blue; + color: white; } .yui3-video-frames .frame-confirm.rejected { background-color: red; + color: white; } .yui3-video-frames .users { z-index:4; diff --git a/web/js/videoframes/videoframes.js b/web/js/videoframes/videoframes.js index 3a75fb1..88e8db8 100644 --- a/web/js/videoframes/videoframes.js +++ b/web/js/videoframes/videoframes.js @@ -32,7 +32,7 @@ YUI.add('video-frames', function(Y) { value: null }, maxFrames: { - value: 20 + value: 50 }, frames: { value: [] @@ -48,6 +48,9 @@ YUI.add('video-frames', function(Y) { }, video: { value: null + }, + interval : { + value: 10 } }; @@ -114,10 +117,16 @@ YUI.add('video-frames', function(Y) { }, _updateFrames : function(node, frames) { + var time = 0; + var interval = this.get("interval")*1000; node.all("li").each(function(node, i) { if(frames[i]) { + var startTime = frames[i].startTime; node.setContent(this.formatFrame(frames[i])); - node.removeClass("hidden"); + if(startTime>time+interval) { + node.removeClass("hidden"); + } + time = startTime; } else { node.setContent(""); node.addClass("hidden");