Skip to content

Instantly share code, notes, and snippets.

@bajosoto
Created March 12, 2017 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bajosoto/9a20b39f446a64a3fdee6ea88a06adc2 to your computer and use it in GitHub Desktop.
Save bajosoto/9a20b39f446a64a3fdee6ea88a06adc2 to your computer and use it in GitHub Desktop.
kodinfo
from beets.plugins import BeetsPlugin
class KodiNfo(BeetsPlugin):
def __init__(self):
super(KodiNfo, self).__init__()
self.register_listener('album_imported', self.makeAlbumNfo)
self.register_listener('item_imported', self.makeItemNfo)
def makeAlbumNfo(self, lib, album):
link = 'https://musicbrainz.org/release/{0}'
with open(album.path + '/album.nfo', 'w') as f:
f.write(link.format(album.mb_albumid))
def makeItemNfo(self, lib, item):
link = 'https://musicbrainz.org/recording/{0}'
with open(album.path + '/' + item.title + '.nfo/', 'w') as f:
f.write(link.format(item.mb_trackid))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment