View difference between Paste ID: hrD2eicv and UCLwVx86
SHOW: | | - or go back to the newest paste.
1
// ==PREPROCESSOR==
2
// @name "Youtube Radio"
3
// @author "Mire777"
4
// @feature "v1.4"
5
// @feature "watch-metadb"
6
// ==/PREPROCESSOR==
7
8
//Properties
9-
auto_yt = window.GetProperty("YT  Radio", "0");
9+
YT_PL = window.GetProperty("YT  Playlist", "0");
10-
AUTO = window.GetProperty("YT  Auto", "0");
10+
YT_AUTO = window.GetProperty("YT  Auto", "0");
11-
ooo2 = window.GetProperty("YT Track", "");
11+
YT_TRACK = window.GetProperty("YT Track", "");
12-
START_ARTIST = window.GetProperty("YT  Station", "");
12+
STATION = window.GetProperty("YT  Station", "");
13-
last_fm = window.GetProperty("YT Similar", "");
13+
SIM_ART = window.GetProperty("YT Similar", "");
14
YT_URL = window.GetProperty("YT URL", "");
15
art = window.GetProperty("YT   Artist Variety (1-20)", "20");
16
sng = window.GetProperty("YT   Song  Hotness (1-20)", "20");
17-
gnr = window.GetProperty("YT   Tag  Hotness (1-100)", "27");
17+
tag = window.GetProperty("YT   Tag  Hotness (1-100)", "27");
18
pls = window.GetProperty("FB Playlist", "YT Radio");
19
20
var MF_GRAYED = 0x00000001;
21
var MF_STRING = 0x00000000;
22
var IDC_ARROW = 32512;
23
var IDC_HAND = 32649;
24
25
function RGB(r, g, b) {
26-
	return (0xff000000 | (r << 16) | (g << 8) | (b));
26+
return (0xff000000 | (r << 16) | (g << 8) | (b));
27
}
28
29
function RGBA(r, g, b, a) {
30-
	return ((a << 24) | (r << 16) | (g << 8) | (b));
30+
return ((a << 24) | (r << 16) | (g << 8) | (b));
31
}
32
33
function on_colors_changed() {
34-
	p.colors_changed();
34+
p.colors_changed();
35
}
36
37
function on_selection_changed() {
38-
	p.item_focus_change();
38+
p.item_focus_change();
39
}
40
41
function on_playlist_switch() {
42-
    set_focus0(); //Check Playlist
42+
set_focus0(); //Check Playlist
43
}
44
45
function on_playback_new_track() {
46-
	p.item_focus_change();
46+
p.item_focus_change();
47-
    downloadLFM();
47+
LOAD_ART();
48
}
49
50
function on_playback_dynamic_info_track() {
51-
	p.item_focus_change();
51+
p.item_focus_change();
52
}
53
54
function on_playback_stop() {
55-
	p.item_focus_change();
55+
p.item_focus_change();
56
}
57
58
function on_item_focus_change() {
59-
	p.item_focus_change();
59+
p.item_focus_change();
60
}
61
62
function on_mouse_leave() {
63
}
64
65
function on_mouse_rbtn_up(x, y) {
66
p.rbtn_up(x, y);
67-
	p.rbtn_up(x, y);
67+
68-
	return true;
68+
69
70
//Playlist
71
function GetPlaylistID(Playlist_Name)
72
{
73
for (var i = 0; i < fb.PlaylistCount; i++)
74-
    for (var i = 0; i < fb.PlaylistCount; i++)
74+
75
if (fb.GetPlaylistName(i) == Playlist_Name)
76-
        if (fb.GetPlaylistName(i) == Playlist_Name)
76+
77
return i;
78
}
79-
            return i;
79+
80
81
//Create playlist if it doesn't exist
82-
    // create playlist if it doesn't exist
82+
fb.CreatePlaylist(fb.PlaylistCount, Playlist_Name);
83-
    fb.CreatePlaylist(fb.PlaylistCount, Playlist_Name);
83+
return i;
84-
    return i;
84+
85
86
//Playlist(Check)
87
function GetPlaylistID0(Playlist_Name)
88
{
89
for (var i = 0; i < fb.PlaylistCount; i++)
90-
    for (var i = 0; i < fb.PlaylistCount; i++)
90+
if (fb.GetPlaylistName(i) == Playlist_Name)
91
{
92-
    if (fb.GetPlaylistName(i) == Playlist_Name)
92+
return i;
93
}
94
}
95-
            return i;
95+
96
//Focus on playlist(Check)
97
function set_focus0()
98
{   
99
if (pls>"")
100
{
101-
{   if (pls>"")
101+
var PL_NM = (GetPlaylistID0(pls + " ["+ STATION +"]"));
102
if (fb.ActivePlaylist == PL_NM) {YT_PL = 1; window.SetProperty("YT  Playlist", "1");}
103-
var PL_NM = (GetPlaylistID0(pls + " ["+ START_ARTIST +"]"));
103+
104-
if (fb.ActivePlaylist == PL_NM) {auto_yt = 1; window.SetProperty("YT  Radio", "1");}
104+
{YT_PL = 0; window.SetProperty("YT  Playlist", "0");}
105
}
106-
{auto_yt = 0; window.SetProperty("YT  Radio", "0");}
106+
107
108
//Focus on playlist(YT Radio)
109
function set_focus()
110
{   
111
if (pls>"")
112-
{   if (pls>"")
112+
fb.ActivePlaylist = (GetPlaylistID(pls + " ["+ STATION +"]"));
113-
    fb.ActivePlaylist = (GetPlaylistID(pls + " ["+ START_ARTIST +"]"));
113+
114
115
//Focus on playlist(Same Video)
116
function set_focus2()
117
{   
118-
{   if (pls>"")
118+
119-
    fb.ActivePlaylist = (GetPlaylistID(pls + " [Same Video]"));
119+
fb.ActivePlaylist = (GetPlaylistID(pls + " [Same Video]"));
120
}
121
122
//Focus on playlist(Search Videos)
123
function set_focus3()
124
{   
125-
{   if (pls>"")
125+
126-
    fb.ActivePlaylist = (GetPlaylistID(pls + " [Search Videos]"));
126+
fb.ActivePlaylist = (GetPlaylistID(pls + " [Search Videos]"));
127
}
128
129
//Focus on playlist(Top Tracks)
130-
function panel(name, features) {
130+
function set_focus4()
131-
	this.item_focus_change = function() {
131+
{   
132-
		if (!this.metadb_func) return;
132+
133-
		switch(this.selection_mode) {
133+
fb.ActivePlaylist = (GetPlaylistID(pls + " [Tracks: "+ p.artist +"]"));
134-
			case 0:
134+
135-
				this.metadb = fb.GetSelection();
135+
136
//Panel
137-
			case 1:
137+
     function panel(name, features) {
138-
				this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
138+
      this.item_focus_change = function() {
139
        if (!this.metadb_func) return;
140-
			case 2:
140+
        switch(this.selection_mode) {
141-
				this.metadb = fb.GetFocusItem();
141+
        case 0:
142
        this.metadb = fb.GetSelection();
143
        break;
144
        case 1:
145
        this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
146
        break;
147
        case 2:
148
        this.metadb = fb.GetFocusItem();
149
        break;
150
		}
151
		if (this.metadb) on_metadb_changed();
152-
	this.size = function() {
152+
153-
		this.w = window.Width;
153+
154-
		this.h = window.Height;
154+
155
this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
156
157
//Size	
158-
	this.move = function(x, y) {
158+
    this.size = function() {
159-
		this.mx = x;
159+
    this.w = window.Width;
160-
		this.my = y;
160+
    this.h = window.Height;
161
}
162
163
//Move	
164-
	this.rbtn_up = function(x, y) {
164+
    this.move = function(x, y) {
165-
		var _menu = window.CreatePopupMenu();
165+
    this.mx = x;
166-
		var idx;
166+
    this.my = y;
167-
		switch(true) {
167+
168
169
//Menu	
170-
			case typeof th == "object":
170+
    this.rbtn_up = function(x, y) {
171-
			case typeof im == "object":
171+
    var _menu = window.CreatePopupMenu();
172
    var idx;
173-
on_item_focus_change()
173+
    switch(true) {
174
            case typeof th == "object":
175-
if(AUTO==1) _menu.AppendMenuItem(MF_STRING, 1902, "Youtube Radio");
175+
            case typeof im == "object":
176-
if(AUTO==0) _menu.AppendMenuItem(MF_STRING, 1903, "Youtube Radio");
176+
177-
_menu.CheckMenuItem(1902, AUTO?1:0);
177+
on_item_focus_change()            
178
if (pls>"")
179
{					
180
if(YT_AUTO==1) _menu.AppendMenuItem(MF_STRING, 1902, "Youtube Radio");
181-
if(auto_yt==1 && AUTO==1 && START_ARTIST>"") {_menu.AppendMenuItem(MF_STRING, 22, "Get Next Video");}
181+
if(YT_AUTO==0) _menu.AppendMenuItem(MF_STRING, 1903, "Youtube Radio");
182
_menu.CheckMenuItem(1902, YT_AUTO?1:0);
183
184
_menu.AppendMenuSeparator();
185
{
186
if(YT_PL==1 && YT_AUTO==1 && STATION>"") {_menu.AppendMenuItem(MF_STRING, 22, "Get Next Video");}
187
else
188
{_menu.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Get Next Video");}
189
190
_menu.AppendMenuItem(MF_STRING, 401, "Search Videos");
191
192
_menu.AppendMenuSeparator();
193
194
_menu.AppendMenuItem(MF_STRING, 1914, "Start Radio Station");
195
196
p.artist = p.eval("%artist%");
197
if (p.artist == "" || p.artist == "?") {_menu.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Same Artist Station");}
198
else
199
{_menu.AppendMenuItem(MF_STRING, 1915, "Same Artist Station");}
200
201
_menu.AppendMenuSeparator();
202
203
p.artist = p.eval("%artist%");
204
if (p.artist == "" || p.artist == "?") {_menu.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Open Same Video");}
205
else
206-
{_menu.AppendMenuItem(MF_STRING, 404, "Find in Browser");}
206+
207-
					
207+
208
/*p.artist = p.eval("%artist%");
209
if (p.artist == "" || p.artist == "?") {_menu.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Find in Browser");}
210
else
211
{_menu.AppendMenuItem(MF_STRING, 404, "Find in Browser");}*/
212
213
p.artist = p.eval("%artist%");
214
if (p.artist == "" || p.artist == "?") {_menu.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Popular Tracks...");}
215
else
216
{_menu.AppendMenuItem(MF_STRING, 1916, "Popular Tracks...");}
217
218-
		switch(idx) {
218+
219
220
_menu.AppendMenuItem(MF_STRING, 9, "Properties...");
221
}				
222
}
223
} 
224
if (pls=="") {_menu.AppendMenuItem(MF_STRING, 9, "Please Set: (FB Playlist)");}
225
if (utils.IsKeyPressed(0x10)) _menu.AppendMenuItem(MF_STRING, 10, "Configure...");
226
		
227
        idx = _menu.TrackPopupMenu(x, y);
228
        switch(idx) {
229-
				downloadLFM();
229+
230
           case 9:
231
				window.ShowProperties();
232
				break;
233
                
234
           case 10:
235
				window.ShowConfigure();
236
				break;
237
                
238-
            this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
238+
239-
            set_focus2(); //Focus on playlist
239+
240-
            downloadART_TITLE();
240+
				LOAD_ART();
241
				break;
242
                
243
           case 401:
244-
            p.artist = p.eval("%artist% %title%");
244+
245-
            p.browser("http://www.youtube.com/results?search_query=" + encodeURIComponent(p.artist));
245+
246
				break;
247
                
248
           case 403:
249-
                AUTO = 0;
249+
                this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
250
                set_focus2(); //Focus on playlist
251
                LOAD_SAME();
252
				break;
253
			
254-
                AUTO = 1;
254+
255
                p.artist = p.eval("%artist% %title%");
256
                p.browser("http://www.youtube.com/results?search_query=" + encodeURIComponent(p.artist));
257
                break;
258
           
259-
            var Start;
259+
260-
            Start = this.InputBox("Type Artist to Start Station\n\n( *genre - will play genre station)", "Youtube Radio", "");
260+
                YT_AUTO = 0;
261-
            if (Start=="")
261+
262
                break;
263
       
264-
            else
264+
265
                YT_AUTO = 1;
266-
            auto_yt = 1;
266+
267-
            window.SetProperty("YT  Radio", "1");
267+
268-
            AUTO = "1"
268+
269-
            window.SetProperty("YT  Auto", "1");
269+
270-
            START_ARTIST = Start;
270+
                var Start;
271-
            window.SetProperty("YT  Station", Start);
271+
                Start = this.InputBox("Type Artist to Start Station\n\n( *genre - will play genre station)", "Youtube Radio", "");
272-
            set_focus(); //Focus on playlist
272+
                if (Start=="")
273-
            downloadLFM();
273+
                {
274
                }
275
                else
276
                {
277-
        case 1915:
277+
                YT_PL = 1;
278-
            this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
278+
                window.SetProperty("YT  Playlist", "1");
279-
            p.artist = p.eval("%artist%");
279+
                YT_AUTO = "1"
280-
            if (p.artist == "" || p.artist == "?") return;
280+
281-
            START_ARTIST = p.artist;
281+
                STATION = Start;
282-
            window.SetProperty("YT  Station", p.artist);
282+
                window.SetProperty("YT  Station", Start);
283-
            auto_yt = 1;
283+
284-
            window.SetProperty("YT  Radio", "1");
284+
                LOAD_ART();
285-
            AUTO = "1"
285+
286-
            window.SetProperty("YT  Auto", "1");
286+
287-
            set_focus(); //Focus on playlist
287+
288-
            downloadLFM();
288+
           case 1915:
289
                this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
290
                p.artist = p.eval("%artist%");
291-
		_menu.Dispose();
291+
                if (p.artist == "" || p.artist == "?") return;
292
                STATION = p.artist;
293
                window.SetProperty("YT  Station", p.artist);
294
                YT_PL = 1;
295-
	this.features_init = function() {
295+
                window.SetProperty("YT  Playlist", "1");
296-
		for (i = 0; i < this.features.length; i++) {
296+
                YT_AUTO = "1"
297-
			switch(this.features[i]) {
297+
298-
				case "metadb":
298+
299-
					this.selection_mode = 1;
299+
                LOAD_ART();
300-
					break;
300+
301-
				case "remap":
301+
302-
					this.artist_tf = ("%artist%");
302+
           case 1916:
303-
					break;
303+
                set_focus4(); //focus on playlist
304
                TOP_TRACKS();
305
                break;
306
                
307
               }
308-
	this.check_feature = function(f) {
308+
		        _menu.Dispose();
309-
		for (i = 0; i < this.features.length; i++) {
309+
	         }
310-
			if (this.features[i] == f) return true;
310+
311
//Features init
312-
		return false;
312+
    this.features_init = function() {
313
    for (i = 0; i < this.features.length; i++) {
314
    switch(this.features[i]) {
315
    case "metadb":
316-
		if (!this.metadb || tf == "") return "";
316+
    this.selection_mode = 1;
317-
		if (fb.IsPlaying && this.metadb.RawPath.indexOf("file://") != 0) {
317+
    break;
318-
			return fb.TitleFormat(tf).Eval();
318+
    case "remap":
319-
		} else {
319+
    this.artist_tf = ("%artist%");
320-
			return fb.TitleFormat(tf).EvalWithMetadb(this.metadb);
320+
    break;
321
			}
322
		}
323
	}
324
	
325-
	this.console = function(message) {
325+
    this.check_feature = function(f) {
326-
	this.name = "Youtube Radio"	
326+
    for (i = 0; i < this.features.length; i++) {
327-
        fb.trace(this.name + ": " + message);
327+
    if (this.features[i] == f) return true;
328
    }
329
    return false;
330
    }
331-
String.prototype.trim = function() {
331+
332-
	return this.replace(/^\s+|\s+$/g, "");
332+
//Eval
333-
}    
333+
334
    if (!this.metadb || tf == "") return "";
335
    if (fb.IsPlaying && this.metadb.RawPath.indexOf("file://") != 0) {
336
    return fb.TitleFormat(tf).Eval();
337-
		prompt = prompt.replace(/"/g, '" + Chr(34) + "').replace(/\n/g, '" + Chr(13) + "');
337+
    } else {
338-
		title = title.replace(/"/g, '" + Chr(34) + "');
338+
    return fb.TitleFormat(tf).EvalWithMetadb(this.metadb);
339-
		value = value.replace(/"/g, '" + Chr(34) + "');
339+
340-
		var temp_value = this.vb.eval('InputBox' + '("' + prompt + '", "' + title + '", "' + value + '")');
340+
341-
		if (typeof temp_value == "undefined") return value;
341+
342-
		if (temp_value.length == 254) this.MsgBox("Your entry was too long and will be truncated.\n\nSee the WSH panel mod script discussion thread on hydrogenaudio forums for help.", 0, "Youtube Radio");
342+
343-
		return temp_value.trim();
343+
    this.console = function(message) {
344
    this.name = "Youtube Radio"	
345
    fb.trace(this.name + ": " + message);
346
    }
347
	
348-
		prompt = prompt.replace(/"/g, '" + Chr(34) + "').replace(/\n/g, '" + Chr(13) + "');
348+
349-
		title = title.replace(/"/g, '" + Chr(34) + "');
349+
    String.prototype.trim = function() {
350-
		return this.vb.eval('MsgBox' + '("' + prompt + '", "' + buttons + '", "' + title + '")');
350+
    return this.replace(/^\s+|\s+$/g, "");
351
    }    
352
353
//Input Box    
354
	this.InputBox = function(prompt, title, value) {
355-
		if (!this.run(command)) this.MsgBox("Unable to launch your default browser.", 0, "Youtube Radio");
355+
    prompt = prompt.replace(/"/g, '" + Chr(34) + "').replace(/\n/g, '" + Chr(13) + "');
356
    title = title.replace(/"/g, '" + Chr(34) + "');
357
    value = value.replace(/"/g, '" + Chr(34) + "');
358
    var temp_value = this.vb.eval('InputBox' + '("' + prompt + '", "' + title + '", "' + value + '")');
359
    if (typeof temp_value == "undefined") return value;
360-
		try {
360+
    if (temp_value.length == 254) this.MsgBox("Your entry was too long and will be truncated.\n\nSee the WSH panel mod script discussion thread on hydrogenaudio forums for help.", 0, "Youtube Radio");
361-
			this.WshShell.Run(command);
361+
    return temp_value.trim();
362-
			return true;
362+
363-
		} catch(e) {
363+
364-
			return false;
364+
365
	this.MsgBox = function(prompt, buttons, title) {
366
    prompt = prompt.replace(/"/g, '" + Chr(34) + "').replace(/\n/g, '" + Chr(13) + "');
367
    title = title.replace(/"/g, '" + Chr(34) + "');
368
    return this.vb.eval('MsgBox' + '("' + prompt + '", "' + buttons + '", "' + title + '")');
369
	}
370
371
//Browser	
372
	this.browser = function(command) {
373
    if (!this.run(command)) this.MsgBox("Unable to launch your default browser.", 0, "Youtube Radio");
374
	}
375
376
//Run Command	
377-
	this.artist_tf = "%path%";
377+
378
    try {
379
    this.WshShell.Run(command);
380
    return true;
381
    } catch(e) {
382
    return false;
383
    }
384
	}
385
	
386
//futures	
387
    this.metadb_func = typeof on_metadb_changed == "function";
388
	this.features = features;
389
	this.dui = window.InstanceType;
390
	this.metadb = fb.GetFocusItem();
391-
        return t.replace(/about:\//,"").replace("music/","").replace("/_/"," - ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("free-music-downloads","").replace("/+similar?page=2","").replace("/+events","").replace("/+wiki","").replace("-+","").replace("/+albums","").replace("/+tags","").replace("/+images","").replace("/journal","").replace("/charts","").replace("/images","").replace("/listeners","").replace("/similar?page=17","").replace("/news","").replace("/groups","").replace("/albums","").replace("/videos","").replace("/tracks","").replace("/similar","").replace("/tags","").replace("noredirect/","").replace("listeners/+tracks","").replace("videos/+tracks","").replace("/+videos/","").replace("?page=1","").replace("?page=8","").replace("?page=5","").replace("?page=7","").replace("?page=9","").replace("?page=8","").replace(" wiki/edit","").replace("/ similar","").replace("?page=","'").replace("/ charts","'").replace("-","").replace("%2F%E3%82%A4%E3%83%95%E3%83%BB%E3%83%8E%E3%83%83%E3%83%88%E3%83%BB%E3%83%95%E3%82%A9%E3%83%BE3%83%BB%E3%83%A6%E3%83%BC","").replace("Ajoutez ce titre sur Deezer exclusivement sur www.hotmixradio.fr","").replace("www.Hituri.net","").replace("%E3%81%97%E3%82%83%E3%81%AB%E3%82%80%E3%81%AB%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%EF","").replace("%B81%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%EF%B81","").replace("%E4%BD%95%E3%82%88%E3%82%8A%E3%82%82%E5%83%95%E3%82%89%E3%81%97%E3%81%8F%E3%80%81%E4%BD%95%E3%82%88%E3%82%8A","").replace("%E3%82%82%E5%90%9B%E3%82%89%E3%81%97%E3%81%8F","").replace("%D0%91%D1%8D0%B5%D1%82 %D0%BF%D0%BE %D0%B3%D0%BB%D0%B0%D0%B7%D0%B0%D0%BC","").replace("%E3%83%9E%E3%82%A4%E3%83%BB%E3%83%9E3%83%87%E3%82%A3","").replace("%D0%9B%D0%B5%D1%82%D0%B5%D1%82%D1%8C","").replace("%2F%2F %D0%A1%D0%9B%D0%A3%D0%A8%D0%90%D0%AE%D0%A2","").replace("%D0%9F%D0%BE%D0%BF-%D0%A5%D0%B8%D1%82","").replace("/","").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'");
391+
392
	this.fso = new ActiveXObject("Scripting.FileSystemObject");
393
	this.vb = new ActiveXObject("ScriptControl");
394
	this.vb.Language = "VBScript";
395
	this.artist_tf = "%artist%";
396
	this.features_init();
397
    this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
398
    if (fb.GetFocusItem())
399
    {this.artist = fb.TitleFormat(this.artist_tf).EvalWithMetadb(this.metadb);}
400-
        return t.replace(/about:\//,"").trim().split(" (")[0].replace(" (","").split(" [")[0].replace(" [","").split(" {")[0].replace(" {","").split(", ")[0].replace(", ","").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace(" 01-","").replace(" 02-","").replace(" 03-","").replace(" 04-","").replace(" 05-","").replace(" 06-","").replace(" 07-","").replace(" 08-","").replace(" 09-","").replace("09  ","").replace("08  ","").replace("07  ","").replace("06  ","").replace("05  ","").replace("04  ","").replace("03  ","").replace("02  ","").replace("01  ","").replace("00  ","").replace("01 ","").replace("02 ","").replace("03 ","").replace("04 ","").replace("05 ","").replace("06 ","").replace("07 ","").replace("08 ","").replace("09 ","").replace("00 ","").replace(".mp","").replace(" - Remastered ","").replace(" - Remastered","").replace("- "," ").replace(decodeURIComponent(last_fm) + " -"," ").replace(decodeURIComponent(last_fm) + " - "," ").replace(" - Live ","").replace(" - Live","").replace(" Pt.1","").replace(" - Demo;2 Digital Remaster 66  ","").replace(" - Demo;2 Digital Remaster","").replace(" - Demo;","").replace(" - Demo","").replace("Digital Remaster","").replace("Original-  ","").replace("Original- ","").replace("Original-","").replace(" - Vocal Version","").replace(" Mega-Mix","").replace("Mega-Mix","").replace(" - Original Mix","").replace(" Pop Radio Edit","").replace(" Radio Edit","").replace(" - Single Version","").replace(" - Edited Version","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace(" - Extended Version","").replace(" -Remaster","").replace("`","'").replace(". "," ").replace(" Version","").replace(" edit","").replace(" - Edit","").replace("  Simple Mix","").replace("  Almighty Mix","").replace(" - Vocal","").replace(" Vocal","").replace("  Remix","").replace("  Extended Version","").replace(" - Explicit Version","").replace("- Explicit Version","").replace(" Explicit Version","").replace("Explicit Version","").replace(" Anthology", "").replace("The " + decodeURIComponent(last_fm), " ").replace(" - Survival Remix","").replace(" Radio Mix","").replace(" Survival Remix","").replace("Survival Remix","").replace(decodeURIComponent(last_fm) + "-"," ").replace(decodeURIComponent(last_fm)," ").replace(" Club Mix","").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("  wwwi.info","").replace(" Edit","").replace("live","").replace("Single","").replace("vk.com/xclusives zone ","").replace("  Acoustic","").replace("Remix","").replace("Part&","").replace("  +","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" Live;0 2","").replace("  Live;0 2","").replace("Live;0 2","").replace(' /"/"',"").replace(" -0","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("  Alternate Mix","").replace("Live","").replace(" Alternate Mix","").replace("Alternate Mix","").replace("-0","").replace("  remastered","").replace(" // СЛУШАЮТ:","").replace("www.KLAUSOM.lt","").replace("-;-Bit Digital Remaster","").replace(" :","").replace("-1  Remaster","").replace("  Genuine Album","").replace("  www.rsmp.com","").replace(" www.rsmp.com","").replace("www.rsmp.com","").replace("Instrumental","").replace(" Instrumental","").replace("www.SongsLover.pk","").replace(" Genuine Album","").replace("Album","").replace("Remaster","").replace("Lyrics","").replace("w/lyrics","").replace(" -","").replace("  Radio","").replace("0%","").replace("remaster","").replace(" Lyrics","").split(" | '' |")[0].replace(" | '' |","").split(" |")[0].replace(" |","").split("|")[0].replace("|","").split("| On:")[0].replace("| On:","").split(" feat")[0].replace(" feat","").split(" ft.")[0].replace(" ft.","").split(" Feat.")[0].replace(" Feat","").split("Greatest Hits Megamix")[0].replace("Greatest Hits Megamix","").split("Lyrics")[0].replace("Lyrics","").split("Lyric")[0].replace("Lyric","").split("www.")[0].replace("www.","").split(";Feat")[0].replace(";Feat","").trim();
400+
401
}
402
403
//YT NAMES-------------------------------------------------
404
405
//Clean Art Name
406
CLEAN_ART_NAME = function (t)
407
{   try
408
    {
409-
        return t.replace(/about:\//,"").replace("music/","").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("free-music-downloads","").replace("/+similar?page=2","").replace("/+events","").replace("/+wiki","").replace("-+","").replace("/+albums","").replace("/+tags","").replace("/+images","").replace("/journal","").replace("/charts","").replace("/images","").replace("/listeners","").replace("/similar?page=17","").replace("/news","").replace("/groups","").replace("/albums","").replace("/videos","").replace("/tracks","").replace("/similar","").replace("/tags","").replace("noredirect/","").replace("listeners/+tracks","").replace("videos/+tracks","").replace("/+videos/","").replace("?page=1","").replace("?page=8","").replace("?page=5","").replace("?page=7","").replace("?page=9","").replace("?page=8","").replace(" wiki/edit","").replace("/ similar","").replace("?page=","'").replace("/ charts","'").replace("-","").replace("%2F%E3%82%A4%E3%83%95%E3%83%BB%E3%83%8E%E3%83%83%E3%83%88%E3%83%BB%E3%83%95%E3%82%A9%E3%83%BE3%83%BB%E3%83%A6%E3%83%BC","").replace("Ajoutez ce titre sur Deezer exclusivement sur www.hotmixradio.fr","").replace("www.Hituri.net","").replace("%E3%81%97%E3%82%83%E3%81%AB%E3%82%80%E3%81%AB%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%EF","").replace("%B81%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%EF%B81","").replace("%E4%BD%95%E3%82%88%E3%82%8A%E3%82%82%E5%83%95%E3%82%89%E3%81%97%E3%81%8F%E3%80%81%E4%BD%95%E3%82%88%E3%82%8A","").replace("%E3%82%82%E5%90%9B%E3%82%89%E3%81%97%E3%81%8F","").replace("%D0%91%D1%8D0%B5%D1%82 %D0%BF%D0%BE %D0%B3%D0%BB%D0%B0%D0%B7%D0%B0%D0%BC","").replace("%E3%83%9E%E3%82%A4%E3%83%BB%E3%83%9E3%83%87%E3%82%A3","").replace("%D0%9B%D0%B5%D1%82%D0%B5%D1%82%D1%8C","").replace("%2F%2F %D0%A1%D0%9B%D0%A3%D0%A8%D0%90%D0%AE%D0%A2","").replace("%D0%9F%D0%BE%D0%BF-%D0%A5%D0%B8%D1%82","").replace("/","").split("tag")[0].split("hype")[0].split("events")[0];
409+
    return t.replace(/about:\//,"").replace("music/","").replace("/_/"," - ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("free-music-downloads","").replace("/+similar?page=2","").replace("/+events","").replace("/+wiki","").replace("-+","").replace("/+albums","").replace("/+tags","").replace("/+images","").replace("/journal","").replace("/charts","").replace("/images","").replace("/listeners","").replace("/similar?page=17","").replace("/news","").replace("/groups","").replace("/albums","").replace("/videos","").replace("/tracks","").replace("/similar","").replace("/tags","").replace("noredirect/","").replace("listeners/+tracks","").replace("videos/+tracks","").replace("/+videos/","").replace("?page=1","").replace("?page=8","").replace("?page=5","").replace("?page=7","").replace("?page=9","").replace("?page=8","").replace(" wiki/edit","").replace("/ similar","").replace("?page=","'").replace("/ charts","'").replace("-","").replace("%2F%E3%82%A4%E3%83%95%E3%83%BB%E3%83%8E%E3%83%83%E3%83%88%E3%83%BB%E3%83%95%E3%82%A9%E3%83%BE3%83%BB%E3%83%A6%E3%83%BC","").replace("Ajoutez ce titre sur Deezer exclusivement sur www.hotmixradio.fr","").replace("www.Hituri.net","").replace("%E3%81%97%E3%82%83%E3%81%AB%E3%82%80%E3%81%AB%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%EF","").replace("%B81%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%EF%B81","").replace("%E4%BD%95%E3%82%88%E3%82%8A%E3%82%82%E5%83%95%E3%82%89%E3%81%97%E3%81%8F%E3%80%81%E4%BD%95%E3%82%88%E3%82%8A","").replace("%E3%82%82%E5%90%9B%E3%82%89%E3%81%97%E3%81%8F","").replace("%D0%91%D1%8D0%B5%D1%82 %D0%BF%D0%BE %D0%B3%D0%BB%D0%B0%D0%B7%D0%B0%D0%BC","").replace("%E3%83%9E%E3%82%A4%E3%83%BB%E3%83%9E3%83%87%E3%82%A3","").replace("%D0%9B%D0%B5%D1%82%D0%B5%D1%82%D1%8C","").replace("%2F%2F %D0%A1%D0%9B%D0%A3%D0%A8%D0%90%D0%AE%D0%A2","").replace("%D0%9F%D0%BE%D0%BF-%D0%A5%D0%B8%D1%82","").replace("/","").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'");
410
    } catch (e) {}
411
}
412
413
//Clean Track Name
414
CLEAN_TRACK_NAME = function (t)
415
{   try
416-
this.downloadLFM = function()
416+
417-
{     if (AUTO=="1")
417+
    return t.replace(/about:\//,"").trim().split(" (")[0].replace(" (","").split(" [")[0].replace(" [","").split(" {")[0].replace(" {","").split(", ")[0].replace(", ","").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace(" 01-","").replace(" 02-","").replace(" 03-","").replace(" 04-","").replace(" 05-","").replace(" 06-","").replace(" 07-","").replace(" 08-","").replace(" 09-","").replace("09  ","").replace("08  ","").replace("07  ","").replace("06  ","").replace("05  ","").replace("04  ","").replace("03  ","").replace("02  ","").replace("01  ","").replace("00  ","").replace("01 ","").replace("02 ","").replace("03 ","").replace("04 ","").replace("05 ","").replace("06 ","").replace("07 ","").replace("08 ","").replace("09 ","").replace("00 ","").replace(".mp","").replace(" - Remastered ","").replace(" - Remastered","").replace("- "," ").replace(decodeURIComponent(SIM_ART) + " -"," ").replace(decodeURIComponent(SIM_ART) + " - "," ").replace(" - Live ","").replace(" - Live","").replace(" Pt.1","").replace(" - Demo;2 Digital Remaster 66  ","").replace(" - Demo;2 Digital Remaster","").replace(" - Demo;","").replace(" - Demo","").replace("Digital Remaster","").replace("Original-  ","").replace("Original- ","").replace("Original-","").replace(" - Vocal Version","").replace(" Mega-Mix","").replace("Mega-Mix","").replace(" - Original Mix","").replace(" Pop Radio Edit","").replace(" Radio Edit","").replace(" - Single Version","").replace(" - Edited Version","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace(" - Extended Version","").replace(" -Remaster","").replace("`","'").replace(". "," ").replace(" Version","").replace(" edit","").replace(" - Edit","").replace("  Simple Mix","").replace("  Almighty Mix","").replace(" - Vocal","").replace(" Vocal","").replace("  Remix","").replace("  Extended Version","").replace(" - Explicit Version","").replace("- Explicit Version","").replace(" Explicit Version","").replace("Explicit Version","").replace(" Anthology", "").replace("The " + decodeURIComponent(SIM_ART), " ").replace(" - Survival Remix","").replace(" Radio Mix","").replace(" Survival Remix","").replace("Survival Remix","").replace(decodeURIComponent(SIM_ART) + "-"," ").replace(decodeURIComponent(SIM_ART)," ").replace(" Club Mix","").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("  wwwi.info","").replace(" Edit","").replace("live","").replace("Single","").replace("vk.com/xclusives zone ","").replace("  Acoustic","").replace("Remix","").replace("Part&","").replace("  +","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" Live;0 2","").replace("  Live;0 2","").replace("Live;0 2","").replace(' /"/"',"").replace(" -0","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("  Alternate Mix","").replace("Live","").replace(" Alternate Mix","").replace("Alternate Mix","").replace("-0","").replace("  remastered","").replace(" // СЛУШАЮТ:","").replace("www.KLAUSOM.lt","").replace("-;-Bit Digital Remaster","").replace(" :","").replace("-1  Remaster","").replace("  Genuine Album","").replace("  www.rsmp.com","").replace(" www.rsmp.com","").replace("www.rsmp.com","").replace("Instrumental","").replace(" Instrumental","").replace("www.SongsLover.pk","").replace(" Genuine Album","").replace("Album","").replace("Remaster","").replace("Lyrics","").replace("w/lyrics","").replace(" -","").replace("  Radio","").replace("0%","").replace("remaster","").replace(" Lyrics","").split(" | '' |")[0].replace(" | '' |","").split(" |")[0].replace(" |","").split("|")[0].replace("|","").split("| On:")[0].replace("| On:","").split(" feat")[0].replace(" feat","").split(" ft.")[0].replace(" ft.","").split(" Feat.")[0].replace(" Feat","").split("Greatest Hits Megamix")[0].replace("Greatest Hits Megamix","").split("Lyrics")[0].replace("Lyrics","").split("Lyric")[0].replace("Lyric","").split("www.")[0].replace("www.","").split(";Feat")[0].replace(";Feat","").trim();
418-
      if (auto_yt=="1")
418+
419
}
420
421
//Clean Genre Name
422-
        if (START_ARTIST == "" || START_ARTIST == "?") return;
422+
423
{   try
424-
		this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(START_ARTIST) + "/+similar"+ "?page=" + a, true);
424+
425
    return t.replace(/about:\//,"").replace("music/","").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("free-music-downloads","").replace("/+similar?page=2","").replace("/+events","").replace("/+wiki","").replace("-+","").replace("/+albums","").replace("/+tags","").replace("/+images","").replace("/journal","").replace("/charts","").replace("/images","").replace("/listeners","").replace("/similar?page=17","").replace("/news","").replace("/groups","").replace("/albums","").replace("/videos","").replace("/tracks","").replace("/similar","").replace("/tags","").replace("noredirect/","").replace("listeners/+tracks","").replace("videos/+tracks","").replace("/+videos/","").replace("?page=1","").replace("?page=8","").replace("?page=5","").replace("?page=7","").replace("?page=9","").replace("?page=8","").replace(" wiki/edit","").replace("/ similar","").replace("?page=","'").replace("/ charts","'").replace("-","").replace("%2F%E3%82%A4%E3%83%95%E3%83%BB%E3%83%8E%E3%83%83%E3%83%88%E3%83%BB%E3%83%95%E3%82%A9%E3%83%BE3%83%BB%E3%83%A6%E3%83%BC","").replace("Ajoutez ce titre sur Deezer exclusivement sur www.hotmixradio.fr","").replace("www.Hituri.net","").replace("%E3%81%97%E3%82%83%E3%81%AB%E3%82%80%E3%81%AB%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%EF","").replace("%B81%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%EF%B81","").replace("%E4%BD%95%E3%82%88%E3%82%8A%E3%82%82%E5%83%95%E3%82%89%E3%81%97%E3%81%8F%E3%80%81%E4%BD%95%E3%82%88%E3%82%8A","").replace("%E3%82%82%E5%90%9B%E3%82%89%E3%81%97%E3%81%8F","").replace("%D0%91%D1%8D0%B5%D1%82 %D0%BF%D0%BE %D0%B3%D0%BB%D0%B0%D0%B7%D0%B0%D0%BC","").replace("%E3%83%9E%E3%82%A4%E3%83%BB%E3%83%9E3%83%87%E3%82%A3","").replace("%D0%9B%D0%B5%D1%82%D0%B5%D1%82%D1%8C","").replace("%2F%2F %D0%A1%D0%9B%D0%A3%D0%A8%D0%90%D0%AE%D0%A2","").replace("%D0%9F%D0%BE%D0%BF-%D0%A5%D0%B8%D1%82","").replace("/","").split("tag")[0].split("hype")[0].split("events")[0];
426
    } catch (e) {}
427-
			if (this.xmlhttp.readyState == 4) {
427+
428-
				if (this.xmlhttp.status == 200) {
428+
429-
					var text = this.xmlhttp.responsetext;
429+
430-
					if (!this.doc) this.doc = new ActiveXObject("htmlfile");
430+
431-
					this.doc.open();
431+
432-
					var div = this.doc.createElement("div");
432+
this.LOAD_ART = function()
433-
					div.innerHTML = text;
433+
{     if (YT_AUTO=="1")
434-
					var data = div.getElementsByTagName("a");
434+
      if (YT_PL=="1")
435-
					var urls = [];
435+
436
    { var randomnumber=Math.floor(Math.random()*art)
437
      var a=randomnumber;
438
        if (STATION == "" || STATION == "?") return;
439
		if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
440-
     if (data[i].href.indexOf("about:/music/") == 0) urls.push(CLEAN_ART_NAME(data[i].href));   
440+
		this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(STATION) + "/+similar"+ "?page=" + a, true);
441
		this.xmlhttp.send();
442
		this.xmlhttp.onreadystatechange = function() {
443
        if (this.xmlhttp.readyState == 4) {
444
        if (this.xmlhttp.status == 200) {
445
        var text = this.xmlhttp.responsetext;
446
        if (!this.doc) this.doc = new ActiveXObject("htmlfile");
447
        this.doc.open();
448
        var div = this.doc.createElement("div");
449
        div.innerHTML = text;
450
        var data = div.getElementsByTagName("a");
451
        var urls = [];
452
453
for (i = 0; i < data.length; i++) {
454
if (data[i].href.indexOf("about:/music/") == 0) urls.push(CLEAN_ART_NAME(data[i].href));   
455
}
456-
last_fm = window.SetProperty("YT Similar", urls[i]);
456+
457-
last_fm = urls[i];
457+
458
var randomnumber = Math.floor(Math.random()*(20-50)+50);
459
do{
460
randomnumber = Math.floor(Math.random()*(20-50)+50);
461
} while(randomnumber%2!=1);
462-
last_fm = window.SetProperty("YT Similar", "");
462+
463-
last_fm = "";
463+
464
{
465
466
//Start with urls[i]
467
if (urls[i] > "") 
468-
                this.doc.close();
468+
469-
                if (START_ARTIST.indexOf("*")== 0) {downloadGENRE();}
469+
470
SIM_ART = window.SetProperty("YT Similar", urls[i]);
471-
                if (last_fm == "" || last_fm == "?") {downloadLFM();}
471+
SIM_ART = urls[i];
472
window.SetProperty("YT Similar", urls[i]);
473-
                downloadTRACK();
473+
474-
				} else {
474+
475-
                if (START_ARTIST.indexOf("*")== 0) {downloadGENRE();}
475+
476
SIM_ART = window.SetProperty("YT Similar", "");
477-
                if (this.xmlhttp.status == 404) {p.console("HTTP error: " + this.xmlhttp.status); downloadLFM();}
477+
SIM_ART = "";
478
window.SetProperty("YT Similar", "");
479
}                   
480
}
481
            
482
        this.doc.close();
483
        if (STATION.indexOf("*")== 0) {LOAD_GENRE();}
484
        else
485
        if (SIM_ART == "" || SIM_ART == "?") {LOAD_ART();}
486-
this.downloadTRACK = function()
486+
487
        LOAD_TRACK();
488
        } else {
489
        if (STATION.indexOf("*")== 0) {LOAD_GENRE();}
490
        else
491-
        if (last_fm == "" || last_fm == "?") return;
491+
        if (this.xmlhttp.status == 404) {p.console("HTTP error: " + this.xmlhttp.status); LOAD_ART();}
492
                }
493-
		this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(last_fm) + "/+tracks" + "?page=" + a, true);
493+
494
		}
495
	}                             
496-
			if (this.xmlhttp.readyState == 4) {
496+
497-
				if (this.xmlhttp.status == 200) {
497+
498-
					var text = this.xmlhttp.responsetext;
498+
499-
					if (!this.doc) this.doc = new ActiveXObject("htmlfile");
499+
this.LOAD_TRACK = function()
500-
					this.doc.open();
500+
501-
					var div = this.doc.createElement("tr");
501+
502-
					div.innerHTML = text;
502+
503-
					var data = div.getElementsByTagName("td");
503+
     var a=randomnumber;
504-
					var urls = [];
504+
        if (SIM_ART == "" || SIM_ART == "?") return;
505
		if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
506
		this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(SIM_ART) + "/+tracks" + "?page=" + a, true);
507
		this.xmlhttp.send();
508
		this.xmlhttp.onreadystatechange = function() {
509-
    if (data[i].title) urls.push(CLEAN_TRACK_NAME(data[i].title));
509+
        if (this.xmlhttp.readyState == 4) {
510
        if (this.xmlhttp.status == 200) {
511
        var text = this.xmlhttp.responsetext;
512
        if (!this.doc) this.doc = new ActiveXObject("htmlfile");
513
        this.doc.open();
514
        var div = this.doc.createElement("tr");
515
        div.innerHTML = text;
516
        var data = div.getElementsByTagName("td");
517
        var urls = [];
518
519
for (i = 0; i < data.length; i++) {
520
if (data[i].title) urls.push(CLEAN_TRACK_NAME(data[i].title));
521-
p.console("" + last_fm + " - " + urls[i]);
521+
522
523-
ooo2 = window.SetProperty("YT Track", urls[i]);
523+
524-
ooo2 = urls[i];
524+
525
i=randomnumber;
526
527
{
528
529-
ooo2 = window.SetProperty("YT Track", "");
529+
530-
ooo2 = "";
530+
531
{
532
p.console("" + SIM_ART + " - " + urls[i]);
533
534
YT_TRACK = window.SetProperty("YT Track", urls[i]);
535-
                this.doc.close();
535+
YT_TRACK = urls[i];
536-
                if (ooo2 == "" || ooo2 == "?") {downloadLFM();}
536+
537
}
538-
                set_focus(); //focus on playlist
538+
539-
                do_youtube_search1(decodeURIComponent(last_fm), decodeURIComponent(ooo2));
539+
540-
				} else {
540+
YT_TRACK = window.SetProperty("YT Track", "");
541-
                p.console("HTTP error: " + this.xmlhttp.status);
541+
YT_TRACK = "";
542-
                if (START_ARTIST.indexOf("*")== 0) {downloadGENRE();}
542+
543
}
544-
                if (this.xmlhttp.status == 404) {downloadLFM();}
544+
545
546
        this.doc.close();
547
        if (YT_TRACK == "" || YT_TRACK == "?") {LOAD_ART();}
548
        else
549
        set_focus(); //focus on playlist
550
        do_youtube_search1(decodeURIComponent(SIM_ART), decodeURIComponent(YT_TRACK));
551
        } else {
552
        p.console("HTTP error: " + this.xmlhttp.status);
553
        if (STATION.indexOf("*")== 0) {LOAD_GENRE();}
554-
this.downloadART_TITLE = function()
554+
555-
     {
555+
        if (this.xmlhttp.status == 404) {LOAD_ART();}
556-
       var artist0 = p.eval("%artist%");
556+
557-
       var title0 = p.eval("%title%");
557+
558-
       if(artist0 > "?" && title0 > "?") {set_focus2(); do_youtube_search1(decodeURIComponent(artist0), decodeURIComponent(title0));}
558+
559
	}
560
}
561
562-
this.downloadGENRE = function()
562+
//TOP TRACKS----------------------------------------------------
563-
     {
563+
this.TOP_TRACKS = function()
564-
         
564+
{       p.artist = p.eval("%artist%");
565-
      if (START_ARTIST.indexOf("*")== 0)
565+
566
    {   if (p.artist == "" || p.artist == "?") return;
567-
    { var randomnumber=Math.floor(Math.random()*gnr)
567+
568
		this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(p.artist) + "/+tracks" + "?page=1", true);
569-
        if (START_ARTIST == "" || START_ARTIST == "?") return;
569+
570
		this.xmlhttp.onreadystatechange = function() {
571-
		this.xmlhttp.open("GET", "http://www.last.fm/music/+tag/" + encodeURIComponent(START_ARTIST).replace("*","") + "?page=" + a, true);
571+
        if (this.xmlhttp.readyState == 4) {
572
        if (this.xmlhttp.status == 200) {
573
        var text = this.xmlhttp.responsetext;
574-
			if (this.xmlhttp.readyState == 4) {
574+
        if (!this.doc) this.doc = new ActiveXObject("htmlfile");
575-
				if (this.xmlhttp.status == 200) {
575+
        this.doc.open();
576-
					var text = this.xmlhttp.responsetext;
576+
        var div = this.doc.createElement("tr");
577-
					if (!this.doc) this.doc = new ActiveXObject("htmlfile");
577+
578-
					this.doc.open();
578+
        var data = div.getElementsByTagName("td");
579-
					var div = this.doc.createElement("li");
579+
        var urls = [];
580-
					div.innerHTML = text;
580+
581-
					var data = div.getElementsByTagName("a");
581+
582-
					var urls = [];
582+
if (data[i].title) urls.push(CLEAN_TRACK_NAME(data[i].title));
583
}
584
585
//Select urls[i]
586
for (i = 0; i < urls.length; i++)
587
588
{
589-
 }
589+
590
if (urls[i] > "") 
591
do_youtube_search1(decodeURIComponent(p.artist), urls[i]);
592
}
593
        this.doc.close();
594
        } else {
595
        p.console("HTTP error: " + this.xmlhttp.status);
596
                }
597
			}
598
		}
599
	}
600
}
601
602
//SAME VIDEO-----------------------------------------------
603
this.LOAD_SAME = function()
604
    {
605-
last_fm = window.SetProperty("YT Similar", urls[i]);
605+
      var artist0 = p.eval("%artist%");
606-
last_fm = urls[i];
606+
      var title0 = p.eval("%title%");
607
      if(artist0 > "?" && title0 > "?") {set_focus2(); do_youtube_search1(decodeURIComponent(artist0), decodeURIComponent(title0));}
608
}
609
610
//GENRE----------------------------------------------------
611-
last_fm = window.SetProperty("YT Similar", "");
611+
this.LOAD_GENRE = function()
612-
last_fm = "";
612+
{     if (STATION.indexOf("*")== 0)
613
   
614
    { var randomnumber=Math.floor(Math.random()*tag)
615
      var a=randomnumber;
616-
                this.doc.close();
616+
        if (STATION == "" || STATION == "?") return;
617-
                if (last_fm == "" || last_fm == "?") {downloadGENRE();}
617+
618
		this.xmlhttp.open("GET", "http://www.last.fm/music/+tag/" + encodeURIComponent(STATION).replace("*","") + "?page=" + a, true);
619-
                downloadTRACK();
619+
620-
				} else {
620+
621-
					p.console("HTTP error: " + this.xmlhttp.status);
621+
        if (this.xmlhttp.readyState == 4) {
622-
				    if (this.xmlhttp.status == 404) {downloadGENRE();}
622+
        if (this.xmlhttp.status == 200) {
623
        var text = this.xmlhttp.responsetext;
624
        if (!this.doc) this.doc = new ActiveXObject("htmlfile");
625
        this.doc.open();
626
        var div = this.doc.createElement("li");
627
        div.innerHTML = text;
628
        var data = div.getElementsByTagName("a");
629
        var urls = [];
630
    
631
for (i = 0; i < data.length; i++) {
632
    if (data[i].className.indexOf("name") == 0)
633
    if (data[i].href.indexOf("about:/music/") == 0) urls.push(CLEAN_GENRE_NAME(data[i].href));
634
}
635-
            return t1;
635+
636
//select random URL
637-
            return t1;
637+
638
do{
639
randomnumber = Math.floor(Math.random()*(0-9)+9);
640
} while(randomnumber%2!=0);
641
642
i=randomnumber;
643-
            t3 = t1.replace(RegExp("[^a-z\\d_)\\]\"]*(" + a + t2 + b + ")[^a-z\\d_(\\[\"]*","gi")," - ").replace(/^[^a-z()\[\]\d\"]*|[^a-z()\[\]\d\"]*$/gi, "");
643+
644
{
645
646
//Start with urls[i]
647-
            var t4 = t2.replace(/^the /i, "")
647+
648-
            t3 = t1.replace(RegExp("[^a-z\\d_)\\]\"]*(" + a + t4 + b + ")[^a-z\\d_(\\[\"]*","gi")," - ").replace(/^[^a-z()\[\]\d\"]*|[^a-z()\[\]\d\"]*$/gi, "");
648+
649
//p.console("" + urls[i]);
650
SIM_ART = window.SetProperty("YT Similar", urls[i]);
651
SIM_ART = urls[i];
652
window.SetProperty("YT Similar", urls[i]);
653
}
654
else
655
{
656
SIM_ART = window.SetProperty("YT Similar", "");
657
SIM_ART = "";
658
window.SetProperty("YT Similar", "");
659
}
660
}
661
        this.doc.close();
662
        if (SIM_ART == "" || SIM_ART == "?") {LOAD_GENRE();}
663
        else
664
        LOAD_TRACK();
665
        } else {
666
        p.console("HTTP error: " + this.xmlhttp.status);
667
        if (this.xmlhttp.status == 404) {LOAD_GENRE();}
668
                }
669
			}
670
		}
671
	}
672
}
673-
        t = t.replace(/[\.,\!\?\:;'"\-_]/g,"").toLowerCase();
673+
674-
        return t;
674+
675
strip_title = function (t1, t2)
676
{
677
    try
678
    {
679
        if (t1 == t2)
680
        return t1;
681
        if (t1.match(RegExp(t2 + "( and | & )", "i")))
682
        return t1;
683-
        return t.replace(/'/g, "’").toLowerCase();
683+
684
        var b = "( feat.| ft.|)";
685
        var t3 = "";
686
        if (!t2.match(/^the /i))
687
        {
688
        t3 = t1.replace(RegExp("[^a-z\\d_)\\]\"]*(" + a + t2 + b + ")[^a-z\\d_(\\[\"]*","gi")," - ").replace(/^[^a-z()\[\]\d\"]*|[^a-z()\[\]\d\"]*$/gi, "");
689
        }
690
        else
691
        {
692-
    this.xmlhttp = null;
692+
        var t4 = t2.replace(/^the /i, "")
693-
    this.http_callback_funct = null;
693+
        t3 = t1.replace(RegExp("[^a-z\\d_)\\]\"]*(" + a + t4 + b + ")[^a-z\\d_(\\[\"]*","gi")," - ").replace(/^[^a-z()\[\]\d\"]*|[^a-z()\[\]\d\"]*$/gi, "");
694-
    this.ready_state_change_callback = state_change_callback;
694+
695-
    this.search_done = false;
695+
696-
    this.on_search_finished_callback = p_on_search_finished_callback;
696+
697-
    this.yt_link;
697+
698-
    this.search_artist;
698+
699-
    this.search_title;
699+
    return t1;
700-
    this.metadata;
700+
701
}
702
703
convert = function(min)
704-
        if (this.xmlhttp != null && this.xmlhttp.readyState == 4 && this.xmlhttp.status == 200 && this.http_callback_funct != null)
704+
705-
            this.http_callback_funct();
705+
706
    minutes = +parts[0],
707
    seconds = +parts[1];
708
    return minutes * 60 + seconds;
709
}
710
711
strip = function (t)
712
{
713
    try
714
    {
715
    t = t.replace(/[\.,\!\?\:;'"\-_]/g,"").toLowerCase();
716
    return t;
717
    } catch (e)
718
    {}
719
}
720
721
clean = function (t)
722
{
723
    try
724
    {
725
    return t.replace(/'/g, "’").toLowerCase();
726
    } catch (e) {}
727
}
728
729
youtube_search = function (state_change_callback, p_on_search_finished_callback)
730
{
731
        this.xmlhttp = null;
732
        this.http_callback_funct = null;
733
        this.ready_state_change_callback = state_change_callback;
734
        this.search_done = false;
735
        this.on_search_finished_callback = p_on_search_finished_callback;
736
        this.yt_link;
737
        this.search_artist;
738
        this.search_title;
739
        this.metadata;
740
741-
                i++; //second link
741+
742
    {
743
    if (this.xmlhttp != null && this.xmlhttp.readyState == 4 && this.xmlhttp.status == 200 && this.http_callback_funct != null)
744-
//if((data[i].title.toLowerCase()).indexOf(decodeURIComponent(last_fm.toLowerCase()).split(" ")[0]) > 0)
744+
    this.http_callback_funct();
745-
//if((data[i].title.toLowerCase()).indexOf(decodeURIComponent(ooo2.toLowerCase()).split(" ")[0]) > 0)
745+
746-
//if((data[i].title.toLowerCase()).indexOf(decodeURIComponent(ooo2.toLowerCase()).split(" ")[1]) > 0)
746+
747-
//if((data[i].title.toLowerCase()).indexOf(decodeURIComponent(ooo2.toLowerCase()).split(" ")[2]) > 0)
747+
748
    {
749
        this.search_artist = p_artist;
750
        this.search_title = p_title;
751
        this.metadata = p_extra_metadata;
752
        this.http_callback_funct = null;
753
        this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
754
755-
            var name = text.substr(st, et - st);
755+
756-
            var C_Name = name.replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&");
756+
757-
            //p.console("Title: " + C_Name);
757+
758
        this.xmlhttp.open("GET", URL);
759
        this.xmlhttp.onreadystatechange = this.ready_state_change_callback;
760
        this.xmlhttp.send();
761
    }
762
763
    this.AnalyseSearch = function ()
764
    {
765
        var text = this.xmlhttp.responsetext;
766
        var doc = new ActiveXObject("htmlfile");
767
        doc.open();
768
        var div = doc.createElement("div");
769
        div.innerHTML = text;
770
        var data = div.getElementsByTagName("a");
771-
{                   
771+
772
        var first_match;
773-
            var stripped_title = strip_title(C_Name, this.search_artist); 
773+
774
        re_test:
775
776-
                //3dydfy
776+
777-
            if (!this.IsGoodMatch(C_Name))
777+
778
        if (data[i].href.indexOf("about:/watch?v=") == 0)
779
           {
780
                i++; //link
781
782
//check if track exist?                
783
//if((data[i].title.toLowerCase()).indexOf(decodeURIComponent(SIM_ART.toLowerCase()).split(" ")[0]) > 0)
784
//if((data[i].title.toLowerCase()).indexOf(decodeURIComponent(YT_TRACK.toLowerCase()).split(" ")[0]) > 0)
785
//if((data[i].title.toLowerCase()).indexOf(decodeURIComponent(YT_TRACK.toLowerCase()).split(" ")[1]) > 0)
786
//if((data[i].title.toLowerCase()).indexOf(decodeURIComponent(YT_TRACK.toLowerCase()).split(" ")[2]) > 0)
787
788
            //Find Title
789
            {
790
            var st = text.indexOf( data[i].href.replace("about:/watch?", "") );
791
            var str = "dir=\"ltr\">";
792
            st = text.indexOf(str, st) + str.length;
793
            var et = text.indexOf("</a>", st);
794
            var youtube_title = text.substr(st, et - st);
795
            var Y_Title = youtube_title.replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "''").replace("&amp;", "&");
796
            //p.console("Title: " + Y_Title);
797
            }
798-
    this.IsGoodMatch = function (video_name)
798+
799
            //Find minutes
800
            var s = text.indexOf( data[i].href.replace("about:/watch?", "") );
801
            var str = "<span class=\"video-time\">";
802
            s = text.indexOf(str, s) + str.length;
803
            var e = text.indexOf("</span>", s);
804
            var length = text.substr(s, e - s);
805
            length = convert(length);
806
            length = length ? length : "";
807
            if (!first_match)
808
809
            {                   
810
            // title stripped of artist name if same as search_artist
811
            var stripped_title = strip_title(Y_Title, this.search_artist); 
812
            first_match = "3dydfy://www.youtube.com/watch?" + (this.metadata ? this.metadata + "&" : "") + "fb2k_title=" + encodeURIComponent(stripped_title) + "&3dydfy_alt_length=" + encodeURIComponent(length) + "&fb2k_artist=" + encodeURIComponent(this.search_artist) + "&" + data[i].href.replace("about:/watch?", "");
813
            }
814
            //3dydfy
815
            if (!this.IsGoodMatch(Y_Title))
816
            continue;
817
818
            url = "3dydfy://www.youtube.com/watch?" + (this.metadata ? this.metadata + "&" : "") + "fb2k_title=" + encodeURIComponent(this.search_title) + "&3dydfy_alt_length=" + encodeURIComponent(length) + "&fb2k_artist=" + encodeURIComponent(this.search_artist) + "&" + data[i].href.replace("about:/watch?", "");
819
            break;
820
            }
821-
        var yt_search1 = new youtube_search(function ()
821+
822
823-
            yt_search1.on_state_change();
823+
824-
        }, on_youtube_search1_done);
824+
825-
        yt_search1.StartSearch(p_artist, p_title);
825+
826
        this.yt_link = url;
827
828-
    on_youtube_search1_done = function (link, p_artist, p_title)
828+
829
830
        this.on_search_finished_callback(url, this.search_artist, this.search_title);
831
        }
832
833-
{p.console("Track Or Artist - Not Exist!"); downloadLFM();} 
833+
        this.IsGoodMatch = function (video_name)
834
        {
835-
        if (link && link.length)
835+
836
        var clean_artist = clean(strip(this.search_artist));
837
        var clean_title = clean(strip(this.search_title));
838
839
        if (clean_vid_name.indexOf(clean_artist) != -1 && clean_vid_name.indexOf(clean_title) != -1 && clean_vid_name.indexOf("full album") == -1)
840
        {
841
            //p.console("GOOD MATCH");
842
            return true;
843
        }
844
        else
845
        {
846
            //p.console("BAD MATCH");
847
            return false;
848
        }
849
    }
850
851
}
852
853
//Call Search
854
do_youtube_search1 = function (p_artist, p_title)
855
    {
856
    var yt_search1 = new youtube_search(function ()
857
    {
858
    yt_search1.on_state_change();
859
    }, on_youtube_search1_done);
860
    yt_search1.StartSearch(p_artist, p_title);
861
    }
862
863
on_youtube_search1_done = function (link, p_artist, p_title)
864
{
865
var url2="";
866
url2 = link;
867
if (!url2)
868
{p.console("Track Or Artist - Not Exist!"); LOAD_ART();} 
869
870
if (link && link.length)
871
{
872
            
873
p.console("" + "\"" + link + "\"");
874
YT_URL = window.SetProperty("YT URL", link);
875
var tmppath = p.fso.GetFolder(fb.FoobarPath).ShortPath;
876
var str = tmppath + "\\foobar2000.exe /add ";
877
var go = str + link;
878
p.run(go);
879
}
880
    }
881
//**************************(END)**************************
882
this.artist = "";
883
884
//Set Panels
885
function pan1() { }
886
function pan2(x, y, w, h) { }
887
//---------------------------------------------------------
888
889
//Begin--->
890
var p = new panel("Youtube Radio", ["remap", "metadb"]);
891
var im = new pan2(0, 0, 0, 0);
892
var th = new pan1();
893
894
on_item_focus_change();
895
{
896
}
897
898-
		this.img_normal = img_src && img_src.normal ? gdi.Image(img_src.normal) : null;
898+
899-
		this.img_hover = img_src && img_src.hover ? gdi.Image(img_src.hover) : this.img_normal;
899+
900-
		this.img_down = img_src && img_src.down ? gdi.Image(img_src.down) : this.img_hover;
900+
901
//Buttons---------------------------------------------------
902-
		this.changeState(this.state);
902+
903
var Buttons;
904
905
var g_tooltip = window.CreateTooltip();
906-
		var b = (this.left < x) && (x < this.right) && (this.top < y) && (y < this.bottom);
906+
907-
		if (b)
907+
908-
			g_down ? this.changeState(ButtonStates.down) : this.changeState(ButtonStates.hover);
908+
909-
		else
909+
910-
			this.changeState(ButtonStates.normal);
910+
911-
		return b;
911+
912
	normal: 0,
913
	hover: 1,
914
	down: 2
915
}
916-
		if (newstate != this.state)
916+
917-
			window.RepaintRect(this.left, this.top, this.w, this.h);
917+
918-
		this.state = newstate;
918+
919-
		switch (this.state)
919+
920-
		{
920+
921-
		case ButtonStates.normal:
921+
922-
			this.img = this.img_normal;
922+
923-
			break;
923+
924
	this.func = func;
925-
		case ButtonStates.hover:
925+
926-
			this.img = this.img_hover;
926+
927-
			break;
927+
928
	this.img_hover = img_src && img_src.hover ? gdi.Image(img_src.hover) : this.img_normal;
929-
		case ButtonStates.down:
929+
930-
			this.img = this.img_down;
930+
931-
			break;
931+
932
	this.alterImage = function(img_src) {
933-
		default:
933+
    this.img_normal = img_src && img_src.normal ? gdi.Image(img_src.normal) : null;
934-
			this.img = null;
934+
    this.img_hover = img_src && img_src.hover ? gdi.Image(img_src.hover) : this.img_normal;
935
    this.img_down = img_src && img_src.down ? gdi.Image(img_src.down) : this.img_hover;
936
		
937
    this.changeState(this.state);
938
	}
939-
		this.img && gr.DrawImage(this.img, this.left, this.top, this.w, this.h, 0, 0, this.w, this.h);
939+
940
	this.traceMouse = function (x, y) {
941
    var b = (this.left < x) && (x < this.right) && (this.top < y) && (y < this.bottom);
942
    if (b)
943-
		this.func && this.func(x,y);
943+
    g_down ? this.changeState(ButtonStates.down) : this.changeState(ButtonStates.hover);
944
    else
945
    this.changeState(ButtonStates.normal);
946
    return b;
947-
		g_tooltip.Text = this.tiptext;
947+
948-
		g_tooltip.Activate();
948+
949
	
950
	this.changeState = function (newstate) {
951
    if (newstate != this.state)
952-
		g_tooltip.Deactivate();
952+
    window.RepaintRect(this.left, this.top, this.w, this.h);
953
    this.state = newstate;
954
    switch (this.state)
955
    {
956
    case ButtonStates.normal:
957
    this.img = this.img_normal;
958-
		Buttons[i].draw(gr);
958+
    break;
959
			
960
    case ButtonStates.hover:
961
    this.img = this.img_hover;
962
    break;
963
			
964
    case ButtonStates.down:
965-
		if (Buttons[i].traceMouse(x, y) && !btn)
965+
    this.img = this.img_down;
966-
			btn = Buttons[i];
966+
    break;
967
			
968
    default:
969
    this.img = null;
970
		}
971
	}
972
	
973
	this.draw = function (gr) {
974
    this.img && gr.DrawImage(this.img, this.left, this.top, this.w, this.h, 0, 0, this.w, this.h);
975
	}
976-
		cur_btn && cur_btn.onMouseOut();
976+
977-
		btn && btn.onMouseIn();
977+
978
    this.func && this.func(x,y);
979
	}
980
	
981
	this.onMouseIn = function() {
982
    g_tooltip.Text = this.tiptext;
983
    g_tooltip.Activate();
984
	}
985
	
986
	this.onMouseOut = function() {
987
    g_tooltip.Deactivate();
988-
		cur_btn.changeState(ButtonStates.down);
988+
989
}
990
991
function buttonsDraw(gr) {
992
	for (i in Buttons) {
993
    Buttons[i].draw(gr);
994-
		cur_btn.changeState(ButtonStates.hover);
994+
995-
		if( btn_down == cur_btn )
995+
996-
			cur_btn.onClick(x, y);
996+
997
function buttonsTraceMouse(x, y) {
998
	var btn = null;
999
	for (i in Buttons) {
1000
    if (Buttons[i].traceMouse(x, y) && !btn)
1001
    btn = Buttons[i];
1002
	}
1003-
		cur_btn.changeState(ButtonStates.normal);
1003+
1004
	return btn;
1005
}
1006
1007
function on_mouse_move(x, y) {
1008
	var btn = buttonsTraceMouse(x, y);
1009
	
1010
	if (btn != cur_btn) {
1011
    cur_btn && cur_btn.onMouseOut();
1012
    btn && btn.onMouseIn();
1013
	}
1014
	
1015
	cur_btn = btn;
1016
}
1017-
        if (this.dui) {
1017+
1018-
			col = window.GetColorDUI(1);
1018+
1019-
			gr.FillSolidRect(0, 0, ww, wh, col);
1019+
1020-
        } 
1020+
1021
1022
	if (cur_btn) {
1023-
        col = window.GetColorCUI(3);    
1023+
    cur_btn.changeState(ButtonStates.down);
1024
	}
1025
}
1026
1027
function on_mouse_lbtn_up(x, y) {
1028
	if (cur_btn) {
1029
    cur_btn.changeState(ButtonStates.hover);
1030
    if( btn_down == cur_btn )
1031-
	return (0xff000000|(r<<16)|(g<<8)|(b)); 
1031+
    cur_btn.onClick(x, y);
1032
	}
1033
	g_down = false;
1034
}
1035
1036
function on_mouse_leave() {
1037
	if (cur_btn) {
1038
    cur_btn.changeState(ButtonStates.normal);
1039
	}
1040
}
1041
1042
function on_size() {
1043
	ww = window.Width;
1044
	wh = window.Height;
1045
    window.Repaint();
1046
}
1047
1048
//Background
1049
this.dui = window.InstanceType;
1050
function on_paint(gr) {
1051
	
1052
    if (this.dui) {
1053
    col = window.GetColorDUI(1);
1054
    gr.FillSolidRect(0, 0, ww, wh, col);
1055
    } 
1056
    else
1057
    {
1058
    col = window.GetColorCUI(3);    
1059
    }
1060
1061
	buttonsDraw(gr);
1062
	
1063-
        p.rbtn_up(24, 17);
1063+
1064-
        //downloadONE();
1064+
1065-
        }, "Youtube")
1065+
1066
return (0xff000000|(r<<16)|(g<<8)|(b)); 
1067
}
1068
1069
function on_colors_changed() {
1070
window.Repaint();
1071
}
1072
1073
//Init Buttons--------------------------------------------
1074
1075
//Custom colour
1076
var custom = RGB(255,255,255);
1077
1078
//Button width
1079
var bw = 24;
1080
1081
//Button height
1082
var bh = 20;
1083
1084
//Button position
1085
var top_margin = -1;
1086
var left_margin = 0;
1087
1088
var image_path0 = window.GetProperty("Button Path", fb.ProfilePath + "image");
1089
var image_path = (image_path0 + "\\");
1090
1091
//These 2 lines of code lock the panel size.
1092
//window.MinWidth = window.MaxWidth = 24;
1093
//window.MinHeight = window.MaxHeight = 20;
1094
1095
1096
Buttons = {
1097
	but1: new Button(left_margin,top_margin,bw,bh, {normal: image_path + "youtube0.png", hover: image_path + "youtube1.png"}, function(){
1098
    p.rbtn_up(24, 17);
1099
    }, "Youtube")
1100
	
1101
}
1102
1103
function on_mouse_rbtn_up(x, y) {
1104
return true;
1105
}