File: check_binary_copyright.py

package info (click to toggle)
psd-tools 1.10.9%2Bdfsg.1-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 8,088 kB
  • sloc: python: 14,293; makefile: 223; sh: 17
file content (20 lines) | stat: -rwxr-xr-x 658 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python3

import os

path = os.walk(".")

for root, directories, files in path:
    for i in files:
        if (i.endswith(".psd") or i.endswith(".psb") or i.endswith(".dat")):
            filename1 = os.path.join(root, i)
            with open(filename1, "rb") as f:
                s = f.read()
                i1 = s.find(b'Copyright')
                if (i1 >= 0):
                    a1 = b''
                    while (s[i1:i1+1] != b'\0'):
                        a1 = a1 + s[i1:i1+1]
                        i1 = i1 + 1
                    copyrightstr = a1.decode("utf-8")
                    print("%s - %s"%(filename1,copyrightstr))