@ -8,8 +8,10 @@ import (
"strings"
"strings"
"time"
"time"
"git.aiterp.net/rpdata/api/models/posts"
"git.aiterp.net/rpdata/api/internal/store"
"git.aiterp.net/rpdata/api/internal/store"
logModel "git.aiterp.net/rpdata/api/model/log"
"git.aiterp.net/rpdata/api/models /logs "
)
)
var prefixReplacer = strings . NewReplacer ( "+" , "" , "@" , "" , "!" , "" , "%" , "" )
var prefixReplacer = strings . NewReplacer ( "+" , "" , "@" , "" , "!" , "" , "%" , "" )
@ -47,13 +49,13 @@ func main() {
log . Fatalln ( err )
log . Fatalln ( err )
}
}
l , err := logModel . New ( date , channel , title , event , "" , false )
l , err := logs . Add ( date , channel , title , event , "" , false )
if err != nil {
if err != nil {
log . Println ( err )
log . Println ( err )
continue
continue
}
}
_ , err = l . NewPost ( time . Now ( ) , "annotation.info" , "rpdata-lb2logimport" , "This logfile is imported from aitelogs2 and may contain errors or wrong timestamps." )
_ , err = posts . Add ( l , time . Now ( ) , "annotation.info" , "rpdata-lb2logimport" , "This logfile is imported from aitelogs2 and may contain errors or wrong timestamps." )
if err != nil {
if err != nil {
log . Println ( err )
log . Println ( err )
}
}
@ -63,7 +65,7 @@ func main() {
continue
continue
}
}
_ , err = l . NewPost ( l . Date , "chars" , prefixReplacer . Replace ( line . Args [ 0 ] ) , line . Text )
_ , err = posts . Add ( l , l . Date , "chars" , prefixReplacer . Replace ( line . Args [ 0 ] ) , line . Text )
if err != nil {
if err != nil {
log . Println ( err )
log . Println ( err )
}
}
@ -92,13 +94,13 @@ func main() {
line . Verb = "SCENE"
line . Verb = "SCENE"
}
}
_ , err = l . NewPost ( postTime , strings . ToLower ( line . Verb ) , prefixReplacer . Replace ( line . Args [ 0 ] ) , line . Text )
_ , err = posts . Add ( l , postTime , strings . ToLower ( line . Verb ) , prefixReplacer . Replace ( line . Args [ 0 ] ) , line . Text )
if err != nil {
if err != nil {
log . Println ( err )
log . Println ( err )
}
}
}
}
err = l . UpdateCharacters ( )
l , err = logs . UpdateCharacters ( l )
if err != nil {
if err != nil {
log . Println ( err )
log . Println ( err )
}
}