-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#504: uploaded video saving updated.
- Loading branch information
Simonas Mikulenas
committed
Jul 17, 2013
1 parent
ec94405
commit cf58deb
Showing
9 changed files
with
169 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
Modules/BetterCms.Module.Viddler/Command/SaveVideo/SaveVideoCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
|
||
using BetterCms.Core.Mvc.Commands; | ||
using BetterCms.Module.MediaManager.Models; | ||
using BetterCms.Module.Root.Mvc; | ||
using BetterCms.Module.Viddler.Models; | ||
using BetterCms.Module.Viddler.Services; | ||
|
||
namespace BetterCms.Module.Viddler.Command.Videos.SaveVideos | ||
{ | ||
internal class SaveVideoCommand : CommandBase, ICommand<SaveVideoRequest, Video> | ||
{ | ||
private readonly IViddlerService viddlerService; | ||
|
||
public SaveVideoCommand(IViddlerService viddlerService) | ||
{ | ||
this.viddlerService = viddlerService; | ||
} | ||
|
||
public Video Execute(SaveVideoRequest request) | ||
{ | ||
var sesionId = viddlerService.GetSessionId(); | ||
var data = viddlerService.GetVideoDetails(sesionId, request.VideoId); | ||
var video = new Video | ||
{ | ||
OriginalFileName = data.Title, | ||
OriginalFileExtension = string.Empty, | ||
FileUri = new Uri(viddlerService.GetPlayerUrl(data.Id)), | ||
PublicUrl = viddlerService.GetVideoUrl(data.Id), | ||
Size = data.Length, | ||
IsTemporary = true, | ||
IsUploaded = data.IsReady, | ||
Title = data.Title, | ||
Type = MediaType.Video, | ||
ContentType = MediaContentType.File, | ||
PublishedOn = DateTime.Now, | ||
Description = data.Description, | ||
VideoId = data.Id, | ||
ThumbnailUrl = data.ThumbnailUrl, | ||
}; | ||
Repository.Save(video); | ||
UnitOfWork.Commit(); | ||
return video; | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
Modules/BetterCms.Module.Viddler/Command/SaveVideo/SaveVideoRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace BetterCms.Module.Viddler.Command.Videos.SaveVideos | ||
{ | ||
public class SaveVideoRequest | ||
{ | ||
public string VideoId { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters