-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored util functions, started argparse support
- Loading branch information
1 parent
5fb4598
commit 4b38d1f
Showing
5 changed files
with
92 additions
and
449 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import argparse | ||
import time | ||
import json | ||
import os | ||
import sys | ||
from logging import DEBUG, ERROR | ||
from pathlib import Path, PurePath | ||
import spotipy | ||
from spotipy.oauth2 import SpotifyClientCredentials | ||
|
||
|
||
def spotify_translator(): | ||
parser = argparse.ArgumentParser( | ||
prog="spotify_translator", description="Translate Spotify songs." | ||
) | ||
parser.add_argument( | ||
"-l", | ||
"--url", | ||
action="store", | ||
help="Spotify Playlist link URL", | ||
type=str, | ||
nargs="+", | ||
required=False, # this has to be set to false to prevent useless prompt for url when all user wants is the script version | ||
) | ||
parser.add_argument( | ||
"-o", | ||
"--output", | ||
type=str, | ||
action="store", | ||
help="Specify download directory for transcriptions, translations, and mp3.", | ||
required=False, | ||
) | ||
parser.add_argument( | ||
"-d", | ||
"--download", | ||
action="store_true", | ||
help="Download mp3 using youtube-dl", | ||
required=False, | ||
default=False, | ||
) | ||
|
||
# url = input("Enter track/playlist/album URL: ") | ||
# songs = [] | ||
|
||
# try: | ||
# if url.find("track") != -1: | ||
# songs = spotify_track(url) | ||
# if url.find("playlist") != -1: | ||
# songs = spotify_playlist(url) | ||
# if url.find("album") != -1: | ||
# songs = spotify_album(url) | ||
# except ValueError: | ||
# raise ValueError("Invalid URL") | ||
|
||
# for song in songs: | ||
# download_one(song) | ||
# print(f"\nTranslating track: {song['name']}\n") | ||
# results = translate(song["name"], "Korean") | ||
# print(f"Transcription:\n{results[0]}\n") | ||
# print(f"Translation:\n{results[1]}\n") | ||
|
||
|
||
if __name__ == "__main__": | ||
spotify_translator() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.