|
|
@ -240,16 +240,25 @@ func (jf *Jellyfin) getUsers(public bool) ([]map[string]interface{}, int, error)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (jf *Jellyfin) userByName(username string, public bool) (map[string]interface{}, int, error) {
|
|
|
|
func (jf *Jellyfin) userByName(username string, public bool) (map[string]interface{}, int, error) {
|
|
|
|
users, status, err := jf.getUsers(public)
|
|
|
|
var match map[string]interface{}
|
|
|
|
if err != nil || status != 200 {
|
|
|
|
find := func() (map[string]interface{}, int, error) {
|
|
|
|
|
|
|
|
users, status, err := jf.getUsers(public)
|
|
|
|
|
|
|
|
if err != nil || status != 200 {
|
|
|
|
|
|
|
|
return nil, status, err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, user := range users {
|
|
|
|
|
|
|
|
if user["Name"].(string) == username {
|
|
|
|
|
|
|
|
return user, status, err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return nil, status, err
|
|
|
|
return nil, status, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _, user := range users {
|
|
|
|
match, status, err := find()
|
|
|
|
if user["Name"].(string) == username {
|
|
|
|
if match == nil {
|
|
|
|
return user, status, nil
|
|
|
|
jf.cacheExpiry = time.Now()
|
|
|
|
}
|
|
|
|
match, status, err = find()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil, status, err
|
|
|
|
return match, status, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (jf *Jellyfin) userById(userId string, public bool) (map[string]interface{}, int, error) {
|
|
|
|
func (jf *Jellyfin) userById(userId string, public bool) (map[string]interface{}, int, error) {
|
|
|
|