Exemple #1
0
 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;
 }
 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);
 }