public override ResponseType Run() { Dialog.ShowAll(); ResponseType response = (ResponseType)Dialog.Run(); if (response == ResponseType.Ok) { string name = SourceName; StationType type = Type; string arg = Arg; ThreadAssist.Spawn(delegate { if (source == null) { source = new StationSource(lastfm, name, type.Name, arg); lastfm.AddChildSource(source); //LastFMPlugin.Instance.Source.AddChildSource (source); //ServiceManager.SourceManager.AddSource (source); } else { source.Rename(name); source.Type = type; source.Arg = arg; source.Save(); //source.Refresh (); } }); } return(response); }
public int Compare(Source sa, Source sb) { StationSource a = sa as StationSource; StationSource b = sb as StationSource; return(a.PlayCount.CompareTo(b.PlayCount)); }
public StationEditor(LastfmSource lastfm, StationSource source) : base(dialog_name, new Glade.XML( System.Reflection.Assembly.GetExecutingAssembly(), dialog_resource, dialog_name, Banshee.ServiceStack.Application.InternalName)) { this.lastfm = lastfm; this.source = source; Arg = source.Arg; Initialize(); Dialog.Title = Catalog.GetString("Edit Station"); }
private void OnRefreshSource(object o, EventArgs args) { StationSource source = Actions.SourceActions.ActionSource as StationSource; if (source != null) { source.Refresh(); } }
private void OnCommandLineArgument(string uri, object value, bool isFile) { if (!isFile || String.IsNullOrEmpty(uri)) { return; } // Handle lastfm:// URIs if (uri.StartsWith("lastfm://")) { StationSource.CreateFromUrl(this, uri); } }
public LastfmTrackInfo(Track track, StationSource station, string trackauth) { this.station = station; this.trackauth = trackauth; Uri = new SafeUri(track.Locations[0]); ArtistName = track.Creator; TrackTitle = track.Title; AlbumTitle = track.Album; Duration = track.Duration; TrackNumber = (int)track.TrackNumber; XspfTrack = track; MediaAttributes = TrackMediaAttributes.AudioStream | TrackMediaAttributes.Music; CanSaveToDatabase = false; }
public void SetUserName(string username) { if (username != last_username || last_was_subscriber != Account.Subscriber) { last_username = username; last_was_subscriber = Account.Subscriber; LastfmSource.LastUserSchema.Set(last_username); ClearChildSources(); PauseSorting(); foreach (StationSource child in StationSource.LoadAll(this, Account.UserName)) { AddChildSource(child); } ResumeSorting(); SortChildSources(); } }
public static StationSource CreateFromUrl(LastfmSource lastfm, string url) { foreach (StationType type in StationType.Types) { string regex = Regex.Escape(type.GetStationFor("XXX")).Replace("XXX", "([^\\/]+)"); Match match = Regex.Match(url, regex); if (match.Groups.Count == 2 && match.Groups[0].Captures.Count > 0) { Log.DebugFormat("Creating last.fm station from url {0}", url); string arg = match.Groups[1].Captures[0].Value; StationSource station = new StationSource(lastfm, arg, type.Name, arg); lastfm.AddChildSource(station); station.NotifyUser(); } } return(null); }
private void OnArtistPlaySimilarRadio(object sender, EventArgs args) { StationSource similar_radio = null; foreach (StationSource station in lastfm.Children) { if (station.Type == StationType.Similar && station.Arg == CurrentArtist) { similar_radio = station; break; } } if (similar_radio == null) { similar_radio = new StationSource(lastfm, String.Format(Catalog.GetString("Similar to {0}"), CurrentArtist), "Similar", CurrentArtist ); lastfm.AddChildSource(similar_radio); } ServiceManager.SourceManager.SetActiveSource(similar_radio); }