memories icon indicating copy to clipboard operation
memories copied to clipboard

.nomedia doesn't seem to work everytime

Open Emporea opened this issue 3 years ago • 8 comments

I created a new folder in my root directory and placed some photos in it. It was visible in memories -> Folders as expected. Then I placed a .nomedia inside the new folder, but the folder is still visible in memories -> Folders.

I tried restarting the server, and I ran the occ memories:index with no effect; still visible.I haven't tried to delete the data-tables of memories yet, but I guess that could work as a workaround.

Emporea avatar Nov 11 '22 15:11 Emporea

occ memories:index --clear

pulsejet avatar Nov 11 '22 15:11 pulsejet

occ memories:index --clear throws an error.

occ memories:index --clear
Checking database indices

MIME Type support:
  image/png: supported
  image/jpeg: supported
  image/heic: supported
  image/png: supported
  image/tiff: supported
  image/gif: supported
  image/bmp: supported
  image/x-dcraw: not supported
  video/mpeg: supported
  video/webm: supported
  video/mp4: supported
  video/quicktime: supported
  video/x-matroska: supported

Some file types are not supported by your preview provider.
Please see https://github.com/pulsejet/memories/wiki/File-Type-Support

Are you sure you want to clear the existing index? (y/N): An unhandled exception has been thrown:
TypeError: trim(): Argument #1 ($string) must be of type string, bool given in /var/www/html/custom_apps/memories/lib/Command/Index.php:155
Stack trace:
#0 /var/www/html/custom_apps/memories/lib/Command/Index.php(155): trim(false)
#1 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OCA\Memories\Command\Index->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 /var/www/html/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Memories\Command\Index), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /var/www/html/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /var/www/html/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/html/console.php(100): OC\Console\Application->run()
#7 /var/www/html/occ(11): require_once('/var/www/html/c...')
#8 {main}

Emporea avatar Nov 11 '22 15:11 Emporea

Hmm strange. Try occ memories:index --clear -n What OS is this?

pulsejet avatar Nov 11 '22 16:11 pulsejet

Adding -n worked, and the .nomedia folder isn't visible anymore. Thanks! But I still don't understand why it threw that error and why -n even worked, as it answers this question Are you sure you want to clear the existing index? (y/N) with no, or am I wrong? I actually tried occ memories:index --clear -y before but that told me that The "-y" option does not exist..

I use the official non-alpine fpm docker image of nextcloud, I think that's ubuntu.

Emporea avatar Nov 11 '22 16:11 Emporea

-n enables non-interactive mode, so it's actually a y. But it's very strange that PHP fails to read from STDIN. Maybe it needs to explicitly open stdin? No idea.

BTW, leave this open. The way we handle hiding folders with .nomedia is to hide folders with no previews. Ideally we should be making an explicit check for .nomedia.

pulsejet avatar Nov 11 '22 16:11 pulsejet

Ah good to know. Also I didn't know that memories:index --help exists. I just tried it and now I know. ^^. Allright. I leave this open.

Emporea avatar Nov 11 '22 16:11 Emporea

But it's very strange that PHP fails to read from STDIN

I think it's because of the way I called php occ. I ran docker exec -u www-data nextcloud_app php occ. What I should've done is docker exec -it -u www-data nextcloud_app php occ for interactive and tty.

Emporea avatar Nov 11 '22 16:11 Emporea

Ah that makes perfect sense now

pulsejet avatar Nov 11 '22 18:11 pulsejet