Warning, /multimedia/kid3/src/qml/script/RewriteTags.qml is written in an unsupported language. File is not indexed.

0001 /**
0002  * \file RewriteTags.qml
0003  * Rewrite all tags in the selected files.
0004  *
0005  * \b Project: Kid3
0006  * \author Urs Fleisch
0007  * \date 30 Jan 2021
0008  *
0009  * Copyright (C) 2021  Urs Fleisch
0010  *
0011  * This program is free software; you can redistribute it and/or modify
0012  * it under the terms of the GNU Lesser General Public License as published by
0013  * the Free Software Foundation; version 3.
0014  *
0015  * This program is distributed in the hope that it will be useful,
0016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0018  * GNU Lesser General Public License for more details.
0019  *
0020  * You should have received a copy of the GNU Lesser General Public License
0021  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0022  */
0023 
0024 import Kid3 1.1
0025 
0026 Kid3Script {
0027   onRun: {
0028     var consideredTags = [Frame.Tag_1, Frame.Tag_2, Frame.Tag_3]
0029 
0030     function doWork() {
0031       for (var ti = 0; ti < consideredTags.length; ++ti) {
0032         var tagNr = consideredTags[ti]
0033         var tagMask = script.toTagVersion(1 << tagNr)
0034         if (app.selectionInfo.tag(tagNr).tagFormat) {
0035           // The files are saved in order to remove padding and use the
0036           // configured ID3v2 version used for new tags.
0037           app.copyTags(tagMask)
0038           app.removeTags(tagMask)
0039           app.saveDirectory()
0040           app.pasteTags(tagMask)
0041           app.saveDirectory()
0042         }
0043       }
0044       if (!nextFile()) {
0045         Qt.quit()
0046       } else {
0047         setTimeout(doWork, 1)
0048       }
0049     }
0050 
0051     firstFile()
0052     doWork()
0053   }
0054 }