Occ audioplayer:scan fails

Basically I checked the IDs of the MP3s and they seem to be fine.

sudo -u www-data php occ audioplayer:scan admin --debug

Please help (I can link the MP3s here if needed)

It’s because of UTF-16 encoding, imo. You can apply the patch manually or wait to v1.3.2.

Sure no problem at all, I’ll stick around for the update. No rush

Scanning my music files I found something remarkable:

1.) scan for single user

root@ncserver:~# sudo -u www-data php /var/www/nextcloud/occ audioplayer:scan klaus

Start scan for klaus
Audios found: 0
Duplicates found: 0
Written to music library: 0
Albums found: 0
Errors: 0

wromg user klaus!! typo
Instead of telling: unknown user, audioplayer tries to find the music and installed in nextcloud/data the default directories and the default files

2.) scan all

root@ncserver:~# sudo -u www-data php /var/www/nextcloud/occ audioplayer:scan --all

Start scan for Hanni
Audios found: 0
Duplicates found: 0
Written to music library: 0
Albums found: 0
Errors: 0

Start scan for Inge
Audios found: 58635
Duplicates found: 361
Written to music library: 57959 !!!
Albums found: 147
Errors: 315

Start scan for Klaus
Audios found: 58635
Duplicates found: 361
Written to music library: 57959 !!!
Albums found: 147
Errors: 315
.
.

Start scan for ncadmin
Audios found: 0
Duplicates found: 0
Written to music library: 0
Albums found: 0
Errors: 0
root@ncserver:~#

the music-files are in a shared directory, wich is shared to a group.
Is it possible to scan the files for a group and put it to the members(users) of the group?
it would be quicker.

3.) scanning errors
scanning for Inge and Klaus finished with 315 errors and 361 duplicates

Is it possible to tell which files have errors and which are duplicates?
It would help to clean the music-files.

4.) starting audioplayer in the webclient

When I started user Klaus, i got the long running Circle.
After a long time the following message popped up and the audioplayer app didn*t work annymore.

Ein Skript auf dieser Seite ist eventuell beschäftigt oder es antwortet nicht mehr. Sie können das Skript jetzt stoppen, im Debugger öffnen oder weiter ausführen.

Skript: https://192.168.178.35/core/ve…ce415fd965bf3a91f721130dc6e1fd:2

Perhaps it is a problem with an timeout?

Please file a bug report on GitHub.

Try occ audioplayer:scan all --debug

The --debug command is in the first post of this thread, which was hijacked by you. :wink:

Hello,
You try to open an impressive number of >50.000 songs in 150 Albums.
In the default album view, all of them get generated/rendered with their cover arts in the frontend (javascript in your browser). It will complain sooner or later.

I dont even know how to handle this?!

Anyway: if you could open a dedicated thread for this, we could brainstorm about suggestions there…

Thank you for your Feedback

OK, I will open a new thread for a big number of songs.
Excuse me for hijacking this thread.
Klaus

I’ve managed to fix the issue

you need to go to custom_apps/audioplayer/lib/Controller/ScannerController.php line 177
and hydrate those strings that way https://stackoverflow.com/questions/7979567/php-convert-any-string-to-utf-8-without-knowing-the-original-character-set-or

for example

$dirtyalbum = $this->getID3Value(array('album'));
        $album = iconv(mb_detect_encoding($dirtyalbum, mb_detect_order(), true), "UTF-8", $dirtyalbum);

this should fix the issue

UPDATE: the best place to patch is getID3Value method.

        /**
     * Get specific ID3 tags from array
     * 
     *@param string[] $ID3Value
     *@param string $defaultValue
     * 
     * @return string
     */
    private function getID3Value ($ID3Value, $defaultValue = null) {
            $c = count($ID3Value);
            $value = null;
            \OCP\Util::writeLog('audioplayer', 'album: '.$this->ID3Tags['comments']['album'][0], \OCP\Util::DEBUG);
            for ($i = 0; $i < $c; $i++) {
                    if (isset($this->ID3Tags['comments'][$ID3Value[$i]][0]) and rawurlencode($this->ID3Tags['comments'][$ID3Value[$i]][0]) !== '%FF%FE') {
                            $value = $this->ID3Tags['comments'][$ID3Value[$i]][0];
                    } elseif ($i === $c-1 AND $defaultValue !== null) {
                            $value = $defaultValue;
                    } elseif ($i === $c-1){
                            $value = (string) $this->l10n->t('Unknown');
                    }
            }

            return $this->hydrateBadString($value);
    }
    private function hydrateBadString($badstring) {
    return iconv(mb_detect_encoding($badstring, mb_detect_order(), true), "UTF-8", $badstring);
}