Skip to content

Instantly share code, notes, and snippets.

@mativs
Last active December 26, 2015 10:28
Show Gist options
  • Save mativs/7136573 to your computer and use it in GitHub Desktop.
Save mativs/7136573 to your computer and use it in GitHub Desktop.
Clean Id3 v1 Wrong Tag. Must run it on music root folder, and must run it at least two times. http://savvyadmin.com/rhythmbox-id3-tag-issues/
#!/usr/bin/env python
# truncates a file after a TAG pattern is found
# use at your own risk!
#
# for a bunch of files, you may want to:
# find somewhere/ -iname "*.mp3" -exec tag-wipe.py {} \;
#
# ulysses - ulysses@naosei.net
import sys
def main ():
name = sys.argv[1]
input = file(name, "r+")
offset = -1024
input.seek(offset, 2)
pos = input.tell()
while (True):
tag = input.read(3)
if (tag == "TAG"):
print(name + ": found the damn tag - truncating at 0x%08x") % pos
input.truncate(pos)
input.close()
sys.exit()
else:
if (offset >= -2):
print(name + ": no damn tag found")
input.close()
sys.exit()
else:
offset += 1
input.seek(offset, 2)
if __name__ == "__main__":
main()
find . -type f -name *.mp3 -exec eyeD3 --remove-v1 '{}' 1>/dev/null \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment