summaryrefslogtreecommitdiff
path: root/jamos
diff options
context:
space:
mode:
authorJackson Taylor <jackson@jacksontaylor.xyz>2021-11-15 15:37:26 -0500
committerJackson Taylor <jackson@jacksontaylor.xyz>2022-04-05 16:52:09 -0400
commit41b5b868a748375648f4d7eb1441f0cb7a817790 (patch)
tree7c0123114510cb2eb836484e0931a0df3b6d5c57 /jamos
parentb37a3ca30ff41e41be2d76fd7de1f08a6984c5e2 (diff)
Alphabetize functions
Diffstat (limited to 'jamos')
-rwxr-xr-xjamos46
1 files changed, 23 insertions, 23 deletions
diff --git a/jamos b/jamos
index 74a019f..b3b04c7 100755
--- a/jamos
+++ b/jamos
@@ -35,11 +35,6 @@ AUDIO_OPTIONS = {
ytdl = youtube_dl.YoutubeDL(AUDIO_OPTIONS)
-# TODO: Make this better with argparse
-def get_playlist_url():
- return sys.argv[1]
-
-
def download_song(song_url):
"""
Download a song using youtube url and song title
@@ -47,17 +42,6 @@ def download_song(song_url):
return ytdl.extract_info(song_url, download=True)
-def write_metadata_to_song_file(file, metadata):
- f = music_tag.load_file(file)
-
- f['name'] = metadata['title']
- f['artist'] = metadata['artist']
- f['album'] = metadata['album']
- f['year'] = format_youtube_date(metadata['release_date'])
-
- f.save()
-
-
def format_youtube_date(date):
default = "Unknown Year"
try:
@@ -91,6 +75,22 @@ def get_directories():
DIRECTORIES.append(f)
+# TODO: Make this better with argparse
+def get_playlist_url():
+ return sys.argv[1]
+
+
+def get_video_urls_in_playlist(playlist_url):
+ videos = ytdl.extract_info(playlist_url, download=False)
+
+ urls = []
+ for vid in videos['entries']:
+ if 'webpage_url' in vid.keys() and vid['webpage_url'] is not None:
+ urls.append(vid['webpage_url'])
+
+ return urls
+
+
def move_file(file, metadata):
artist = 'unknownartist'
album = 'unknownalbum'
@@ -122,15 +122,15 @@ def move_file(file, metadata):
os.path.join(final_directory, artist + '_' + title + '.mp3'))
-def get_video_urls_in_playlist(playlist_url):
- videos = ytdl.extract_info(playlist_url, download=False)
+def write_metadata_to_song_file(file, metadata):
+ f = music_tag.load_file(file)
- urls = []
- for vid in videos['entries']:
- if 'webpage_url' in vid.keys() and vid['webpage_url'] is not None:
- urls.append(vid['webpage_url'])
+ f['name'] = metadata['title']
+ f['artist'] = metadata['artist']
+ f['album'] = metadata['album']
+ f['year'] = format_youtube_date(metadata['release_date'])
- return urls
+ f.save()
if __name__ == "__main__":