fix most incompatibilites, start separating api clients

This commit is contained in:
Harvey Tindall
2021-01-08 23:47:26 +00:00
committed by Harvey Tindall
parent 4aae655180
commit 5d56ed5378
8 changed files with 473 additions and 80 deletions
+6
View File
@@ -848,6 +848,11 @@ func parseDT(date string) time.Time {
if err == nil {
return dt
}
// emby method
dt, err = time.Parse("2006-01-02T15:04:05.0000000+00:00", date)
if err == nil {
return dt
}
// magic method
// some stored dates from jellyfin have no timezone at the end, if not we assume UTC
if date[len(date)-1] != 'Z' {
@@ -882,6 +887,7 @@ func (app *appContext) GetUsers(gc *gin.Context) {
var user respUser
user.LastActive = "n/a"
if jfUser["LastActivityDate"] != nil {
fmt.Println(jfUser["LastActivityDate"].(string))
date := parseDT(jfUser["LastActivityDate"].(string))
user.LastActive = app.formatDatetime(date)
// fmt.Printf("%s: %s, %s, %+v\n", jfUser["Name"].(string), jfUser["LastActivityDate"].(string), user.LastActive, date)