def test_pattern_5(self):
	  	pattern = decoder.decode_file('fixtures/pattern_5.splice')

		expected_pattern = "Saved with HW Version: 0.708-alpha\n" + \
							"Tempo: 999\n" + \
							"(1) Kick    |x---|----|x---|----|\n" + \
							"(2) HiHat   |x-x-|x-x-|x-x-|x-x-|"

		#print expected_pattern
	  	self.assertEqual(pattern, expected_pattern)
	def test_pattern_4(self):
	  	pattern = decoder.decode_file('fixtures/pattern_4.splice')

		expected_pattern = "Saved with HW Version: 0.909\n" + \
							"Tempo: 240\n" + \
							"(0) SubKick       |----|----|----|----|\n" + \
							"(1) Kick          |x---|----|x---|----|\n" + \
							"(99) Maracas      |x-x-|x-x-|x-x-|x-x-|\n" + \
							"(255) Low Conga   |----|x---|----|x---|"

		#print expected_pattern
	  	self.assertEqual(pattern, expected_pattern)
	def test_pattern_2(self):
	  	pattern = decoder.decode_file('fixtures/pattern_2.splice')

		expected_pattern = "Saved with HW Version: 0.808-alpha\n" + \
						   "Tempo: 98.4\n" + \
						   "(0) kick    |x---|----|x---|----|\n" + \
						   "(1) snare   |----|x---|----|x---|\n" + \
						   "(3) hh-open |--x-|--x-|x-x-|--x-|\n" + \
						   "(5) cowbell |----|----|x---|----|"

		#print expected_pattern
	  	self.assertEqual(pattern, expected_pattern)
	def test_pattern_3(self):
	  	pattern = decoder.decode_file('fixtures/pattern_3.splice')

		expected_pattern = "Saved with HW Version: 0.808-alpha\n" + \
						   "Tempo: 118\n" + \
							"(40) kick    |x---|----|x---|----|\n" + \
							"(1) clap     |----|x---|----|x---|\n" + \
							"(3) hh-open  |--x-|--x-|x-x-|--x-|\n" + \
							"(5) low-tom  |----|---x|----|----|\n" + \
							"(12) mid-tom |----|----|x---|----|\n" + \
							"(9) hi-tom   |----|----|-x--|----|"

		#print expected_pattern
	  	self.assertEqual(pattern, expected_pattern)
Beispiel #5
0



    return lines


if __name__ == "__main__":

    print sys.argv[1]
    if len(sys.argv) >= 2:
        path = sys.argv[1]
    else:
        print "Please supply the path of the DJI Flight Log .txt file to convert"

    if len(sys.argv) >= 3:
        outpath = sys.argv[3]
    else:
        outpath = os.path.dirname(path) + os.sep + os.path.basename(path) + ".csv"

    print "Loading %s" % path
    frames = decoder.decode_file(path)

    print "Decoding file"
    lines = frames_to_lines(frames)


    print "Writing %d lines to %s" % (len(lines), outpath)
    with open(outpath, "w") as csv:
        csv.writelines([line + "\n" for line in lines])
    print "Done"
Beispiel #6
0
def play():
	decoder.decode_file(video_path)
Beispiel #7
0
from generator import generate
from encoder import encrypt_file
from decoder import decode_file
from input import toBinary
from input import toData
import math


def isTrue(a, b):
    for i in range(len(a)):
        if (a[i] != b[i]):
            print(i)
            return False
    return True


if __name__ == "__main__":
    filename = "input.jpg"
    binary = toBinary(filename)
    binaryEncrypt = encrypt_file(binary)
    binaryDecode = decode_file(binaryEncrypt)
    toData(binaryDecode)