mirror of
https://github.com/simon-ding/polaris.git
synced 2026-02-06 23:21:00 +08:00
feat: support generate .plexmatch
This commit is contained in:
@@ -14,6 +14,8 @@ import (
|
||||
type Storage interface {
|
||||
Move(src, dest string) error
|
||||
ReadDir(dir string) ([]fs.FileInfo, error)
|
||||
ReadFile(string)([]byte, error)
|
||||
WriteFile(string, []byte) error
|
||||
}
|
||||
|
||||
func NewLocalStorage(dir string) (*LocalStorage, error) {
|
||||
@@ -81,3 +83,12 @@ func (l *LocalStorage) Move(src, destDir string) error {
|
||||
func (l *LocalStorage) ReadDir(dir string) ([]fs.FileInfo, error) {
|
||||
return ioutil.ReadDir(filepath.Join(l.dir, dir))
|
||||
}
|
||||
|
||||
func (l *LocalStorage) ReadFile(name string) ([]byte, error) {
|
||||
return os.ReadFile(name)
|
||||
}
|
||||
|
||||
|
||||
func (l *LocalStorage) WriteFile(name string, data []byte) error {
|
||||
return os.WriteFile(name, data, os.ModePerm)
|
||||
}
|
||||
@@ -98,3 +98,13 @@ func (w *WebdavStorage) Move(local, remoteDir string) error {
|
||||
func (w *WebdavStorage) ReadDir(dir string) ([]fs.FileInfo, error) {
|
||||
return w.fs.ReadDir(filepath.Join(w.dir, dir))
|
||||
}
|
||||
|
||||
|
||||
func (w *WebdavStorage) ReadFile(name string) ([]byte, error) {
|
||||
return w.fs.Read(filepath.Join(w.dir, name))
|
||||
}
|
||||
|
||||
|
||||
func (w *WebdavStorage) WriteFile(name string, data []byte) error {
|
||||
return w.fs.Write(filepath.Join(w.dir, name), data, os.ModePerm)
|
||||
}
|
||||
Reference in New Issue
Block a user