示例#1
0
        private async Task TryUploadMp3(SongUpload song, AlbumUpload album, int songNumber, string songId)
        {
            var mp3Uri = default(Uri);

            try
            {
                var uri = await cdnManagerService.UploadMp3Async(song.Address, album.Artist, album.Name, songNumber, song.FileName);

                mp3Uri = uri;
            }
            catch (Exception error)
            {
                logger.LogError(error, "Unable to upload song MP3. {songId}, {songAddress}, {fileName}, {album}, {artist}", songId, song.Address, song.FileName, album.Name, album.Artist);
                await TryDeleteSong(songId);
            }

            if (mp3Uri != null)
            {
                await TryUpdateSongUri(songId, mp3Uri);
            }
        }
示例#2
0
 public void QueueMp3Upload(SongUpload song, AlbumUpload album, int songNumber, string songId)
 {
     backgroundQueue.Enqueue(_ => TryUploadMp3(song, album, songNumber, songId));
 }