File: test_picture

package info (click to toggle)
mp3fs 1.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, trixie
  • size: 888 kB
  • sloc: cpp: 1,884; ansic: 564; sh: 298; makefile: 82
file content (15 lines) | stat: -rwxr-xr-x 392 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

. "${BASH_SOURCE%/*}/funcs.sh"

hash_image() {
    python3 <<END
import hashlib, mutagen
file = mutagen.File('$1')
artwork = file.tags['APIC:'].data
print(hashlib.sha1(artwork).hexdigest())
END
}

check_equal "$(hash_image "$DIRNAME/obama.mp3")" 794865299f4fac10ba5719b203f0c71b5b524e95
check_equal "$(hash_image "$DIRNAME/ra[ven].mp3")" 5cd44d9e64c90d137ed3614213e309afec060dbc