audioplayer icon indicating copy to clipboard operation
audioplayer copied to clipboard

[BUG] Call to undefined method OC\Files\Node\Folder::getContent()

Open sstefanov opened this issue 2 years ago • 1 comments

When try to scan files this error occurred:

Error: Call to undefined method OC\Files\Node\Folder::getContent() in /var/www/html/nextcloud/apps/audioplayer/lib/Controller/ScannerController.php:783

Steps to reproduce the behavior: Start from console: sudo -u www-data php --define apc.enable_cli=1 /var/www/html/nextcloud/occ audioplayer:scan --all -v From web also does not work, probably for the same error.

  • Nextcloud: 24.0.2
  • Audioplayer 3.3.0

sstefanov avatar Jul 01 '22 07:07 sstefanov

After some investigation I found this error occurred on the file on External storage mounted using sftp.

sstefanov avatar Jul 04 '22 12:07 sstefanov

hello, sorry for the delay. so is the error still existing?

Rello avatar Sep 26 '22 06:09 Rello

Yes. it still exists. Nextcloud was updated to 24.0.5.

sstefanov avatar Sep 26 '22 12:09 sstefanov

Hi, can you please scann with -vv and send me some lines? the mentioned code area is in the area, where an image is existing in the folder of the audio file and this will be chosen as album-picture

Rello avatar Sep 28 '22 15:09 Rello

Hello, these are last lines:

An unhandled exception has been thrown:
Error: Call to undefined method OC\Files\Node\Folder::getContent() in /var/www/html/nextcloud/apps/audioplayer/lib/Controller/ScannerController.php:783
Stack trace:
#0 /var/www/html/nextcloud/apps/audioplayer/lib/Controller/ScannerController.php(320): OCA\audioplayer\Controller\ScannerController->getAlbumArt()
#1 /var/www/html/nextcloud/apps/audioplayer/lib/Controller/ScannerController.php(177): OCA\audioplayer\Controller\ScannerController->scanAudio()
#2 /var/www/html/nextcloud/apps/audioplayer/lib/Command/Scan.php(75): OCA\audioplayer\Controller\ScannerController->scanForAudios()
#3 /var/www/html/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OCA\audioplayer\Command\Scan->execute()
#4 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#5 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#6 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#7 /var/www/html/nextcloud/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run()
#8 /var/www/html/nextcloud/console.php(100): OC\Console\Application->run()
#9 /var/www/html/nextcloud/occ(11): require_once('/var/www/html/n...')
#10 {main}

sstefanov avatar Sep 28 '22 16:09 sstefanov

Hi, I meant the output of audioplayer itself during scanning with occ and "-vv"

audioplayer:scan --all -vv

Rello avatar Sep 28 '22 18:09 Rello

The command was this:

sudo -u www-data php --define apc.enable_cli=1 /var/www/html/nextcloud/occ audioplayer:scan --all -vv

There are several thousand of lines before these I've already pasted here. All of them shows found audio files or covers.

sstefanov avatar Sep 28 '22 18:09 sstefanov

Hi, yes. I am searching for some line with a debug output like Alternative album art: .... this is, where it breaks. So it would be good to see which image might cause the issue. it is expecting a file that is not there anymore and we need to find it.

Rello avatar Sep 28 '22 18:09 Rello

Here is it: /nextadmin/files/SFTP/tmp/THE_BIG_PLAYLIST/MP3/04 Fire Dance.mp3

Alternative album art: tmp/THE_BIG_PLAYLIST/MP3/cover.jpg

SFTP is SFTP mounted external storage.

sstefanov avatar Sep 28 '22 18:09 sstefanov

ok. and when you navigate to this cover.jpg file and open it. is it working? because its not about the general SFTP access. it managed to read the mp3 already - because it would not reach the art-extraction without this. there must be an issue with this file.

another try would be to remove it and see if the scanner works then

Rello avatar Sep 28 '22 18:09 Rello

Rello, I think Alternative album art lacks of /nextadmin/files/SFTP/ prefix.

r4sas avatar Sep 28 '22 18:09 r4sas

There is no file cover.jpg in this directory!

sstefanov avatar Sep 28 '22 18:09 sstefanov

ah. getting there. all file operations are based on the filecache table of Nextcloud. My only idea is, that there was a file which was deleted at some point?

in the mount of your external storage, did you enable the updating? Bildschirmfoto 2022-09-28 um 20 46 39

or perhaps run an occ files:scan --path="/nextadmin/files/SFTP/tmp/THE_BIG_PLAYLIST/MP3" --v

@r4sas I think this should not be the issue as NC handles the paths via its Node object. I also using external mounts (SMB in my case) and the extraction of the images works if ($audio->getParent()->nodeExists('cover.jpg')) { $this->folderPicture = $audio->getParent()->get('cover.jpg');

Rello avatar Sep 28 '22 18:09 Rello

Yes, it is set with "Once every direct access".

I started again: occ files:scan --path="/nextadmin/files/SFTP/tmp/THE_BIG_PLAYLIST/MP3" --vv It didn't show file cover.jpg. Next start of audioplayer:scan situation is the same!

Next I found that command files:cleanup will clean file cache. After start result is: 0 orphaned file cache entries deleted 1 orphaned mount entries deleted

Then started again audioplayer:scan. Result is error in another cover.jpg file. This time there is file, but named Cover.jpg (with capital first letter). File is OK when I open it in Nextcloud.

Again performed clean files and scan files but error is the same.

sstefanov avatar Sep 29 '22 10:09 sstefanov

I am running out of ideas. Tried it myself: having a cover.jpg in filecache but then removed without Nextcloud "knowing". Do you also see these lines when scanning?

Alternative album art: covertest/cover.jpg
/admin/files/audio/covertest/test-sameartist1.mp3
Reusing previous folder image
/admin/files/audio/covertest/test-sameartist2.mp3

The image is technically not there. This is caught by the scanner and the cover is not written to the database. But I don´t get the errors you have. tried on NC24 & NC25

Rello avatar Sep 29 '22 19:09 Rello

Is it possible to add a line to check if file exists before try to open it? I'm not so strong in php to add it myself.

sstefanov avatar Sep 30 '22 05:09 sstefanov

I am still thinking. if the file (the node object) is not there/wrong, the error would be "call method on null" or so. when the file is physically not there, it will take care below (as in my case).

If I could reproduce the error, I could try a catch...

Rello avatar Sep 30 '22 07:09 Rello

I see error is: Error: Call to undefined method OC\Files\Node\Folder::getContent() That means it tries to get content from the folder, not from the file, isn't it?

sstefanov avatar Sep 30 '22 07:09 sstefanov

fyi: I keep on investigating. I have to push the current bugfix release - without this fix - for the upcoming NC25 release...

Rello avatar Sep 30 '22 20:09 Rello

Hello, thank you for this request. I understand the requirement, but the time invested in the app is currently limited due to other priorities.

Rello avatar Dec 11 '23 21:12 Rello