mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
Add IGNORE_DOT_FILES setting
With this .env setting, user can specify Koel to ignore dot files and folders (default) or include them during scanning.
This commit is contained in:
parent
7c378ac78f
commit
e4f0027f6a
5 changed files with 27 additions and 2 deletions
|
@ -22,6 +22,10 @@ APP_KEY=
|
|||
# Another random 32-char string. You can leave this empty if use php artisan koel:init.
|
||||
JWT_SECRET=
|
||||
|
||||
# By default, Koel ignore dot files and folders. This greatly improve performance if your media
|
||||
# root have folders like .git or .cache. If by any chance your media files are under a dot folder,
|
||||
# set the following setting to false.
|
||||
IGNORE_DOT_FILES=true
|
||||
|
||||
APP_ENV=production
|
||||
APP_DEBUG=true
|
||||
|
|
|
@ -119,7 +119,7 @@ class Media
|
|||
{
|
||||
return Finder::create()
|
||||
->ignoreUnreadableDirs()
|
||||
->ignoreDotFiles(false) // https://github.com/phanan/koel/issues/450
|
||||
->ignoreDotFiles((bool) config('koel.ingore_dot_files')) // https://github.com/phanan/koel/issues/450
|
||||
->files()
|
||||
->followLinks()
|
||||
->name('/\.(mp3|ogg|m4a|flac)$/i')
|
||||
|
|
|
@ -100,4 +100,14 @@ return [
|
|||
'allow' => env('ALLOW_DOWNLOAD', true),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Ignore Dot Files
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Ignore dot files and folders when scanning for media files.
|
||||
|
|
||||
*/
|
||||
'ingore_dot_files' => env('IGNORE_DOT_FILES', true),
|
||||
|
||||
];
|
||||
|
|
|
@ -63,7 +63,6 @@ class MediaTest extends TestCase
|
|||
$this->assertTrue($song->album->is_compilation);
|
||||
$this->assertEquals(Artist::VARIOUS_ID, $song->album->artist_id);
|
||||
|
||||
|
||||
$currentCover = $album->cover;
|
||||
|
||||
$song = Song::orderBy('id', 'desc')->first();
|
||||
|
@ -214,4 +213,16 @@ class MediaTest extends TestCase
|
|||
$this->assertEquals('小岩井こ Random', $info['album']);
|
||||
$this->assertEquals('水谷広実', $info['title']);
|
||||
}
|
||||
|
||||
public function testDotDirectories()
|
||||
{
|
||||
config(['koel.ingore_dot_files' => false]);
|
||||
$media = new Media();
|
||||
$media->sync($this->mediaPath);
|
||||
$this->seeInDatabase('albums', ['name' => 'Hidden Album']);
|
||||
|
||||
config(['koel.ingore_dot_files' => true]);
|
||||
$media->sync($this->mediaPath);
|
||||
$this->notSeeInDatabase('albums', ['name' => 'Hidden Album']);
|
||||
}
|
||||
}
|
||||
|
|
BIN
tests/songs/.hidden/foo.mp3
Normal file
BIN
tests/songs/.hidden/foo.mp3
Normal file
Binary file not shown.
Loading…
Reference in a new issue