Skip to content
Snippets Groups Projects
Commit 1af75a44 authored by Julian Rother's avatar Julian Rother
Browse files

Added publish_video

parent c4fd51df
No related branches found
No related tags found
No related merge requests found
TARGETS = probe probe-raw remux thumbnail transcode TARGETS = probe probe-raw remux thumbnail transcode publish_video
CFLAGS = -I /usr/include/libxml2 CFLAGS = -I /usr/include/libxml2
LDFLAGS= -lcurl -lavcodec -lavformat -lavfilter -lswscale -lavutil -lxml2 LDFLAGS= -lcurl -lavcodec -lavformat -lavfilter -lswscale -lavutil -lxml2
...@@ -16,5 +16,7 @@ thumbnail: thumbnail.c *.h util/*.c ...@@ -16,5 +16,7 @@ thumbnail: thumbnail.c *.h util/*.c
transcode: transcode.c *.h util/*.c transcode: transcode.c *.h util/*.c
publish_video: publish_video.c *.h util/*.c
clean: clean:
rm -f ${TARGETS} 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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment