-
Notifications
You must be signed in to change notification settings - Fork 146
/
plat.go
28 lines (26 loc) · 794 Bytes
/
plat.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package client
import (
"fmt"
"github.com/iyear/pure-live-core/model"
"github.com/iyear/pure-live-core/pkg/client/internal/bilibili"
"github.com/iyear/pure-live-core/pkg/client/internal/douyu"
"github.com/iyear/pure-live-core/pkg/client/internal/egame"
"github.com/iyear/pure-live-core/pkg/client/internal/huya"
"github.com/iyear/pure-live-core/pkg/client/internal/inke"
"github.com/iyear/pure-live-core/pkg/conf"
)
func GetClient(plat string) (model.Client, error) {
switch plat {
case conf.PlatBiliBili:
return bilibili.NewBiliBili()
case conf.PlatHuya:
return huya.NewHuya()
case conf.PlatDouyu:
return douyu.NewDouyu()
case conf.PlatEGame:
return egame.NewEGame()
case conf.PlatInke:
return inke.NewInke()
}
return nil, fmt.Errorf("unsupported live platform")
}