:- module(yaz_video_item, [yaz_video_header//1, % +VideoURL yaz_video_item//1, % +VideoURL yaz_video_result//2 % +VideoURL, +Options ]). :- use_module(library(http/http_dispatch)). :- use_module(library(http/http_parameters)). :- use_module(library(http/html_write)). :- use_module(library(http/http_host)). :- use_module(library(http/http_path)). :- use_module(library(http/html_head)). :- use_module(user(user_db)). :- use_module(library(http/http_wrapper)). :- use_module(library(semweb/rdf_db)). :- use_module(library(semweb/rdf_label)). :- use_module(library(yaz_util)). %% yaz_video_header(+VideoURL) % % Emit html with info about Video as a page header. yaz_video_header(Video) --> { display_label(Video, Title), video_desc(Video, Desc) }, html(div(class('video-header'), [h2(class(title), Title), div(class(desc), Desc) ])). %% yaz_video_item(+VideoURL) % % Emit html with info about a Video. yaz_video_item(URL) --> { display_label(URL, Title), video_source(URL, Video), truncate_atom(Title, 100, ShortTitle), video_desc(URL, Description) }, html(div(class('video-item'), [ div(class('video-thumb'), \yaz_video_image(Video)), div([class('title'), title(Title)], ShortTitle), div(class('desc'), Description) ])). yaz_video_image(Video) --> { http_link_to_id(serve_video_frame, [url(Video),time(5)], FrameURL) }, html(img([width('140px'), alt('no image available'), src(FrameURL)], [])). %% yaz_video_result(+VideoURL) % % Emit html with search result representation of VideoURL. yaz_video_result(URL, Options) --> { display_label(URL, Title), video_source(URL, Video), truncate_atom(Title, 47, ShortTitle), ( option(desc(true), Options) -> video_desc(URL, Description) ; Description = '' ), option(frame(Frame), Options, 5), delete(Options, desc(_), Options1), http_link_to_id(http_yaz_player, [video(URL)|Options1], Link), http_link_to_id(serve_video_frame, [url(Video),time(Frame)], FrameURL) }, html(div(class('video-result'), [ a(href(Link), [ div(class('video-thumb'), img([width('140px'), alt('no image available'), title(Title), src(FrameURL)], [])), div(class('title'), a([href(Link),title(Title)], ShortTitle)), div([class('desc'), title(Description)], Description) ]) ])).