rbrainz 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +25 -0
- data/README +11 -0
- data/Rakefile +110 -0
- data/TODO +24 -0
- data/doc/README.rdoc +68 -0
- data/examples/getartist.rb +54 -0
- data/lib/rbrainz.rb +11 -0
- data/lib/rbrainz/data/countrynames.rb +259 -0
- data/lib/rbrainz/data/languagenames.rb +404 -0
- data/lib/rbrainz/data/scriptnames.rb +64 -0
- data/lib/rbrainz/model.rb +48 -0
- data/lib/rbrainz/model/alias.rb +23 -0
- data/lib/rbrainz/model/artist.rb +54 -0
- data/lib/rbrainz/model/disc.rb +30 -0
- data/lib/rbrainz/model/entity.rb +72 -0
- data/lib/rbrainz/model/incomplete_date.rb +76 -0
- data/lib/rbrainz/model/label.rb +55 -0
- data/lib/rbrainz/model/mbid.rb +82 -0
- data/lib/rbrainz/model/release.rb +50 -0
- data/lib/rbrainz/model/release_event.rb +34 -0
- data/lib/rbrainz/model/track.rb +27 -0
- data/lib/rbrainz/webservice.rb +6 -0
- data/lib/rbrainz/webservice/filter.rb +132 -0
- data/lib/rbrainz/webservice/includes.rb +150 -0
- data/lib/rbrainz/webservice/mbxml.rb +404 -0
- data/lib/rbrainz/webservice/query.rb +61 -0
- data/lib/rbrainz/webservice/webservice.rb +69 -0
- data/test/lib/test_entity.rb +58 -0
- data/test/lib/testing_helper.rb +13 -0
- data/test/test-data/README +13 -0
- data/test/test-data/invalid/artist/basic_1.xml +12 -0
- data/test/test-data/invalid/artist/basic_2.xml +12 -0
- data/test/test-data/invalid/artist/empty_1.xml +0 -0
- data/test/test-data/invalid/artist/empty_2.xml +3 -0
- data/test/test-data/invalid/artist/empty_3.xml +7 -0
- data/test/test-data/invalid/artist/search_result_1.xml +11 -0
- data/test/test-data/valid/artist/Tchaikovsky-1.xml +90 -0
- data/test/test-data/valid/artist/Tori_Amos_1.xml +8 -0
- data/test/test-data/valid/artist/Tori_Amos_2.xml +53 -0
- data/test/test-data/valid/artist/Tori_Amos_3.xml +25 -0
- data/test/test-data/valid/artist/Tori_Amos_4.xml +14 -0
- data/test/test-data/valid/artist/Tori_Amos_5.xml +13 -0
- data/test/test-data/valid/artist/empty_1.xml +7 -0
- data/test/test-data/valid/artist/empty_2.xml +11 -0
- data/test/test-data/valid/artist/search_result_1.xml +19 -0
- data/test/test-data/valid/label/Atlantic_Records_1.xml +9 -0
- data/test/test-data/valid/label/Atlantic_Records_2.xml +11 -0
- data/test/test-data/valid/label/search_result_1.xml +14 -0
- data/test/test-data/valid/release/Highway_61_Revisited_1.xml +68 -0
- data/test/test-data/valid/release/Little_Earthquakes_1.xml +24 -0
- data/test/test-data/valid/release/Little_Earthquakes_2.xml +73 -0
- data/test/test-data/valid/release/Mission_Impossible_2.xml +155 -0
- data/test/test-data/valid/release/Under_the_Pink_1.xml +16 -0
- data/test/test-data/valid/release/Under_the_Pink_2.xml +14 -0
- data/test/test-data/valid/release/Under_the_Pink_3.xml +16 -0
- data/test/test-data/valid/release/search_result_1.xml +29 -0
- data/test/test-data/valid/track/Silent_All_These_Years_1.xml +7 -0
- data/test/test-data/valid/track/Silent_All_These_Years_2.xml +21 -0
- data/test/test-data/valid/track/Silent_All_These_Years_3.xml +16 -0
- data/test/test-data/valid/track/Silent_All_These_Years_4.xml +30 -0
- data/test/test-data/valid/track/Silent_All_These_Years_5.xml +20 -0
- data/test/test-data/valid/track/search_result_1.xml +45 -0
- data/test/test-data/valid/user/User_1.xml +15 -0
- data/test/test_alias.rb +50 -0
- data/test/test_artist.rb +132 -0
- data/test/test_artist_filter.rb +36 -0
- data/test/test_artist_includes.rb +63 -0
- data/test/test_disc.rb +38 -0
- data/test/test_incomplete_date.rb +60 -0
- data/test/test_label.rb +129 -0
- data/test/test_label_filter.rb +36 -0
- data/test/test_label_includes.rb +55 -0
- data/test/test_mbid.rb +99 -0
- data/test/test_mbxml.rb +368 -0
- data/test/test_query.rb +24 -0
- data/test/test_release.rb +161 -0
- data/test/test_release_event.rb +67 -0
- data/test/test_release_filter.rb +57 -0
- data/test/test_release_includes.rb +73 -0
- data/test/test_track.rb +102 -0
- data/test/test_track_filter.rb +57 -0
- data/test/test_track_includes.rb +61 -0
- data/test/test_webservice.rb +23 -0
- metadata +138 -0
data/LICENSE
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
Copyright (c) 2007, Philipp Wolfer
|
2
|
+
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
4
|
+
modification, are permitted provided that the following conditions
|
5
|
+
are met:
|
6
|
+
1. Redistributions of source code must retain the above copyright
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
|
+
3. Neither the name of the RBrainz project nor the names of the
|
12
|
+
contributors may be used to endorse or promote products derived from
|
13
|
+
this software without specific prior written permission.
|
14
|
+
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
16
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
17
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
18
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
19
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
20
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
21
|
+
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
22
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
23
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
24
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
25
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
RBrainz - Ruby MusicBrainz library
|
2
|
+
|
3
|
+
See doc/README.rdoc for details about RBrainz.
|
4
|
+
|
5
|
+
To generate the complete RBrainz documentation run
|
6
|
+
rake rdoc
|
7
|
+
|
8
|
+
The documentation will be stored in doc/api.
|
9
|
+
|
10
|
+
Copyright (c) 2007, Philipp Wolfer
|
11
|
+
Licensing information can be found in the file LICENSE.
|
data/Rakefile
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# $Id: Rakefile 4 2007-05-21 02:04:26Z phw $
|
2
|
+
# Copyright (c) 2007, Philipp Wolfer
|
3
|
+
# All rights reserved.
|
4
|
+
# See LICENSE for permissions.
|
5
|
+
|
6
|
+
# Rakefile for RBrainz
|
7
|
+
|
8
|
+
require 'rubygems'
|
9
|
+
require 'rake/gempackagetask'
|
10
|
+
require 'rake/testtask'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
|
13
|
+
# Packaging tasks: -------------------------------------------------------
|
14
|
+
|
15
|
+
PKG_NAME = 'rbrainz'
|
16
|
+
PKG_VERSION = '0.1.0'
|
17
|
+
PKG_FILES = FileList[
|
18
|
+
"Rakefile", "LICENSE", "README", "TODO",
|
19
|
+
"doc/README.rdoc",
|
20
|
+
"examples/**/*",
|
21
|
+
"lib/**/*.rb",
|
22
|
+
"test/**/*.rb",
|
23
|
+
"test/test-data/**/*"
|
24
|
+
]
|
25
|
+
|
26
|
+
spec = Gem::Specification.new do |spec|
|
27
|
+
spec.platform = Gem::Platform::RUBY
|
28
|
+
spec.summary = 'Ruby library for the MusicBrainz XML webservice.'
|
29
|
+
spec.name = PKG_NAME
|
30
|
+
spec.version = PKG_VERSION
|
31
|
+
spec.requirements << 'none'
|
32
|
+
spec.require_path = 'lib'
|
33
|
+
spec.autorequire = 'rbrainz'
|
34
|
+
spec.files = PKG_FILES
|
35
|
+
spec.description = <<EOF
|
36
|
+
RBrainz is a Ruby client library to access the MusicBrainz XML
|
37
|
+
webservice written in pure Ruby.
|
38
|
+
|
39
|
+
RBrainz follows the design of python-musicbrainz2, the reference
|
40
|
+
implementation for a MusicBrainz client library. Developers used to
|
41
|
+
python-musicbrainz2 should already know most of RBrainz' interface.
|
42
|
+
However, RBrainz differs from python-musicbrainz2 wherever it makes
|
43
|
+
the library more Ruby like or easier to use.
|
44
|
+
|
45
|
+
RBrainz supports the MusicBrainz XML Metadata Version 1.1, including
|
46
|
+
support for labels and extended release events.
|
47
|
+
EOF
|
48
|
+
spec.author = 'Philipp Wolfer'
|
49
|
+
spec.email = 'phw@rubyforge.org'
|
50
|
+
spec.homepage = 'http://rbrainz.rubyforge.org'
|
51
|
+
spec.rubyforge_project = 'rbrainz'
|
52
|
+
spec.has_rdoc = true
|
53
|
+
spec.extra_rdoc_files = ['doc/README.rdoc']
|
54
|
+
end
|
55
|
+
|
56
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
57
|
+
pkg.need_zip = true
|
58
|
+
pkg.need_tar_gz= true
|
59
|
+
end
|
60
|
+
|
61
|
+
# Test tasks: ------------------------------------------------------------
|
62
|
+
|
63
|
+
desc "Run the unit and functional tests"
|
64
|
+
task :test => [:test_units, :test_functional]
|
65
|
+
|
66
|
+
desc "Run just the unit tests"
|
67
|
+
Rake::TestTask.new(:test_units) do |test|
|
68
|
+
test.test_files = FileList['test/test*.rb']
|
69
|
+
test.libs = ['lib', 'test/lib']
|
70
|
+
test.warning = true
|
71
|
+
end
|
72
|
+
|
73
|
+
desc "Run just the functional tests"
|
74
|
+
Rake::TestTask.new(:test_functional) do |test|
|
75
|
+
test.test_files = FileList['test/functional*.rb']
|
76
|
+
test.libs = ['lib', 'test/lib']
|
77
|
+
test.warning = true
|
78
|
+
end
|
79
|
+
|
80
|
+
# Documentation tasks: ---------------------------------------------------
|
81
|
+
|
82
|
+
Rake::RDocTask.new do |rdoc|
|
83
|
+
rdoc.title = "RBrainz %s" % PKG_VERSION
|
84
|
+
rdoc.main = 'doc/README.rdoc'
|
85
|
+
rdoc.rdoc_dir = 'doc/api'
|
86
|
+
rdoc.rdoc_files.include('doc/README.rdoc', 'lib/**/*.rb',
|
87
|
+
'LICENSE', 'TODO')
|
88
|
+
rdoc.options << '--inline-source' << '--line-numbers'
|
89
|
+
end
|
90
|
+
|
91
|
+
# Other tasks: -----------------------------------------------------------
|
92
|
+
|
93
|
+
def egrep(pattern)
|
94
|
+
Dir['**/*.rb'].each do |fn|
|
95
|
+
count = 0
|
96
|
+
open(fn) do |f|
|
97
|
+
while line = f.gets
|
98
|
+
count += 1
|
99
|
+
if line =~ pattern
|
100
|
+
puts "#{fn}:#{count}:#{line}"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
desc "Look for TODO and FIXME tags in the code"
|
108
|
+
task :todo do
|
109
|
+
egrep /#.*(FIXME|TODO)/
|
110
|
+
end
|
data/TODO
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
=TODO
|
2
|
+
|
3
|
+
==Short term tasks
|
4
|
+
* Support relationships (0.1.1)
|
5
|
+
* Query collections (0.1.2)
|
6
|
+
* Support for the score parameter in search result. Could be implemented
|
7
|
+
a little bit like in PythonMusicBrainz2, but more flexible. Maybe a result
|
8
|
+
object over which one can iterate to retrieve all results witch the
|
9
|
+
corresponding score. (0.1.2)
|
10
|
+
result.each {|entity, score|
|
11
|
+
...
|
12
|
+
}
|
13
|
+
* Support for the offset parameter for queries on collections
|
14
|
+
to retrieve results below the 100 results limit. Could be easily integrated
|
15
|
+
into the result object (see previous point). (0.1.2)
|
16
|
+
* Make it easier to create MBID objects or allow usage of ID strings
|
17
|
+
where it makes life easier.
|
18
|
+
|
19
|
+
==Longer term tasks
|
20
|
+
* Calculation of disc IDs (0.3.0)
|
21
|
+
* User authentication (0.4.0)
|
22
|
+
* Querying of user information (0.4.0)
|
23
|
+
* PUID submission
|
24
|
+
* Full text search (lucene search queries).
|
data/doc/README.rdoc
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
=RBrainz - Ruby MusicBrainz library
|
2
|
+
RBrainz is a Ruby client library to access the MusicBrainz XML webservice,
|
3
|
+
which can be used to query the MusicBrainz database.
|
4
|
+
|
5
|
+
RBrainz is written in pure Ruby and follows the design of
|
6
|
+
PythonMusicBrainz2[http://musicbrainz.org/doc/PythonMusicBrainz2],
|
7
|
+
the reference implementation for a MusicBrainz client library. Developers
|
8
|
+
used to PythonMusicBrainz2 should already know most of RBrainz' interface.
|
9
|
+
However, RBrainz differs from PythonMusicBrainz2 wherever it makes the
|
10
|
+
library more Ruby like or easier to use.
|
11
|
+
|
12
|
+
RBrainz supports the MusicBrainz XML Metadata Version 1.1, including support
|
13
|
+
for labels and extended release events.
|
14
|
+
|
15
|
+
==Installation
|
16
|
+
===Installing with RubyGems
|
17
|
+
The easiest way to install the latest release of RBrainz is using
|
18
|
+
RubyGems[http://rubygems.org] by executing the following command:
|
19
|
+
gem install rbrainz
|
20
|
+
|
21
|
+
===Manual installation
|
22
|
+
Not supported, yet.
|
23
|
+
|
24
|
+
==Basic usage
|
25
|
+
The most important classes in this library are the model classes
|
26
|
+
MusicBrainz::Model::Artist, MusicBrainz::Model::Release,
|
27
|
+
MusicBrainz::Model::Track and MusicBrainz::Model::Label
|
28
|
+
together with MusicBrainz::Webservice::Query. The Query class
|
29
|
+
provides an easy to use interface to query the MusicBrainz webservice.
|
30
|
+
It will always return one of the model classes above or an
|
31
|
+
array of those classes. The example below should make the usage clear:
|
32
|
+
|
33
|
+
require 'rbrainz'
|
34
|
+
include MusicBrainz
|
35
|
+
|
36
|
+
# Create an MBID object which represents a MusicBrainz artist ID.
|
37
|
+
mbid = Model::MBID.from_uuid(:artist, 'c0b2500e-0cef-4130-869d-732b23ed9df5')
|
38
|
+
|
39
|
+
# With the ArtistInclude object we can control what kind of information
|
40
|
+
# the MusicBrainz server will include in its answer.
|
41
|
+
artist_includes = Webservice::ArtistIncludes.new(
|
42
|
+
:aliases => true,
|
43
|
+
:releases => ['Album', 'Official'],
|
44
|
+
:artist_rels => true,
|
45
|
+
:release_rels => true,
|
46
|
+
:track_rels => true,
|
47
|
+
:label_rels => true,
|
48
|
+
:url_rels => true
|
49
|
+
)
|
50
|
+
|
51
|
+
# Query the webservice for the artist with the above ID
|
52
|
+
# The result will contain all the information specified
|
53
|
+
# in artist_includes.
|
54
|
+
q = Webservice::Query.new
|
55
|
+
artist = q.get_artist_by_id(mbid, artist_includes)
|
56
|
+
|
57
|
+
==The MusicBrainz webservice
|
58
|
+
For more information about the MusicBrainz webservice visit the
|
59
|
+
following resources:
|
60
|
+
- MusicBrainzXMLWebService[http://musicbrainz.org/doc/XMLWebService]
|
61
|
+
- MusicBrainzXMLMetaData[http://musicbrainz.org/doc/MusicBrainzXMLMetaData]
|
62
|
+
|
63
|
+
==License
|
64
|
+
RBrainz is Copyright (c) 2007 Philipp Wolfer.
|
65
|
+
It is free softare distributed under a BSD style license. See
|
66
|
+
LICENSE[link:files/LICENSE.html] for details.
|
67
|
+
|
68
|
+
$Id: README.rdoc 5 2007-05-21 16:51:22Z phw $
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Example script which queries the database for an
|
4
|
+
# artist and displays the artist's data.
|
5
|
+
#
|
6
|
+
# $Id: getartist.rb 16 2007-05-23 15:49:06Z phw $
|
7
|
+
|
8
|
+
# Just make sure we can run this example from the command
|
9
|
+
# line even if RBrainz is not yet installed properly.
|
10
|
+
$: << 'lib/' << '../lib/'
|
11
|
+
|
12
|
+
# Load RBrainz and include the MusicBrainz namespace.
|
13
|
+
require 'rbrainz'
|
14
|
+
include MusicBrainz
|
15
|
+
|
16
|
+
# The artist's MusicBrainz ID.
|
17
|
+
# Either read it from the command line as the first
|
18
|
+
# parameter or use a default one for demonstration.
|
19
|
+
id = $*[0] ? $*[0] : '10bf95b6-30e3-44f1-817f-45762cdc0de0'
|
20
|
+
|
21
|
+
# Generate a new artist MBID object from the ID:
|
22
|
+
mbid = Model::MBID.from_uuid(:artist, id)
|
23
|
+
|
24
|
+
# Define what information about the artist
|
25
|
+
# should be included in the result.
|
26
|
+
# In this case the artist's aliases and all
|
27
|
+
# the official albums by this artist will be
|
28
|
+
# fetched.
|
29
|
+
artist_includes = Webservice::ArtistIncludes.new(
|
30
|
+
:aliases => true,
|
31
|
+
:releases => ['Album', 'Official']
|
32
|
+
)
|
33
|
+
|
34
|
+
# Create a new Query object which will provide
|
35
|
+
# us an interface to the MusicBrainz webservice.
|
36
|
+
query = Webservice::Query.new
|
37
|
+
|
38
|
+
# Now query the MusicBrainz database for the artist
|
39
|
+
# with the MBID defined above.
|
40
|
+
artist = query.get_artist_by_id(mbid, artist_includes)
|
41
|
+
|
42
|
+
# Display the fetched artist data together with all
|
43
|
+
# unique release titles.
|
44
|
+
print <<EOF
|
45
|
+
ID : #{artist.id.uuid}
|
46
|
+
Name : #{artist.name}
|
47
|
+
Sort name : #{artist.sort_name}
|
48
|
+
Disambiguation: #{artist.disambiguation}
|
49
|
+
Type : #{artist.type}
|
50
|
+
Begin date : #{artist.begin_date}
|
51
|
+
End date : #{artist.end_date}
|
52
|
+
Aliases : #{artist.aliases.join('; ')}
|
53
|
+
Releases : #{artist.releases.map{|r| r.title}.uniq.join("\r\n ")}
|
54
|
+
EOF
|
data/lib/rbrainz.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# $Id: rbrainz.rb 4 2007-05-21 02:04:26Z phw $
|
2
|
+
# Copyright (c) 2007, Philipp Wolfer
|
3
|
+
# All rights reserved.
|
4
|
+
# See LICENSE for permissions.
|
5
|
+
|
6
|
+
# This is actually just a convenient shortcut that allows
|
7
|
+
# the user to use RBrainz by just using <tt>require 'rbrainz'</tt>.
|
8
|
+
# This will include the whole RBrainz webservice library, which
|
9
|
+
# should be ok most of the time.
|
10
|
+
|
11
|
+
require 'rbrainz/webservice'
|
@@ -0,0 +1,259 @@
|
|
1
|
+
# $Id: countrynames.rb 4 2007-05-21 02:04:26Z phw $
|
2
|
+
# Copyright (c) 2007, Philipp Wolfer
|
3
|
+
# All rights reserved.
|
4
|
+
# See LICENSE for permissions.
|
5
|
+
|
6
|
+
module MusicBrainz
|
7
|
+
module Data
|
8
|
+
|
9
|
+
# List of country names.
|
10
|
+
COUNTRY_NAMES = {
|
11
|
+
'BD' => 'Bangladesh',
|
12
|
+
'BE' => 'Belgium',
|
13
|
+
'BF' => 'Burkina Faso',
|
14
|
+
'BG' => 'Bulgaria',
|
15
|
+
'BB' => 'Barbados',
|
16
|
+
'WF' => 'Wallis and Futuna Islands',
|
17
|
+
'BM' => 'Bermuda',
|
18
|
+
'BN' => 'Brunei Darussalam',
|
19
|
+
'BO' => 'Bolivia',
|
20
|
+
'BH' => 'Bahrain',
|
21
|
+
'BI' => 'Burundi',
|
22
|
+
'BJ' => 'Benin',
|
23
|
+
'BT' => 'Bhutan',
|
24
|
+
'JM' => 'Jamaica',
|
25
|
+
'BV' => 'Bouvet Island',
|
26
|
+
'BW' => 'Botswana',
|
27
|
+
'WS' => 'Samoa',
|
28
|
+
'BR' => 'Brazil',
|
29
|
+
'BS' => 'Bahamas',
|
30
|
+
'BY' => 'Belarus',
|
31
|
+
'BZ' => 'Belize',
|
32
|
+
'RU' => 'Russian Federation',
|
33
|
+
'RW' => 'Rwanda',
|
34
|
+
'RE' => 'Reunion',
|
35
|
+
'TM' => 'Turkmenistan',
|
36
|
+
'TJ' => 'Tajikistan',
|
37
|
+
'RO' => 'Romania',
|
38
|
+
'TK' => 'Tokela',
|
39
|
+
'GW' => 'Guinea-Bissa',
|
40
|
+
'GU' => 'Guam',
|
41
|
+
'GT' => 'Guatemala',
|
42
|
+
'GR' => 'Greece',
|
43
|
+
'GQ' => 'Equatorial Guinea',
|
44
|
+
'GP' => 'Guadeloupe',
|
45
|
+
'JP' => 'Japan',
|
46
|
+
'GY' => 'Guyana',
|
47
|
+
'GF' => 'French Guiana',
|
48
|
+
'GE' => 'Georgia',
|
49
|
+
'GD' => 'Grenada',
|
50
|
+
'GB' => 'United Kingdom',
|
51
|
+
'GA' => 'Gabon',
|
52
|
+
'SV' => 'El Salvador',
|
53
|
+
'GN' => 'Guinea',
|
54
|
+
'GM' => 'Gambia',
|
55
|
+
'GL' => 'Greenland',
|
56
|
+
'GI' => 'Gibraltar',
|
57
|
+
'GH' => 'Ghana',
|
58
|
+
'OM' => 'Oman',
|
59
|
+
'TN' => 'Tunisia',
|
60
|
+
'JO' => 'Jordan',
|
61
|
+
'HT' => 'Haiti',
|
62
|
+
'HU' => 'Hungary',
|
63
|
+
'HK' => 'Hong Kong',
|
64
|
+
'HN' => 'Honduras',
|
65
|
+
'HM' => 'Heard and Mc Donald Islands',
|
66
|
+
'VE' => 'Venezuela',
|
67
|
+
'PR' => 'Puerto Rico',
|
68
|
+
'PW' => 'Pala',
|
69
|
+
'PT' => 'Portugal',
|
70
|
+
'SJ' => 'Svalbard and Jan Mayen Islands',
|
71
|
+
'PY' => 'Paraguay',
|
72
|
+
'IQ' => 'Iraq',
|
73
|
+
'PA' => 'Panama',
|
74
|
+
'PF' => 'French Polynesia',
|
75
|
+
'PG' => 'Papua New Guinea',
|
76
|
+
'PE' => 'Per',
|
77
|
+
'PK' => 'Pakistan',
|
78
|
+
'PH' => 'Philippines',
|
79
|
+
'PN' => 'Pitcairn',
|
80
|
+
'PL' => 'Poland',
|
81
|
+
'PM' => 'St. Pierre and Miquelon',
|
82
|
+
'ZM' => 'Zambia',
|
83
|
+
'EH' => 'Western Sahara',
|
84
|
+
'EE' => 'Estonia',
|
85
|
+
'EG' => 'Egypt',
|
86
|
+
'ZA' => 'South Africa',
|
87
|
+
'EC' => 'Ecuador',
|
88
|
+
'IT' => 'Italy',
|
89
|
+
'VN' => 'Viet Nam',
|
90
|
+
'SB' => 'Solomon Islands',
|
91
|
+
'ET' => 'Ethiopia',
|
92
|
+
'SO' => 'Somalia',
|
93
|
+
'ZW' => 'Zimbabwe',
|
94
|
+
'SA' => 'Saudi Arabia',
|
95
|
+
'ES' => 'Spain',
|
96
|
+
'ER' => 'Eritrea',
|
97
|
+
'MD' => 'Moldova, Republic of',
|
98
|
+
'MG' => 'Madagascar',
|
99
|
+
'MA' => 'Morocco',
|
100
|
+
'MC' => 'Monaco',
|
101
|
+
'UZ' => 'Uzbekistan',
|
102
|
+
'MM' => 'Myanmar',
|
103
|
+
'ML' => 'Mali',
|
104
|
+
'MO' => 'Maca',
|
105
|
+
'MN' => 'Mongolia',
|
106
|
+
'MH' => 'Marshall Islands',
|
107
|
+
'MK' => 'Macedonia, The Former Yugoslav Republic of',
|
108
|
+
'MU' => 'Mauritius',
|
109
|
+
'MT' => 'Malta',
|
110
|
+
'MW' => 'Malawi',
|
111
|
+
'MV' => 'Maldives',
|
112
|
+
'MQ' => 'Martinique',
|
113
|
+
'MP' => 'Northern Mariana Islands',
|
114
|
+
'MS' => 'Montserrat',
|
115
|
+
'MR' => 'Mauritania',
|
116
|
+
'UG' => 'Uganda',
|
117
|
+
'MY' => 'Malaysia',
|
118
|
+
'MX' => 'Mexico',
|
119
|
+
'IL' => 'Israel',
|
120
|
+
'FR' => 'France',
|
121
|
+
'IO' => 'British Indian Ocean Territory',
|
122
|
+
'SH' => 'St. Helena',
|
123
|
+
'FI' => 'Finland',
|
124
|
+
'FJ' => 'Fiji',
|
125
|
+
'FK' => 'Falkland Islands (Malvinas)',
|
126
|
+
'FM' => 'Micronesia, Federated States of',
|
127
|
+
'FO' => 'Faroe Islands',
|
128
|
+
'NI' => 'Nicaragua',
|
129
|
+
'NL' => 'Netherlands',
|
130
|
+
'NO' => 'Norway',
|
131
|
+
'NA' => 'Namibia',
|
132
|
+
'VU' => 'Vanuat',
|
133
|
+
'NC' => 'New Caledonia',
|
134
|
+
'NE' => 'Niger',
|
135
|
+
'NF' => 'Norfolk Island',
|
136
|
+
'NG' => 'Nigeria',
|
137
|
+
'NZ' => 'New Zealand',
|
138
|
+
'ZR' => 'Zaire',
|
139
|
+
'NP' => 'Nepal',
|
140
|
+
'NR' => 'Naur',
|
141
|
+
'NU' => 'Niue',
|
142
|
+
'CK' => 'Cook Islands',
|
143
|
+
'CI' => 'Cote d\'Ivoire',
|
144
|
+
'CH' => 'Switzerland',
|
145
|
+
'CO' => 'Colombia',
|
146
|
+
'CN' => 'China',
|
147
|
+
'CM' => 'Cameroon',
|
148
|
+
'CL' => 'Chile',
|
149
|
+
'CC' => 'Cocos (Keeling) Islands',
|
150
|
+
'CA' => 'Canada',
|
151
|
+
'CG' => 'Congo',
|
152
|
+
'CF' => 'Central African Republic',
|
153
|
+
'CZ' => 'Czech Republic',
|
154
|
+
'CY' => 'Cyprus',
|
155
|
+
'CX' => 'Christmas Island',
|
156
|
+
'CR' => 'Costa Rica',
|
157
|
+
'CV' => 'Cape Verde',
|
158
|
+
'CU' => 'Cuba',
|
159
|
+
'SZ' => 'Swaziland',
|
160
|
+
'SY' => 'Syrian Arab Republic',
|
161
|
+
'KG' => 'Kyrgyzstan',
|
162
|
+
'KE' => 'Kenya',
|
163
|
+
'SR' => 'Suriname',
|
164
|
+
'KI' => 'Kiribati',
|
165
|
+
'KH' => 'Cambodia',
|
166
|
+
'KN' => 'Saint Kitts and Nevis',
|
167
|
+
'KM' => 'Comoros',
|
168
|
+
'ST' => 'Sao Tome and Principe',
|
169
|
+
'SI' => 'Slovenia',
|
170
|
+
'KW' => 'Kuwait',
|
171
|
+
'SN' => 'Senegal',
|
172
|
+
'SM' => 'San Marino',
|
173
|
+
'SL' => 'Sierra Leone',
|
174
|
+
'SC' => 'Seychelles',
|
175
|
+
'KZ' => 'Kazakhstan',
|
176
|
+
'KY' => 'Cayman Islands',
|
177
|
+
'SG' => 'Singapore',
|
178
|
+
'SE' => 'Sweden',
|
179
|
+
'SD' => 'Sudan',
|
180
|
+
'DO' => 'Dominican Republic',
|
181
|
+
'DM' => 'Dominica',
|
182
|
+
'DJ' => 'Djibouti',
|
183
|
+
'DK' => 'Denmark',
|
184
|
+
'VG' => 'Virgin Islands (British)',
|
185
|
+
'DE' => 'Germany',
|
186
|
+
'YE' => 'Yemen',
|
187
|
+
'DZ' => 'Algeria',
|
188
|
+
'US' => 'United States',
|
189
|
+
'UY' => 'Uruguay',
|
190
|
+
'YT' => 'Mayotte',
|
191
|
+
'UM' => 'United States Minor Outlying Islands',
|
192
|
+
'LB' => 'Lebanon',
|
193
|
+
'LC' => 'Saint Lucia',
|
194
|
+
'LA' => 'Lao People\'s Democratic Republic',
|
195
|
+
'TV' => 'Tuval',
|
196
|
+
'TW' => 'Taiwan',
|
197
|
+
'TT' => 'Trinidad and Tobago',
|
198
|
+
'TR' => 'Turkey',
|
199
|
+
'LK' => 'Sri Lanka',
|
200
|
+
'LI' => 'Liechtenstein',
|
201
|
+
'LV' => 'Latvia',
|
202
|
+
'TO' => 'Tonga',
|
203
|
+
'LT' => 'Lithuania',
|
204
|
+
'LU' => 'Luxembourg',
|
205
|
+
'LR' => 'Liberia',
|
206
|
+
'LS' => 'Lesotho',
|
207
|
+
'TH' => 'Thailand',
|
208
|
+
'TF' => 'French Southern Territories',
|
209
|
+
'TG' => 'Togo',
|
210
|
+
'TD' => 'Chad',
|
211
|
+
'TC' => 'Turks and Caicos Islands',
|
212
|
+
'LY' => 'Libyan Arab Jamahiriya',
|
213
|
+
'VA' => 'Vatican City State (Holy See)',
|
214
|
+
'VC' => 'Saint Vincent and The Grenadines',
|
215
|
+
'AE' => 'United Arab Emirates',
|
216
|
+
'AD' => 'Andorra',
|
217
|
+
'AG' => 'Antigua and Barbuda',
|
218
|
+
'AF' => 'Afghanistan',
|
219
|
+
'AI' => 'Anguilla',
|
220
|
+
'VI' => 'Virgin Islands (U.S.)',
|
221
|
+
'IS' => 'Iceland',
|
222
|
+
'IR' => 'Iran (Islamic Republic of)',
|
223
|
+
'AM' => 'Armenia',
|
224
|
+
'AL' => 'Albania',
|
225
|
+
'AO' => 'Angola',
|
226
|
+
'AN' => 'Netherlands Antilles',
|
227
|
+
'AQ' => 'Antarctica',
|
228
|
+
'AS' => 'American Samoa',
|
229
|
+
'AR' => 'Argentina',
|
230
|
+
'AU' => 'Australia',
|
231
|
+
'AT' => 'Austria',
|
232
|
+
'AW' => 'Aruba',
|
233
|
+
'IN' => 'India',
|
234
|
+
'TZ' => 'Tanzania, United Republic of',
|
235
|
+
'AZ' => 'Azerbaijan',
|
236
|
+
'IE' => 'Ireland',
|
237
|
+
'ID' => 'Indonesia',
|
238
|
+
'UA' => 'Ukraine',
|
239
|
+
'QA' => 'Qatar',
|
240
|
+
'MZ' => 'Mozambique',
|
241
|
+
'BA' => 'Bosnia and Herzegovina',
|
242
|
+
'CD' => 'Congo, The Democratic Republic of the',
|
243
|
+
'CS' => 'Serbia and Montenegro',
|
244
|
+
'HR' => 'Croatia',
|
245
|
+
'KP' => 'Korea (North), Democratic People\'s Republic of',
|
246
|
+
'KR' => 'Korea (South), Republic of',
|
247
|
+
'SK' => 'Slovakia',
|
248
|
+
'SU' => 'Soviet Union (historical, 1922-1991)',
|
249
|
+
'TL' => 'East Timor',
|
250
|
+
'XC' => 'Czechoslovakia (historical, 1918-1992)',
|
251
|
+
'XE' => 'Europe',
|
252
|
+
'XG' => 'East Germany (historical, 1949-1990)',
|
253
|
+
'XU' => '[Unknown Country]',
|
254
|
+
'XW' => '[Worldwide]',
|
255
|
+
'YU' => 'Yugoslavia (historical, 1918-1992)',
|
256
|
+
}
|
257
|
+
|
258
|
+
end
|
259
|
+
end
|