feat: complte media store
This commit is contained in:
@@ -14,7 +14,24 @@ type Store []VideoInfo
|
||||
type VideoInfo struct {
|
||||
Hash string
|
||||
Name string
|
||||
Duration uint
|
||||
Duration int64
|
||||
}
|
||||
|
||||
// Price
|
||||
func (info VideoInfo) Price() int64 {
|
||||
min := int64(10)
|
||||
// if duration is less than 300 seconds, return 10
|
||||
if info.Duration < 5*60 {
|
||||
return min * 100
|
||||
}
|
||||
|
||||
// 每多一分钟,价格加 3, 如果余数大于 30 秒,按一分钟计算
|
||||
cells := (info.Duration - 5*30) / 60
|
||||
if info.Duration%60 > 30 {
|
||||
cells++
|
||||
}
|
||||
|
||||
return (min + cells*3) * 100
|
||||
}
|
||||
|
||||
func NewStore(path string) (Store, error) {
|
||||
|
||||
Reference in New Issue
Block a user