-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Deprecated decoding paths from legacy versions and added tool to fix paths. * Fixed null hash on corrupted media. * Made a verbose getStatus that will show new files. * Fixed unable to delete rated media.
- Loading branch information
SimplyBoo
committed
Oct 6, 2018
1 parent
1429605
commit 0aedb04
Showing
5 changed files
with
73 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const Database = require('../src/database'); | ||
const utils = require('../src/utils.js'); | ||
const path = require('path'); | ||
|
||
(async function() { | ||
await utils.setup(); | ||
global.db = await Database.setup(utils.config); | ||
console.log('Decoding all paths'); | ||
const map = global.db.getDefaultMap(); | ||
// Convert from hashmap to array. | ||
let updated = 0; | ||
for (let i = 0; i < map.length; i++) { | ||
const media = global.db.getMedia(map[i]); | ||
const newPath = decodeURIComponent((media.path + '').replace(/\+/g, '%20')).replace(/\\/g, '/'); | ||
if (media.path !== newPath) { | ||
console.log(`Updated ${media.path} to ${newPath}`); | ||
await global.db.updateMedia(media.hash, {path: newPath}); | ||
updated++; | ||
} | ||
} | ||
console.log(`Updated ${updated} paths`); | ||
|
||
await global.db.close(); | ||
})(); |