diff options
author | Marcel Klehr <mklehr@gmx.net> | 2022-01-02 15:37:10 +0300 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2022-03-17 16:06:58 +0300 |
commit | 825e01d7218cfa572578967ecb9c7d710173b1b1 (patch) | |
tree | b6b22e784ccb2fbdf703a0499a9f026e7601897e /src/store/files.js | |
parent | 6f5f392b633d7cf4e2644a60f713383cf8e9415a (diff) |
Implement .nomedia/.noimage filter
for Timeline and Tags
fixes #234
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Diffstat (limited to 'src/store/files.js')
-rw-r--r-- | src/store/files.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/store/files.js b/src/store/files.js index a1408af7..27f5cb03 100644 --- a/src/store/files.js +++ b/src/store/files.js @@ -23,6 +23,7 @@ import Vue from 'vue' const state = { files: {}, + nomediaPaths: [], } const mutations = { @@ -34,6 +35,9 @@ const mutations = { */ updateFiles(state, files) { files.forEach(file => { + if (state.nomediaPaths.some(nomediaPath => file.filename.startsWith(nomediaPath))) { + return + } if (file.fileid >= 0) { Vue.set(state.files, file.fileid, file) } @@ -57,10 +61,21 @@ const mutations = { Vue.set(state.files[fileid], 'folders', subfolders) } }, + + /** + * Set list of all .nomedia/.noimage files + * + * @param {object} state the store mutations + * @param {Array} paths list of files + */ + setNomediaPaths(state, paths) { + state.nomediaPaths = paths + }, } const getters = { files: state => state.files, + nomediaPaths: state => state.nomediaPaths, } const actions = { @@ -88,6 +103,17 @@ const actions = { appendFiles(context, files = []) { context.commit('updateFiles', files) }, + + /** + * Set list of all .nomedia/.noimage files + * + * @param {object} context the store mutations + * @param {Array} paths list of files + */ + setNomediaPaths(context, paths) { + console.debug('Ignored paths', { paths }) + context.commit('setNomediaPaths', paths) + }, } export default { state, mutations, getters, actions } |