-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prompt to rescan "dirty" files when Music app loaded
- If the user's library contains any files potentially needing rescanning, this is now prompted to the user upon app loading, similarly as any new files to scan - The rescanning of modified files, both with the new prompt and using `occ music:scan --rescan-modified`, can now also remove files from the library if the modified file turns out to be within an excluded folder - When moving folder within the music library, and that folder contains more than 15 audio files, those files are now marked as "dirty" to trigger the mechanism described above. Previously, up to 30 files were rescanned immediately and over 30 files were removed from the library, which was sub-optimal. - This completes the fix for #1173 which was started with the commit 9c43c9c. This also provides a partial fix for the old issue #706.
- Loading branch information
Showing
11 changed files
with
162 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OCA\Music\Migration; | ||
|
||
use Closure; | ||
use OCP\DB\ISchemaWrapper; | ||
use OCP\Migration\SimpleMigrationStep; | ||
use OCP\Migration\IOutput; | ||
|
||
/** | ||
* Migrate the DB schema to Music v2.1.0 level from the v1.9.1 level | ||
*/ | ||
class Version020100Date20241114220300 extends SimpleMigrationStep { | ||
|
||
/** | ||
* @param IOutput $output | ||
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` | ||
* @param array $options | ||
*/ | ||
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { | ||
} | ||
|
||
/** | ||
* @param IOutput $output | ||
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` | ||
* @param array $options | ||
* @return null|ISchemaWrapper | ||
*/ | ||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { | ||
/** @var ISchemaWrapper $schema */ | ||
$schema = $schemaClosure(); | ||
$this->addDirtyFieldToTrack($schema); | ||
return $schema; | ||
} | ||
|
||
/** | ||
* @param IOutput $output | ||
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` | ||
* @param array $options | ||
*/ | ||
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { | ||
} | ||
|
||
/** | ||
* Add the new field 'dirty' to the table 'music_tracks' | ||
*/ | ||
private function addDirtyFieldToTrack(ISchemaWrapper $schema) { | ||
$table = $schema->getTable('music_tracks'); | ||
$this->setColumn($table, 'dirty', 'smallint', ['notnull' => true, 'default' => 0]); | ||
} | ||
|
||
private function setColumn($table, string $name, string $type, array $args) : void { | ||
if (!$table->hasColumn($name)) { | ||
$table->addColumn($name, $type, $args); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters