app

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2024 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

应用实例

func NewApp

func NewApp() *App

func (*App) AddDownloadTasks

func (app *App) AddDownloadTasks(taskMaps []taskMap) bool
添加下载任务

1. 获取任务目标 2. 创建/添加到任务队列 3. 保存任务信息

func (*App) DisablePlugin

func (app *App) DisablePlugin(p *plugin.Plugin) *plugin.Plugin

关闭插件,并禁用插件

func (*App) DownloadPlugin

func (app *App) DownloadPlugin(p *plugin.Plugin) *plugin.Plugin

func (*App) EnablePlugin

func (app *App) EnablePlugin(p *plugin.Plugin) (*plugin.Plugin, string)

启用插件, 但是不会运行

func (*App) GetConfig

func (app *App) GetConfig() *config.Config

获取主机配置信息

func (*App) GetPlugins

func (app *App) GetPlugins() map[string]*plugin.Plugin

func (*App) OpenExplorer

func (app *App) OpenExplorer(dir string) error

func (*App) OpenFileWithSystemPlayer

func (app *App) OpenFileWithSystemPlayer(filePath string) error

func (*App) ParsePlaylist

func (app *App) ParsePlaylist(ids []string) *pb.ParseResponse

解析数据

func (*App) RemoveAllTask

func (app *App) RemoveAllTask(parts []Part) bool

移除任务 移除完成任务: 去除app.tasks目标 并保存配置 移除下载中任务: 调用下载器StopDownload函数 关闭stopChan 移除队列中任务: 清理缓存队列的queueTasks

func (*App) RemoveTask

func (app *App) RemoveTask(uid string) bool

移除单个任务

  1. 下载中 调用download.Stop, handleTask续会自动检测tq.queueTasks是否为空, 需要refill等
  2. 队列中 直接删除对应任务
  3. 已完成 直接删除对应任务

func (*App) RunPlugin

func (app *App) RunPlugin(p *plugin.Plugin) *plugin.Plugin

运行插件, 并建立连接

func (*App) SaveConfig

func (app *App) SaveConfig(config *config.Config) bool

保存配置文件到本地

func (*App) SavePluginConfig

func (app *App) SavePluginConfig(id string, pluginConfig *config.PluginConfig) (*plugin.Plugin, error)

保存插件配置

func (*App) SetDownloadDir

func (app *App) SetDownloadDir(title string) string

func (*App) ShowDownloadInfo

func (app *App) ShowDownloadInfo(link string) *pb.InfoResponse
获取主页选择下载详情列表

1. 获取下载器 2. 调用展示信息函数 3. 缓存数据

func (*App) Shutdown

func (app *App) Shutdown(ctx context.Context)

func (*App) Startup

func (app *App) Startup(ctx context.Context)

func (*App) StopPlugin

func (app *App) StopPlugin(p *plugin.Plugin) *plugin.Plugin

func (*App) TaskParts

func (app *App) TaskParts() []Part

获取前端任务片段

func (*App) UpdatePlugin

func (app *App) UpdatePlugin(p *plugin.Plugin) *plugin.Plugin

更新插件参数

func (*App) UpdatePluginsConfig

func (app *App) UpdatePluginsConfig(id string, pluginConfig *config.PluginConfig) *App

修改插件配置(不会保存)

func (*App) UpdateSystemConfig

func (app *App) UpdateSystemConfig(systemConfig *models.SystemConfig) *App

修改系统配置(不会保存)

type AppInfo

type AppInfo struct {
	LogDir     string
	ConfigDir  string
	AssetsDir  string
	PluginsDir string
	// contains filtered or unexported fields
}

软件基础信息 aa

func NewAppInfo

func NewAppInfo() AppInfo

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache() *Cache

func (*Cache) AddTask

func (c *Cache) AddTask(id string, info *pb.Task)

func (*Cache) AddTasks

func (c *Cache) AddTasks(tasks []*pb.Task)

func (*Cache) ClearTasks

func (c *Cache) ClearTasks()

func (*Cache) DeleteTask

func (c *Cache) DeleteTask(id string)

func (*Cache) Downloader

func (c *Cache) Downloader() *plugin.Plugin

下载器缓存

func (*Cache) SetDownloader

func (c *Cache) SetDownloader(p *plugin.Plugin)

func (*Cache) Task

func (c *Cache) Task(id string) (*pb.Task, bool)

任务缓存

func (*Cache) Tasks

func (c *Cache) Tasks(ids []string) ([]*pb.Task, error)

type MessageData

type MessageData struct {
	Message     string `json:"message"`
	MessageType string `json:"messageType"`
}

type Part

type Part struct {
	URL         string // 链接
	TaskID      string // 唯一标识 ;需创建task时初始化
	WorkDirName string // 工作文件夹名 ;需创建task时初始化
	DownloadDir string // 下载文件夹完整路径 ;需创建task时初始化
	MagicName   string // 下载文件名 不带后缀
	Path        string // 下载文件完整路径

	Index       int       // 所在父级索引 0开始
	Author      string    // 作者
	Title       string    // 标题
	Description string    // 描述
	Width       int       // 宽度
	Height      int       // 高度
	Size        int       // 字节数
	Duration    int       // 持续时间 秒
	PubDate     time.Time // 发布日期

	Thumbnail string        // 封面
	Video     StreamQuality // 质量标签
	Audio     StreamQuality // 质量标签
	Subtitle  string        // todo

	State           string    // 状态
	Status          string    // 进度
	CreatedAt       time.Time // 任务创建日期
	DownloadPercent int       // 下载百分比
	DownloadSpeed   string    // 下载速度
}

任务片段信息

type StreamQuality

type StreamQuality struct {
	IDtag int
	Label string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL