[GH-ISSUE #90] Problem restarting Media Path Scan after hitting APP_MAX_SCAN_TIME #62

Closed
opened 2026-02-26 02:31:59 +03:00 by kerem · 7 comments
Owner

Originally created by @nodje on GitHub (Dec 17, 2015).
Original GitHub issue: https://github.com/koel/koel/issues/90

Hi,

I've started the Media Path scanning with a 600s timeout but it wasn't enough as my music lib is quite big.
I then modified APP_MAX_SCAN_TIME=60000 in .env and reissued the command php artisan init but got an exception.
So I don't know if the new setting has been taken into account, but obviously the scanning is not happening when I click the Scan button, as it did the first time (at least I had some CPU activity and some log activity).

How can I restart the scanning process and monitor it?
How can I change the init paremeter in .env ?
How can I simply restart from scratch (erasing the php artisan init config)?

-- sorry just discovered php artisan koel:sync -v from the doc, this answers my 2 first questions.

Originally created by @nodje on GitHub (Dec 17, 2015). Original GitHub issue: https://github.com/koel/koel/issues/90 Hi, I've started the Media Path scanning with a 600s timeout but it wasn't enough as my music lib is quite big. I then modified `APP_MAX_SCAN_TIME=60000` in `.env` and reissued the command `php artisan init` but got an exception. So I don't know if the new setting has been taken into account, but obviously the scanning is not happening when I click the Scan button, as it did the first time (at least I had some CPU activity and some log activity). How can I restart the scanning process and monitor it? How can I change the init paremeter in `.env` ? How can I simply restart from scratch (erasing the `php artisan init` config)? -- sorry just discovered `php artisan koel:sync -v` from the doc, this answers my 2 first questions.
kerem closed this issue 2026-02-26 02:31:59 +03:00
Author
Owner

@phanan commented on GitHub (Dec 17, 2015):

APP_MAX_SCAN_TIME use php's set_time_limit() and thus has the same limitation – e.g. the server (Apache/nginx) can time out before php's own process. For bigger music lib, the artisan command should be used instead.

How can I simply restart from scratch (erasing the php artisan init config)?

What config is there to erase?

<!-- gh-comment-id:165351490 --> @phanan commented on GitHub (Dec 17, 2015): `APP_MAX_SCAN_TIME` use php's `set_time_limit()` and thus has the same limitation – e.g. the server (Apache/nginx) can time out before php's own process. For bigger music lib, the artisan command should be used instead. > How can I simply restart from scratch (erasing the php artisan init config)? What config is there to erase?
Author
Owner

@nodje commented on GitHub (Dec 17, 2015):

What config is there to erase?

anything that was set by php artisan init when reading .env (mail server, admin name and password etc.)

The reason for the sync problem is an exception:

[Illuminate\Database\QueryException]
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Ой°Ы' for key 'artists_name_unique' (SQL: insert into `artis
  ts` (`name`, `updated_at`, `created_at`) values (Ой°Ы, 2015-12-17 06:10:18, 2015-12-17 06:10:18))



Exception trace:
 () at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:651
 Illuminate\Database\Connection->runQueryCallback() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:611
 Illuminate\Database\Connection->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:391
 Illuminate\Database\Connection->statement() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:347
 Illuminate\Database\Connection->insert() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php:32
 Illuminate\Database\Query\Processors\Processor->processInsertGetId() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:1799
 Illuminate\Database\Query\Builder->insertGetId() at n/a:n/a
 call_user_func_array() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:943
 Illuminate\Database\Eloquent\Builder->__call() at /home/vagrant/koel/bootstrap/cache/compiled.php:10476
 Illuminate\Database\Eloquent\Model->insertAndSetId() at /home/vagrant/koel/bootstrap/cache/compiled.php:10465
 Illuminate\Database\Eloquent\Model->performInsert() at /home/vagrant/koel/bootstrap/cache/compiled.php:10422
 Illuminate\Database\Eloquent\Model->save() at /home/vagrant/koel/bootstrap/cache/compiled.php:10055
 Illuminate\Database\Eloquent\Model::create() at /home/vagrant/koel/bootstrap/cache/compiled.php:10070
 Illuminate\Database\Eloquent\Model::firstOrCreate() at /home/vagrant/koel/app/Models/Artist.php:41
 App\Models\Artist::get() at /home/vagrant/koel/app/Services/Media.php:103
 App\Services\Media->syncFile() at /home/vagrant/koel/app/Services/Media.php:52
 App\Services\Media->sync() at /home/vagrant/koel/bootstrap/cache/compiled.php:6026
 Illuminate\Support\Facades\Facade::__callStatic() at /home/vagrant/koel/app/Console/Commands/SyncMedia.php:52
 App\Console\Commands\SyncMedia->handle() at n/a:n/a
 call_user_func_array() at /home/vagrant/koel/bootstrap/cache/compiled.php:1182
 Illuminate\Container\Container->call() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Console/Command.php:150
 Illuminate\Console\Command->execute() at /home/vagrant/koel/vendor/symfony/console/Command/Command.php:256
 Symfony\Component\Console\Command\Command->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Console/Command.php:136
 Illuminate\Console\Command->run() at /home/vagrant/koel/vendor/symfony/console/Application.php:838
 Symfony\Component\Console\Application->doRunCommand() at /home/vagrant/koel/vendor/symfony/console/Application.php:189
 Symfony\Component\Console\Application->doRun() at /home/vagrant/koel/vendor/symfony/console/Application.php:120
 Symfony\Component\Console\Application->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107
 Illuminate\Foundation\Console\Kernel->handle() at /home/vagrant/koel/artisan:35





  [PDOException]
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Ой°Ы' for key 'artists_name_unique'



Exception trace:
 () at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:390
 PDOStatement->execute() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:390
 Illuminate\Database\Connection->Illuminate\Database\{closure}() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:644
 Illuminate\Database\Connection->runQueryCallback() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:611
 Illuminate\Database\Connection->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:391
 Illuminate\Database\Connection->statement() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:347
 Illuminate\Database\Connection->insert() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php:32
 Illuminate\Database\Query\Processors\Processor->processInsertGetId() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:1799
 Illuminate\Database\Query\Builder->insertGetId() at n/a:n/a
 call_user_func_array() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:943
 Illuminate\Database\Eloquent\Builder->__call() at /home/vagrant/koel/bootstrap/cache/compiled.php:10476
 Illuminate\Database\Eloquent\Model->insertAndSetId() at /home/vagrant/koel/bootstrap/cache/compiled.php:10465
 Illuminate\Database\Eloquent\Model->performInsert() at /home/vagrant/koel/bootstrap/cache/compiled.php:10422
 Illuminate\Database\Eloquent\Model->save() at /home/vagrant/koel/bootstrap/cache/compiled.php:10055
 Illuminate\Database\Eloquent\Model::create() at /home/vagrant/koel/bootstrap/cache/compiled.php:10070
 Illuminate\Database\Eloquent\Model::firstOrCreate() at /home/vagrant/koel/app/Models/Artist.php:41
 App\Models\Artist::get() at /home/vagrant/koel/app/Services/Media.php:103
 App\Services\Media->syncFile() at /home/vagrant/koel/app/Services/Media.php:52
 App\Services\Media->sync() at /home/vagrant/koel/bootstrap/cache/compiled.php:6026
 Illuminate\Support\Facades\Facade::__callStatic() at /home/vagrant/koel/app/Console/Commands/SyncMedia.php:52
 App\Console\Commands\SyncMedia->handle() at n/a:n/a
 call_user_func_array() at /home/vagrant/koel/bootstrap/cache/compiled.php:1182
 Illuminate\Container\Container->call() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Console/Command.php:150
 Illuminate\Console\Command->execute() at /home/vagrant/koel/vendor/symfony/console/Command/Command.php:256
 Symfony\Component\Console\Command\Command->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Console/Command.php:136
 Illuminate\Console\Command->run() at /home/vagrant/koel/vendor/symfony/console/Application.php:838
 Symfony\Component\Console\Application->doRunCommand() at /home/vagrant/koel/vendor/symfony/console/Application.php:189
 Symfony\Component\Console\Application->doRun() at /home/vagrant/koel/vendor/symfony/console/Application.php:120
 Symfony\Component\Console\Application->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107
 Illuminate\Foundation\Console\Kernel->handle() at /home/vagrant/koel/artisan:35

This seems to come from an encoding problem (song with Chinese character in the name or artist)

I don't understand how the scanning can encounter this problem, it should reuse existing artist name instead of recreating it, right?

<!-- gh-comment-id:165355759 --> @nodje commented on GitHub (Dec 17, 2015): > > What config is there to erase? anything that was set by `php artisan init` when reading `.env` (mail server, admin name and password etc.) The reason for the sync problem is an exception: ``` [Illuminate\Database\QueryException] SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Ой°Ы' for key 'artists_name_unique' (SQL: insert into `artis ts` (`name`, `updated_at`, `created_at`) values (Ой°Ы, 2015-12-17 06:10:18, 2015-12-17 06:10:18)) Exception trace: () at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:651 Illuminate\Database\Connection->runQueryCallback() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:611 Illuminate\Database\Connection->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:391 Illuminate\Database\Connection->statement() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:347 Illuminate\Database\Connection->insert() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php:32 Illuminate\Database\Query\Processors\Processor->processInsertGetId() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:1799 Illuminate\Database\Query\Builder->insertGetId() at n/a:n/a call_user_func_array() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:943 Illuminate\Database\Eloquent\Builder->__call() at /home/vagrant/koel/bootstrap/cache/compiled.php:10476 Illuminate\Database\Eloquent\Model->insertAndSetId() at /home/vagrant/koel/bootstrap/cache/compiled.php:10465 Illuminate\Database\Eloquent\Model->performInsert() at /home/vagrant/koel/bootstrap/cache/compiled.php:10422 Illuminate\Database\Eloquent\Model->save() at /home/vagrant/koel/bootstrap/cache/compiled.php:10055 Illuminate\Database\Eloquent\Model::create() at /home/vagrant/koel/bootstrap/cache/compiled.php:10070 Illuminate\Database\Eloquent\Model::firstOrCreate() at /home/vagrant/koel/app/Models/Artist.php:41 App\Models\Artist::get() at /home/vagrant/koel/app/Services/Media.php:103 App\Services\Media->syncFile() at /home/vagrant/koel/app/Services/Media.php:52 App\Services\Media->sync() at /home/vagrant/koel/bootstrap/cache/compiled.php:6026 Illuminate\Support\Facades\Facade::__callStatic() at /home/vagrant/koel/app/Console/Commands/SyncMedia.php:52 App\Console\Commands\SyncMedia->handle() at n/a:n/a call_user_func_array() at /home/vagrant/koel/bootstrap/cache/compiled.php:1182 Illuminate\Container\Container->call() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Console/Command.php:150 Illuminate\Console\Command->execute() at /home/vagrant/koel/vendor/symfony/console/Command/Command.php:256 Symfony\Component\Console\Command\Command->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Console/Command.php:136 Illuminate\Console\Command->run() at /home/vagrant/koel/vendor/symfony/console/Application.php:838 Symfony\Component\Console\Application->doRunCommand() at /home/vagrant/koel/vendor/symfony/console/Application.php:189 Symfony\Component\Console\Application->doRun() at /home/vagrant/koel/vendor/symfony/console/Application.php:120 Symfony\Component\Console\Application->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107 Illuminate\Foundation\Console\Kernel->handle() at /home/vagrant/koel/artisan:35 [PDOException] SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Ой°Ы' for key 'artists_name_unique' Exception trace: () at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:390 PDOStatement->execute() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:390 Illuminate\Database\Connection->Illuminate\Database\{closure}() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:644 Illuminate\Database\Connection->runQueryCallback() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:611 Illuminate\Database\Connection->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:391 Illuminate\Database\Connection->statement() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:347 Illuminate\Database\Connection->insert() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php:32 Illuminate\Database\Query\Processors\Processor->processInsertGetId() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:1799 Illuminate\Database\Query\Builder->insertGetId() at n/a:n/a call_user_func_array() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:943 Illuminate\Database\Eloquent\Builder->__call() at /home/vagrant/koel/bootstrap/cache/compiled.php:10476 Illuminate\Database\Eloquent\Model->insertAndSetId() at /home/vagrant/koel/bootstrap/cache/compiled.php:10465 Illuminate\Database\Eloquent\Model->performInsert() at /home/vagrant/koel/bootstrap/cache/compiled.php:10422 Illuminate\Database\Eloquent\Model->save() at /home/vagrant/koel/bootstrap/cache/compiled.php:10055 Illuminate\Database\Eloquent\Model::create() at /home/vagrant/koel/bootstrap/cache/compiled.php:10070 Illuminate\Database\Eloquent\Model::firstOrCreate() at /home/vagrant/koel/app/Models/Artist.php:41 App\Models\Artist::get() at /home/vagrant/koel/app/Services/Media.php:103 App\Services\Media->syncFile() at /home/vagrant/koel/app/Services/Media.php:52 App\Services\Media->sync() at /home/vagrant/koel/bootstrap/cache/compiled.php:6026 Illuminate\Support\Facades\Facade::__callStatic() at /home/vagrant/koel/app/Console/Commands/SyncMedia.php:52 App\Console\Commands\SyncMedia->handle() at n/a:n/a call_user_func_array() at /home/vagrant/koel/bootstrap/cache/compiled.php:1182 Illuminate\Container\Container->call() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Console/Command.php:150 Illuminate\Console\Command->execute() at /home/vagrant/koel/vendor/symfony/console/Command/Command.php:256 Symfony\Component\Console\Command\Command->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Console/Command.php:136 Illuminate\Console\Command->run() at /home/vagrant/koel/vendor/symfony/console/Application.php:838 Symfony\Component\Console\Application->doRunCommand() at /home/vagrant/koel/vendor/symfony/console/Application.php:189 Symfony\Component\Console\Application->doRun() at /home/vagrant/koel/vendor/symfony/console/Application.php:120 Symfony\Component\Console\Application->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107 Illuminate\Foundation\Console\Kernel->handle() at /home/vagrant/koel/artisan:35 ``` This seems to come from an encoding problem (song with Chinese character in the name or artist) I don't understand how the scanning can encounter this problem, it should reuse existing artist name instead of recreating it, right?
Author
Owner

@phanan commented on GitHub (Dec 17, 2015):

What's your table encoding?

On Thu, Dec 17, 2015 at 2:27 PM, nodje notifications@github.com wrote:

What config is there to erase?
anything that was set by php artisan init when reading .env (mail server,
admin name and password etc.)

The reason for the sync problem is an exception:

[Illuminate\Database\QueryException]
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Ой°Ы' for key 'artists_name_unique' (SQL: insert into artis ts (name, updated_at, created_at) values (Ой°Ы, 2015-12-17 06:10:18, 2015-12-17 06:10:18))

Exception trace:
() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:651
Illuminate\Database\Connection->runQueryCallback() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:611
Illuminate\Database\Connection->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:391
Illuminate\Database\Connection->statement() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:347
Illuminate\Database\Connection->insert() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php:32
Illuminate\Database\Query\Processors\Processor->processInsertGetId() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:1799
Illuminate\Database\Query\Builder->insertGetId() at n/a:n/a
call_user_func_array() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:943
Illuminate\Database\Eloquent\Builder->__call() at /home/vagrant/koel/bootstrap/cache/compiled.php:10476
Illuminate\Database\Eloquent\Model->insertAndSetId() at /home/vagrant/koel/bootstrap/cache/compiled.php:10465
Illuminate\Database\Eloquent\Model->performInsert() at /home/vagrant/koel/bootstrap/cache/compiled.php:10422
Illuminate\Database\Eloquent\Model->save() at /home/vagrant/koel/bootstrap/cache/compiled.php:10055
Illuminate\Database\Eloquent\Model::create() at /home/vagrant/koel/bootstrap/cache/compiled.php:10070
Illuminate\Database\Eloquent\Model::firstOrCreate() at /home/vagrant/koel/app/Models/Artist.php:41
App\Models\Artist::get() at /home/vagrant/koel/app/Services/Media.php:103
App\Services\Media->syncFile() at /home/vagrant/koel/app/Services/Media.php:52
App\Services\Media->sync() at /home/vagrant/koel/bootstrap/cache/compiled.php:6026
Illuminate\Support\Facades\Facade::__callStatic() at /home/vagrant/koel/app/Console/Commands/SyncMedia.php:52
App\Console\Commands\SyncMedia->handle() at n/a:n/a
call_user_func_array() at /home/vagrant/koel/bootstrap/cache/compiled.php:1182
Illuminate\Container\Container->call() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Console/Command.php:150
Illuminate\Console\Command->execute() at /home/vagrant/koel/vendor/symfony/console/Command/Command.php:256
Symfony\Component\Console\Command\Command->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Console/Command.php:136
Illuminate\Console\Command->run() at /home/vagrant/koel/vendor/symfony/console/Application.php:838
Symfony\Component\Console\Application->doRunCommand() at /home/vagrant/koel/vendor/symfony/console/Application.php:189
Symfony\Component\Console\Application->doRun() at /home/vagrant/koel/vendor/symfony/console/Application.php:120
Symfony\Component\Console\Application->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107
Illuminate\Foundation\Console\Kernel->handle() at /home/vagrant/koel/artisan:35

[PDOException]
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Ой°Ы' for key 'artists_name_unique'

Exception trace:
() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:390
PDOStatement->execute() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:390
Illuminate\Database\Connection->Illuminate\Database{closure}() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:644
Illuminate\Database\Connection->runQueryCallback() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:611
Illuminate\Database\Connection->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:391
Illuminate\Database\Connection->statement() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:347
Illuminate\Database\Connection->insert() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php:32
Illuminate\Database\Query\Processors\Processor->processInsertGetId() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:1799
Illuminate\Database\Query\Builder->insertGetId() at n/a:n/a
call_user_func_array() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:943
Illuminate\Database\Eloquent\Builder->__call() at /home/vagrant/koel/bootstrap/cache/compiled.php:10476
Illuminate\Database\Eloquent\Model->insertAndSetId() at /home/vagrant/koel/bootstrap/cache/compiled.php:10465
Illuminate\Database\Eloquent\Model->performInsert() at /home/vagrant/koel/bootstrap/cache/compiled.php:10422
Illuminate\Database\Eloquent\Model->save() at /home/vagrant/koel/bootstrap/cache/compiled.php:10055
Illuminate\Database\Eloquent\Model::create() at /home/vagrant/koel/bootstrap/cache/compiled.php:10070
Illuminate\Database\Eloquent\Model::firstOrCreate() at /home/vagrant/koel/app/Models/Artist.php:41
App\Models\Artist::get() at /home/vagrant/koel/app/Services/Media.php:103
App\Services\Media->syncFile() at /home/vagrant/koel/app/Services/Media.php:52
App\Services\Media->sync() at /home/vagrant/koel/bootstrap/cache/compiled.php:6026
Illuminate\Support\Facades\Facade::__callStatic() at /home/vagrant/koel/app/Console/Commands/SyncMedia.php:52
App\Console\Commands\SyncMedia->handle() at n/a:n/a
call_user_func_array() at /home/vagrant/koel/bootstrap/cache/compiled.php:1182
Illuminate\Container\Container->call() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Console/Command.php:150
Illuminate\Console\Command->execute() at /home/vagrant/koel/vendor/symfony/console/Command/Command.php:256
Symfony\Component\Console\Command\Command->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Console/Command.php:136
Illuminate\Console\Command->run() at /home/vagrant/koel/vendor/symfony/console/Application.php:838
Symfony\Component\Console\Application->doRunCommand() at /home/vagrant/koel/vendor/symfony/console/Application.php:189
Symfony\Component\Console\Application->doRun() at /home/vagrant/koel/vendor/symfony/console/Application.php:120
Symfony\Component\Console\Application->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107
Illuminate\Foundation\Console\Kernel->handle() at /home/vagrant/koel/artisan:35

This seems to come from an encoding problem (song with Chinese character
in the name or artist)

I don't understand how the scanning can encounter this problem, it should
reuse existing artist name instead of recreating it, right?


Reply to this email directly or view it on GitHub
https://github.com/phanan/koel/issues/90#issuecomment-165355759.

<!-- gh-comment-id:165357723 --> @phanan commented on GitHub (Dec 17, 2015): What's your table encoding? On Thu, Dec 17, 2015 at 2:27 PM, nodje notifications@github.com wrote: > What config is there to erase? > anything that was set by php artisan init when reading .env (mail server, > admin name and password etc.) > > The reason for the sync problem is an exception: > > [Illuminate\Database\QueryException] > SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Ой°Ы' for key 'artists_name_unique' (SQL: insert into `artis > ts` (`name`, `updated_at`, `created_at`) values (Ой°Ы, 2015-12-17 06:10:18, 2015-12-17 06:10:18)) > > Exception trace: > () at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:651 > Illuminate\Database\Connection->runQueryCallback() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:611 > Illuminate\Database\Connection->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:391 > Illuminate\Database\Connection->statement() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:347 > Illuminate\Database\Connection->insert() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php:32 > Illuminate\Database\Query\Processors\Processor->processInsertGetId() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:1799 > Illuminate\Database\Query\Builder->insertGetId() at n/a:n/a > call_user_func_array() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:943 > Illuminate\Database\Eloquent\Builder->__call() at /home/vagrant/koel/bootstrap/cache/compiled.php:10476 > Illuminate\Database\Eloquent\Model->insertAndSetId() at /home/vagrant/koel/bootstrap/cache/compiled.php:10465 > Illuminate\Database\Eloquent\Model->performInsert() at /home/vagrant/koel/bootstrap/cache/compiled.php:10422 > Illuminate\Database\Eloquent\Model->save() at /home/vagrant/koel/bootstrap/cache/compiled.php:10055 > Illuminate\Database\Eloquent\Model::create() at /home/vagrant/koel/bootstrap/cache/compiled.php:10070 > Illuminate\Database\Eloquent\Model::firstOrCreate() at /home/vagrant/koel/app/Models/Artist.php:41 > App\Models\Artist::get() at /home/vagrant/koel/app/Services/Media.php:103 > App\Services\Media->syncFile() at /home/vagrant/koel/app/Services/Media.php:52 > App\Services\Media->sync() at /home/vagrant/koel/bootstrap/cache/compiled.php:6026 > Illuminate\Support\Facades\Facade::__callStatic() at /home/vagrant/koel/app/Console/Commands/SyncMedia.php:52 > App\Console\Commands\SyncMedia->handle() at n/a:n/a > call_user_func_array() at /home/vagrant/koel/bootstrap/cache/compiled.php:1182 > Illuminate\Container\Container->call() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Console/Command.php:150 > Illuminate\Console\Command->execute() at /home/vagrant/koel/vendor/symfony/console/Command/Command.php:256 > Symfony\Component\Console\Command\Command->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Console/Command.php:136 > Illuminate\Console\Command->run() at /home/vagrant/koel/vendor/symfony/console/Application.php:838 > Symfony\Component\Console\Application->doRunCommand() at /home/vagrant/koel/vendor/symfony/console/Application.php:189 > Symfony\Component\Console\Application->doRun() at /home/vagrant/koel/vendor/symfony/console/Application.php:120 > Symfony\Component\Console\Application->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107 > Illuminate\Foundation\Console\Kernel->handle() at /home/vagrant/koel/artisan:35 > > [PDOException] > SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Ой°Ы' for key 'artists_name_unique' > > Exception trace: > () at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:390 > PDOStatement->execute() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:390 > Illuminate\Database\Connection->Illuminate\Database{closure}() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:644 > Illuminate\Database\Connection->runQueryCallback() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:611 > Illuminate\Database\Connection->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:391 > Illuminate\Database\Connection->statement() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:347 > Illuminate\Database\Connection->insert() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php:32 > Illuminate\Database\Query\Processors\Processor->processInsertGetId() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:1799 > Illuminate\Database\Query\Builder->insertGetId() at n/a:n/a > call_user_func_array() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:943 > Illuminate\Database\Eloquent\Builder->__call() at /home/vagrant/koel/bootstrap/cache/compiled.php:10476 > Illuminate\Database\Eloquent\Model->insertAndSetId() at /home/vagrant/koel/bootstrap/cache/compiled.php:10465 > Illuminate\Database\Eloquent\Model->performInsert() at /home/vagrant/koel/bootstrap/cache/compiled.php:10422 > Illuminate\Database\Eloquent\Model->save() at /home/vagrant/koel/bootstrap/cache/compiled.php:10055 > Illuminate\Database\Eloquent\Model::create() at /home/vagrant/koel/bootstrap/cache/compiled.php:10070 > Illuminate\Database\Eloquent\Model::firstOrCreate() at /home/vagrant/koel/app/Models/Artist.php:41 > App\Models\Artist::get() at /home/vagrant/koel/app/Services/Media.php:103 > App\Services\Media->syncFile() at /home/vagrant/koel/app/Services/Media.php:52 > App\Services\Media->sync() at /home/vagrant/koel/bootstrap/cache/compiled.php:6026 > Illuminate\Support\Facades\Facade::__callStatic() at /home/vagrant/koel/app/Console/Commands/SyncMedia.php:52 > App\Console\Commands\SyncMedia->handle() at n/a:n/a > call_user_func_array() at /home/vagrant/koel/bootstrap/cache/compiled.php:1182 > Illuminate\Container\Container->call() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Console/Command.php:150 > Illuminate\Console\Command->execute() at /home/vagrant/koel/vendor/symfony/console/Command/Command.php:256 > Symfony\Component\Console\Command\Command->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Console/Command.php:136 > Illuminate\Console\Command->run() at /home/vagrant/koel/vendor/symfony/console/Application.php:838 > Symfony\Component\Console\Application->doRunCommand() at /home/vagrant/koel/vendor/symfony/console/Application.php:189 > Symfony\Component\Console\Application->doRun() at /home/vagrant/koel/vendor/symfony/console/Application.php:120 > Symfony\Component\Console\Application->run() at /home/vagrant/koel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107 > Illuminate\Foundation\Console\Kernel->handle() at /home/vagrant/koel/artisan:35 > > This seems to come from an encoding problem (song with Chinese character > in the name or artist) > > I don't understand how the scanning can encounter this problem, it should > reuse existing artist name instead of recreating it, right? > > — > Reply to this email directly or view it on GitHub > https://github.com/phanan/koel/issues/90#issuecomment-165355759.
Author
Owner

@nodje commented on GitHub (Dec 17, 2015):

good catch:

SELECT DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA S WHERE schema_name = 'homestead';
+----------------------------+------------------------+
| DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME |
+----------------------------+------------------------+
| latin1                     | latin1_swedish_ci      |
+----------------------------+------------------------+

I guess this applies to tables in the database as well.
And I would guess Laravel is swedish...

So at this point I guess I want to restart the init process: would droping the database and relaunching php artisan init be enough?
Can I set the encoding in .env?

<!-- gh-comment-id:165364141 --> @nodje commented on GitHub (Dec 17, 2015): good catch: ``` SELECT DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA S WHERE schema_name = 'homestead'; +----------------------------+------------------------+ | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME | +----------------------------+------------------------+ | latin1 | latin1_swedish_ci | +----------------------------+------------------------+ ``` I guess this applies to tables in the database as well. And I would guess Laravel is swedish... So at this point I guess I want to restart the init process: would droping the database and relaunching `php artisan init` be enough? Can I set the encoding in `.env`?
Author
Owner

@phanan commented on GitHub (Dec 17, 2015):

So at this point I guess I want to restart the init process: would droping the database and relaunching php artisan init be enough?
Can I set the encoding in .env?

Koel (Laravel) will not create the database for you, so you'll need to create the it with a utf8_unicode_ci collation manually. And yes, dropping the database should be the faster approach than trying to fix it.

<!-- gh-comment-id:165365014 --> @phanan commented on GitHub (Dec 17, 2015): > So at this point I guess I want to restart the init process: would droping the database and relaunching php artisan init be enough? > Can I set the encoding in .env? Koel (Laravel) will not create the database for you, so you'll need to create the it with a `utf8_unicode_ci` collation manually. And yes, dropping the database should be the faster approach than trying to fix it.
Author
Owner

@nodje commented on GitHub (Dec 18, 2015):

I got it working, it's great, well done!

How is the .env file used though? Is it read at runtime for configuration? Do I just have to change settings in there for them to be taken into account? Specifically, STREAMING_METHOD can just be written in there and will be set at runtime right?

Usage of this .env file is a bit confusing because php artisan init seems to setup configuration once and for all in the database based on it as well.

<!-- gh-comment-id:165656265 --> @nodje commented on GitHub (Dec 18, 2015): I got it working, it's great, well done! How is the `.env` file used though? Is it read at runtime for configuration? Do I just have to change settings in there for them to be taken into account? Specifically, `STREAMING_METHOD` can just be written in there and will be set at runtime right? Usage of this `.env` file is a bit confusing because `php artisan init` seems to setup configuration once and for all in the database based on it as well.
Author
Owner

@phanan commented on GitHub (Dec 18, 2015):

Glad you made it. You can read more about .env here:
https://github.com/vlucas/phpdotenv

On Fri, Dec 18, 2015 at 11:03 AM, nodje notifications@github.com wrote:

I got it working, it's great, well done!

How is the .env file used though? Is it read at runtime for
configuration? Do I just have to change settings in there for them to be
taken into account? Specifically, STREAMING_METHOD can just be written in
there and will be set at runtime right?

Usage of this .env file is a bit confusing because php artisan init seems
to setup configuration once and for all in the database based on it as well.


Reply to this email directly or view it on GitHub
https://github.com/phanan/koel/issues/90#issuecomment-165656265.

<!-- gh-comment-id:165656511 --> @phanan commented on GitHub (Dec 18, 2015): Glad you made it. You can read more about .env here: https://github.com/vlucas/phpdotenv On Fri, Dec 18, 2015 at 11:03 AM, nodje notifications@github.com wrote: > I got it working, it's great, well done! > > How is the .env file used though? Is it read at runtime for > configuration? Do I just have to change settings in there for them to be > taken into account? Specifically, STREAMING_METHOD can just be written in > there and will be set at runtime right? > > Usage of this .env file is a bit confusing because php artisan init seems > to setup configuration once and for all in the database based on it as well. > > — > Reply to this email directly or view it on GitHub > https://github.com/phanan/koel/issues/90#issuecomment-165656265.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#62
No description provided.