[go: up one dir, main page]

Menu

#70 Automatically delete a defined set of tags

3.5.0
closed
nobody
None
1
2016-11-01
2016-10-14
No

I usually remove all the tags apart from certain ones. Would it be possible to have a feature that automatically removes the ones i don't want/need?

Discussion

  • Urs Fleisch

    Urs Fleisch - 2016-10-14

    As this is something quite specific for some user, it would be the best to solve it using a QML script. The following script will remove all frames except Artist, Album from Tag 2, you can easily adapt it for other frames or other tags:

    import Kid3 1.0
    
    Kid3Script {
      onRun: {
        function doWork() {
          if (app.selectionInfo.tag(Frame.Tag_2).tagFormat) {
            var frames = Object.keys(app.getAllFrames(tagv2))
            for (var i = 0, len = frames.length; i < len; ++i) {
              var type = frames[i]
              if (['Artist', 'Album'].indexOf(type) === -1) {
                app.setFrame(tagv2, type, '')
              }
            }
          }
          if (!app.nextFile()) {
            if (isStandalone()) {
              // Save the changes if the script is started stand-alone, not from Kid3.
              app.saveDirectory()
            }
            Qt.quit()
          } else {
            setTimeout(doWork, 1)
          }
        }
    
        app.firstFile()
        doWork()
      }
    }
    

    If you save it as "/home/matteo/RemoveFrames.qml", you can add it to the user actions in "Settings/User Actions" with Name="Remove Frames", Command="@qml /home/matteo/RemoveFrames.qml" and Output checked (to see any errors). You can afterwards invoke the script using the context menu of the file list.

     
  • Matteo Gremese

    Matteo Gremese - 2016-10-14

    Thanks so much, I'll try to make it work as i'm not an expert with scripts but i should manage
    Thanks again!

     
  • Matteo Gremese

    Matteo Gremese - 2016-10-14

    I got it to work but I get this error message
    file:///Users/matteo/Documents/RemoveFrames.qml:6: TypeError: Property 'tag' of object TaggedFileSelection(0x7ff18d04cf20, "TaggedFileSelection") is not a function

    If you manage to help me with it would be great
    thanks again

     
  • Urs Fleisch

    Urs Fleisch - 2016-10-15

    If you are not using the latest version of Kid3 (3.4.2), you have to replace app.selectionInfo.tag(Frame.Tag_2).tagFormat by app.selectionInfo.tagFormatV2

     
  • Matteo Gremese

    Matteo Gremese - 2016-10-15

    I made a mistake in the update, sorry.
    Works perfectly, thanks a lot! This will save me a lot of time :)
    Thanks again for your efforts in the app!

     
  • Urs Fleisch

    Urs Fleisch - 2016-11-01
    • status: open --> closed