Warning, /multimedia/kid3/src/qml/script/ShowTextEncodingV1.qml is written in an unsupported language. File is not indexed.
0001 /** 0002 * \file ShowTextEncodingV1.qml 0003 * Helps to find the encoding of ID3v1 tags by showing the tags of the 0004 * current file in all available character encodings. 0005 * 0006 * \b Project: Kid3 0007 * \author Urs Fleisch 0008 * \date 06 Mar 2015 0009 * 0010 * Copyright (C) 2015 Urs Fleisch 0011 * 0012 * This program is free software; you can redistribute it and/or modify 0013 * it under the terms of the GNU Lesser General Public License as published by 0014 * the Free Software Foundation; version 3. 0015 * 0016 * This program is distributed in the hope that it will be useful, 0017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0019 * GNU Lesser General Public License for more details. 0020 * 0021 * You should have received a copy of the GNU Lesser General Public License 0022 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0023 */ 0024 0025 import Kid3 1.0 0026 0027 Kid3Script { 0028 onRun: { 0029 // Apply the encoding by changing the configuration, applying the changes, 0030 // and then force rereading the tags by deselecting and selecting the 0031 // current file. 0032 function applyEncoding(encNr) { 0033 tagCfg.textEncodingV1Index = encNr 0034 app.applyChangedConfiguration() 0035 app.selectCurrentFile(false) 0036 app.unloadAllTags() 0037 app.selectCurrentFile(true) 0038 } 0039 0040 if (app.selectionInfo.tag(Frame.Tag_1).tagFormat) { 0041 var frameNames = ["title", "artist", "album", "comment"] 0042 var tagCfg = configs.tagConfig() 0043 var textEncodings = tagCfg.getTextCodecNames() 0044 var textEncodingV1Index = tagCfg.textEncodingV1Index 0045 var maxEncLen = Math.max.apply(null, textEncodings.map( 0046 function(s) { return s.length; })) 0047 var i 0048 for (var encNr = 0; encNr < textEncodings.length; ++encNr) { 0049 applyEncoding(encNr) 0050 var txt = textEncodings[encNr] 0051 var numSpaces = maxEncLen - txt.length 0052 txt += ":" 0053 for (i = 0; i < numSpaces; ++i) { 0054 txt += " " 0055 } 0056 for (i = 0; i < frameNames.length; ++i) { 0057 if (i > 0) { 0058 txt += " " 0059 } 0060 txt += app.getFrame(tagv1, frameNames[i]) 0061 } 0062 console.log(txt) 0063 } 0064 applyEncoding(textEncodingV1Index) 0065 app.applyChangedConfiguration() 0066 } 0067 Qt.quit() 0068 } 0069 }