コード例 #1
0
 private string GetParameterValue(string parameterKey, BroadcastingParameter parameter)
 {
     switch (parameterKey)
     {
         case "name":
             return parameter.BroadcastParameter.Name;
         case "bitrate":
             return parameter.Bitrate.ToString();
         case "tags":
             return parameter.BroadcastParameter.Genre;
         case "description":
             return parameter.BroadcastParameter.Description;
         case "comment":
             return parameter.BroadcastParameter.Comment;
         case "contact_url":
             return parameter.BroadcastParameter.ContactUrl;
         case "protocol":
             return "Peercast";
         case "stream_url":
             return "http://localhost:7144/pls/" + parameter.Id;
         case "type":
             return parameter.BroadcastParameter.Type;
         case "password":
             return parameter.YellowPagesParameters.Single(x => x.Key == "password").Value;
         case "listeners_invisibility":
             return parameter.YellowPagesParameters.Single(x => x.Key == "listeners_invisibility").Value;
         case "result_format":
             return "json";
         default:
             throw new ArgumentException();
     }
 }
コード例 #2
0
 public Task OnBroadcastedAsync(BroadcastingParameter parameter)
 {
     password = parameter.YellowPagesParameters["password"];
     var nvc = new NameValueCollection();
     foreach (var param in BroadcastParameters)
     {
         nvc.Add(param, GetParameterValue(param, parameter));
     }
     return Post(BroadcastUrl, nvc);
 }
コード例 #3
0
 public static IChannel ToChannel(BroadcastingParameter parameter)
 {
     return new Channel
     {
         Name = parameter.BroadcastParameter.Name,
         Id = parameter.Id,
         Bitrate = parameter.Bitrate,
         Type = "",
         TotalListeners = 0,
         TotalRelays = 0,
         LocalListeners = 0,
         LocalRelays = 0,
         Status = "",
         Genre = parameter.BroadcastParameter.Genre,
         Description = parameter.BroadcastParameter.Description,
         ContactUrl = parameter.BroadcastParameter.ContactUrl,
         Comment = parameter.BroadcastParameter.Comment,
         Age = 0
     };
 }