From 19d5e374ad769cb9d37539d2df16de2a4519334c Mon Sep 17 00:00:00 2001 From: Hannes Thaller Date: Tue, 28 Apr 2020 23:28:16 +0200 Subject: [PATCH] Added character blacklisting Bumped version to 0.2.0 --- package.json | 2 +- src/assets/EpisodeService.js | 12 ++- src/assets/FileService.js | 1 + src/components/EpisodeList.vue | 100 +++++++++++----------- src/components/FileList.vue | 2 +- src/components/SettingsPopup.vue | 139 ++++++++++++++++++------------- src/components/Toolbar.vue | 2 +- src/store.js | 3 +- 8 files changed, 147 insertions(+), 114 deletions(-) diff --git a/package.json b/package.json index 8af022f..05fc1cf 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "author": "Hannes Thaller", "email": "hannes.thaller.at@gmail.com", "homepage": "https://tallic.github.io/name-it/", - "version": "0.1.0", + "version": "0.2.0", "private": true, "license": "MIT", "repository": "https://github.com/Tallic/name-it", diff --git a/src/assets/EpisodeService.js b/src/assets/EpisodeService.js index 9200a7f..1487cfc 100644 --- a/src/assets/EpisodeService.js +++ b/src/assets/EpisodeService.js @@ -64,7 +64,15 @@ export default { } }).sort((a, b) => a.episodeNumber - b.episodeNumber) }, - formatEpisodeName(episode, format) { + normalizeFileNames(name, blacklist) { + if(blacklist === null || blacklist.length === 0 || name === null || name.length === 0 ){ + return name + } + + const blacklistSet = new Set(blacklist) + return Array.from(name).map(c => blacklistSet.has(c) ? '' : c).join('') + }, + formatEpisodeName(episode, format, blacklist) { let name = format.replace("{series}", episode.seriesTitle) .replace("{episode}", episode.episodeTitle); @@ -73,6 +81,6 @@ export default { name = replaceNumberPattern(name, episode.seasonNumber, seasonNumberRegex); name = replaceNumberPattern(name, episode.seasonNumber, seasonNumberRegexPrefix, "S"); - return name + return this.normalizeFileNames(name, blacklist) } } diff --git a/src/assets/FileService.js b/src/assets/FileService.js index 3c4eef2..cd5086c 100644 --- a/src/assets/FileService.js +++ b/src/assets/FileService.js @@ -39,6 +39,7 @@ export default { return _.sortBy(files, ["weight"]) }, + async renameFiles(files, names) { let promises = []; diff --git a/src/components/EpisodeList.vue b/src/components/EpisodeList.vue index efcb887..82dc208 100644 --- a/src/components/EpisodeList.vue +++ b/src/components/EpisodeList.vue @@ -1,61 +1,61 @@