{"id":50,"date":"2009-10-29T10:42:29","date_gmt":"2009-10-29T15:42:29","guid":{"rendered":"http:\/\/ebixio.com\/wordpress\/?p=50"},"modified":"2009-10-29T10:42:29","modified_gmt":"2009-10-29T15:42:29","slug":"script-to-show-id3v2-frames-present-or-absent-in-a-file","status":"publish","type":"post","link":"http:\/\/ebixio.com\/blog\/2009\/10\/29\/script-to-show-id3v2-frames-present-or-absent-in-a-file\/","title":{"rendered":"Script to show id3v2 frames present or absent in a file"},"content":{"rendered":"<p>This is a very simple script. See the usage at the top of the script starting on line 28.<\/p>\n\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n#!\/bin\/bash\n\n# Author: Gabriel Burca (gburca dash mp3 at ebixio dot com)\n# Version: 1.0\n#\n# Copyright (C) 2006-2009  Gabriel Burca (gburca dash mp3 at ebixio dot com)\n#\n# This program is free software; you can redistribute it and\/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2\n# of the License, or (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n\n\nset -o nounset\nset -o errexit\n\nfunction usage () {\n    cat &lt;&lt; EOF\nChecks for particular id3v2 frames in a set of files.\nUsage:\n    $0 &lt;option&gt; &lt;FRAME&gt; files...\n\nOptions:\n    -m | --missing  Show files that are missing the frame\n    -h | --has      Show files that have the frame\n    -s | --show     Show the contents of the frame\n    -a | --all      Show all the frames\n\nFor example, to find mp3's with no album art:\n    $0 -m APIC *.mp3\n\nSome sample frames:\n    APIC    - Cover art\n    TIT2    - Song name\n    TPE1    - Artist\n    TALB    - Album\n    TCON    - Genre\nEOF\n}\n\nfunction FilesWithoutFrame() {\n    FRAME=$1\n    shift\n\n    for file in $@ ; do\n        id3v2 -R &quot;$file&quot; | egrep &quot;^$FRAME &quot; 2&gt;&amp;1 &gt; \/dev\/null\n        if &#x5B; $? -gt 0 ]; then\n            # $file is missing $FRAME\n            echo $file\n        fi\n    done\n}\n\nfunction FilesWithFrame() {\n    FRAME=$1\n    shift\n\n    for file in $@ ; do\n        id3v2 -R &quot;$file&quot; | egrep &quot;^$FRAME &quot; 2&gt;&amp;1&gt; \/dev\/null\n        if &#x5B; $? -eq 0 ]; then\n            # $file has $FRAME\n            echo $file\n        fi\n    done\n}\n\nfunction ShowFrameContents() {\n    FRAME=$1\n    shift\n\n    for file in $@ ; do\n        id3v2 -R &quot;$file&quot; | egrep &quot;^$FRAME &quot;\n    done\n}\n\nfunction ShowAll() {\n    for file in $@; do\n        echo\n        echo\n        id3v2 -R &quot;$file&quot;\n    done\n}\n\n\n################################################################################\n# main()\n################################################################################\n\nif &#x5B; $# -lt 2 ]; then\n    usage\n    exit 1\nfi\n\nIFS_orig=$IFS\nIFS='\n'\n\ncase $1 in\n    -m | --missing)\n        shift\n        FilesWithoutFrame $@\n        ;;\n    -h | --has)\n        shift\n        FilesWithFrame $@\n        ;;\n    -s | --show)\n        shift\n        ShowFrameContents $@\n        ;;\n    -a | --all)\n        shift\n        ShowAll $@\n        ;;\n    *)\n        usage\n        exit 1\n        ;;\nesac\n\nIFS=$IFS_orig\n<\/pre>","protected":false},"excerpt":{"rendered":"<p>This is a very simple script. See the usage at the top of the script starting on line 28. #!\/bin\/bash # Author: Gabriel Burca (gburca dash mp3 at ebixio dot com) # Version: 1.0 # # Copyright (C) 2006-2009 Gabriel Burca (gburca dash mp3 at ebixio dot com) # # This program is free software; [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[5,12,18,19,17],"class_list":["post-50","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-bash","tag-linux","tag-photo","tag-pictures","tag-script"],"_links":{"self":[{"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/posts\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/comments?post=50"}],"version-history":[{"count":0,"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/posts\/50\/revisions"}],"wp:attachment":[{"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/media?parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/categories?post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/tags?post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}