File size: 885 Bytes
215df2f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package mega

import (
	"github.com/alist-org/alist/v3/pkg/utils"
	"time"

	"github.com/alist-org/alist/v3/internal/model"
	"github.com/t3rm1n4l/go-mega"
)

type MegaNode struct {
	n *mega.Node
}

func (m *MegaNode) GetSize() int64 {
	return m.n.GetSize()
}

func (m *MegaNode) GetName() string {
	return m.n.GetName()
}

func (m *MegaNode) CreateTime() time.Time {
	return m.n.GetTimeStamp()
}

func (m *MegaNode) GetHash() utils.HashInfo {
	//Meganz use md5, but can't get the original file hash, due to it's encrypted in the cloud
	return utils.HashInfo{}
}

func (m *MegaNode) ModTime() time.Time {
	return m.n.GetTimeStamp()
}

func (m *MegaNode) IsDir() bool {
	return m.n.GetType() == mega.FOLDER || m.n.GetType() == mega.ROOT
}

func (m *MegaNode) GetID() string {
	return m.n.GetHash()
}

func (m *MegaNode) GetPath() string {
	return ""
}

var _ model.Obj = (*MegaNode)(nil)