Created
February 23, 2017 07:51
-
-
Save NeuroWinter/5d346811a113a41888242a0acc12e903 to your computer and use it in GitHub Desktop.
beets to WM
This file contains hidden or 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
import os | |
import json | |
def getArtist(releaseFile): | |
with open(dirpath + '/' + file) as data_file: | |
artist = str(data['group']['musicInfo']['artists'][1]['name']) | |
return artist | |
def getAlbum(releaseFile): | |
with open(dirpath + '/' + file) as data_file: | |
album = str(data['group']['name']) | |
return album | |
for (dirpath, dirnames, filenames) in os.walk("/home/neuro/UUI/"): | |
for file in os.listdir(dirpath): | |
if file.endswith("2.txt"): | |
with open(dirpath + '/' + file) as data_file: | |
try: | |
data = json.load(data_file) | |
# artist = str(data['group']['musicInfo']['artists'][0][1]) | |
# artist = str(data['group']['musicInfo']['artists'][1]['name']) | |
# len(data['group']['musicInfo']['artists']) | |
# album = str(data['group']['name']) | |
print getArtist(data) + " " + getAlbum(data) | |
except : | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment