|
@@ -1,3 +1,5 @@
|
|
|
+#!/usr/bin/env python3
|
|
|
+
|
|
|
from bs4 import BeautifulSoup
|
|
|
from gizmo_funtions import gizmo_stdout
|
|
|
from gizmo_transforming_functions import duration_to_string, convert_multiple_key_signetures
|
|
@@ -16,9 +18,9 @@ def how_many_alter_signs(value):
|
|
|
|
|
|
# Reading the data inside the xml
|
|
|
# file to a variable under the name
|
|
|
-# data
|
|
|
-with open('../tests/motiv.xml', 'r') as f:
|
|
|
- data = f.read()
|
|
|
+# data from standard input
|
|
|
+import sys
|
|
|
+data = sys.stdin.read()
|
|
|
|
|
|
# Passing the stored data inside
|
|
|
# the beautifulsoup parser, storing
|
|
@@ -36,7 +38,7 @@ for note in notes:
|
|
|
duration = float(note.find('duration').text) / float(BS_data.find('divisions').text)
|
|
|
duration = duration_to_string(duration)
|
|
|
pitch = note.find('pitch')
|
|
|
- if pitch == None: # cut out pauses does not work yet
|
|
|
+ if pitch == None: # TODO: cutting out pauses does not work yet
|
|
|
next
|
|
|
else:
|
|
|
new_note = duration + ',' + note.find('step').text
|
|
@@ -45,4 +47,6 @@ for note in notes:
|
|
|
new_note += note.find('octave').text
|
|
|
new_note = convert_multiple_key_signetures(new_note)
|
|
|
working_list.append(new_note)
|
|
|
+
|
|
|
+# print to standard output
|
|
|
gizmo_stdout(working_list)
|