public ObsessedForm(Plugin.MusicBeeApiInterface pApi) { // C:\MusicBee\AppData\LastFmScrobbles.log | Scrobble log location InitializeComponent(); // --------Initializing lastfm api-------- string apikey = app.Default.API_KEY; //ConfigurationManager.AppSettings["API_KEY"]; string secretkey = app.Default.SECRET_KEY; //ConfigurationManager.AppSettings["SECRET_KEY"]; Session session = new Session(apikey, secretkey); string usr = pApi.Setting_GetLastFmUserId(); // -------- URL Construction -------- string root = "http://ws.audioscrobbler.com/2.0/?"; string m_topTracks = "method=user.gettoptracks&user="******"method=user.gettopalbums&user="******"method=user.getrecenttracks&user="******"&limit=200"; string pages = "&page="; int pageNum = 1; string tail = "&api_key=" + apikey + "&format=json"; // --------------------------------------- string url = root + m_recentTracks + limit + pages + pageNum + tail; var request = (HttpWebRequest)WebRequest.Create(url); var response = (HttpWebResponse)request.GetResponse(); var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); // Use QueryFilesEx to get the fileURLs pApi.Library_QueryFilesEx("domain=SelectedFiles", out String[] files); // files contains the fileURL for a selected track(s) string[] lines = System.IO.File.ReadAllLines(@"C:\MusicBee\AppData\LastFmScrobble.log"); string artist = pApi.Library_GetFileTag(files[0], Plugin.MetaDataType.Artist); string title = pApi.Library_GetFileTag(files[0], Plugin.MetaDataType.TrackTitle); int plays = Int32.Parse(pApi.Library_GetFileTag(files[0], (Plugin.MetaDataType) 14)); string added = pApi.Library_GetFileProperty(files[0], Plugin.FilePropertyType.DateAdded); //Date the selected track was added to the library string track = artist + " - " + title; // Consolidation for matching in the scrobble log List <DateTime> history = filter(lines, track, plays); // history contains the history of scrobbles for a given track represented in unix time. if (history.Count <= 1) { label1.Text = "Not enough scrobbles for this track"; } else { label1.Text = responseString + "";// +" | "+obsession(history, added, title, artist, plays); } }