spec updates: project episode num & different metadata
This commit is contained in:
parent
4e5102ac59
commit
e8f9869461
|
@ -9,11 +9,14 @@
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char* member;
|
char* member;
|
||||||
char* twitch;
|
char* stream_platform;
|
||||||
|
char* stream_username;
|
||||||
char* project;
|
char* project;
|
||||||
char* title;
|
char* title;
|
||||||
char* platform;
|
char* vod_platform;
|
||||||
char* id;
|
char* id;
|
||||||
|
char* co_host;
|
||||||
|
char* guest;
|
||||||
char* annotator;
|
char* annotator;
|
||||||
} HMML_VideoMetaData;
|
} HMML_VideoMetaData;
|
||||||
|
|
||||||
|
@ -42,6 +45,7 @@ typedef struct {
|
||||||
HMML_MarkerType type;
|
HMML_MarkerType type;
|
||||||
char* marker;
|
char* marker;
|
||||||
char* parameter;
|
char* parameter;
|
||||||
|
char* episode;
|
||||||
int offset;
|
int offset;
|
||||||
} HMML_Marker;
|
} HMML_Marker;
|
||||||
|
|
||||||
|
|
|
@ -110,14 +110,17 @@ RB \]
|
||||||
|
|
||||||
<VIDEO>{S}
|
<VIDEO>{S}
|
||||||
<VIDEO>member{S}= { yyextra->attr = V_(member); BEGIN(V_ATTR); }
|
<VIDEO>member{S}= { yyextra->attr = V_(member); BEGIN(V_ATTR); }
|
||||||
<VIDEO>twitch_username{S}= { yyextra->attr = V_(twitch); BEGIN(V_ATTR); }
|
<VIDEO>stream_platform{S}= { yyextra->attr = V_(stream_platform); BEGIN(V_ATTR); }
|
||||||
|
<VIDEO>stream_username{S}= { yyextra->attr = V_(stream_username); BEGIN(V_ATTR); }
|
||||||
<VIDEO>project{S}= { yyextra->attr = V_(project); BEGIN(V_ATTR); }
|
<VIDEO>project{S}= { yyextra->attr = V_(project); BEGIN(V_ATTR); }
|
||||||
<VIDEO>title{S}= { yyextra->attr = V_(title); BEGIN(V_ATTR); }
|
<VIDEO>title{S}= { yyextra->attr = V_(title); BEGIN(V_ATTR); }
|
||||||
<VIDEO>platform{S}= { yyextra->attr = V_(platform); BEGIN(V_ATTR); }
|
<VIDEO>vod_platform{S}= { yyextra->attr = V_(vod_platform); BEGIN(V_ATTR); }
|
||||||
<VIDEO>id{S}= { yyextra->attr = V_(id); BEGIN(V_ATTR); }
|
<VIDEO>id{S}= { yyextra->attr = V_(id); BEGIN(V_ATTR); }
|
||||||
|
<VIDEO>co_host{S}= { yyextra->attr = V_(co_host); BEGIN(V_ATTR); }
|
||||||
|
<VIDEO>guest{S}= { yyextra->attr = V_(guest); BEGIN(V_ATTR); }
|
||||||
<VIDEO>annotator{S}= { yyextra->attr = V_(annotator); BEGIN(V_ATTR); }
|
<VIDEO>annotator{S}= { yyextra->attr = V_(annotator); BEGIN(V_ATTR); }
|
||||||
<VIDEO>\] { BEGIN(ANNOTATION); };
|
<VIDEO>\] { BEGIN(ANNOTATION); };
|
||||||
<VIDEO>. { HMML_ERR("Invalid char '%c' in video tag.", *yytext); }
|
<VIDEO>. { HMML_ERR("Invalid char '%s' in video tag.", yytext); }
|
||||||
|
|
||||||
<V_ATTR>{S} { BEGIN(VIDEO); }
|
<V_ATTR>{S} { BEGIN(VIDEO); }
|
||||||
<V_ATTR>{ATTR_SIMPLE} { *yyextra->attr = strndup(yytext , yyleng ); BEGIN(VIDEO); }
|
<V_ATTR>{ATTR_SIMPLE} { *yyextra->attr = strndup(yytext , yyleng ); BEGIN(VIDEO); }
|
||||||
|
@ -134,7 +137,7 @@ RB \]
|
||||||
<TEXT_START>{LB}@ { M_(MEMBER , TEXT); BEGIN(MARKER); }
|
<TEXT_START>{LB}@ { M_(MEMBER , TEXT); BEGIN(MARKER); }
|
||||||
<TEXT_START>{LB}~ { M_(PROJECT , TEXT); BEGIN(MARKER); }
|
<TEXT_START>{LB}~ { M_(PROJECT , TEXT); BEGIN(MARKER); }
|
||||||
<TEXT_START>{LB} { yyless(0); BEGIN(TEXT); }
|
<TEXT_START>{LB} { yyless(0); BEGIN(TEXT); }
|
||||||
<TEXT_START>. { HMML_ERR("Unknown character '%c' after timecode.", *yytext); }
|
<TEXT_START>. { HMML_ERR("Unknown character '%s' after timecode.", yytext); }
|
||||||
|
|
||||||
<TEXT>{TEXT_BREAK}+ { memcpy(sb_add(yyextra->an.text, yyleng), yytext, yyleng); }
|
<TEXT>{TEXT_BREAK}+ { memcpy(sb_add(yyextra->an.text, yyleng), yytext, yyleng); }
|
||||||
<TEXT>\\. { CHECKESCAPE(yytext[1]); memcpy(sb_add(yyextra->an.text, yyleng-1), yytext+1, yyleng-1); }
|
<TEXT>\\. { CHECKESCAPE(yytext[1]); memcpy(sb_add(yyextra->an.text, yyleng-1), yytext+1, yyleng-1); }
|
||||||
|
@ -155,7 +158,17 @@ RB \]
|
||||||
<MARKER>. { HMML_ERR("Cannot parse Marker. Expected quoted or alphanumeric attribute."); }
|
<MARKER>. { HMML_ERR("Cannot parse Marker. Expected quoted or alphanumeric attribute."); }
|
||||||
|
|
||||||
<MARKER_XTRA>\\] { MX_ADD(']'); }
|
<MARKER_XTRA>\\] { MX_ADD(']'); }
|
||||||
|
<MARKER_XTRA>\\# { MX_ADD('#'); }
|
||||||
<MARKER_XTRA>\] { MX_ADD('\0'); BEGIN(TEXT); }
|
<MARKER_XTRA>\] { MX_ADD('\0'); BEGIN(TEXT); }
|
||||||
|
<MARKER_XTRA>[ ]\#[0-9]+ {
|
||||||
|
HMML_Marker* m = &sb_last(yyextra->an.markers);
|
||||||
|
if(m->type == HMML_PROJECT){
|
||||||
|
m->episode = strdup(yytext+2);
|
||||||
|
} else {
|
||||||
|
memcpy(sb_add(m->parameter, yyleng-1), yytext+1, yyleng-1);
|
||||||
|
memcpy(sb_add(yyextra->an.text, yyleng-1), yytext+1, yyleng-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
<MARKER_XTRA>[ ] { if(sb_last(yyextra->an.markers).parameter){ MX_ADD(' '); } }
|
<MARKER_XTRA>[ ] { if(sb_last(yyextra->an.markers).parameter){ MX_ADD(' '); } }
|
||||||
<MARKER_XTRA>. { MX_ADD(*yytext); }
|
<MARKER_XTRA>. { MX_ADD(*yytext); }
|
||||||
|
|
||||||
|
@ -189,11 +202,11 @@ RB \]
|
||||||
<AUTHOR>{S}
|
<AUTHOR>{S}
|
||||||
|
|
||||||
<CATEGORIES>{S}
|
<CATEGORIES>{S}
|
||||||
<CATEGORIES>:{ATTR_SIMPLE} { HMML_Marker m = { HMML_CATEGORY, strndup(yytext+1, yyleng-1), NULL, -1 }; sb_push(yyextra->an.markers, m); }
|
<CATEGORIES>:{ATTR_SIMPLE} { HMML_Marker m = { HMML_CATEGORY, strndup(yytext+1, yyleng-1), NULL, NULL, -1 }; sb_push(yyextra->an.markers, m); }
|
||||||
<CATEGORIES>:{ATTR_QUOTED} { HMML_Marker m = { HMML_CATEGORY, UNQUOTE(strndup(yytext+2, yyleng-3)), NULL, -1 }; sb_push(yyextra->an.markers, m); }
|
<CATEGORIES>:{ATTR_QUOTED} { HMML_Marker m = { HMML_CATEGORY, UNQUOTE(strndup(yytext+2, yyleng-3)), NULL, NULL, -1 }; sb_push(yyextra->an.markers, m); }
|
||||||
<CATEGORIES>\]{LB} { BEGIN(QUOTES); }
|
<CATEGORIES>\]{LB} { BEGIN(QUOTES); }
|
||||||
<CATEGORIES>\] { BEGIN(ANNOTATION); }
|
<CATEGORIES>\] { BEGIN(ANNOTATION); }
|
||||||
<CATEGORIES>. { HMML_ERR("Unexpected character in category tag: '%c'\n", *yytext); }
|
<CATEGORIES>. { HMML_ERR("Unexpected character in category tag: '%s'\n", yytext); }
|
||||||
|
|
||||||
<QUOTES>{S}
|
<QUOTES>{S}
|
||||||
<QUOTES>[0-9]+{S}\] { yyextra->an.is_quote = true; yyextra->an.quote.id = atoi(yytext); BEGIN(ANNOTATION); }
|
<QUOTES>[0-9]+{S}\] { yyextra->an.is_quote = true; yyextra->an.quote.id = atoi(yytext); BEGIN(ANNOTATION); }
|
||||||
|
@ -271,6 +284,7 @@ static void _hmml_free_anno(HMML_Annotation* a){
|
||||||
|
|
||||||
for(size_t j = 0; j < sb_count(a->markers); ++j){
|
for(size_t j = 0; j < sb_count(a->markers); ++j){
|
||||||
free(a->markers[j].marker);
|
free(a->markers[j].marker);
|
||||||
|
free(a->markers[j].episode);
|
||||||
sb_free(a->markers[j].parameter);
|
sb_free(a->markers[j].parameter);
|
||||||
}
|
}
|
||||||
sb_free(a->markers);
|
sb_free(a->markers);
|
||||||
|
|
Loading…
Reference in New Issue