Rello / audioplayer

Audio Player for Nextcloud and ownCloud
https://rello.github.io/audioplayer
GNU Affero General Public License v3.0
223 stars 54 forks source link

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

Closed sstefanov closed 11 months ago

sstefanov commented 2 years ago

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.

sstefanov commented 2 years ago

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

Rello commented 2 years ago

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

sstefanov commented 2 years ago

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

Rello commented 2 years ago

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

sstefanov commented 2 years ago

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}
Rello commented 2 years ago

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

audioplayer:scan --all -vv

sstefanov commented 2 years ago

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.

Rello commented 2 years ago

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.

sstefanov commented 2 years ago

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

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

SFTP is SFTP mounted external storage.

Rello commented 2 years ago

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

r4sas commented 2 years ago

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

sstefanov commented 2 years ago

There is no file cover.jpg in this directory!

Rello commented 2 years ago

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');

sstefanov commented 2 years ago

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.

Rello commented 2 years ago

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

sstefanov commented 2 years ago

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.

Rello commented 2 years ago

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...

sstefanov commented 2 years ago

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?

Rello commented 2 years ago

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

Rello commented 11 months ago

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