diff --git a/meson.build b/meson.build index 521f630..33a4c4f 100644 --- a/meson.build +++ b/meson.build @@ -31,6 +31,7 @@ libresplit_sources = files( 'src/server.c', 'src/shared.c', 'src/timer.c', + 'src/therun.c', # Settings 'src/settings/definitions.c', diff --git a/src/therun.c b/src/therun.c new file mode 100644 index 0000000..09416fd --- /dev/null +++ b/src/therun.c @@ -0,0 +1,16 @@ +#include "timer.h" +#include + +char* build_therun_live_payload(ls_timer *timer) { + printf("tesrt"); + json_t *root = json_object(); + json_t *metadata = json_object(); + json_object_set_new(metadata, "game", json_string(timer->game->title)); + json_object_set_new(root, "metadata", metadata); + + char *payload = json_dumps(root, 0); + json_decref(root); + fprintf(stderr, payload); + + return payload; +} \ No newline at end of file diff --git a/src/therun.h b/src/therun.h new file mode 100644 index 0000000..c4b0c9b --- /dev/null +++ b/src/therun.h @@ -0,0 +1,7 @@ +#ifndef THERUN_H +#define THERUN_H + +#include "timer.h" +char* build_therun_live_payload(ls_timer *timer); + +#endif // THERUN_H \ No newline at end of file diff --git a/src/timer.c b/src/timer.c index 93afdbc..3bb8d7f 100644 --- a/src/timer.c +++ b/src/timer.c @@ -5,6 +5,7 @@ #include "timer.h" #include "gui/dialogs.h" #include "settings/utils.h" +#include "therun.h" #include "lasr/auto-splitter.h" @@ -884,6 +885,9 @@ int ls_timer_split(ls_timer* timer) ls_run_save(timer, "FINISHED"); } } + // char* therun; + build_therun_live_payload(timer); + // fprintf(stderr, therun); return timer->curr_split; } }