spookyuser
commited on
Commit
·
4c4704f
1
Parent(s):
f57d4e8
Fix error where os was changed to output for too long
Browse files- .vscode/launch.json +16 -0
- app.py +3 -6
.vscode/launch.json
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
// Use IntelliSense to learn about possible attributes.
|
3 |
+
// Hover to view descriptions of existing attributes.
|
4 |
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
5 |
+
"version": "0.2.0",
|
6 |
+
"configurations": [
|
7 |
+
{
|
8 |
+
"name": "Python: Current File",
|
9 |
+
"type": "python",
|
10 |
+
"request": "launch",
|
11 |
+
"program": "${file}",
|
12 |
+
"console": "integratedTerminal",
|
13 |
+
"justMyCode": true
|
14 |
+
}
|
15 |
+
]
|
16 |
+
}
|
app.py
CHANGED
@@ -31,9 +31,7 @@ class SpotifyApi:
|
|
31 |
f.write(
|
32 |
f"{os.environ['SPOTIFY_USERNAME']} {os.environ['SPOTIFY_PASSWORD']}"
|
33 |
)
|
34 |
-
|
35 |
-
else:
|
36 |
-
pass
|
37 |
|
38 |
def download_episode(self, episode_url) -> str:
|
39 |
# Generate a 8 character random string
|
@@ -48,7 +46,7 @@ class SpotifyApi:
|
|
48 |
def get_final_mp3(self) -> str | None:
|
49 |
# Look in all the subdirectories of spotify for the mp3 file
|
50 |
for root, dirs, files in os.walk(
|
51 |
-
Path(self.spotify_directory / self.foldername)
|
52 |
):
|
53 |
for file in files:
|
54 |
if file.endswith(".mp3"):
|
@@ -91,7 +89,6 @@ def add_static_image_to_audio(image, audio_input) -> str:
|
|
91 |
foldername = str(uuid.uuid4())[:8]
|
92 |
vid_output_dir = Path(output_dir / foldername)
|
93 |
vid_output_dir.mkdir(exist_ok=True, parents=True)
|
94 |
-
os.chdir(vid_output_dir)
|
95 |
audio_clip = AudioFileClip(audio_input.path)
|
96 |
# Make the audio clip start at the specified time and set the duration to the specified duration
|
97 |
audio_clip = audio_clip.subclip(
|
@@ -103,7 +100,7 @@ def add_static_image_to_audio(image, audio_input) -> str:
|
|
103 |
audio_clip.duration
|
104 |
) # The duration here is the cut duration from above
|
105 |
video_clip.fps = 1
|
106 |
-
path = Path("output.mp4").as_posix()
|
107 |
video_clip.write_videofile(path)
|
108 |
return path
|
109 |
|
|
|
31 |
f.write(
|
32 |
f"{os.environ['SPOTIFY_USERNAME']} {os.environ['SPOTIFY_PASSWORD']}"
|
33 |
)
|
34 |
+
subprocess.call(["spodcast", "-l", "spotify.rc"])
|
|
|
|
|
35 |
|
36 |
def download_episode(self, episode_url) -> str:
|
37 |
# Generate a 8 character random string
|
|
|
46 |
def get_final_mp3(self) -> str | None:
|
47 |
# Look in all the subdirectories of spotify for the mp3 file
|
48 |
for root, dirs, files in os.walk(
|
49 |
+
Path(self.spotify_directory / self.foldername).resolve()
|
50 |
):
|
51 |
for file in files:
|
52 |
if file.endswith(".mp3"):
|
|
|
89 |
foldername = str(uuid.uuid4())[:8]
|
90 |
vid_output_dir = Path(output_dir / foldername)
|
91 |
vid_output_dir.mkdir(exist_ok=True, parents=True)
|
|
|
92 |
audio_clip = AudioFileClip(audio_input.path)
|
93 |
# Make the audio clip start at the specified time and set the duration to the specified duration
|
94 |
audio_clip = audio_clip.subclip(
|
|
|
100 |
audio_clip.duration
|
101 |
) # The duration here is the cut duration from above
|
102 |
video_clip.fps = 1
|
103 |
+
path = Path(vid_output_dir / "output.mp4").as_posix()
|
104 |
video_clip.write_videofile(path)
|
105 |
return path
|
106 |
|