Skip to content

Commit 62824ae

Browse files
authored
Merge pull request #118 from nulib/0.3.0.a0
0.3.0.a0
2 parents a04dbce + e8e6b09 commit 62824ae

File tree

18 files changed

+346
-11
lines changed

18 files changed

+346
-11
lines changed
File renamed without changes.
File renamed without changes.

nulrdcscripts/tools/oyez/runfile.py renamed to nulrdcscripts/tools/EmbedExtract/runfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
import subprocess
3-
from nulrdcscripts.tools.oyez.setupparser import args
3+
from nulrdcscripts.tools.EmbedExtract.setupparser import args
44

55

66
def main():
File renamed without changes.
File renamed without changes.

nulrdcscripts/tools/checksoftware/__init__,py

Whitespace-only changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import subprocess
2+
3+
4+
def main(software):
5+
"""This will check if the software is installed on the computer in use"""
6+
dashVersion = ["ffprobe", "ffplay", "ffmpeg", "qcli"]
7+
doubleDashVersion = ["sox", "mediaconch", "bwfmetaedit"]
8+
9+
if software in dashVersion:
10+
versionCommand = "-version"
11+
elif software in doubleDashVersion:
12+
versionCommand = "--version"
13+
else:
14+
print("This software is not included in this checking tool")
15+
16+
try:
17+
command = software + " " + versionCommand
18+
subprocess.run(command)
19+
except:
20+
raise Exception(software, "cannot be found. Check your path variable.")

nulrdcscripts/tools/md5generation/__init__.py

Whitespace-only changes.
Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
import hashlib
1+
from nulrdcscripts.tools.md5generation.params import args
22
import os
33
import sys
4-
from Arguments.Arguments import args
5-
6-
"""
7-
Credit: IFI Scripts
8-
"""
9-
4+
import hashlib
105

6+
filename = os.path.abspath(args.input_path)
7+
basefilename = os.path.basename(filename)
8+
basefilename = basefilename.replace(".mkv","")
9+
basedir = os.path.dirname(filename)
10+
md5file = basefilename + ".md5"
11+
md5output = os.path.join(basedir + "/",md5file)
1112
def hashlib_md5(filename):
13+
"""
14+
Uses hashlib to return an MD5 checksum of an input filename
15+
Credit: IFI scripts
16+
"""
1217
read_size = 0
1318
last_percent_done = 0
1419
chksm = hashlib.md5()
1520
total_size = os.path.getsize(filename)
1621
with open(filename, "rb") as f:
1722
while True:
23+
# 2**20 is for reading the file in 1 MiB chunks
1824
buf = f.read(2**20)
1925
if not buf:
2026
break
@@ -27,3 +33,13 @@ def hashlib_md5(filename):
2733
last_percent_done = percent_done
2834
md5_output = chksm.hexdigest()
2935
return md5_output
36+
37+
38+
def main():
39+
mkvHash = hashlib_md5(filename)
40+
with open(md5output, "w", newline="\n") as f:
41+
print(mkvHash, "*" + basefilename, file=f)
42+
43+
44+
if __name__ == "__main__":
45+
main()
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env python3
2+
3+
import argparse
4+
5+
parser = argparse.ArgumentParser()
6+
7+
parser.add_argument(
8+
"--input",
9+
"-i",
10+
action="store",
11+
dest="input_path",
12+
type=str,
13+
help="full path to input folder",
14+
)
15+
16+
args = parser.parse_args()

0 commit comments

Comments
 (0)