diff --git a/remux.c b/remux.c index 1297bfce91cfbe40553a3624330eda42db1de302..d50aa6fe4bd755aaa1782529d61fb397cd61a93f 100644 --- a/remux.c +++ b/remux.c @@ -77,6 +77,7 @@ int main(int argc, char *argv[]) if (rename(tmp, path)) job_failed("Overwriting output file failed: %s", strerror(errno)); unlink(tmp); - ping_job(jobid, "finished", "{\"log\": \"%s\"}", jescape(get_avlogbuf())); + ping_job(jobid, "finished", "{%s, \"log\": \"%s\"}", json_fileinfo(path), + jescape(get_avlogbuf())); return 0; } diff --git a/transcode.c b/transcode.c index 42f179b85988d2b515f2179eceb15d7016743bd9..7dae08bde826d2e4659099bd1906daa0e12e42b2 100644 --- a/transcode.c +++ b/transcode.c @@ -359,7 +359,7 @@ int main(int argc, char *argv[]) if (rename(tmppath, outpath)) job_failed("Overwriting output file \"%s\" failed: %s", outpath, strerror(errno)); unlink(tmppath); - ping_job(jobid, "finished", "{\"hash\": \"%s\", \"duration\": %f, \"filesize\": %i, \"log\": \"%s\"}", - hashfile(outpath), fileduration(outpath), filesize(outpath), jescape(get_avlogbuf())); + ping_job(jobid, "finished", "{%s, \"log\": \"%s\"}", json_fileinfo(outpath), + jescape(get_avlogbuf())); return 0; } diff --git a/util.h b/util.h index d9e9da14f405cc8e7c5c9d911c118e5ec791fd1f..aa000f816cae17f6f7e0662454b5f09b2da2484b 100644 --- a/util.h +++ b/util.h @@ -15,6 +15,7 @@ void *xmalloc(size_t size); char *hashfile(char *path); double fileduration(char *path); size_t filesize(char *path); +char *json_fileinfo(char *path); /* JSON av parsing */ void parse_dict(AVDictionary **d, char *s); diff --git a/util/json_fileinfo.c b/util/json_fileinfo.c new file mode 100644 index 0000000000000000000000000000000000000000..b03f5641060b1e79c67c0cb3c1bd5f6ba6dd5d7a --- /dev/null +++ b/util/json_fileinfo.c @@ -0,0 +1,7 @@ +#include "../util.h" + +char *json_fileinfo(char *path) +{ + return mprintf("\"hash\": \"%s\", \"duration\": %f, \"filesize\": %i", + hashfile(path), fileduration(path), filesize(path)); +}