Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Google Photo support #1853

Merged
merged 3 commits into from
Oct 7, 2022
Merged

feat: add Google Photo support #1853

merged 3 commits into from
Oct 7, 2022

Conversation

LittleJake
Copy link
Contributor

增加对谷歌相册的支持。

谷歌相册api相当的多限制,只能支持下载和上传,其他操作基本上没了。

还有几个问题:

  1. api限制上限为每次请求只能获取100个媒体(如果图库数量多的话获取速度较慢);
  2. 下载的照片非原图大小;
  3. 图库照片多的话,alist前端需要开启分页,否则浏览器会挂;

可以改进的地方:

  1. 谷歌相册通过ID进行获取文件,可像rclone一样虚拟一些分年份、类别的文件夹存放,防止展示数量过大。

@welcome
Copy link

welcome bot commented Sep 29, 2022

Thanks for opening this pull request! Please check out our contributing guidelines.

Copy link
Member

@xhofe xhofe left a comment

Choose a reason for hiding this comment

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

如果Google Photo有目录的概念的话,可能需要在添加按照目录列出后merge

}

func (d *GooglePhoto) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error) {
files, err := d.getFiles()
Copy link
Member

Choose a reason for hiding this comment

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

这里没有使用file_id 是一次性展示所有吗

Copy link
Contributor Author

@LittleJake LittleJake Oct 2, 2022

Choose a reason for hiding this comment

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

根据谷歌提供的api来说,除了列出所有,或者通过手动进行搜索条件筛选列出、列出影集这几种。

我这边也review了一下rclone的做法,他们那边好像也是遍历分日期、影集、全部这三种方式展示全部文件(包括重复的情况)。

Rclone - Google Photos

var config = driver.Config{
Name: "GooglePhoto",
OnlyProxy: true,
DefaultRoot: "root",
Copy link
Member

Choose a reason for hiding this comment

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

如果Google photo没有排序的方法的话,可以在这里加上LocalSort:true以使用本地排序。

@LittleJake
Copy link
Contributor Author

如果Google Photo有目录的概念的话,可能需要在添加按照目录列出后merge

谷歌相册好像目前只有影集这种目录的情况,但是需要手动在相册app添加相片至影集才行。

@xhofe xhofe merged commit 2840358 into alist-org:main Oct 7, 2022
@welcome
Copy link

welcome bot commented Oct 7, 2022

Congrats on merging your first pull request! We here at behavior bot are proud of you!

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.

None yet

2 participants