summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackson Taylor <jackson@jacksontaylor.xyz>2021-11-10 13:38:02 -0500
committerJackson Taylor <jackson@jacksontaylor.xyz>2022-04-05 16:51:58 -0400
commitd239f21654d35484e311dfc38f47ed398054e619 (patch)
tree7904bb3dc58526ad11dc945842549ebb1ab9342f
parent1dbcccdf106c29da9a53a22c209733dfd479b1ad (diff)
pep8 fixes
-rwxr-xr-xjamos23
1 files changed, 17 insertions, 6 deletions
diff --git a/jamos b/jamos
index 0280ea6..15209b8 100755
--- a/jamos
+++ b/jamos
@@ -24,8 +24,10 @@ AUDIO_OPTIONS = {
'cookiefile': 'cookies.txt',
'outtmpl': MUSIC_DIRECTORY + '%(title)s.%(ext)s',
'postprocessors': [
- {'key': 'FFmpegExtractAudio','preferredcodec': 'mp3',
- 'preferredquality': '192',
+ {
+ 'key': 'FFmpegExtractAudio',
+ 'preferredcodec': 'mp3',
+ 'preferredquality': '192',
},
{'key': 'FFmpegMetadata'},
],
@@ -57,11 +59,13 @@ def write_metadata_to_song_file(file, metadata):
f.save()
+
def format_youtube_date(date):
fmt = "%Y%m%d"
d = datetime.datetime.strptime(date, fmt)
return d.year
+
def sort_stuff():
# read in all the files and directories to move
get_all_files()
@@ -117,11 +121,19 @@ def get_directories():
def move_file(file, metadata):
- p = os.path.join(MUSIC_DIRECTORY, metadata['artist'].replace(' ', '_').lower(), metadata['album'].replace(' ', '_').lower())
- Path(p).mkdir( parents=True, exist_ok=True )
+ p = os.path.join(
+ MUSIC_DIRECTORY,
+ metadata['artist'].replace(' ', '_').lower(),
+ metadata['album'].replace(' ', '_').lower())
- os.rename(file, os.path.join(p, metadata['artist'].replace(' ', '_').lower() + '_' + metadata['title'].replace(' ', '_').lower() + '.mp3'))
+ Path(p).mkdir(parents=True, exist_ok=True)
+ os.rename(
+ file,
+ os.path.join(
+ p,
+ metadata['artist'].replace(' ', '_').lower() +
+ '_' + metadata['title'].replace(' ', '_').lower() + '.mp3'))
if __name__ == "__main__":
@@ -139,4 +151,3 @@ if __name__ == "__main__":
json_data = json.load(json_file)
write_metadata_to_song_file(f, json_data)
move_file(f, json_data)
-