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

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

Closed
sstefanov opened this issue Jul 1, 2022 · 20 comments
Closed

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

sstefanov opened this issue Jul 1, 2022 · 20 comments
Assignees

Comments

@sstefanov
Copy link

sstefanov commented Jul 1, 2022

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
Copy link
Author

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

@Rello
Copy link
Owner

Rello commented Sep 26, 2022

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

@Rello Rello self-assigned this Sep 26, 2022
@sstefanov
Copy link
Author

sstefanov commented Sep 26, 2022

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

@Rello
Copy link
Owner

Rello commented Sep 28, 2022

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 Rello added the needs info feedback from requester required label Sep 28, 2022
@sstefanov
Copy link
Author

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
Copy link
Owner

Rello commented Sep 28, 2022

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

audioplayer:scan --all -vv

@sstefanov
Copy link
Author

sstefanov commented Sep 28, 2022

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
Copy link
Owner

Rello commented Sep 28, 2022

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
Copy link
Author

sstefanov commented Sep 28, 2022

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.

@Rello
Copy link
Owner

Rello commented Sep 28, 2022

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
Copy link
Contributor

r4sas commented Sep 28, 2022

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

@sstefanov
Copy link
Author

There is no file cover.jpg in this directory!

@Rello
Copy link
Owner

Rello commented Sep 28, 2022

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
Copy link
Author

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
Copy link
Owner

Rello commented Sep 29, 2022

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
Copy link
Author

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
Copy link
Owner

Rello commented Sep 30, 2022

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
Copy link
Author

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
Copy link
Owner

Rello commented Sep 30, 2022

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

@Rello
Copy link
Owner

Rello commented Dec 11, 2023

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 Rello closed this as completed Dec 11, 2023
@Rello Rello added won't fix and removed needs info feedback from requester required investigation labels Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants