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

Added json_filenifo function

parent 78fe819e
No related branches found
No related tags found
No related merge requests found
...@@ -77,6 +77,7 @@ int main(int argc, char *argv[]) ...@@ -77,6 +77,7 @@ int main(int argc, char *argv[])
if (rename(tmp, path)) if (rename(tmp, path))
job_failed("Overwriting output file failed: %s", strerror(errno)); job_failed("Overwriting output file failed: %s", strerror(errno));
unlink(tmp); 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; return 0;
} }
...@@ -359,7 +359,7 @@ int main(int argc, char *argv[]) ...@@ -359,7 +359,7 @@ int main(int argc, char *argv[])
if (rename(tmppath, outpath)) if (rename(tmppath, outpath))
job_failed("Overwriting output file \"%s\" failed: %s", outpath, strerror(errno)); job_failed("Overwriting output file \"%s\" failed: %s", outpath, strerror(errno));
unlink(tmppath); unlink(tmppath);
ping_job(jobid, "finished", "{\"hash\": \"%s\", \"duration\": %f, \"filesize\": %i, \"log\": \"%s\"}", ping_job(jobid, "finished", "{%s, \"log\": \"%s\"}", json_fileinfo(outpath),
hashfile(outpath), fileduration(outpath), filesize(outpath), jescape(get_avlogbuf())); jescape(get_avlogbuf()));
return 0; return 0;
} }
...@@ -15,6 +15,7 @@ void *xmalloc(size_t size); ...@@ -15,6 +15,7 @@ void *xmalloc(size_t size);
char *hashfile(char *path); char *hashfile(char *path);
double fileduration(char *path); double fileduration(char *path);
size_t filesize(char *path); size_t filesize(char *path);
char *json_fileinfo(char *path);
/* JSON av parsing */ /* JSON av parsing */
void parse_dict(AVDictionary **d, char *s); void parse_dict(AVDictionary **d, char *s);
......
#include "../util.h"
char *json_fileinfo(char *path)
{
return mprintf("\"hash\": \"%s\", \"duration\": %f, \"filesize\": %i",
hashfile(path), fileduration(path), filesize(path));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment