Skip to content

Instantly share code, notes, and snippets.

View ocharles's full-sized avatar
🥳

Ollie Charles ocharles

🥳
View GitHub Profile
[%- MACRO link_entity(entity, action, text) BLOCK;
type = "$entity";
IF type.search('Entity::Artist='); link_artist(entity, action, text);
ELSIF type.search('Entity::Work='); link_work(entity, action, text);
ELSIF type.search('Entity::Label='); link_label(entity, action, text);
ELSIF type.search('Entity::Release='); link_release(entity, action, text);
ELSIF type.search('Entity::ReleaseGroup='); link_release_group(entity, action, text);
END;
END -%]
package MusicBrainz::Server::Controller::Artist;
BEGIN
{
use Moose;
extends 'MusicBrainz::Server::Controller';
with 'MusicBrainz::Server::Controller::Annotation';
}
__PACKAGE__->config(
$c->model('ReleaseStatus')->load($release);
$c->model('ReleasePackaging')->load($release);
$c->model('Country')->load($release);
$c->model('Language')->load($release);
$c->model('Script')->load($release);
$c->model('ReleaseLabel')->load($release);
$c->model('Medium')->load($release);
musicbrainz_db=# \d artist_name;
Table "musicbrainz_test.artist_name"
Column | Type | Modifiers
----------+------------------------+----------------------------------------------------------
id | integer | not null default nextval('artist_name_id_seq'::regclass)
name | character varying(255) | not null
page | integer | not null
refcount | integer | default 0
Indexes:
"artist_name_pk" PRIMARY KEY, btree (id)
sub find_or_insert
{
my ($self, @artist_joinphrase) = @_;
my $i = 0;
my ($credits, $join_phrases) = part { $i++ % 2 } @artist_joinphrase;
my @positions = (0..scalar @$credits - 1);
my @artists = map { $_->{artist} } @$credits;
my @names = map { $_->{name} } @$credits;
sub find_or_insert
{
my ($self, @artist_joinphrase) = @_;
my $i = 0;
my ($credits, $join_phrases) = part { $i++ % 2 } @artist_joinphrase;
my @positions = (0..scalar @$credits - 1);
my @artists = map { $_->{artist} } @$credits;
my @names = map { $_->{name} } @$credits;
sub _hash_to_row
{
my ($self, $artist, $names) = @_;
no warnings 'uninitialized';
my $row = {
name => $names->{$artist->{name}},
sortname => $names->{$artist->{sort_name}} || $names->{$artist->{name}},
begindate_year => $artist->{begin_date}->{year},
begindate_month => $artist->{begin_date}->{month},
begindate_day => $artist->{begin_date}->{day},
[ollie@ollie-arch TemplateToolkit]$ ./admin/psql --profile=test READWRITE < ./admin/sql/InsertTestData.sql
BEGIN
SET
TRUNCATE TABLE
INSERT 0 1
INSERT 0 1
INSERT 0 1
TRUNCATE TABLE
INSERT 0 1
INSERT 0 1
(gdb) bt
#0 0x00007f41f33d51a1 in strlen () from /lib/libc.so.6
#1 0x000000000062c0b4 in textin ()
#2 0x000000000066d964 in DirectFunctionCall1 ()
#3 0x00007f41f103eb89 in unaccent () from /usr/lib/postgresql/unaccent.so
#4 0x000000000052bb9d in ExecMakeFunctionResult ()
#5 0x0000000000529aae in ExecProject ()
#6 0x000000000053aac9 in ExecResult ()
#7 0x0000000000528f0d in ExecProcNode ()
#8 0x0000000000526fe5 in ExecutorRun ()
package MusicBrainz::Server::Edit::Artist::Edit;
use Moose;
use MusicBrainz::Server::Constants qw( $EDIT_ARTIST_EDIT );
use MusicBrainz::Server::Types;
extends 'MusicBrainz::Server::Edit';
sub name { 'Edit Artist' }
sub edit_type { $EDIT_ARTIST_EDIT }