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