Commit 1af75a44 authored by Julian Rother's avatar Julian Rother

Added publish_video

parent c4fd51df
TARGETS = probe probe-raw remux thumbnail transcode
TARGETS = probe probe-raw remux thumbnail transcode publish_video
CFLAGS = -I /usr/include/libxml2
LDFLAGS= -lcurl -lavcodec -lavformat -lavfilter -lswscale -lavutil -lxml2
......@@ -16,5 +16,7 @@ thumbnail: thumbnail.c *.h util/*.c
transcode: transcode.c *.h util/*.c
publish_video: publish_video.c *.h util/*.c
clean:
rm -f ${TARGETS}
#include <unistd.h>
#include <libgen.h>
#include <sys/stat.h>
#include "util.h"
int main(int argc, char *argv[])
{
char *src, *dest, *destdir;
if (argc != 5)
return 1;
av_register_all();
init_env();
init_avlogbuf();
jobid = atoi(argv[1]);
src = mprintf("%s/%s", getenv(WORKER_TMP), jstr(jlookup(argv[4], "source"), ""));
dest = mprintf("%s/%s", getenv(WORKER_RELEASED), jstr(jlookup(argv[4], "path"), ""));
destdir = dirname(mprintf("%s/%s", getenv(WORKER_RELEASED), jstr(jlookup(argv[4], "path"), "")));
ping_job(jobid, "running", 0);
overwrite_check(dest, 0, 0);
if (mkdir(destdir, 02775) && errno != EEXIST)
job_failed("Could not create target directory \"%s\": %s", destdir, strerror(errno));
if (rename(src, dest))
job_failed("Overwriting target file failed: %s", strerror(errno));
ping_job(jobid, "finished", "{%s, \"log\": \"%s\"}",
json_fileinfo(dest), jescape(get_avlogbuf()));
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment