boredazfcuk / docker-icloudpd

An Alpine Linux container for the iCloud Photos Downloader command line utility
1.71k stars 163 forks source link

【Solved】Synology Moments can NOT show photos after completed rebuild Index #165

Closed Howardnm closed 2 years ago

Howardnm commented 2 years ago

This way can solve the problem

image

Author: Howardnm

-----------#####-----------#####-----------#####-----------#####-----------

config

down_directory="/volume1/homes/howard/Drive/Moments/icloud" # Photo download directory (照片下载目录)

Script_cache_file="/volume1/web" # Script cache file storage (脚本缓存文件存放区)

days=2 # check files from the last 2 days (扫描前2天的照片)

synophoto_index_tool="/var/packages/SynologyMoments/target/usr/bin/synophoto-bin-index-tool" # DSM 6.2 moments tool

synophoto_index_tool="/var/packages/SynologyPhotos/target/usr/bin/synofoto-bin-index-tool" # mybe DSM 7.0 ? (i don't know)

-----------#####-----------#####-----------#####-----------#####-----------

execution area

search_file(){ find ${down_directory} -mtime -${days} -name '.' > ${Script_cache_file}/log.txt sleep 2s sed '/@eaDir/d' ${Script_cache_file}/log.txt > ${Script_cache_file}/log_update.txt sleep 2s num_files=$(cat ${Script_cache_file}/log_update.txt | wc -l) echo "[Find ${num_files} files from the last ${days} days]" }

search_file

file=1 while(( $file<=$num_files )) do file_path=$(sed -n "${file}p" ${Script_cache_file}/log_update.txt) echo "[$file]$file_path" ${synophoto_index_tool} -t basic_reindex -i ${file_path} sleep 1s let "file++" done

echo "[------Finish------]"



- **successful !**
![未标题-1](https://user-images.githubusercontent.com/55622355/171097601-014fbd7b-1847-4203-8766-601100a54527.jpg)
404gods commented 2 years ago

我就用中文说了啊,非常感谢,正在遇到这个麻烦,请问兄弟2个问题: 1,还需要添加synology_photos_app_fix这个变量吗?这个变量是不是没起到作用? 2,directory_1/2/3是不是只留一个就行了?我的变量里只设置了folder_structure:{:%Y} 多谢啦

Howardnm commented 2 years ago

@404gods 1、my docker: --env synology_photos_app_fix=True; But this variable doesn't work

Alano-i commented 2 years ago

@Howardnm This script is awesome, thanks!

404gods commented 2 years ago

@404gods 1、my docker: --env synology_photos_app_fix=True; But this variable doesn't work 2、sure ! you can

# config
days=0  # Because yesterday was also 2022, no need to scan the same directory multiple times a day
        # days=0 (It means scan today only)
directory_1=$(date -d "${today} days ago" +%Y)    # @1 [%Y] = 2022
directory_structure=${directory_1}    # @3 your docker: --env folder_structure={:%Y}

But I suggest your directory name contains %d I recommend you to use my directory structure!Save more CPU performance.

十分感谢,如果包含 %d,我觉得一天一个文件夹实在太多了,我想把变量设置为{:%Y/%m},这样在年度文件夹下面每月一个文件夹还能接受,当然最方便还是一年一个文件夹。 请问如果这样的话,脚本该如何设置才能运行的时候只索引短期内的照片呢,多谢啦

Howardnm commented 2 years ago

@404gods 我已经解决这个的问题了,现在的脚本只索引短期内的照片,重新复制上面的icloudpd.sh吧!

boredazfcuk commented 2 years ago

Hi,

I've closed this as it's marked as [Solved].

Thanks.

daya0576 commented 1 year ago

FYI

Reindex command in DSM 7.1-42661:

/var/packages/SynologyPhotos/target/usr/bin/synofoto-bin-index-tool -i ${down_directory} -t basic_reindex
jinnxu75 commented 1 year ago

@404gods 我已经解决这个的问题了,现在的脚本只索引短期内的照片,重新复制上面的icloudpd.sh吧!

太棒了,搜索了几天,好像只有你这个办法好使啊

jinnxu75 commented 1 year ago

mybe DSM 7.0 ? (i don't know)

it works for DSM 7.2, the question mark can be confirmed. 这个注释可以把问号去掉了,我在7.2里面试过了,是对的,FYI @Howardnm

jinnxu75 commented 1 year ago

@Howardnm 大佬,这个方法很好。不过我后来发现,这个索引真的是完全忽视容器的操作啊。

用这个办法把PhotoIndex搞定了。但是文件的索引还是没有刷新,比如CloudSync就不会被激活。用手机Photo应用同步的安卓照片就没问题,用容器下载的iCloud照片就不会被自动同步到CloudSync里面去。

我现在用的办法是直接每个月操作一次,改一下目录名,就重建这个目录的索引了。有没有什么比较好的命令,能够一次把所有地方的文件索引都重建呢?

Thanks again.

Howardnm commented 1 year ago

@jinnxu75 你是指一次扫描多个文件夹吗?(即多个down_directory?)你可以新建多个计划任务,多脚本运行也是可以的。 如果你是指扫描一个文件夹内的所有照片,你可以把扫描天数(即days)改成几千,就相当于无限了,这样就不会把超出天数范围的照片筛选掉,就可以扫描完文件内所有的照片了。

Howardnm commented 11 months ago

@handsomebin666 你要把代码保存成sh文件,在计划任务运行该文件,7.1系统要修改代码config区域的路径

handsomebin666 commented 11 months ago

@handsomebin666 你要把代码保存成sh文件,在计划任务运行该文件,7.1系统要修改代码config区域的路径 感谢大佬指点。但还是出现报错,再次请教处理方法 [Find 27 files from the last 2 days] [1]/volume2/homes/mrbin/Photos/iCloud/2023/10/.DS_Store /volume2/homes/mrbin/icloudpd.sh: line 41: /var/packages/SynologyMoments/target/usr/bin/synophoto-bin-index-tool: No such file or directory

find: `/volume2/homes/mrbin/Photos/iCloud/2023/09/17/@eaDir': Permission denied

截屏2023-10-21 23 55 05
ljw89 commented 9 months ago

[Find 10782 files from the last 7300 days] [1]/volume1/homes/wen/Photos/iCloud_Photos/.mounted terminate called after throwing an instance of 'synophoto::Exception<(synophoto::ExceptionTag)5>' what(): /source/synofoto/src/lib/index/path_info.cpp:107 path in invalid dir: /volume1/homes/wen/Photos/iCloud_Photos/.mounted /volume1/docker/icloudpd/icloudpd.sh: line 44: 24658 Aborted (core dumped) ${synophoto_index_tool} -t basic_reindex -i ${file_path}

自动执行脚本后,显示以上错误

wanglewis commented 8 months ago

Just as a tipps for others, The script running as sh file works not in schedule(DSM 7.2). So I write the script direkt into the Schedule, replacing the parameter definition with direct folder information, and it worked.

atcodrinky commented 8 months ago

Just as a tipps for others, The script running as sh file works not in schedule(DSM 7.2). So I write the script direkt into the Schedule, replacing the parameter definition with direct folder information, and it worked.

Can you please provide a screenshot on how your set that up? I'm not that into programming and don't know how to set and write the code on Task Scheduler. Thanks

jiawen1929 commented 5 months ago

[查找过去 7300 天的 10782 个文件] [1]/volume1/homes/wen/Photos/iCloud_Photos/.mounted 在抛出 'synophoto::Exception<(synophoto::ExceptionTag)5>' 实例后终止调用 什么( ):/source/synofoto/src/lib/index/path_info.cpp:107 无效目录中的路径:/volume1/homes/wen/Photos/iCloud_Photos/.mounted /volume1/docker/icloudpd/icloudpd.sh:第 44 行: 24658 已中止(核心已转储)${synophoto_index_tool} -t basic_reindex -i ${file_path}

自动执行脚本后,显示以上错误

一样