-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
29 lines (23 loc) · 1.09 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from audioman.fingerprint.identifier import AudioFileIdentifier
from audioman.locator.audio_file_locator import AudioFileLocator
from audioman.lookup.metadata_lookup import MetadataLookup
from audioman.parser.metadata_parser import MetadataParser
from audioman.metadata.tagger import AudioTagger
from audioman.files.structure import Structure, FolderStructure, FileNameStructure
from audioman.files.restructure import FileRestructurer
from audioman.cli import TerminalAlbumChooser
files = AudioFileLocator(".", ()).locate_files()
print(files)
if len(files) == 0:
exit(0)
identifier = AudioFileIdentifier(files[0])
id = identifier.identify
print('http://musicbrainz.org/recording/%s' % id)
data = MetadataLookup.lookup(str(id))
metadata = MetadataParser(data, TerminalAlbumChooser(files[0])).parse_metadata()
print(metadata.artist, metadata.rating, metadata.title, sep=", ")
tagger = AudioTagger.get_tagger(files[0])
tagger.tag(metadata)
tagger.save()
FileRestructurer("./", Structure(FolderStructure.ARTIST_ALBUM,
FileNameStructure.ARTIST_TITLE)).move(files[0], metadata)