Skip to content

Conversation

@Seven66677731
Copy link
Contributor

添加strm驱动,类似别名驱动,将文件变成strm文件进行挂载
see: #106 (comment)

@Seven66677731 Seven66677731 changed the title feat: add strm driver and add strm proxy feat: add strm driver and strm proxy Jun 27, 2025
@Seven66677731 Seven66677731 marked this pull request as draft June 27, 2025 06:22
@Seven66677731 Seven66677731 marked this pull request as ready for review June 27, 2025 06:23
@ljcbaby
Copy link
Contributor

ljcbaby commented Jun 27, 2025

这个变更已经超过一个驱动的范围了吧,驱动应该是能独立运行的,不应该改到internal才是

@foxxorcat
Copy link
Member

的确,如果是想返回自定义的strm内容Link方法的返回值可以使用

RangeReadCloser RangeReadCloserIF `json:"-"` // recommended way if can't use URL

@foxxorcat
Copy link
Member

并且strm的使用场景好像会有文件(刮削封面等)写入到strm所在的目录吧,所以这个驱动可能不完善,需要绑定一个本地磁盘进行混合读写

@Seven66677731
Copy link
Contributor Author

这个变更已经超过一个驱动的范围了吧,驱动应该是能独立运行的,不应该改到internal才是

主要生成的strm文件,需要url前缀,有一些请求里获取不到,才去internal里面添加的

@Seven66677731
Copy link
Contributor Author

并且strm的使用场景好像会有文件(刮削封面等)写入到strm所在的目录吧,所以这个驱动可能不完善,需要绑定一个本地磁盘进行混合读写

大部分情况下使用 strm的话不会在目录下生成其他文件了(现在自己使用emby不会),strm文件主要使用目的只是为了生成海报墙,所以不用考虑其他文件的问题

@Seven66677731
Copy link
Contributor Author

的确,如果是想返回自定义的strm内容Link方法的返回值可以使用

RangeReadCloser RangeReadCloserIF `json:"-"` // recommended way if can't use URL

这里可以获取到url前缀吗

@ljcbaby
Copy link
Contributor

ljcbaby commented Jun 27, 2025

Reference in new issue

考虑作为 参数/环境动态参数 传入?ctx里应该有不少变量

@Seven66677731
Copy link
Contributor Author

Reference in new issue

考虑作为 参数/环境动态参数 传入?ctx里应该有不少变量

一开始考虑用配置里,感觉不太灵活

SiteURL string `json:"site_url" env:"SITE_URL"`
大佬帮忙看看有没有更好的方式

@foxxorcat
Copy link
Member

你看看LinkArgs里面有没有

@Seven66677731
Copy link
Contributor Author

你看看LinkArgs里面有没有

args.HttpReq可以获取到,但是args里面有些没有HttpReq

@Seven66677731
Copy link
Contributor Author

你看看LinkArgs里面有没有

args.HttpReq可以获取到,但是args里面有些没有HttpReq

copy和move 的时候就没有

@foxxorcat
Copy link
Member

if d.Thumbnail {
typeName := utils.GetFileType(f.Name())
if typeName == conf.IMAGE || typeName == conf.VIDEO {
thumb = common.GetApiUrl(common.GetHttpReq(ctx)) + stdpath.Join("/d", reqPath, f.Name())
thumb = utils.EncodePath(thumb, true)
thumb += "?type=thumb&sign=" + sign.Sign(stdpath.Join(reqPath, f.Name()))
}
}
参考下这个

@Seven66677731
Copy link
Contributor Author

Seven66677731 commented Jun 27, 2025

if d.Thumbnail {
typeName := utils.GetFileType(f.Name())
if typeName == conf.IMAGE || typeName == conf.VIDEO {
thumb = common.GetApiUrl(common.GetHttpReq(ctx)) + stdpath.Join("/d", reqPath, f.Name())
thumb = utils.EncodePath(thumb, true)
thumb += "?type=thumb&sign=" + sign.Sign(stdpath.Join(reqPath, f.Name()))
}
}

参考下这个

现在就是用的 common.GetApiUrl,但是有些ctx里面没有,才降级使用的
https://github.com/Seven66677731/OpenList/blob/2d61970a53928d116d39871bc99e5271e6c80364/drivers/strm/util.go#L114C1-L117C6

@foxxorcat
Copy link
Member

那的确没啥好办法了,不过你觉得直接用配置文件不灵活的话可以增加为存储配置啊,可以增加多个strm存储配置多种站址

@foxxorcat
Copy link
Member

你看看LinkArgs里面有没有

args.HttpReq可以获取到,但是args里面有些没有HttpReq

copy和move 的时候就没有

copy和move用不到吧,直接挪动原始文件就行

@Seven66677731
Copy link
Contributor Author

那的确没啥好办法了,不过你觉得直接用配置文件不灵活的话可以增加为存储配置啊,可以增加多个strm存储配置多种站址

这个方法可以,之前想着是一般就一个站址,用户就不用输入了,后面我改成使用存储配置的吧

@Seven66677731 Seven66677731 changed the title feat: add strm driver and strm proxy feat(strm_driver): add strm driver Jun 27, 2025
@Seven66677731
Copy link
Contributor Author

@foxxorcat @ljcbaby 按照建议修改了,帮忙审查下

@hshpy
Copy link
Contributor

hshpy commented Jun 27, 2025

下载strm文件里的媒体类型没改回来吧

@Seven66677731
Copy link
Contributor Author

下载strm文件里的媒体类型没改回来吧

指的是哪一块

@hshpy
Copy link
Contributor

hshpy commented Jun 27, 2025

下载strm文件里的媒体类型没改回来吧

指的是哪一块

test.mp4被改成test.strm,emby访问/d/test.strm的得到的文件内容是/d/test.strm?sign=xxx吧,不应该是/d/test.mp4?sign=xxx吗

@Seven66677731
Copy link
Contributor Author

Seven66677731 commented Jun 27, 2025

下载strm文件里的媒体类型没改回来吧

指的是哪一个

test.mp4被改成test.strm,emby访问/d/test.strm的得到的文件内容是/d/test.strm?sign=xxx吧

/d/test.strm 得到是 d/test.mp4?sign=xxx

image

@Seven66677731
Copy link
Contributor Author

下载strm文件里的媒体类型没改回来吧

指的是哪一块

test.mp4被改成test.strm,emby访问/d/test.strm的得到的文件内容是/d/test.strm?sign=xxx吧,不应该是/d/test.mp4?sign=xxx吗

明白你的意思了,strm文件的内容是根据path生成的,这里只改了显示名称为strm,path没改

@hshpy
Copy link
Contributor

hshpy commented Jun 27, 2025

下载strm文件里的媒体类型没改回来吧

指的是哪一块

test.mp4被改成test.strm,emby访问/d/test.strm的得到的文件内容是/d/test.strm?sign=xxx吧,不应该是/d/test.mp4?sign=xxx吗

明白你的意思了,strm文件的内容是根据path生成的,这里只改了显示名称为strm,path没改

你下载看看是不是,我看着像没改。。。

@Seven66677731
Copy link
Contributor Author

Seven66677731 commented Jun 27, 2025

下载strm文件里的媒体类型没改回来吧

指的是哪一块

test.mp4被改成test.strm,emby访问/d/test.strm的得到的文件内容是/d/test.strm?sign=xxx吧,不应该是/d/test.mp4?sign=xxx吗

明白你的意思了,strm文件的内容是根据path生成的,这里只改了显示名称为strm,path没改

你下载看看是不是,我看着像没改。。。

这个上面的是下载下来的

image image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strm只支持这些文件吗,要不改成存储配置允许用户增加?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

存储设置里可以设置 FilterFileTypes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FilterFileTypescan参数我设置了strm ass也无法拿到ass字幕文件, strm驱动里只有strm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FilterFileTypescan参数我设置了strm ass也无法拿到ass字幕文件, strm驱动里只有strm

用,分割,并且这个参数是控制将哪些文件转换成strm的,不是保留文件的

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FilterFileTypescan参数我设置了strm ass也无法拿到ass字幕文件, strm驱动里只有strm

用,分割,并且这个参数是控制将哪些文件转换成strm的,不是保留文件的

好的,谢谢
那请问一下有支持保留文件的计划吗 字幕文件需要保留


func (d *Strm) Init(ctx context.Context) error {
// 强制使用本地代理
d.Storage.Proxy.WebdavPolicy = "native_proxy"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没记错的话这里不需要强制设置,获取的link为reader时自动会使用代理

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里我试了下302 和 代理地址都有点问题

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里我试了下302 和 代理地址都有点问题

你再测试一下,如果真有问题,那其他驱动也会有

Copy link
Member

@foxxorcat foxxorcat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码大体没问题,但我没部署emby没法测试实际使用

@Seven66677731
Copy link
Contributor Author

代码大体没问题,但我没部署emby没法测试实际使用

vidhub也支持strm.可以直接添加webdav

@hshpy
Copy link
Contributor

hshpy commented Jun 28, 2025

下载strm文件里的媒体类型没改回来吧

指的是哪一块

test.mp4被改成test.strm,emby访问/d/test.strm的得到的文件内容是/d/test.strm?sign=xxx吧,不应该是/d/test.mp4?sign=xxx吗

明白你的意思了,strm文件的内容是根据path生成的,这里只改了显示名称为strm,path没改

你下载看看是不是,我看着像没改。。。

这个上面的是下载下来的

image image

那可以,我以为入库和播放互不相干,拿不到list的path。

@j2rong4cn j2rong4cn marked this pull request as draft June 30, 2025 07:53
@Seven66677731 Seven66677731 marked this pull request as ready for review June 30, 2025 09:42
@j2rong4cn j2rong4cn merged commit a17b3dc into OpenListTeam:main Jul 1, 2025
12 checks passed
@Seven66677731 Seven66677731 deleted the feat/strm_driver branch July 1, 2025 07:24
@tangxl0604
Copy link

怎么没有食用说明呢

@chas0000
Copy link

chas0000 commented Jul 2, 2025

佬们,能不能加一个不url转码的开关,因为我记的从api中请求网盘直链是要使用明文路径的;还有就是strm文件内地sign能不能开关

@tangxl0604
Copy link

怎么关闭URL编码

@tangxl0604
Copy link

strm的使用场景好像会有文件(刮削封面等)写入到strm所在的目录,你这个不可以读写,最好增加docker映射本地,而且今天测试emby扫库巨慢!

@cdesign89
Copy link

得能映射出来..才能在emby、jellyfin之类的用上吧?

@cdesign89
Copy link

strm的使用场景好像会有文件(刮削封面等)写入到strm所在的目录,你这个不可以读写,最好增加docker映射本地,而且今天测试emby扫库巨慢!

您应该是指刮削生成nfo之类的写进去原目录吧?这个是得考虑写入以及存储的位置应该怎样的逻辑了。我之前自己用strm的时候,是设置不生成其他文件的。

@cdesign89
Copy link

下载strm文件里的媒体类型没改回来吧

指的是哪一个

test.mp4被改成test.strm,emby访问/d/test.strm的得到的文件内容是/d/test.strm?sign=xxx吧

/d/test.strm 得到是 d/test.mp4?sign=xxx

image

全局已经关闭签名,STRM驱动也没开签名,但strm文件里面的sign还是存在0.0,无法去掉?

@hshpy
Copy link
Contributor

hshpy commented Jul 3, 2025

下载strm文件里的媒体类型没改回来吧

指的是哪一个

test.mp4被改成test.strm,emby访问/d/test.strm的得到的文件内容是/d/test.strm?sign=xxx吧

/d/test.strm 得到是 d/test.mp4?sign=xxx
image

全局已经关闭签名,STRM驱动也没开签名,但strm文件里面的sign还是存在0.0,无法去掉?

更新beta版本

@Seven66677731
Copy link
Contributor Author

Seven66677731 commented Jul 4, 2025

strm的使用场景好像会有文件(刮削封面等)写入到strm所在的目录,你这个不可以读写,最好增加docker映射本地,而且今天测试emby扫库巨慢!

这个驱动暂时不在本地存储数据,最好使用webdav挂载或者同步到本地使用

@Losalado
Copy link

strm的使用场景好像会有文件(刮削封面等)写入到strm所在的目录,你这个不可以读写,最好增加docker映射本地,而且今天测试emby扫库巨慢!

这个驱动暂时不在本地存储数据,最好使用webdav挂载或者同步到本地使用

请问一下后面会有保存到本地的计划吗?
学习了一下rclone以及在开发中的syncer功能,感觉到同步这个功能还是想对复杂的。
strm如果可以直接保存到本地,那么就不需要额外引入同步了。
谢谢~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants