Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==PREPROCESSOR==
- // @name "Youtube Radio"
- // @author "Mire777"
- // @feature "v1.4"
- // @feature "watch-metadb"
- // ==/PREPROCESSOR==
- //Properties
- auto_yt = window.GetProperty("YT Radio", "0");
- ooo2 = window.GetProperty("YT Track", "");
- START_ARTIST = window.GetProperty("YT Station", "");
- last_fm = window.GetProperty("YT Similar", "");
- YT_URL = window.GetProperty("YT URL", "");
- gnr = window.GetProperty("YT Tag(27-100)", "27");
- var MF_GRAYED = 0x00000001;
- var MF_STRING = 0x00000000;
- var IDC_ARROW = 32512;
- var IDC_HAND = 32649;
- function RGB(r, g, b) {
- return (0xff000000 | (r << 16) | (g << 8) | (b));
- }
- function RGBA(r, g, b, a) {
- return ((a << 24) | (r << 16) | (g << 8) | (b));
- }
- function on_colors_changed() {
- p.colors_changed();
- }
- function on_selection_changed() {
- p.item_focus_change();
- }
- function on_playlist_switch() {
- p.item_focus_change();
- }
- function on_playback_new_track() {
- p.item_focus_change();
- downloadLFM();
- }
- function on_playback_dynamic_info_track() {
- p.item_focus_change();
- }
- function on_playback_stop() {
- p.item_focus_change();
- }
- function on_item_focus_change() {
- p.item_focus_change();
- }
- function on_mouse_leave() {
- }
- function on_mouse_rbtn_up(x, y) {
- p.rbtn_up(x, y);
- return true;
- }
- function panel(name, features) {
- this.item_focus_change = function() {
- if (!this.metadb_func) return;
- switch(this.selection_mode) {
- case 0:
- this.metadb = fb.GetSelection();
- break;
- case 1:
- this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
- break;
- case 2:
- this.metadb = fb.GetFocusItem();
- break;
- }
- if (this.metadb) on_metadb_changed();
- }
- //Metadb
- this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
- //Size
- this.size = function() {
- this.w = window.Width;
- this.h = window.Height;
- }
- //Move
- this.move = function(x, y) {
- this.mx = x;
- this.my = y;
- }
- //Menu
- this.rbtn_up = function(x, y) {
- var _menu = window.CreatePopupMenu();
- var idx;
- switch(true) {
- case typeof th == "object":
- case typeof im == "object":
- {
- if(auto_yt==1) _menu.AppendMenuItem(MF_STRING, 1902, "Youtube Radio");
- if(auto_yt==0) _menu.AppendMenuItem(MF_STRING, 1903, "Youtube Radio");
- _menu.CheckMenuItem(1902, auto_yt?1:0);
- _menu.AppendMenuSeparator();
- {
- if (auto_yt=="1") _menu.AppendMenuItem(MF_STRING, 22, "Get Next Video");
- if (auto_yt=="0") _menu.AppendMenuItem(MF_STRING, 21, "Get Next Video");
- _menu.AppendMenuItem(MF_STRING, 401, "Search Videos");
- _menu.AppendMenuSeparator();
- _menu.AppendMenuItem(MF_STRING, 1914, "Start Radio Station");
- p.artist = p.eval("%artist%");
- if (p.artist == "" || p.artist == "?") {_menu.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Same Artist Station");}
- else
- {_menu.AppendMenuItem(MF_STRING, 1915, "Same Artist Station");}
- _menu.AppendMenuSeparator();
- _menu.AppendMenuItem(MF_STRING, 403, "Open Same Video");
- _menu.AppendMenuItem(MF_STRING, 404, "Find in Browser");
- _menu.AppendMenuSeparator();
- }
- }
- _menu.AppendMenuItem(MF_STRING, 9, "Properties...");
- }
- if (utils.IsKeyPressed(0x10)) _menu.AppendMenuItem(MF_STRING, 10, "Configure...");
- idx = _menu.TrackPopupMenu(x, y);
- switch(idx) {
- case 9:
- window.ShowProperties();
- break;
- case 10:
- window.ShowConfigure();
- break;
- case 21:
- downloadLFM1();
- break;
- case 22:
- downloadLFM1();
- break;
- case 401:
- fb.RunMainMenuCommand("View/Youtube Source");
- break;
- case 403:
- this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
- on_item_focus_change();
- downloadART_TITLE();
- break;
- case 404:
- p.artist = p.eval("%artist% %title%");
- p.browser("http://www.youtube.com/results?search_query=" + encodeURIComponent(p.artist));
- break;
- case 1902:
- auto_yt = 0;
- window.SetProperty("YT Radio", "0");
- break;
- case 1903:
- auto_yt = 1;
- window.SetProperty("YT Radio", "1");
- break;
- case 1914:
- Start = START_ARTIST;
- START_ARTIST = this.InputBox("Type Artist to Start Station\n\n( *genre - will play genre station)", this.name, START_ARTIST);
- window.SetProperty("YT Station", START_ARTIST);
- if (START_ARTIST==Start)
- {
- }
- else
- {
- auto_yt = 1;
- window.SetProperty("YT Radio", "1");
- downloadLFM0();
- }
- break;
- case 1915:
- this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
- Start = START_ARTIST;
- p.artist = p.eval("%artist%");
- if (p.artist == "" || p.artist == "?") return;
- START_ARTIST = p.artist;
- window.SetProperty("YT Station", p.artist);
- auto_yt = 1;
- window.SetProperty("YT Radio", "1");
- on_item_focus_change();
- /*if (START_ARTIST==Start)
- {
- }
- else
- {*/
- downloadLFM0();
- //}
- break;
- }
- _menu.Dispose();
- }
- //Features init
- this.features_init = function() {
- for (i = 0; i < this.features.length; i++) {
- switch(this.features[i]) {
- case "metadb":
- this.selection_mode = 1;
- break;
- case "remap":
- this.artist_tf = window.GetProperty("YT Search", "%path%");
- break;
- }
- }
- }
- this.check_feature = function(f) {
- for (i = 0; i < this.features.length; i++) {
- if (this.features[i] == f) return true;
- }
- return false;
- }
- this.eval = function(tf) {
- if (!this.metadb || tf == "") return "";
- if (fb.IsPlaying && this.metadb.RawPath.indexOf("file://") != 0) {
- return fb.TitleFormat(tf).Eval();
- } else {
- return fb.TitleFormat(tf).EvalWithMetadb(this.metadb);
- }
- }
- //Console Msg
- this.console = function(message) {
- this.name = "Youtube Radio"
- fb.trace(this.name + ": " + message);
- }
- //Input Box
- String.prototype.trim = function() {
- return this.replace(/^\s+|\s+$/g, "");
- }
- this.InputBox = function(prompt, title, value) {
- prompt = prompt.replace(/"/g, '" + Chr(34) + "').replace(/\n/g, '" + Chr(13) + "');
- //title = title.replace(/"/g, '" + Chr(34) + "');
- value = value.replace(/"/g, '" + Chr(34) + "');
- var temp_value = this.vb.eval('InputBox' + '("' + prompt + '", "' + title + '", "' + value + '")');
- if (typeof temp_value == "undefined") return value;
- 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, this.name);
- return temp_value.trim();
- }
- //Msg Box
- this.MsgBox = function(prompt, buttons, title) {
- prompt = prompt.replace(/"/g, '" + Chr(34) + "').replace(/\n/g, '" + Chr(13) + "');
- title = title.replace(/"/g, '" + Chr(34) + "');
- return this.vb.eval('MsgBox' + '("' + prompt + '", "' + buttons + '", "' + title + '")');
- }
- //Browser
- this.browser = function(command) {
- if (!this.run(command)) this.MsgBox("Unable to launch your default browser.", 0, this.name);
- }
- //Run Command
- this.run = function(command) {
- try {
- this.WshShell.Run(command);
- return true;
- } catch(e) {
- return false;
- }
- }
- //futures
- this.metadb_func = typeof on_metadb_changed == "function";
- this.features = features;
- this.dui = window.InstanceType;
- this.metadb = fb.GetFocusItem();
- this.WshShell = new ActiveXObject("WScript.Shell");
- this.fso = new ActiveXObject("Scripting.FileSystemObject");
- this.vb = new ActiveXObject("ScriptControl");
- this.vb.Language = "VBScript";
- this.artist_tf = "%path%";
- this.features_init();
- this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
- if (fb.GetFocusItem())
- {this.artist = fb.TitleFormat(this.artist_tf).EvalWithMetadb(this.metadb);}
- }
- //YT RADIO-------------------------------------------------
- //open simmilar artist
- this.downloadLFM = function()
- {
- //if (!p.fso.FolderExists(this.folder)) return;
- {
- if (auto_yt=="1")
- {
- p.artist = p.eval("%path%");
- 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)
- { var randomnumber=Math.floor(Math.random()*18)
- var a=randomnumber;
- this.working=true;
- if (START_ARTIST == "" || START_ARTIST == "?") return;
- if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(START_ARTIST) + "/+similar"+ "?page=" + a, true);
- this.xmlhttp.send();
- this.xmlhttp.onreadystatechange = function() {
- if (this.xmlhttp.readyState == 4) {
- if (this.xmlhttp.status == 200) {
- var text = this.xmlhttp.responsetext;
- if (!this.doc) this.doc = new ActiveXObject("htmlfile");
- this.doc.open();
- var div = this.doc.createElement("div");
- div.innerHTML = text;
- var data = div.getElementsByTagName("a");
- var urls = [];
- for (i = 0; i < data.length; i++) {
- if (data[i].href.indexOf("about:/music/") == 0) urls.push(data[i].href.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","'"));
- }
- //select random URL
- var randomnumber = Math.floor(Math.random()*(20-50)+50);
- do{
- randomnumber = Math.floor(Math.random()*(20-50)+50);
- } while(randomnumber%2!=1);
- i=randomnumber;
- {
- //do something with urls[i]
- if (urls[i] > "")
- {
- last_fm = window.SetProperty("YT Similar", urls[i]);
- last_fm = urls[i];
- window.SetProperty("YT Similar", urls[i]);
- }
- else
- //if (urls[i] == "" || urls[i] == "?")
- {
- last_fm = window.SetProperty("YT Similar", "");
- last_fm = "";
- window.SetProperty("YT Similar", "");
- }
- }
- this.doc.close();
- this.working=false;
- if (START_ARTIST.indexOf("*")== 0) {downloadGENRE2();}
- else
- if (last_fm == "" || last_fm == "?") {downloadLFM();}
- else
- downloadTRACK();
- } else {
- if (START_ARTIST.indexOf("*")== 0) {} else {p.console("HTTP error: " + this.xmlhttp.status);}
- if (START_ARTIST.indexOf("*")== 0) {downloadGENRE2();}
- else
- if (this.xmlhttp.status == 404) {downloadLFM();}
- }
- }
- }
- }
- }}
- }
- //Open track
- this.downloadTRACK = function()
- {
- {
- {
- {var randomnumber=Math.floor(Math.random()*20)
- var a=randomnumber;
- this.working=true;
- if (last_fm == "" || last_fm == "?") return;
- if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(last_fm) + "/+tracks" + "?page=" + a, true);
- this.xmlhttp.send();
- this.xmlhttp.onreadystatechange = function() {
- if (this.xmlhttp.readyState == 4) {
- if (this.xmlhttp.status == 200) {
- var text = this.xmlhttp.responsetext;
- if (!this.doc) this.doc = new ActiveXObject("htmlfile");
- this.doc.open();
- var div = this.doc.createElement("tr");
- div.innerHTML = text;
- var data = div.getElementsByTagName("td");
- var urls = [];
- for (i = 0; i < data.length; i++) {
- if (data[i].title) urls.push(data[i].title.replace(/about:\//,"").replace(",","").replace("1","").replace("2","").replace("3","").replace("4","").replace("5","").replace("6","").replace("7","").replace("8","").replace("9","").replace("0","").replace("listeners","").replace("listener","").split("(")[0].split("[")[0].split(",")[0].split("{")[0].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","'"));
- }
- //select random URL
- var randomnumber = Math.floor(Math.random()*Math.max(urls.length));
- i=randomnumber;
- {
- //do something with urls[i]
- if (urls[i] > "")
- {
- //clean track name
- var urls0 = ((urls[i]).trim().replace(" ","").replace(" ","").replace(" 1 ","").replace(" 2 ","").replace(" 3 ","").replace(" 4 ","").replace(" 5 ","").replace(" 6 ","").replace(" 7 ","").replace(" 8 ","").replace(" 9 ","").replace(" 0 ","").replace("1","").replace("2","").replace("3","").replace("4","").replace("5","").replace("6","").replace("7","").replace("8","").replace("9","").replace("0","").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(" - 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(" Survival Remix","").replace("Survival Remix","").replace(decodeURIComponent(last_fm) + "-"," ").replace(decodeURIComponent(last_fm)," ").replace(" Club Mix","").replace(" wwwi.info","").replace(" Edit","").replace("feat","").replace("ft","").replace("live","").replace("Single","").replace(" Acoustic","").replace("Remix","").replace("Part","").replace("Part&","").replace(" +","").replace(" % ","").replace(' /"/"',"").replace(" remastered","").replace(" // СЛУШАЮТ:","").split(" | '' |")[0].split(" |")[0].split("| On:")[0].trim());
- p.console("" + last_fm + " - " + urls0);
- ooo2 = window.SetProperty("YT Track", urls0);
- ooo2 = urls0;
- window.SetProperty("YT Track", urls0);
- }
- else
- //if (urls[i] == "" || urls[i] == "?")
- {
- ooo2 = window.SetProperty("YT Track", "");
- ooo2 = "";
- window.SetProperty("YT Track", "");
- }
- }
- this.doc.close();
- this.working=false;
- if (ooo2 == "" || ooo2 == "?") {downloadLFM();}
- else
- do_youtube_search1(decodeURIComponent(last_fm), decodeURIComponent(ooo2));
- } else {
- p.console("HTTP error: " + this.xmlhttp.status);
- if (START_ARTIST.indexOf("*")== 0) {downloadGENRE2();}
- else
- if (this.xmlhttp.status == 404) {downloadLFM();}
- }
- }
- }
- }
- }}}
- //YT RADIO(One)--------------------------------------------
- //open simmilar artist
- this.downloadLFM1 = function()
- {
- {
- {
- //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)
- { var randomnumber=Math.floor(Math.random()*18)
- var a=randomnumber;
- this.working=true;
- if (START_ARTIST == "" || START_ARTIST == "?") return;
- if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(START_ARTIST) + "/+similar"+ "?page=" + a, true);
- this.xmlhttp.send();
- this.xmlhttp.onreadystatechange = function() {
- if (this.xmlhttp.readyState == 4) {
- if (this.xmlhttp.status == 200) {
- var text = this.xmlhttp.responsetext;
- if (!this.doc) this.doc = new ActiveXObject("htmlfile");
- this.doc.open();
- var div = this.doc.createElement("div");
- div.innerHTML = text;
- var data = div.getElementsByTagName("a");
- var urls = [];
- for (i = 0; i < data.length; i++) {
- if (data[i].href.indexOf("about:/music/") == 0) urls.push(data[i].href.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","'"));
- }
- //select random URL
- var randomnumber = Math.floor(Math.random()*(20-50)+50);
- do{
- randomnumber = Math.floor(Math.random()*(20-50)+50);
- } while(randomnumber%2!=1);
- i=randomnumber;
- {
- //do something with urls[i]
- if (urls[i] > "")
- {
- last_fm = window.SetProperty("YT Similar", urls[i]);
- last_fm = urls[i];
- window.SetProperty("YT Similar", urls[i]);
- }
- else
- //if (urls[i] == "" || urls[i] == "?")
- {
- last_fm = window.SetProperty("YT Similar", "");
- last_fm = "";
- window.SetProperty("YT Similar", "");
- }
- }
- this.doc.close();
- this.working=false;
- if (START_ARTIST.indexOf("*")== 0) {downloadGENRE2();}
- else
- if (last_fm == "" || last_fm == "?") {downloadLFM1();}
- else
- downloadTRACK1();
- } else {
- if (START_ARTIST.indexOf("*")== 0) {} else {p.console("HTTP error: " + this.xmlhttp.status);}
- if (START_ARTIST.indexOf("*")== 0) {downloadGENRE2();}
- else
- if (this.xmlhttp.status == 404) {downloadLFM1();}
- }
- }
- }
- }
- }}
- }
- //Open track
- this.downloadTRACK1 = function()
- {
- {
- {
- {var randomnumber=Math.floor(Math.random()*20)
- var a=randomnumber;
- this.working=true;
- if (last_fm == "" || last_fm == "?") return;
- if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(last_fm) + "/+tracks" + "?page=" + a, true);
- this.xmlhttp.send();
- this.xmlhttp.onreadystatechange = function() {
- if (this.xmlhttp.readyState == 4) {
- if (this.xmlhttp.status == 200) {
- var text = this.xmlhttp.responsetext;
- if (!this.doc) this.doc = new ActiveXObject("htmlfile");
- this.doc.open();
- var div = this.doc.createElement("tr");
- div.innerHTML = text;
- var data = div.getElementsByTagName("td");
- var urls = [];
- for (i = 0; i < data.length; i++) {
- if (data[i].title) urls.push(data[i].title.replace(/about:\//,"").replace(",","").replace("1","").replace("2","").replace("3","").replace("4","").replace("5","").replace("6","").replace("7","").replace("8","").replace("9","").replace("0","").replace("listeners","").replace("listener","").split("(")[0].split("[")[0].split(",")[0].split("{")[0].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","'"));
- }
- //select random URL
- var randomnumber = Math.floor(Math.random()*Math.max(urls.length));
- i=randomnumber;
- {
- //do something with urls[i]
- if (urls[i] > "")
- {
- //clean track name
- var urls0 = ((urls[i]).trim().replace(" ","").replace(" ","").replace(" 1 ","").replace(" 2 ","").replace(" 3 ","").replace(" 4 ","").replace(" 5 ","").replace(" 6 ","").replace(" 7 ","").replace(" 8 ","").replace(" 9 ","").replace(" 0 ","").replace("1","").replace("2","").replace("3","").replace("4","").replace("5","").replace("6","").replace("7","").replace("8","").replace("9","").replace("0","").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(" - 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(" Survival Remix","").replace("Survival Remix","").replace(decodeURIComponent(last_fm) + "-"," ").replace(decodeURIComponent(last_fm)," ").replace(" Club Mix","").replace(" wwwi.info","").replace(" Edit","").replace("feat","").replace("ft","").replace("live","").replace("Single","").replace(" Acoustic","").replace("Remix","").replace("Part","").replace("Part&","").replace(" +","").replace(" % ","").replace(' /"/"',"").replace(" remastered","").replace(" // СЛУШАЮТ:","").split(" | '' |")[0].split(" |")[0].split("| On:")[0].trim());
- p.console("" + last_fm + " - " + urls0);
- ooo2 = window.SetProperty("YT Track", urls0);
- ooo2 = urls0;
- window.SetProperty("YT Track", urls0);
- }
- else
- //if (urls[i] == "" || urls[i] == "?")
- {
- ooo2 = window.SetProperty("YT Track", "");
- ooo2 = "";
- window.SetProperty("YT Track", "");
- }
- }
- this.doc.close();
- this.working=false;
- if (ooo2 == "" || ooo2 == "?") {downloadLFM1();}
- else
- do_youtube_search1(decodeURIComponent(last_fm), decodeURIComponent(ooo2));
- } else {
- p.console("HTTP error: " + this.xmlhttp.status);
- if (START_ARTIST.indexOf("*")== 0) {downloadGENRE2();}
- else
- if (this.xmlhttp.status == 404) {downloadLFM1();}
- }
- }
- }
- }
- }}}
- //CHECK IF ARTIST EXIST------------------------------------
- this.downloadLFM0 = function()
- {
- this.working=true;
- if (START_ARTIST == "" || START_ARTIST == "?") return;
- if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(START_ARTIST) + "/+similar", true);
- this.xmlhttp.send();
- this.xmlhttp.onreadystatechange = function() {
- if (this.xmlhttp.readyState == 4) {
- if (this.xmlhttp.status == 200) {
- var text = this.xmlhttp.responsetext;
- if (!this.doc) this.doc = new ActiveXObject("htmlfile");
- this.doc.open();
- var div = this.doc.createElement("div");
- div.innerHTML = text;
- var data = div.getElementsByTagName("a");
- var urls = [];
- this.doc.close();
- this.working=false;
- downloadLFM000();
- } else {
- if (START_ARTIST.indexOf("*")== 0) {} else {p.console("HTTP error: " + this.xmlhttp.status);}
- if (START_ARTIST.indexOf("*")== 0) {downloadGENRE2();}
- else
- if (this.xmlhttp.status == 404)
- {
- p.MsgBox("This Artist Not Found!", 0, p.name);
- }
- }
- }
- }
- }
- //START ARTIST RADIO(same artist)--------------------------
- //open simmilar artist
- this.downloadLFM000 = function()
- {
- {
- {
- //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)
- { var randomnumber=Math.floor(Math.random()*18)
- var a=randomnumber;
- this.working=true;
- if (START_ARTIST == "" || START_ARTIST == "?") return;
- if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(START_ARTIST) + "/+similar"+ "?page=" + a, true);
- this.xmlhttp.send();
- this.xmlhttp.onreadystatechange = function() {
- if (this.xmlhttp.readyState == 4) {
- if (this.xmlhttp.status == 200) {
- var text = this.xmlhttp.responsetext;
- if (!this.doc) this.doc = new ActiveXObject("htmlfile");
- this.doc.open();
- var div = this.doc.createElement("div");
- div.innerHTML = text;
- var data = div.getElementsByTagName("a");
- var urls = [];
- for (i = 0; i < data.length; i++) {
- if (data[i].href.indexOf("about:/music/") == 0) urls.push(data[i].href.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","'"));
- }
- //select random URL
- var randomnumber = Math.floor(Math.random()*(20-50)+50);
- do{
- randomnumber = Math.floor(Math.random()*(20-50)+50);
- } while(randomnumber%2!=1);
- i=randomnumber;
- {
- //do something with urls[i]
- if (urls[i] > "")
- {
- last_fm = window.SetProperty("YT Similar", urls[i]);
- last_fm = urls[i];
- window.SetProperty("YT Similar", urls[i]);
- }
- else
- //if (urls[i] == "" || urls[i] == "?")
- {
- last_fm = window.SetProperty("YT Similar", "");
- last_fm = "";
- window.SetProperty("YT Similar", "");
- }
- }
- this.doc.close();
- this.working=false;
- if (START_ARTIST.indexOf("*")== 0) {downloadGENRE2();}
- else
- if (last_fm == "" || last_fm == "?") {downloadLFM000();}
- else
- downloadTRACK11();
- } else {
- if (START_ARTIST.indexOf("*")== 0) {} else {p.console("HTTP error: " + this.xmlhttp.status);}
- if (START_ARTIST.indexOf("*")== 0) {downloadGENRE2();}
- else
- if (this.xmlhttp.status == 404) {downloadLFM000();}
- }
- }
- }
- }
- }}
- }
- //Open track
- this.downloadTRACK11 = function()
- {
- {
- {
- {var randomnumber=Math.floor(Math.random()*20)
- var a=randomnumber;
- this.working=true;
- if (last_fm == "" || last_fm == "?") return;
- if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(last_fm) + "/+tracks" + "?page=" + a, true);
- this.xmlhttp.send();
- this.xmlhttp.onreadystatechange = function() {
- if (this.xmlhttp.readyState == 4) {
- if (this.xmlhttp.status == 200) {
- var text = this.xmlhttp.responsetext;
- if (!this.doc) this.doc = new ActiveXObject("htmlfile");
- this.doc.open();
- var div = this.doc.createElement("tr");
- div.innerHTML = text;
- var data = div.getElementsByTagName("td");
- var urls = [];
- for (i = 0; i < data.length; i++) {
- if (data[i].title) urls.push(data[i].title.replace(/about:\//,"").replace(",","").replace("1","").replace("2","").replace("3","").replace("4","").replace("5","").replace("6","").replace("7","").replace("8","").replace("9","").replace("0","").replace("listeners","").replace("listener","").split("(")[0].split("[")[0].split(",")[0].split("{")[0].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","'"));
- }
- //select random URL
- var randomnumber = Math.floor(Math.random()*Math.max(urls.length));
- i=randomnumber;
- {
- //do something with urls[i]
- if (urls[i] > "")
- {
- //clean track name
- var urls0 = ((urls[i]).trim().replace(" ","").replace(" ","").replace(" 1 ","").replace(" 2 ","").replace(" 3 ","").replace(" 4 ","").replace(" 5 ","").replace(" 6 ","").replace(" 7 ","").replace(" 8 ","").replace(" 9 ","").replace(" 0 ","").replace("1","").replace("2","").replace("3","").replace("4","").replace("5","").replace("6","").replace("7","").replace("8","").replace("9","").replace("0","").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(" - 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(" Survival Remix","").replace("Survival Remix","").replace(decodeURIComponent(last_fm) + "-"," ").replace(decodeURIComponent(last_fm)," ").replace(" Club Mix","").replace(" wwwi.info","").replace(" Edit","").replace("feat","").replace("ft","").replace("live","").replace("Single","").replace(" Acoustic","").replace("Remix","").replace("Part","").replace("Part&","").replace(" +","").replace(" % ","").replace(' /"/"',"").replace(" remastered","").replace(" // СЛУШАЮТ:","").split(" | '' |")[0].split(" |")[0].split("| On:")[0].trim());
- p.console("" + last_fm + " - " + urls0);
- ooo2 = window.SetProperty("YT Track", urls0);
- ooo2 = urls0;
- window.SetProperty("YT Track", urls0);
- }
- else
- //if (urls[i] == "" || urls[i] == "?")
- {
- ooo2 = window.SetProperty("YT Track", "");
- ooo2 = "";
- window.SetProperty("YT Track", "");
- }
- }
- this.doc.close();
- this.working=false;
- if (ooo2 == "" || ooo2 == "?") {downloadLFM000();}
- else
- do_youtube_search1(decodeURIComponent(last_fm), decodeURIComponent(ooo2));
- } else {
- p.console("HTTP error: " + this.xmlhttp.status);
- if (START_ARTIST.indexOf("*")== 0) {downloadGENRE2();}
- else
- if (this.xmlhttp.status == 404) {downloadLFM000();}
- }
- }
- }
- }
- }}}
- //DOWNLOAD YOUTUBE VIDEO-----------------------------------
- strip_title = function (t1, t2)
- {
- try
- {
- var a = "(by |the |\\(|\\[|)";
- var b = "(\\) |\\] | - |-| \/\/ |, | |)";
- return t1.replace(RegExp((a + t2 + b), "gi"), "");
- }
- catch (e)
- {}
- }
- convert = function(min)
- {
- var parts = min.split(':'),
- minutes = +parts[0],
- seconds = +parts[1];
- return minutes * 60 + seconds;
- }
- strip = function (t)
- {
- try
- {
- t = t.replace(/\//g, "\\/"); t = t.replace(/\?/g, "\\?"); t = t.replace(/\+/g, "\\+"); t = t.replace(/\-/g, "\\-"); t = t.replace(/\*/g, "\\*");
- t = t.replace(/\^/g, "\\^"); t = t.replace(/\[/g, "\\["); t = t.replace(/\]/g, "\\]"); t = t.replace(/\(/g, "\\("); t = t.replace(/\)/g, "\\)"); t = t.replace(/\{/g, "\\{");
- t = t.replace(/\}/g, "\\}"); t = t.replace(/\&/g, "\\&"); t = t.replace(/\|/g, "\\|"); t = t.replace(/\!/g, "\\!"); t = t.replace(/\:/g, "\\:"); return t;
- } catch (e) {}
- }
- clean = function (t)
- {
- try
- {
- return t.replace(/'/g, "’").toLowerCase();
- } catch (e) {}
- }
- youtube_search = function (state_change_callback, p_on_search_finished_callback)
- {
- this.xmlhttp = null;
- this.http_callback_funct = null;
- this.ready_state_change_callback = state_change_callback;
- this.search_done = false;
- this.on_search_finished_callback = p_on_search_finished_callback;
- this.yt_link;
- this.search_artist;
- this.search_title;
- this.metadata;
- this.on_state_change = function ()
- {
- if (this.xmlhttp != null && this.xmlhttp.readyState == 4 && this.xmlhttp.status == 200 && this.http_callback_funct != null)
- this.http_callback_funct();
- }
- this.StartSearch = function (p_artist, p_title, p_extra_metadata)
- {
- this.search_artist = p_artist;
- this.search_title = p_title;
- this.metadata = p_extra_metadata;
- this.http_callback_funct = null;
- this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- var URL = "http://www.youtube.com/results?search_query=" + encodeURIComponent(p_artist + " " + p_title);
- this.http_callback_funct = this.AnalyseSearch;
- this.xmlhttp.open("GET", URL);
- this.xmlhttp.onreadystatechange = this.ready_state_change_callback;
- this.xmlhttp.send();
- }
- this.AnalyseSearch = function ()
- {
- var text = this.xmlhttp.responsetext;
- var doc = new ActiveXObject("htmlfile");
- doc.open();
- var div = doc.createElement("div");
- div.innerHTML = text;
- var data = div.getElementsByTagName("a");
- var url = "";
- var first_match;
- re_test:
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].href.indexOf("about:/watch?v=") == 0)
- {
- i++; //the title is on the second link
- //check if track exist?
- //if((data[i].title.toLowerCase()).indexOf(decodeURIComponent(last_fm.toLowerCase()).split(" ")[0]) > 0)
- //if((data[i].title.toLowerCase()).indexOf(decodeURIComponent(ooo2.toLowerCase()).split(" ")[0]) > 0)
- //if((data[i].title.toLowerCase()).indexOf(decodeURIComponent(ooo2.toLowerCase()).split(" ")[1]) > 0)
- //if((data[i].title.toLowerCase()).indexOf(decodeURIComponent(ooo2.toLowerCase()).split(" ")[2]) > 0)
- var radio_on = (auto_yt ? 1:0);
- var s = text.indexOf( data[i].href.replace("about:/watch?", "") );
- var str = "<span class=\"video-time\">";
- s = text.indexOf(str, s) + str.length;
- var e = text.indexOf("</span>", s);
- var length = text.substr(s, e - s);
- length = convert(length);
- length = length ? length : "";
- if (!first_match)
- {
- // title stripped of artist name if same as search_artist
- var stripped_title = strip_title(data[i].title, this.search_artist);
- first_match = "3dydfy://www.youtube.com/watch?" + (this.metadata ? this.metadata + "&" : "") + "fb2k_title=" + encodeURIComponent(stripped_title + (!radio_on ? " [" + this.search_title + "]" : "")) + "&3dydfy_alt_length=" + encodeURIComponent(length) + "&fb2k_artist=" + encodeURIComponent(this.search_artist) + "&" + data[i].href.replace("about:/watch?", "");
- }
- //3dydfy
- if (!this.IsGoodMatch(data[i].title))
- continue;
- 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?", "");
- break;
- }
- }
- if (!url.length)
- url = first_match;
- this.yt_link = url;
- doc.close();
- this.on_search_finished_callback(url, this.search_artist, this.search_title);
- }
- this.IsGoodMatch = function (video_name)
- {
- var clean_vid_name = clean(strip(video_name));
- var clean_artist = clean(strip(this.search_artist));
- var clean_title = clean(strip(this.search_title));
- if (clean_vid_name.indexOf(clean_artist) != -1 && clean_vid_name.indexOf(clean_title) != -1 && clean_vid_name.indexOf("full album") == -1)
- {
- //p.console("GOOD MATCH");
- return true;
- }
- else
- {
- //p.console("BAD MATCH");
- return false;
- }
- }
- }
- //Call Search
- do_youtube_search1 = function (p_artist, p_title)
- {
- var yt_search1 = new youtube_search(function ()
- {
- yt_search1.on_state_change();
- }, on_youtube_search1_done);
- yt_search1.StartSearch(p_artist, p_title);
- }
- on_youtube_search1_done = function (link, p_artist, p_title)
- {
- var url2="";
- url2 = link;
- if (!url2)
- {p.console("Track Or Artist - Not Exist!"); downloadLFM1();}
- if (link && link.length)
- {
- p.console("" + "\"" + link + "\"");
- YT_URL = window.SetProperty("YT URL", link);
- var tmppath = p.fso.GetFolder(fb.FoobarPath).ShortPath;
- var str = tmppath + "\\foobar2000.exe /add ";
- var go = str + link;
- p.run(go);
- }
- if (link == "" || link == "?") {downloadLFM1();}
- }
- //END------------------------------------------------------
- //Download Same Video--------------------------------------
- this.downloadART_TITLE = function()
- {
- var artist0 = p.eval("%artist%");
- var title0 = p.eval("%title%");
- do_youtube_search1(decodeURIComponent(artist0), decodeURIComponent(title0));
- }
- //GENRE----------------------------------------------------
- //open Genre
- this.downloadGENRE2 = function()
- {
- {
- {
- if (START_ARTIST.indexOf("*")== 0)
- { var randomnumber=Math.floor(Math.random()*gnr)
- var a=randomnumber;
- this.working=true;
- if (START_ARTIST == "" || START_ARTIST == "?") return;
- //var folder = this.folder + "\\";
- if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- this.xmlhttp.open("GET", "http://www.last.fm/music/+tag/" + encodeURIComponent(START_ARTIST).replace("*","") + "?page=" + a, true);
- this.xmlhttp.send();
- this.xmlhttp.onreadystatechange = function() {
- if (this.xmlhttp.readyState == 4) {
- if (this.xmlhttp.status == 200) {
- var text = this.xmlhttp.responsetext;
- if (!this.doc) this.doc = new ActiveXObject("htmlfile");
- this.doc.open();
- var div = this.doc.createElement("li");
- div.innerHTML = text;
- var data = div.getElementsByTagName("a");
- var urls = [];
- for (i = 0; i < data.length; i++) {
- if (data[i].className.indexOf("name") == 0)
- if (data[i].href.indexOf("about:/music/") == 0) urls.push(data[i].href.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]);
- }
- //select random URL
- var randomnumber = Math.floor(Math.random()*(0-9)+9);
- do{
- randomnumber = Math.floor(Math.random()*(0-9)+9);
- } while(randomnumber%2!=0);
- i=randomnumber;
- {
- if (urls[i] > "")
- //p.console("" + urls[i]);
- {
- last_fm = window.SetProperty("YT Similar", urls[i]);
- last_fm = urls[i];
- window.SetProperty("YT Similar", urls[i]);
- }
- else
- {
- last_fm = window.SetProperty("YT Similar", "");
- last_fm = "";
- window.SetProperty("YT Similar", "");
- }
- }
- this.doc.close();
- this.working=false;
- if (last_fm == "" || last_fm == "?") {downloadGENRE2();}
- else
- downloadTRACK1();
- } else {
- p.console("HTTP error: " + this.xmlhttp.status);
- if (this.xmlhttp.status == 404)
- {downloadGENRE2();}
- }
- }
- }
- }
- }}
- }
- this.artist = "";
- function pan1() { }
- function pan2(x, y, w, h) { }
- //Begin----------------------------------------------------
- var p = new panel("Youtube Radio", ["remap", "metadb"]);
- var im = new pan2(0, 0, 0, 0);
- var th = new pan1();
- on_item_focus_change();
- {
- }
- function on_metadb_changed() {
- }
- //Button---------------------------------------------------
- var Buttons;
- var g_tooltip = window.CreateTooltip();
- var g_down = false;
- var btn_down = null;
- var cur_btn = null;
- ButtonStates = {
- normal: 0,
- hover: 1,
- down: 2
- }
- function Button(x, y, w, h, img_src, func, tiptext) {
- this.left = x;
- this.top = y;
- this.w = w;
- this.h = h;
- this.right = x + w;
- this.bottom = y + h;
- this.func = func;
- this.tiptext = tiptext;
- this.state = ButtonStates.normal;
- this.img_normal = img_src && img_src.normal ? gdi.Image(img_src.normal) : null;
- this.img_hover = img_src && img_src.hover ? gdi.Image(img_src.hover) : this.img_normal;
- this.img_down = img_src && img_src.down ? gdi.Image(img_src.down) : this.img_hover;
- this.img = this.img_normal;
- this.alterImage = function(img_src) {
- this.img_normal = img_src && img_src.normal ? gdi.Image(img_src.normal) : null;
- this.img_hover = img_src && img_src.hover ? gdi.Image(img_src.hover) : this.img_normal;
- this.img_down = img_src && img_src.down ? gdi.Image(img_src.down) : this.img_hover;
- this.changeState(this.state);
- }
- this.traceMouse = function (x, y) {
- var b = (this.left < x) && (x < this.right) && (this.top < y) && (y < this.bottom);
- if (b)
- g_down ? this.changeState(ButtonStates.down) : this.changeState(ButtonStates.hover);
- else
- this.changeState(ButtonStates.normal);
- return b;
- }
- this.changeState = function (newstate) {
- if (newstate != this.state)
- window.RepaintRect(this.left, this.top, this.w, this.h);
- this.state = newstate;
- switch (this.state)
- {
- case ButtonStates.normal:
- this.img = this.img_normal;
- break;
- case ButtonStates.hover:
- this.img = this.img_hover;
- break;
- case ButtonStates.down:
- this.img = this.img_down;
- break;
- default:
- this.img = null;
- }
- }
- this.draw = function (gr) {
- this.img && gr.DrawImage(this.img, this.left, this.top, this.w, this.h, 0, 0, this.w, this.h);
- }
- this.onClick = function () {
- this.func && this.func(x,y);
- }
- this.onMouseIn = function() {
- g_tooltip.Text = this.tiptext;
- g_tooltip.Activate();
- }
- this.onMouseOut = function() {
- g_tooltip.Deactivate();
- }
- }
- function buttonsDraw(gr) {
- for (i in Buttons) {
- Buttons[i].draw(gr);
- }
- }
- function buttonsTraceMouse(x, y) {
- var btn = null;
- for (i in Buttons) {
- if (Buttons[i].traceMouse(x, y) && !btn)
- btn = Buttons[i];
- }
- return btn;
- }
- function on_mouse_move(x, y) {
- var btn = buttonsTraceMouse(x, y);
- if (btn != cur_btn) {
- cur_btn && cur_btn.onMouseOut();
- btn && btn.onMouseIn();
- }
- cur_btn = btn;
- }
- function on_mouse_lbtn_down(x, y) {
- g_down = true;
- btn_down = cur_btn;
- if (cur_btn) {
- cur_btn.changeState(ButtonStates.down);
- }
- }
- function on_mouse_lbtn_up(x, y) {
- if (cur_btn) {
- cur_btn.changeState(ButtonStates.hover);
- if( btn_down == cur_btn )
- cur_btn.onClick(x, y);
- }
- g_down = false;
- }
- function on_mouse_leave() {
- if (cur_btn) {
- cur_btn.changeState(ButtonStates.normal);
- }
- }
- function on_size() {
- ww = window.Width;
- wh = window.Height;
- window.Repaint();
- }
- //Background
- this.dui = window.InstanceType;
- function on_paint(gr) {
- if (this.dui) {
- col = window.GetColorDUI(1);
- gr.FillSolidRect(0, 0, ww, wh, col);
- }
- else
- {
- col = window.GetColorCUI(3);
- }
- buttonsDraw(gr);
- }
- function RGB(r,g,b) {
- return (0xff000000|(r<<16)|(g<<8)|(b));
- }
- function on_colors_changed() {
- window.Repaint();
- }
- //init Buttons--------------------------------------------
- //custom colour
- var custom = RGB(255,255,255);
- //button width
- var bw = 24;
- //button height
- var bh = 20;
- //Button position
- var top_margin = -1;
- var left_margin = 0;
- var image_path0 = window.GetProperty("Button Path", fb.ProfilePath + "image");
- var image_path = (image_path0 + "\\");
- //these 2 lines of code lock the panel size.
- //window.MinWidth = window.MaxWidth = 24;
- //window.MinHeight = window.MaxHeight = 20;
- Buttons = {
- but1: new Button(left_margin,top_margin,bw,bh, {normal: image_path + "youtube0.png", hover: image_path + "youtube1.png"}, function(){
- p.rbtn_up(24, 17);
- //downloadONE();
- }, "Youtube")
- }
- function on_mouse_rbtn_up(x, y) {
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement