yaz/commit

Use SIP ID

authorMichiel Hildebrand
Tue Nov 8 09:40:54 2011 +0100
committerMichiel Hildebrand
Tue Nov 8 09:40:54 2011 +0100
commit689e39d19f6375680ba3e44c232c03856779e86f
tree446595f2f73321434e5c48867282ad7a12383a19
parent150c1d37938fc918b375995b55a5ae834f9ca5f2
Diff style: patch stat
diff --git a/api/edm_export.pl b/api/edm_export.pl
index 9122110..0c3493f 100644
--- a/api/edm_export.pl
+++ b/api/edm_export.pl
@@ -23,6 +23,9 @@
 :- http_handler(yaz(api/edmexport), http_api_edm_export, []).
 :- http_handler(yaz(sipupdate), http_yaz_sip_update, []).
 
+conv_url('http://prestoprime.joanneum.at/conv/ppenv/vu/documents').
+% update_url('https://p4.prestoprime.eu:8443/p4ws/ingest/update/usermd/').
+update_url('10.2.7.176/p4ws/ingest/update/usermd/').
 
 %%	http_yaz_sip_update(+Request)
 %
@@ -56,7 +59,10 @@ http_yaz_sip_update(Request) :-
 			      ]),
 	    sort_by_arg(Annotations0, 2, Annotations)
 	),
-	Id = '11111',
+	(   rdf(Video, pprime:slug, Slug)
+	->  literal_text(Slug, Id)
+	;   Id = 'no id'
+	),
 	length(Annotations, Count),
 	% convert EDM
 	conv_url(SubmitURL),
@@ -88,7 +94,7 @@ http_yaz_sip_update(Request) :-
 				div(class('yui3-u-1-2'),
 				    [h3('MPEG-7'),
 				     form([method('POST'), action(UpdateURL)],
-					  [ input([type(hidden), name(id), value(Id)], []),
+					  [ input([type(hidden), name(id), value(Slug)], []),
 					    textarea([id(mpeg),name(file),style('width:100%;height:400px')], MPEG),
 					    input([type(submit), value('Submit')])
 					  ])
@@ -286,9 +292,6 @@ annotation_value(literal(Lit), literal(Lit), Label) :-
 
 :- use_module(library(http/http_client)).
 
-conv_url('http://prestoprime.joanneum.at/conv/ppenv/vu/documents').
-update_url('https://p4.prestoprime.eu:8443/p4ws/ingest/update/usermd/').
-
 submit_mpeg(Id, XMLString) :-
 	update_url(URL),
 	atom_concat(URL, Id, UpdateURL),
diff --git a/api/ugm_ingest.pl b/api/ugm_ingest.pl
index 58b1852..3bdd51e 100644
--- a/api/ugm_ingest.pl
+++ b/api/ugm_ingest.pl
@@ -47,6 +47,9 @@ http_api_ugm_ingest(Request) :-
 				  videoDescription(Desc,
 						   [default(''),
 						    description('Description of the video')]),
+				  slug(Slug,
+				       [default(''),
+					description('Slug to identify the video')]),
 				  streamURL(StreamURL,
 					    [description('URL of the video stream')]),
 				  entries(Entries,
@@ -63,7 +66,7 @@ http_api_ugm_ingest(Request) :-
 		    %save_video_stream(StreamURL, File)
 		),
 		rdf_transaction((
-				    import_video(VideoURL, VideoId, StreamURL, Title, Desc, Duration),
+				    import_video(VideoURL, VideoId, StreamURL, Title, Desc, Duration, Slug),
 				    debug(ugm_ingest, 'added video ~w', [VideoURL, StreamURL]),
 				    import_entries(Entries, VideoURL),
 				    debug(ugm_ingest, 'added ~w tag entries', [EntryCount])
@@ -88,7 +91,7 @@ http:convert_parameter(json_tag_entries, Atom, Term) :-
 %
 %	@see video_property/2
 
-import_video(URL, Id, Stream, Title, Desc, Duration0) :-
+import_video(URL, Id, Stream, Title, Desc, Duration0, Slug) :-
 	get_time(Now),
 	rdf_atom_object(Duration0, Duration),
 	rdf_assert(URL, dc:id, literal(Id), URL),
@@ -97,6 +100,7 @@ import_video(URL, Id, Stream, Title, Desc, Duration0) :-
 	rdf_assert(URL, dc:title, literal(Title), URL),
 	rdf_assert(URL, dc:description, literal(Desc), URL),
 	rdf_assert(URL, pprime:duration, literal(Duration), URL),
+	rdf_assert(URL, pprime:slug, literal(Slug), URL),
 	rdf_assert(URL, pprime:ingestedAt, literal(type(xsd:date, Now)), URL).