File hash
This commit is contained in:
parent
a35f9d05d4
commit
aa7c0fb106
@ -1,3 +1,4 @@
|
||||
import configparser
|
||||
import os
|
||||
import json
|
||||
import sys
|
||||
@ -19,8 +20,22 @@ class AudibleBook(object):
|
||||
# getChapters() returns chapter metadata for a given filepath.
|
||||
def getChapters(self):
|
||||
return self.chapters
|
||||
|
||||
filePath=''
|
||||
|
||||
# getTitle() returns audiobook title.
|
||||
def getTitle(self):
|
||||
return self.getMetadata()['title']
|
||||
|
||||
# getHash() returns the hash of a given file.
|
||||
def getHash(filePath):
|
||||
with open(filePath, 'rb') as f:
|
||||
f.seek(653)
|
||||
data = f.read(20)
|
||||
f.close()
|
||||
return data.hex()
|
||||
|
||||
configString = '[Settings]\n' + open('./settings.conf').read()
|
||||
configParser = configparser.RawConfigParser()
|
||||
configParser.read_string(configString)
|
||||
book = AudibleBook(sys.argv[1])
|
||||
|
||||
for c in book.getChapters():
|
||||
@ -31,4 +46,8 @@ for c in book.getChapters():
|
||||
#os.system('ffmpeg -i {} -acodec copy -vcodec copy -ss {} -t {} OUTFILE-{}.m4a'.format(filePath, start, end, title))
|
||||
|
||||
|
||||
print(book.getMetadata())
|
||||
print(book.getTitle())
|
||||
print(configParser.get('Settings', 'activationBytes'))
|
||||
|
||||
|
||||
print(getHash(sys.argv[1]))
|
||||
|
Loading…
x
Reference in New Issue
Block a user