v1.0
This commit is contained in:
parent
d1a8058515
commit
bd22110fce
@ -50,18 +50,21 @@ def push_ogg(ogg_file):
|
|||||||
icecast.open()
|
icecast.open()
|
||||||
with open(ogg_file, 'rb') as ogg:
|
with open(ogg_file, 'rb') as ogg:
|
||||||
total = 0
|
total = 0
|
||||||
# print("- Reading 4096 bytes")
|
if args.debug:
|
||||||
|
print("- Reading 4096 bytes")
|
||||||
new_buff = ogg.read(4096)
|
new_buff = ogg.read(4096)
|
||||||
while True:
|
while True:
|
||||||
cur_buff = new_buff
|
cur_buff = new_buff
|
||||||
# print("- Reading next 4096 bytes")
|
if args.debug:
|
||||||
|
print("- Reading next 4096 bytes")
|
||||||
new_buff = ogg.read(4096)
|
new_buff = ogg.read(4096)
|
||||||
total += len(cur_buff)
|
total += len(cur_buff)
|
||||||
if len(cur_buff) == 0:
|
if len(cur_buff) == 0:
|
||||||
print(" - Buffer is empty: EOF")
|
print(" - Buffer is empty: EOF")
|
||||||
print(" - Sent: {} bytes".format(total))
|
print(" - Sent: {} bytes".format(total))
|
||||||
break
|
break
|
||||||
# print("- Sending 4096 bytes")
|
if args.debug:
|
||||||
|
print("- Sending 4096 bytes")
|
||||||
icecast.send(cur_buff)
|
icecast.send(cur_buff)
|
||||||
icecast.sync()
|
icecast.sync()
|
||||||
|
|
||||||
@ -84,7 +87,8 @@ def main():
|
|||||||
oord = ord(letter)
|
oord = ord(letter)
|
||||||
freq, duration = notes_table(oord)
|
freq, duration = notes_table(oord)
|
||||||
if oord not in args.exclude:
|
if oord not in args.exclude:
|
||||||
# print("Caractère: {} | Ord: {} | Fréquence: {} | Durée: {}".format(letter, oord, freq, duration))
|
if args.debug:
|
||||||
|
print("Caractère: {} | Ord: {} | Fréquence: {} | Durée: {}".format(letter, oord, freq, duration))
|
||||||
wave_file.writeframes(sine_wave(frequency=freq, duration=duration))
|
wave_file.writeframes(sine_wave(frequency=freq, duration=duration))
|
||||||
result = convert2ogg(wav_output, ogg_output)
|
result = convert2ogg(wav_output, ogg_output)
|
||||||
if result == 0:
|
if result == 0:
|
||||||
@ -109,5 +113,6 @@ if __name__ == '__main__':
|
|||||||
parser.add_argument('--password', help="Mot de passe (requis)", type=str, required=True)
|
parser.add_argument('--password', help="Mot de passe (requis)", type=str, required=True)
|
||||||
parser.add_argument('--mount', help="Point de montage Icecast2 (requis)", type=str, required=True)
|
parser.add_argument('--mount', help="Point de montage Icecast2 (requis)", type=str, required=True)
|
||||||
parser.add_argument('--protocol', help="Protocol à utiliser (défaut: http)", type=str, default='http')
|
parser.add_argument('--protocol', help="Protocol à utiliser (défaut: http)", type=str, default='http')
|
||||||
|
parser.add_argument('--debug', help="Affiche l'activité (défaut: False)", type=bool, default=False)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user