jncraton commited on
Commit
1d342b4
·
1 Parent(s): fcee91b

Adjust logging

Browse files
Files changed (1) hide show
  1. prune-nonfree.py +6 -0
prune-nonfree.py CHANGED
@@ -17,6 +17,8 @@ def get_field(root, field):
17
 
18
 
19
  def prune():
 
 
20
  global count
21
 
22
  for filename in list(Path(".").rglob("*.xml")):
@@ -38,7 +40,11 @@ def prune():
38
  rights = get_field(root, "DC.Rights")
39
 
40
  if rights and "public domain" not in rights.lower():
 
41
  print(f"Removed {filename} due to copyright: {rights}")
 
 
 
42
 
43
 
44
  if __name__ == "__main__":
 
17
 
18
 
19
  def prune():
20
+ log = open("removed.txt", "a")
21
+
22
  global count
23
 
24
  for filename in list(Path(".").rglob("*.xml")):
 
40
  rights = get_field(root, "DC.Rights")
41
 
42
  if rights and "public domain" not in rights.lower():
43
+ os.unlink(filename)
44
  print(f"Removed {filename} due to copyright: {rights}")
45
+ log.write(f"Removed {filename} due to copyright\n")
46
+
47
+ log.close()
48
 
49
 
50
  if __name__ == "__main__":