File tree Expand file tree Collapse file tree 6 files changed +34
-21
lines changed
Expand file tree Collapse file tree 6 files changed +34
-21
lines changed Original file line number Diff line number Diff line change 44__pycache__
55output
66themes
7- downloaded /
7+ downloaded /
8+
9+ # FFMPEG dependencies
10+ ffmpeg.exe
11+ ffplay.exe
12+ ffprobe.exe
Original file line number Diff line number Diff line change 1+ # Lesson 1
2+
3+ Required dependencies for this lesson:
4+ Python dependencies: fbchat, win10toast(extra for windows)
5+
Original file line number Diff line number Diff line change 1+ # Lesson 2
2+
3+ Required dependencies for this lesson:
4+ Python dependencies: beautifulsoup4, youtube_dl
5+ External dependencies: ffmpeg executables
Original file line number Diff line number Diff line change 11import os
22import glob
33import 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 )
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ name = "pypi"
77fbchat = " *"
88"win10toast" = " *"
99"beautifulsoup4" = " *"
10- pytube = " *"
1110youtube-dl = " *"
1211
1312[dev-packages ]
You can’t perform that action at this time.
0 commit comments