internal void Follow(MpdFileInfo e) { lastFollow = e; TreeIter iter; var hasItem = ContentsList.GetIterFirst(out iter); selfSetting = true; while (hasItem) { var info=(MpdFileInfo)ContentsList.GetValue(iter, 6); if (info.Id == e.Id) { Contents.SetCursor(ContentsList.GetPath(iter),Contents.Columns[0],false); Contents.ScrollToCell(ContentsList.GetPath(iter), Contents.Columns[0], true, 0.5f,0f); break; } hasItem = ContentsList.IterNext(ref iter); } selfSetting = false; }
public void UpdateStatus() { var rv = MpdClient.GetSharedClient().CurrentSong() ?? new MpdFileInfo(); var newState = MpdClient.GetSharedClient().Status(); var oldSong = _lastSong != null && rv.Path == _lastSong.Path; string xState; newState.TryGetValue("state", out xState); var oldState = xState == _lastState; if (oldSong && oldState) return; _lastSong = rv; _lastState = xState; Logger.Debug("Status update"); Application.Invoke(delegate { Album.Text = rv.Album; Artist.Text = rv.Artist; Title.Text = rv.Title; ((PlayerChangeForwarder)Program.Kernel.Get<PlayerInteraction>()).PushSongChange(rv.Artist, rv.Album, rv.Title, rv.Path); Art.Pixbuf = null; Lyrics.Buffer.Text = ""; if (!oldState) OnPlayStateChanged(newState); if (!oldSong) OnSongChanged(rv); }); }
protected virtual void OnSongChanged(MpdFileInfo e) { var handler = SongChanged; if (handler != null) handler(this, e); }
private static void ParseListing(string path, Tuple<List<string>, string> items, List<MpdFileInfo> list) { MpdFileInfo lastItem = null; foreach (var item in items.Item1) { var parts = item.Split(new[] { ':' }, 2); if (parts[0] == "directory" || parts[0] == "file") { list.Add(lastItem = new MpdFileInfo { Name = parts[1].Trim(), Type = parts[0], Path = path + parts[1].Trim() }); } else if (parts[0] == "lastModified" && lastItem != null) lastItem.LastModified = parts[1].Trim(); else if (parts[0] == "Artist" && lastItem != null) lastItem.Artist = parts[1].Trim(); else if (parts[0] == "AlbumArtist" && lastItem != null) lastItem.AlbumArtist = parts[1].Trim(); else if (parts[0] == "Title" && lastItem != null) lastItem.Title = parts[1].Trim(); else if (parts[0] == "Album" && lastItem != null) lastItem.Album = parts[1].Trim(); else if (parts[0] == "Time" && lastItem != null) lastItem.Time = int.Parse(parts[1].Trim()); else if (parts[0] == "Id" && lastItem != null) lastItem.Id = parts[1].Trim(); } }
private void NowPlayingPage_SongChanged(object sender, MpdFileInfo e) { Logger.Debug("Song change"); playlistPage.Follow(e); Title = string.Format("{0} from {1} by {2}", e.Title, e.Album, e.Artist); }