當前位置: 首頁>>代碼示例>>Python>>正文


Python editing.MusicBrainzClient類代碼示例

本文整理匯總了Python中editing.MusicBrainzClient的典型用法代碼示例。如果您正苦於以下問題:Python MusicBrainzClient類的具體用法?Python MusicBrainzClient怎麽用?Python MusicBrainzClient使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了MusicBrainzClient類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: push_data

def push_data():
    mb = MusicBrainzClient(cfg.MB_USERNAME, cfg.MB_PASSWORD, cfg.MB_SITE)
    for row in aClient.get_mb_data():
        gid, workid, iswc, artist, work = row
        note = 'Data taken from ' + aClient.search_url(str(workid), 'i')
        mb.edit_work(gid, {'iswc': iswc}, note)
        print artist + ' work: ' + work + ' Done!'
開發者ID:Jokipii,項目名稱:musicbrainz-bot,代碼行數:7,代碼來源:ascap-iswc.py

示例2: main

def main(args):
    if not args:
        out('Usage:   cancel_edits.py <edit_number edit_note>...\n')
        out('Example: cancel_edits.py "Edit #123 my mistake"')
        out('         cancel_edits.py 123 124 125')
        return

    edits = []
    for arg in args:
        if not isinstance(arg, unicode):
            arg = unicode(arg, locale.getpreferredencoding())
        m = re.match(ur'(?:[Ee]dit )?#?([0-9]+) ?(.*)$', arg)
        if not m:
            out('invalid edit number "%s", aborting!' % arg)
            return
        edit_nr = str(m.group(1))
        edit_note = m.group(2).lstrip()
        edits.append((edit_nr, edit_note))

    mb = MusicBrainzClient(cfg.MB_USERNAME, cfg.MB_PASSWORD, cfg.MB_SITE)
    for edit_nr, edit_note in edits:
        out(u'Cancel edit #%s: %s' % (edit_nr, edit_note if edit_note else u'<no edit note>'))
        mb.cancel_edit(str(edit_nr), edit_note)
開發者ID:Freso,項目名稱:musicbrainz-bot,代碼行數:23,代碼來源:cancel_edits.py

示例3: MusicBrainzClient

#!/usr/bin/python

import re
import sqlalchemy
from editing import MusicBrainzClient
import time
from utils import out, colored_out, bcolors
import config as cfg

engine = sqlalchemy.create_engine(cfg.MB_DB)
db = engine.connect()
db.execute("SET search_path TO musicbrainz, %s" % cfg.BOT_SCHEMA_DB)

mb = MusicBrainzClient(cfg.MB_USERNAME, cfg.MB_PASSWORD, cfg.MB_SITE)

query = """
    SELECT DISTINCT r.id, r.gid AS r_gid, w.gid AS w_gid, r.name, r.comment, lrw.id AS rel_id, lt.id AS link_type, r.artist_credit
    FROM recording r
        JOIN l_recording_work lrw ON lrw.entity0 = r.id
        JOIN link l ON l.id = lrw.link
        JOIN link_type lt ON l.link_type = lt.id
        JOIN link_attribute la ON la.link = l.id
        JOIN link_attribute_type lat ON la.attribute_type = lat.id AND lat.name = 'live'
        JOIN work w ON lrw.entity1 = w.id
    WHERE r.comment ~ E'live, \\\\d{4}(-\\\\d{2})?(-\\\\d{2})?:'
        AND l.begin_date_year IS NULL
        AND l.end_date_year IS NULL
        AND lt.name = 'performance'
        AND r.edits_pending = 0 AND lrw.edits_pending = 0
        /* Only one linked work */
        AND NOT EXISTS (SELECT 1 FROM l_recording_work lrw2 WHERE lrw2.entity0 = r.id AND lrw2.entity1 <> lrw.entity1)
開發者ID:legoktm,項目名稱:musicbrainz-bot,代碼行數:31,代碼來源:live_recordings_dates.py

示例4: MediaWiki

from simplemediawiki import MediaWiki
from editing import MusicBrainzClient
import pprint
import urllib
import time
from utils import mangle_name, join_names, quote_page_title
import config as cfg

engine = sqlalchemy.create_engine(cfg.MB_DB)
db = engine.connect()
db.execute("SET search_path TO musicbrainz, %s" % cfg.BOT_SCHEMA_DB)

wp = MediaWiki("https://en.wikipedia.org/w/api.php")
wps = solr.SolrConnection("http://localhost:8983/solr/wikipedia")

mb = MusicBrainzClient(cfg.MB_USERNAME, cfg.MB_PASSWORD, cfg.MB_SITE)

"""
CREATE TABLE bot_wp_label (
    gid uuid NOT NULL,
    processed timestamp with time zone DEFAULT now()
);

ALTER TABLE ONLY bot_wp_label
    ADD CONSTRAINT bot_wp_label_pkey PRIMARY KEY (gid);

"""

query = """
WITH
    labels_wo_wikipedia AS (
開發者ID:murdos,項目名稱:musicbrainz-bot,代碼行數:31,代碼來源:wp_links_labels.py

示例5: MusicBrainzClient

import re
import sqlalchemy
import solr
from editing import MusicBrainzClient
from mbbot.source.secondhandsongs import SHSWebService
import pprint
import urllib
import time
from utils import mangle_name, join_names, out, colored_out, bcolors
import config as cfg

engine = sqlalchemy.create_engine(cfg.MB_DB)
db = engine.connect()
db.execute("SET search_path TO musicbrainz, %s" % cfg.BOT_SCHEMA_DB)

mb = MusicBrainzClient(cfg.MB_USERNAME, cfg.MB_PASSWORD, cfg.MB_SITE)
shs = SHSWebService()

"""
CREATE TABLE bot_shs_work_lang (
    work uuid NOT NULL,
    processed timestamp with time zone DEFAULT now(),
    CONSTRAINT bot_shs_work_lang_pkey PRIMARY KEY (work)
);
"""

query = """
WITH
    works_wo_lang AS (
        SELECT w.id AS work_id, u.url AS shs_url
        FROM work w
開發者ID:Sophist-UK,項目名稱:Sophist_musicbrainz-bot,代碼行數:31,代碼來源:shs_work_lang.py

示例6: MediaWiki

from simplemediawiki import MediaWiki
from editing import MusicBrainzClient
import pprint
import urllib
import time
from utils import mangle_name, join_names, out
import config as cfg

engine = sqlalchemy.create_engine(cfg.MB_DB)
db = engine.connect()
db.execute("SET search_path TO musicbrainz")

wp = MediaWiki('http://en.wikipedia.org/w/api.php')
wps = solr.SolrConnection('http://localhost:8983/solr/wikipedia')

mb = MusicBrainzClient(cfg.MB_USERNAME, cfg.MB_PASSWORD, cfg.MB_SITE)

"""
CREATE TABLE bot_wp_rg (
    gid uuid NOT NULL,
    processed timestamp with time zone DEFAULT now()
);

ALTER TABLE ONLY bot_wp_rg
    ADD CONSTRAINT bot_wp_rg_pkey PRIMARY KEY (gid);
"""

query = """
WITH
    rgs_wo_wikipedia AS (
        SELECT a.id
開發者ID:reosarevok,項目名稱:musicbrainz-bot,代碼行數:31,代碼來源:wp_links_rgs.py

示例7: MusicBrainzClient

import re
import sqlalchemy
import solr
from editing import MusicBrainzClient
import discogs_client as discogs
import pprint
import urllib
import time
from utils import mangle_name, join_names, out, colored_out, bcolors
import config as cfg

engine = sqlalchemy.create_engine(cfg.MB_DB)
db = engine.connect()
db.execute("SET search_path TO musicbrainz, %s" % cfg.BOT_SCHEMA_DB)

mb = MusicBrainzClient(cfg.MB_USERNAME, cfg.MB_PASSWORD, cfg.MB_SITE)

discogs.user_agent = 'MusicBrainzBot/0.1 +https://github.com/murdos/musicbrainz-bot'

"""
CREATE TABLE bot_discogs_release_packaging (
    release uuid NOT NULL,
    processed timestamp with time zone DEFAULT now(),
    CONSTRAINT bot_discogs_release_packaging_pkey PRIMARY KEY (release)
);
"""

query = """
WITH
    releases_wo_packaging AS (
        SELECT r.id AS release_id, u.url AS discogs_url
開發者ID:tommycrock,項目名稱:musicbrainz-bot,代碼行數:31,代碼來源:discogs_release_packaging.py

示例8: len

from mbbot.wp.wikipage import WikiPage
from utils import mangle_name, join_names, out, colored_out, bcolors, escape_query, quote_page_title, wp_is_canonical_page
import config as cfg

engine = sqlalchemy.create_engine(cfg.MB_DB)
db = engine.connect()
db.execute("SET search_path TO musicbrainz, %s" % cfg.BOT_SCHEMA_DB)

wp_lang = sys.argv[1] if len(sys.argv) > 1 else 'en'

wp = MediaWiki('https://%s.wikipedia.org/w/api.php' % wp_lang)

suffix = '_' + wp_lang if wp_lang != 'en' else ''
wps = solr.SolrConnection('http://localhost:8983/solr/wikipedia' + suffix)

mb = MusicBrainzClient(cfg.MB_USERNAME, cfg.MB_PASSWORD, cfg.MB_SITE)

"""
CREATE TABLE bot_wp_rg_link (
    gid uuid NOT NULL,
    lang character varying(2),
    processed timestamp with time zone DEFAULT now(),
    CONSTRAINT bot_wp_rg_link_pkey PRIMARY KEY (gid, lang)
);
"""


acceptable_countries_for_lang = {
    'fr': ['FR', 'MC']
}
acceptable_countries_for_lang['en'] = acceptable_countries_for_lang['fr']
開發者ID:Freso,項目名稱:musicbrainz-bot,代碼行數:31,代碼來源:wp_links_rgs.py

示例9: MusicBrainzClient

import re
import sqlalchemy
import solr
from editing import MusicBrainzClient
import discogs_client
import pprint
import urllib
import time
from utils import mangle_name, join_names, out, colored_out, bcolors
import config as cfg

engine = sqlalchemy.create_engine(cfg.MB_DB)
db = engine.connect()
db.execute("SET search_path TO musicbrainz, %s" % cfg.BOT_SCHEMA_DB)

mb = MusicBrainzClient(cfg.MB_USERNAME, cfg.MB_PASSWORD, cfg.MB_SITE)

discogs = discogs_client.Client('MusicBrainzBot/0.1 +https://github.com/murdos/musicbrainz-bot')

"""
CREATE TABLE bot_discogs_medium_format (
    medium integer NOT NULL,
    processed timestamp with time zone DEFAULT now(),
    CONSTRAINT bot_discogs_medium_format_pkey PRIMARY KEY (medium)
);
"""

query = """
WITH
    mediums_with_fuzzy_format AS (
        SELECT r.id AS release_id, m.position, m.id AS medium_id, u.url AS discogs_url, m.format
開發者ID:legoktm,項目名稱:musicbrainz-bot,代碼行數:31,代碼來源:discogs_medium_format.py

示例10: MusicBrainzClient

#!/usr/bin/python

import re
import sqlalchemy
from editing import MusicBrainzClient
import time
from utils import out, colored_out, bcolors
import config as cfg

engine = sqlalchemy.create_engine(cfg.MB_DB)
db = engine.connect()
db.execute("SET search_path TO musicbrainz, %s" % cfg.BOT_SCHEMA_DB)

mb = MusicBrainzClient(cfg.MB_USERNAME, cfg.MB_PASSWORD, cfg.MB_SITE)

query = """
    SELECT DISTINCT r.id, r.gid, r.name, r.comment, lrw.id AS rel_id, lt.id AS link_type, r.artist_credit
    FROM recording r
        JOIN l_recording_work lrw ON lrw.entity0 = r.id
        JOIN link l ON l.id = lrw.link
        JOIN link_type lt ON l.link_type = lt.id
        JOIN link_attribute la ON la.link = l.id
        JOIN link_attribute_type lat ON la.attribute_type = lat.id AND lat.name = 'live'
    WHERE r.comment ~ E'live, \\\\d{4}(-\\\\d{2})?(-\\\\d{2})?:'
        AND l.begin_date_year IS NULL
        AND l.end_date_year IS NULL
        AND lt.name = 'performance'
        AND r.edits_pending = 0 AND lrw.edits_pending = 0
        /* Only one linked work */
        AND NOT EXISTS (SELECT 1 FROM l_recording_work lrw2 WHERE lrw2.entity0 = r.id AND lrw2.entity1 <> lrw.entity1)
    ORDER BY r.artist_credit
開發者ID:JesseWeinstein,項目名稱:musicbrainz-bot,代碼行數:31,代碼來源:live_recordings_dates.py

示例11: MediaWiki

from simplemediawiki import MediaWiki
from editing import MusicBrainzClient
import pprint
import urllib
import time
from utils import mangle_name, join_names, mw_remove_markup, out
import config as cfg

engine = sqlalchemy.create_engine(cfg.MB_DB)
db = engine.connect()
db.execute("SET search_path TO musicbrainz")

wp = MediaWiki('http://en.wikipedia.org/w/api.php')
wps = solr.SolrConnection('http://localhost:8983/solr/wikipedia')

mb = MusicBrainzClient(cfg.MB_USERNAME, cfg.MB_PASSWORD, cfg.MB_SITE)

query = """
SELECT DISTINCT
    a.id, a.gid, a.name, a.country, a.type, a.gender,
    a.begin_date_year,
    a.begin_date_month,
    a.begin_date_day,
    a.end_date_year,
    a.end_date_month,
    a.end_date_day,
    u.url
FROM s_artist a
JOIN l_artist_url l ON l.entity0 = a.id AND l.link IN (SELECT id FROM link WHERE link_type = 179)
JOIN url u ON u.id = l.entity1
LEFT JOIN bot_wp_artist_data b ON a.gid = b.gid
開發者ID:reosarevok,項目名稱:musicbrainz-bot,代碼行數:31,代碼來源:wp_artist_country.py

示例12: MusicBrainzClient

import re
import sys
import urllib
import urllib2
import config
import pymongo
import pprint
from editing import MusicBrainzClient
import cgi


mb = MusicBrainzClient('lukz_bot', 'mb', 'http://mb.muziq.eu')


opener = urllib2.build_opener()
if config.WWW_USER_AGENT:
    opener.addheaders = [('User-Agent', config.WWW_USER_AGENT)]


mongo = pymongo.Connection()
db = mongo.mbot


html_escape_table = {
    "&": "&amp;",
    '"': "&quot;",
    "'": "&apos;",
    ">": "&gt;",
    "<": "&lt;",
    }
開發者ID:digideskio,項目名稱:musicbrainz-bot,代碼行數:30,代碼來源:import_albums.py

示例13: isrc_valid

        m = re.search(ur'<span property="v:identifier">(.+?)</span>', page)
        identifier = m.group(1).upper() if m else None
        return identifier if identifier and isrc_valid(identifier) else None

query_releases = '''
SELECT DISTINCT r.id, r.gid, r.barcode
FROM release r
WHERE r.barcode ~ %s
'''

engine = sqlalchemy.create_engine(cfg.MB_DB)
db = engine.connect()
db.execute('SET search_path TO musicbrainz')

zeroinch = ZeroInch()
mb = MusicBrainzClient(cfg.MB_USERNAME, cfg.MB_PASSWORD, cfg.MB_SITE)
ws = MusicBrainzWebservice(cfg.MB_USERNAME, cfg.MB_PASSWORD, cfg.MB_SITE)


def identify_isrc_edit(isrcs):
    return lambda edit_nr, text: set(isrcs) == set(re.findall(r'<a href="' + cfg.MB_SITE + r'/isrc/([A-Z0-9]{12})">', text))

isrc_submitted = set(url for url, in db.execute('''SELECT url FROM bot_isrc_zeroinch_submitted'''))
isrc_missing = set(url for url, in db.execute('''SELECT url FROM bot_isrc_zeroinch_missing'''))
isrc_problematic = set(url for url, in db.execute('''SELECT url FROM bot_isrc_zeroinch_problematic'''))

#for artists in [['Gui_Boratto']]:
#for artists in zeroinch.get_artists('/label/Warp_Records'):
for artists in zeroinch.get_artists('/catalogue', cipher='all', page='1'):
    for artist in artists:
        artist_url = u'http://www.zero-inch.com/artist/%s' % artist
開發者ID:Freso,項目名稱:musicbrainz-bot,代碼行數:31,代碼來源:isrc_zeroinch.py

示例14: MusicBrainzClient

import re
import sqlalchemy
import solr
from editing import MusicBrainzClient
import discogs_client as discogs
import pprint
import urllib
import time
from utils import mangle_name, join_names, out, colored_out, bcolors
import config as cfg

engine = sqlalchemy.create_engine(cfg.MB_DB)
db = engine.connect()
db.execute("SET search_path TO musicbrainz, %s" % cfg.BOT_SCHEMA_DB)

mb = MusicBrainzClient(cfg.MB_USERNAME, cfg.MB_PASSWORD, cfg.MB_SITE)

discogs.user_agent = "MusicBrainzBot/0.1 +https://github.com/murdos/musicbrainz-bot"

"""
CREATE TABLE bot_discogs_medium_format (
    medium integer NOT NULL,
    processed timestamp with time zone DEFAULT now(),
    CONSTRAINT bot_discogs_medium_format_pkey PRIMARY KEY (medium)
);
"""

query = """
WITH
    mediums_with_fuzzy_format AS (
        SELECT r.id AS release_id, m.position, m.id AS medium_id, u.url AS discogs_url, m.format
開發者ID:Freso,項目名稱:musicbrainz-bot,代碼行數:31,代碼來源:discogs_medium_format.py

示例15: MusicBrainzClient

import re
import sqlalchemy
import solr
from editing import MusicBrainzClient
import pprint
import urllib
import time
from utils import mangle_name, join_names, out, colored_out, bcolors
import config as cfg

engine = sqlalchemy.create_engine(cfg.MB_DB)
db = engine.connect()
db.execute("SET search_path TO musicbrainz")

mb = MusicBrainzClient(cfg.MB_USERNAME, cfg.MB_PASSWORD, cfg.MB_SITE)

"""
CREATE TABLE bot_encyclopedisque_medium_format (
    gid uuid NOT NULL,
    processed timestamp with time zone DEFAULT now()
);

ALTER TABLE ONLY bot_encyclopedisque_medium_format
    ADD CONSTRAINT bot_encyclopedisque_medium_format_pkey PRIMARY KEY (gid);

"""

query = """
WITH
    releases_wo_7inch AS (
開發者ID:Jokipii,項目名稱:musicbrainz-bot,代碼行數:30,代碼來源:encyclopedisque_medium_format.py


注:本文中的editing.MusicBrainzClient類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。