yaz/commit
update video frame serving for local files
author | Michiel Hildebrand |
---|---|
Thu Mar 3 19:19:19 2011 +0100 | |
committer | Michiel Hildebrand |
Thu Mar 3 19:19:19 2011 +0100 | |
commit | 40ee6bac43ba09a6bf936ea906a1131e9d931240 |
tree | 89eafb47bf57a6963c019cf1597195d409545efd |
parent | bf27e8d16212405654f168d255665455c672a9f7 |
Diff style: patch stat
diff --git a/api/video_frames.pl b/api/video_frames.pl index 3f18071..ef273f1 100644 --- a/api/video_frames.pl +++ b/api/video_frames.pl @@ -84,11 +84,11 @@ serve_video_frame(Request) :- time(Time, [ description('Time in the video')]) ]), - debug(frame, 'Frame for ~w', [Video]), - http_absolute_location(video(.), VideoBase, []), - ( atom_concat(VideoBase, Video, VideoURL) - -> absolute_file_name(video(Video), VideoFile), - video_frame(VideoFile, Time, FrameFile) + debug(frame, 'Frame for ~w', [VideoURL]), + www_form_encode(VideoURL, LocalVideo0), + absolute_file_name(video(LocalVideo0), VideoFile), + ( exists_file(VideoFile) + -> video_frame(VideoFile, Time, FrameFile) ; http_absolute_location(icon('no_image.jpg'), FrameFile, []) ), http_reply_file(FrameFile, [mimetype('image/png'), unsafe(true)], Request). @@ -97,21 +97,17 @@ serve_video_frame(Request) :- % % Return thumbnail file for video frame at Time. -video_frame(Video, Time, File) :- - video_frame_cache(Video, Time, File), - exists_file(File), !. video_frame(Video, Time, File) :- video_frame_dir(Dir0), - atom_concat(Video, Time, Frame), - url_cache_file(Frame, Dir0, '', File0), + atom_concat(Video, Time, FrameUrl), + url_cache_file(FrameUrl, Dir0, '', File0), concat_atom([File0, '%d', '.jpg'], ExtractFile), atom_concat(File0, '1.jpg', File), ( exists_file(File) -> debug(frame, 'CACHE: ~w', [File]) ; debug(frame, 'Extracting frame from ~w at time ~w', [Video, Time]), extract_video_frame(Video, Time, ExtractFile) - ), - assert(video_frame_cache(Video, Time, File)). + ). %% video_frame_dir(-AbsDir) %