Skip to content

Commit

Permalink
Added persistent artist and updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
beveradb committed Dec 18, 2023
1 parent ff90b72 commit 10554f1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ options:
--use_coreml Optional: use Apple Silicon GPU with CoreML for separation (default: False). Example: --use_coreml=true
--denoise DENOISE Optional: enable or disable denoising during separation (default: True). Example: --denoise=False
--normalize NORMALIZE Optional: enable or disable normalization during separation (default: True). Example: --normalize=False
--no_track_subfolders Optional:do NOT create a named subfolder for each track. Example: --no_track_subfolders
--no_track_subfolders Optional: do NOT create a named subfolder for each track. Example: --no_track_subfolders
--intro_background_color INTRO_BACKGROUND_COLOR Optional: Background color for intro video (default: black). Example: --intro_background_color=#123456
--intro_background_image INTRO_BACKGROUND_IMAGE Optional: Path to background image for intro video. Overrides background color if provided. Example: --intro_background_image=path/to/image.jpg
--intro_font INTRO_FONT Optional: Font file for intro video (default: Avenir-Next-Bold). Example: --intro_font=AvenirNext-Bold.ttf
--intro_artist_color INTRO_ARTIST_COLOR Optional: Font color for intro video artist text (default: #ff7acc). Example: --intro_artist_color=#123456
--intro_title_color INTRO_TITLE_COLOR Optional: Font color for intro video title text (default: #ffdf6b). Example: --intro_title_color=#123456
```
Expand Down
8 changes: 5 additions & 3 deletions karaoke_prep/karaoke_prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def extract_metadata_from_url(self):
with yt_dlp.YoutubeDL({"quiet": True}) as ydl:
info = ydl.extract_info(self.url, download=False)
self.artist, self.title = self.parse_metadata(info)
if self.persistent_artist:
self.artist = self.persistent_artist
if self.artist and self.title:
self.logger.info(f"Extracted artist: {self.artist}, title: {self.title}")
else:
Expand Down Expand Up @@ -421,7 +423,6 @@ def process_playlist(self):
Processes all videos in a YouTube playlist.
"""
self.logger.debug(f"Querying playlist metadata from YouTube, assuming consistent artist {self.artist}...")
persistent_artist = self.artist
with yt_dlp.YoutubeDL({"quiet": True}) as ydl:
result = ydl.extract_info(self.url, download=False)
if "entries" in result:
Expand All @@ -432,13 +433,14 @@ def process_playlist(self):
self.logger.info(f"Processing video: {video_url}")
self.url = video_url
track_results.append(self.prep_single_track())
self.artist = persistent_artist
self.artist = self.persistent_artist
self.title = None
return track_results

def process(self):
if self.is_playlist_url():
self.logger.info(f"Provided YouTube URL is a playlist, beginning batch operation")
self.persistent_artist = self.artist
self.logger.info(f"Provided YouTube URL is a playlist, beginning batch operation with persistent artist: {self.persistent_artist}")
return self.process_playlist()
else:
self.logger.info(f"Provided YouTube URL is NOT a playlist, processing single track")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "karaoke-prep"
version = "0.4.5"
version = "0.4.6"
description = "Prepare for karaoke video creation, by downloading audio and lyrics for a specified song or youtube playlist and separatung audio stems."
authors = ["Andrew Beveridge <andrew@beveridge.uk>"]
license = "MIT"
Expand Down

0 comments on commit 10554f1

Please sign in to comment.