public void AddHistoryEntry(Song song) { var cmdHistoryInsert = new SQLiteCommand("INSERT INTO history (id, title, time) VALUES ((SELECT max(id) FROM history) + 1, @title, @time)", this.connection); cmdHistoryInsert.Parameters.AddWithValue("@title", song.title); cmdHistoryInsert.Parameters.AddWithValue("@time", GetUnixTime()); cmdHistoryInsert.ExecuteNonQuery(); }
public static Song CreateFromTitle(string title) { try { Regex titleRegex = new Regex(Database.Instance.GetKv("song_title_regex", @"(.*?)\s\-\s(.*)"), RegexOptions.IgnoreCase | RegexOptions.Singleline); Match titleMatch = titleRegex.Match(title); if (titleMatch.Success && titleMatch.Groups.Count == 3) { var songAuthor = titleMatch.Groups[1].Value; var songName = titleMatch.Groups[2].Value; var instance = new Song(); instance.author = songAuthor; instance.name = songName; instance.title = title; return instance; } } catch (Exception) { return null; } return null; }
public SongStat(Song song) { this.song = song; this.occurrencesTitle = 0; this.occurrencesTitlePercent = 0; this.occurrencesAuthor = 0; this.occurrencesAuthorPercent = 0; }