示例#1
0
 public override async Task Upload(MusicItem song, string resource, PimpSession destSession)
 {
     var targetUri = destSession.BaseUri + resource;
     var cmd       = new BeamCommand(song.Id, targetUri, destSession.Username, destSession.Password);
     // Bug: If the upload takes about over one minute, the client-side
     // response of HttpClient says 404 even though the server has returned
     // 200 OK. Increasing HttpClient.Timeout has no effect.
     // Displaying an error when all is fine is confusing so we suppress the
     // exception until this is resolved properly. This might of course also
     // suppress 404s that are actually real.
     await Utils.SuppressAsync <NotFoundException>(async() => {
         var versionResponse = await session.PingAuth();
         var serverVersion   = new Version(versionResponse.version);
         try {
             // throws BadRequestException if adding fails
             await session.PostCommand(cmd, "/playback/stream");
         } catch (InternalServerErrorException) {
             // MusicPimp server 2.0.0 and lower throw InternalServerError if the MusicBeamer endpoint uses https because
             // StartSSL certs are not trusted. Fixed in MusicPimp server 2.1.0.
             if (destSession.BaseUri.StartsWith("https") && serverVersion < PimpSessionBase.HttpsSupportingVersion)
             {
                 MessagingService.Instance.Send("An error occurred. Please upgrade the MusicPimp server to version 2.1.1 or later. Get it from www.musicpimp.org. Thanks!");
             }
             else
             {
                 throw;
             }
         }
     });
 }
示例#2
0
 public PimpPlaylist(PimpSession session, Func <MusicEndpoint> musicSource, PimpWebSocket webSocket)
     : base(session, webSocket)
 {
     this.s           = session;
     this.musicSource = musicSource;
 }
示例#3
0
 public PimpWebPlayer(PimpSession session, PimpWebSocket webSocket)
     : base(session, webSocket)
 {
     Playlist = new PimpWebPlaylist(session, webSocket);
 }