-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathlyrics.js
114 lines (98 loc) · 7.23 KB
/
lyrics.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
var MM = {
lyrics: [],
sample: {
message: {
header: {
status_code: 200,
execute_time: 0.095350027084351
},
body: {
subtitle: {
subtitle_id: 62675,
restricted: 0,
subtitle_body: "[00:02.18] I was toting my pack along the dusty [00:04.81] Winnemucca [00:05.81] road [00:06.58] When along came a semi with a high canvas covered load [00:10.93] If your goin' to Winnemucca, Mack with me you can ride [00:15.58] And so I climbed into the cab and then I settled down inside [00:21.19] He asked me if I'd seen a road with so much dust and sand [00:25.71] And I said, \"Listen! I've traveled every road in this here land!\" [00:31.46] I've Been Everywhere, man [00:33.46] I've Been Everywhere, man [00:35.63] Crossed the deserts bare, man [00:37.72] I've breathed the mountain air, man [00:39.84] Of travel I've had my share, man [00:42.07] I've Been Everywhere [00:45.42] I've been to: [00:45.89] Reno [00:46.28] Chicago [00:47.04] Fargo [00:47.57] Minnesota [00:48.24] Buffalo [00:48.61] Toronto [00:48.96] Winslow [00:49.36] Sarasota [00:49.75] Wichita [00:50.22] Tulsa [00:50.75] Ottawa [00:51.21] Oklahoma [00:51.79] Tampa [00:52.35] Panama [00:52.81] Mattawa [00:53.35] La Paloma [00:53.92] Bangor [00:54.42] Baltimore [00:54.90] Salvador [00:55.40] Amarillo [00:55.96] Tocapillo [00:56.47] Barranquilla [00:56.99] And [00:57.25] Perdilla [00:57.49] I'm a Killer [00:58.15] I've Been Everywhere, man [01:00.21] I've Been Everywhere, man [01:02.21] Crossed the deserts bare, man [01:04.62] I've breathed the mountain air, man [01:06.73] Of travel I've had my share, man [01:08.65] I've Been Everywhere [01:11.90] I've been to: [01:13.34] Boston [01:13.89] Charleston [01:14.34] Dayton [01:14.84] Louisiana [01:15.29] Washington [01:15.76] Houston [01:16.21] Kingston [01:16.73] Texarkana [01:17.21] Monterey [01:17.73] Fairaday [01:18.31] Santa Fe [01:18.87] Tallapoosa [01:19.43] Glen Rock [01:20.00] Black Rock [01:20.57] Little Rock [01:21.09] Oskaloosa [01:21.65] Tennessee [01:22.20] Tennessee [01:22.73] Chicopee [01:23.31] Spirit Lake [01:23.81] Grand Lake [01:24.37] Devil's Lake [01:24.89] Crater Lake [01:25.39] For Pete's Sake [01:25.89] I've Been Everywhere, man [01:30.01] I've Been Everywhere, man [01:30.50] Crossed the deserts bare, man [01:32.03] I've breathed the mountain air, man [01:34.23] Of travel I've had my share, man [01:36.35] I've Been Everywhere [01:39.75] I've been to: [01:41.04] Louisville [01:41.50] Nashville [01:42.03] Knoxville [01:42.57] Ombabika [01:43.18] Schefferville [01:43.68] Jacksonville [01:44.20] Waterville [01:44.73] Costa Rock [01:45.29] Pittsfield [01:45.76] Springfield [01:46.32] Bakersfield [01:46.81] Shreveport [01:47.35] Hackensack [01:47.93] Cadillac [01:48.43] Fond du Lac [01:48.93] Davenport [01:49.45] Idaho [01:49.96] Jellico [01:50.48] Argentina [01:51.03] Diamantina [01:51.59] Pasadena [01:52.10] Catalina [01:52.68] See What I Mean [01:53.21] I've Been Everywhere, man [01:55.84] I've Been Everywhere, man [01:58.00] Crossed the deserts bare, man [02:00.09] I've breathed the mountain air, man [02:02.07] Of travel I've had my share, man [02:04.43] I've Been Everywhere [02:07.79] I've been to: [02:08.83] Pittsburgh [02:09.37] Parkersburg [02:09.93] Gravelbourg [02:10.44] Colorado [02:10.97] Ellensburg [02:11.46] Rexburg [02:12.00] Vicksburg [02:12.53] Eldorado [02:13.09] Larimore [02:13.56] Adimore [02:14.06] Haverstraw [02:14.59] Chatanika [02:15.09] Shasta [02:15.65] Nebraska [02:16.18] Alaska [02:16.72] Opalacka [02:17.27] Baraboo [02:17.78] Waterloo [02:18.34] Kalamazoo [02:18.90] Kansas City [02:19.49] Sioux City [02:20.06] Cedar City [02:20.56] Dodge City [02:21.02] What A Pity [02:21.52] I've Been Everywhere, man [02:23.63] I've Been Everywhere, man [02:25.87] Crossed the deserts bare, man [02:27.87] I've breathed the mountain air, man [02:29.96] Of travel I've had my share, man [02:32.12] I've Been Everywhere [02:35.56] I've Been Everywhere [02:43.81] ",
lyrics_copyright: null,
subtitle_length: 197,
subtitle_language: "en",
script_tracking_url: "http://tracking.musixmatch.com/t1.0/04n84gt40pQ4lkd7u1m6pF2rdczn1p1WLc5f3O2Bg0pzX6kpNIHrufDDU+vELsRRPltoAa6BWs/U7L0uAn2tj/9bJm+5IL53yoVkP3fxIm8H5z4j/DFTqrZCAtCkMaHtg0MnlgYBCJjmPr9OumFlPUcTJTCQFNg6EgFKTRnWWZ9mVU5eOyjZQFOQ/Vi52BDipeB3245ChEw8M7sIjeYeYoEuv/H6O5mVoBDHCyNhaCSxkEB/cXj4B9MnSATQOPU/TFBvcHQwAbTptT/fG/EX0Tjov3zBSi+K2IG/MZ+pV/nBTlg8v9c08tdnFt7zujnihF/91KhwiMLdPTGpZiFslL8vWiTi4LgB0KuiVO9zb2cXxieToJaP9XQu0gQGKsi8TVtGtTSUPfSzQKdD3+XZRTQ7YeqwoyFi+O4LDZ8obts=/",
pixel_tracking_url: "http://tracking.musixmatch.com/t1.0/N1DOV+SdGhMzAR7Ybr82sOYwa5xslZPDxQ+0hEjHFw8gsrCfrHX7XLJ/iAiuFD5RQKrLzqWq77snMdxFYrFxEo7rhSCACq9+8TsFw1kMx/KwQcQiumWIB2UTUZYl6fYaqlHh19D9eVZ8hev2GMvQAsQPfBV3Oe/Ec1UCAsfej4QBuF7X4hfgXnmyZyGnF8jVdxhFD34CIvgAlNiKoZxu/PZvK5GNnHi80MbKK18Pv3BDyqdBPhxppBPrb5b6usaL7HmlW+3DPKk8w8jJy7CrcQ7/SaueyPFgbtljzAQzQC2cmNC5rYXTgjCciHyt3ZDwIdW9tH/eiltnJLh+DYiFBCQ0JofjP2tVHfO9UaJ98Qr2600L1MQu0IqzfceXwJMKQQTJ0xSDUFcah044uacymnOMSLNf/QbTUC/IBNmKcto=/",
html_tracking_url: "http://tracking.musixmatch.com/t1.0//4s5uZG6V0NlNXZ11qbkPX4RTXqpCak2WNsh6qHiPeTtw9jOrF2nhy+Yr/GY+w2PIVqxX5oJjG/dL6OOxVP5RpClQkbyzlyINwZjmwwd+k13g3/mzwV4psogFygVxf4d0TnZqMxUjJpCLDowymqY2P/vHu106oCsQP8YL4rX68vX9WsfBZ/ANUkR2GQQvvpTQa31mt+Llh/IPEH1LHTlaRhx8HppZQh8XHeOl5gv4bke23Xz4Tc+tArj1kV0fK32pfr4QEO3Qe/Q1NxV0dAt6yjQnKmvXm6H1DIfFikNBlMAQJBki8chekCpEv9p1EIC1ixvIZXLGlMt7h83THZbPn78H198GtA7GXId50vWpxVnTVd13jAF+C/GONgD3hT3mkBbcKZQqU9gGrbEVfzeLUNbkdbvvQcVgOyfSgcssKA=/",
updated_time: "2012-09-27T23:25:04Z"
}
}
}
},
nextLyric: false,
finished: false,
offset: 200,
distance: 0,
getNextLyric: function(time) {
if (!this.nextLyric && !this.finished) {
this.nextLyric = this.lyrics[1];
// console.log(this.nextLyric);
}
if (time+this.offset > this.nextLyric.time) {
var r = this.nextLyric;
// console.log(this.nextLyric);
if (this.lyrics[r.id+1]) {
this.nextLyric = this.lyrics[r.id+1];
} else {
this.nextLyric = false;
this.finished = true;
$('#finger').show();
$('#distance').animate({bottom: '55%'}, function() {
$('#distance').animate({bottom: '50%'});
});
}
return r;
}
return false;
},
key: "b2d4cb582fdfde55bd80539fc9e29d15",
_get:function(method, params, callback) {
callback(MM.sample);
return;
params.apikey = this.key;
params.format = 'JSONP';
params.callback = 'mmcb';
var url = "http://api.musixmatch.com/ws/1.1/"+method;
$.get(url, params, function(data) {
callback(data);
});
},
track: {
subtitle: function(mbid, callback) {
MM._get('track.subtitle.get', {'track_mbid': mbid}, function(data) {
MM.parse(data.message.body.subtitle.subtitle_body, callback);
});
}
},
parse: function(subtitles, callback) {
var pattern = "/[[0-9]+:[0-9]+.[0-9]+]/";
var lines = subtitles.replace(/\[/g, "\n[");
lines = lines.split("\n");
var i = 0;
var indexed = {};
$.each(lines, function(i,e) {
parts = e.split("]");
if (parts.length == 2) {
t = parts[0];
t = t.substr(1);
t = t.split(':');
mins = t[0];
//t = t[1].split('.');
t = (t[0]*60*1000) + (t[1]) * 1000;// + t[2];
indexed[i] = {
id: i,
time: t,
lyric: $.trim(parts[1])
};
i++;
}
});
callback(indexed);
}
};
function mmcb(data) {
// console.log(data);
}