Exemple #1
0
sysname = re.compile(r'[!/\\:;*?«<>|]+')

# Init

# Пользователь выбирает интересуещего его исполнителя
user_artist = u'foo'

Start_Dir = os.getcwdu()
config = ConfigParser.ConfigParser()

config.read(os.path.join(Start_Dir, 'vkdconfig.ini'))
login = config.get('vkuser', 'login')
password = config.get('vkuser', 'pass')

lfm = lfmAPI("f3d8fbacbda2a35bfa855ef52052ca25") # Init Last.FM Api
mbAPI = mbzAPI() # Init MusicBrainz Api

# VK Login

br = initVk(login, password)

# Last.FM Build Artist Profile

artists = lfm.artist_search(user_artist) # Список найденых исполнителей
albums = lfm.getTopAlbums(artists[0]) # Список альбомов испослнителя
# Словарь { 'тип обложки' : 'ссылка' } типы [small|large|medium|mega|extralarge]
# Список треков в формате [['номер трека', 'имя трека', 'длительность в секундах'], ....]
# Дата релиза в формате datetime объекта
tracks, release_date, covers = lfm.getAlbumInfo(artists[0], albums[0])
tags = lfm.getTopTags(artists[0]) # Список тегов исполнителя
Exemple #2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

__author__ = 'MasterX2'

from mbrainzApi import mbzAPI

mbAPI = mbzAPI()

results = mbAPI.findArtists(u'Сплин')
artist = results[0].getArtist()

print 'name >', artist.name
print 'id >', artist.id[30:]

artist = mbAPI.getArtistById(artist.id)
releases = artist.releases
tag = artist.tags[0]
release = releases[0]

print 'title >', release.title
print 'tags >', tag
print 'id >', release.id[31:]

release = mbAPI.getReleaseById(release.id)
track = release.tracks[0]

print 'title >', track.title
print 'duration >', track.duration
Exemple #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import cmd
import ConfigParser
import pickle

from mbrainzApi import mbzAPI
from lastfmApi import lfmAPI
from unidecode import unidecode
from vkdtools import tomin, initVk, get_links, getWorkdir, DownloadPrepare, ProcessFile

config = ConfigParser.ConfigParser()

mbz_api = mbzAPI()
lfm = lfmAPI("f3d8fbacbda2a35bfa855ef52052ca25")


intro = "\nWelcome to VKD ver 3.0 with Command Interface\ntype 'help' for view command list\n"

# noinspection PyBroadException
class command_interface(cmd.Cmd):
    status = {
        "vk": "off",
        "artist": "notset",
        "album": "notset",
        "score": 98.0,
        "listsize": 5,
        "timerange": 0,
        "manual": False,