Skip to content

Instantly share code, notes, and snippets.

Frederik “Freso” S. Olesen Freso

Block or report user

Report or block Freso

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View URLCleanup.js
otherdatabases: {
match: new RegExp("^(https?://)?(www\\.)?(rateyourmusic\\.com/|worldcat\\.org/|musicmoz\\.org/|45cat\\.com/|musik-sammler\\.de/|discografia\\.dds\\.it/|tallinn\\.ester\\.ee/|tartu\\.ester\\.ee/|encyclopedisque\\.fr/|discosdobrasil\\.com\\.br/|isrc\\.ncl\\.edu\\.tw/|rolldabeats\\.com/|psydb\\.net/|metal-archives\\.com/|spirit-of-metal\\.com/|ibdb\\.com/|lortel.\\org/|theatricalia\\.com/|ocremix\\.org/|trove\\.nla\\.gov\\.au/|(wiki\\.)?rockinchina\\.com|(www\\.)?dhhu\\.dk|thesession\\.org)", "i"),
type: MB.constants.LINK_TYPES.otherdatabases,
clean: function(url) {
//Removing cruft from Worldcat URLs
url = url.replace(/^(?:https?:\/\/)?(?:www\.)?worldcat\.org(?:\/title\/[a-zA-Z0-9_-]+)?\/oclc\/([^&?]+)(?:.*)$/, "http://www.worldcat.org/oclc/$1");
//Standardising IBDb not to use www
url = url.replace(/^(https?:\/\/)?(www\.)?ibdb\.com/, "http://ibdb.com");
//Standardising ESTER to their default parameters
@Freso
Freso / Pocoo Styleguide question.py
Last active Dec 10, 2015
Which of these are correct?
View Pocoo Styleguide question.py
def spam(argument2):
this_is_a_very_long([
'this is the first', 'set of items', 'with more items',
'to come in this line', 'like this'
], argument2)
def eggs(argument2):
this_is_a_very_long([
'this is the first', 'set of items', 'with more items',
'to come in this line', 'like this'
View gist:4428921

Hello all,

I've been missing a "language" attribute for URLs for a while, as I'm frequently adding e.g. Danish reviews of release groups. This post is to discuss the feature and try to convince all the rest of you that it'd be nifty to have as well. Please chime in with questions and comments and suggestions!

Uses

Some use cases I see for this could be, once we actually launch a localised musicbrainz.org, to only show URLs based on locale (e.g., show English language links for English language locales).

This would also be something I'd want for MusicBottle - to only display links relevant for the language the person is browsing in (probably like "eng+mul+$sessionlanguage"). If a user is browsing in Danish, it's unlikely they want to read a review in Greek.

View gist:4427854
<td>
[%- IF medium_edit.title && medium_edit.old == 'new' -%]
[%- l('Disc <span class="new">{new}</span>: {title} (new disc)',
new => medium_edit.new, title => medium_edit.title) -%]
[%- ELSIF medium_edit.title -%]
[%- l('Disc <span class="new">{new}</span>: {title} (moved from position <span class="old">{old}</span>)',
new => medium_edit.new, title => medium_edit.title, , old => medium_edit.old) -%]
[%- ELSIF medium_edit.old == 'new' -%]
[%- l('Disc <span class="new">{new}</span> (new disc)',
new => medium_edit.new) -%]
View gist:4416300
#!/usr/bin/python2
# -*- coding: utf-8 -*-
"""Test coverage for MusicBottle."""
import musicbottle
from flask.ext.testing import TestCase
class MusicBottleTestCase(TestCase):
def create_app(self):
musicbottle.app.config['TESTING'] = True
View gist:4397332
{'attribs': {u'id': u'2c6c5a89-12c8-45ac-acc6-7c3dd46e3fdd'},
'children': {u'artist_credit': [{'attribs': {},
'children': {u'name_credit': [{'attribs': {},
'children': {u'artist': [{'attribs': {u'id': u'9bffb20c-dd17-4895-9fd1-4e73e888d799'},
'children': {u'name': [{'attribs': {},
'children': {},
'text': u'\u30e2\u30fc\u30cb\u30f3\u30b0\u5a18\u3002'}],
u'sort_name': [{'attribs': {},
@Freso
Freso / acousticbrainz-submit.sh
Created Nov 2, 2014
Script used to initiate `abzsubmit` before it was able to detect the extractor in `$PATH` and has other infancy issues. No longer needed, just uploaded for documentation and historical purpose.
View acousticbrainz-submit.sh
#!/usr/bin/dash
cd $HOME/Development/AcousticBrainz/acousticbrainz-client
git pull
. ./venv/bin/activate
ls "$@" | parallel --eta python2 ./abzsubmit
View addrecording.py
# -*- coding: utf-8 -*-
PLUGIN_NAME = u"Add Track As Recording"
PLUGIN_AUTHOR = u"Freso, Lukáš Lalinský, Philip Jägenstedt"
PLUGIN_DESCRIPTION = ""
PLUGIN_VERSION = "0.1"
PLUGIN_API_VERSIONS = ["1.0.0"]
from picard import log
#from picard.metadata import register_file_metadata_processor
You can’t perform that action at this time.