Skip to content

Commit e04f39b

Browse files
committed
Added readme to each lessons adn edited play music to target wanted os
1 parent 9c6f06e commit e04f39b

File tree

6 files changed

+34
-21
lines changed

6 files changed

+34
-21
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ ve
44
__pycache__
55
output
66
themes
7-
downloaded/
7+
downloaded/
8+
9+
# FFMPEG dependencies
10+
ffmpeg.exe
11+
ffplay.exe
12+
ffprobe.exe

Lesson1/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Lesson 1
2+
3+
Required dependencies for this lesson:
4+
Python dependencies: fbchat, win10toast(extra for windows)
5+

Lesson2/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Lesson 2
2+
3+
Required dependencies for this lesson:
4+
Python dependencies: beautifulsoup4, youtube_dl
5+
External dependencies: ffmpeg executables

Lesson2/play_music.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
import os
22
import glob
33
import time
4-
from simpleaudio import WaveObject
4+
from sys import platform
55

6-
for file in glob.glob('./downloaded/*.mp4'): #get all mp4 files in downloaded/
7-
print(file)
8-
os.system(f'./ffmpeg -i "{file}" "{file[:-4]}.wav" ') # call function to convert file type
9-
os.remove(file)
10-
11-
for file in glob.glob('./downloaded/*.wav'): #play all music in file
12-
wave = WaveObject.from_wave_file(file)
13-
play = wave.play()
14-
play.wait_done()
6+
if platform == "linux" or platform == "linux2"or platform == "darwin":
7+
try:
8+
from simpleaudio import WaveObject
9+
except ImportError:
10+
exit(1)
11+
for file in glob.glob('./downloaded/*.wav'): # play all wav music in file
12+
wave = WaveObject.from_wave_file(file)
13+
play = wave.play()
14+
play.wait_done()
15+
elif platform == "win32" or platform == "cygwin":
16+
try:
17+
import winsound
18+
except ImportError:
19+
exit(1)
20+
for file in glob.glob('./downloaded/*.wav'):
21+
winsound.PlaySound(file, winsound.SND_FILENAME)

Pipfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ name = "pypi"
77
fbchat = "*"
88
"win10toast" = "*"
99
"beautifulsoup4" = "*"
10-
pytube = "*"
1110
youtube-dl = "*"
1211

1312
[dev-packages]

Pipfile.lock

Lines changed: 1 addition & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)