Exemple #1
0
        private EchoResponse Identify(SharedType.Code data)
        {
            var result = EchonestAPI.IdentifySongAsync(data, apipath.Text);
            var item   = JsonConvert.DeserializeObject <EchoResponse>(result.Data);

            return(item);
        }
        private async Task <string> SetItem(Code item, bool skip_Check_existed, string file)
        {
            if (item == null)
            {
                return(null);
            }

            Api = new EchonestAPI();
            item.metadata.version = 4.12f;

            var result = await Api.AsyncInsertSongToDataBaseChecking(item, SelectedServer, file, Program.Message, skip_Check_existed);

            Program.Message(JsonConvert.SerializeObject(result));
            return(result);
        }
        private void button8_Click(object sender, EventArgs e)
        {
            var url = "";

            //this.Invoke(new MethodInvoker(delegate () { url = comboBox1.SelectedItem.ToString(); }));
            this.Invoke(new MethodInvoker(delegate() { url = tburl.Text; }));
            var code = new Code();

            this.Invoke(new MethodInvoker(delegate() { code = JsonConvert.DeserializeObject <Code>(JsonOutput.Text); }));

            ThreadPool.QueueUserWorkItem(state =>
            {
                EchonestAPI.IdentifySong(code, url, (result) =>
                {
                    Program.SetMetaDataResponse(result.Data);
                    Program.Message(result.Data);
                });
            });
        }
Exemple #4
0
        private void RunTimeAnalyzer_Identify(object sender, EventArgs e)
        {
            var data = e as ReceivedStepArgs;
            var t1   = DateTime.Now.Ticks;
            var msg  = "Unknown error";

            log.Warn(DateTime.Now.Second + " - Array length: " + data.Stream.Length + " - Step: " + data.Step);
            var result = EchonestAPI.GetFingerprintAsync(data.Stream, filename).Result;

            var meta = Identify(result);

            //Ingest(data.station, meta.track_info.release == null ? "" : meta.track_info.release, JsonConvert.SerializeObject(meta),JsonConvert.SerializeObject(result));
            if (meta.track_info.artist == null)
            {
                msg = "No match: " + meta.message;
            }
            else
            {
                msg = "Result: " + (DateTime.Now.Ticks - t1) / TimeSpan.TicksPerMillisecond + " - track: " + meta.track_info.artist + ": " + meta.track_info.track;
            }
            //  log.Warn("codgentime: " + (DateTime.Now.Ticks - t1) / TimeSpan.TicksPerMillisecond + " - length meta: " + result.code_count);
            log.Warn(msg);
            AppendText(interval.Text + " seconds -> " + msg);
        }