Skip to content

Commit

Permalink
Merge pull request #469 from classtranscribe/MoreTaskengineUpdates
Browse files Browse the repository at this point in the history
More taskengine updates
  • Loading branch information
angrave authored Jan 27, 2024
2 parents c47ff71 + 217b91a commit fa1a49d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions ClassTranscribeServer/Controllers/CaptionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public async Task<ActionResult<Caption>> PostCaption(Caption modifiedCaption)
};
_context.Captions.Add(newCaption);
await _context.SaveChangesAsync();
_wakeDownloader.UpdateVTTFile(oldCaption.TranscriptionId);
// nope _wakeDownloader.UpdateVTTFile(oldCaption.TranscriptionId);
return newCaption;
}

Expand Down Expand Up @@ -337,7 +337,7 @@ public async Task<ActionResult<IEnumerable<Caption>>> PostCaptionFile(IFormFile
await _context.Captions.AddRangeAsync(captions);
await _context.SaveChangesAsync();

_wakeDownloader.UpdateVTTFile(transcription.Id);
//nope _wakeDownloader.UpdateVTTFile(transcription.Id);

return captions;
}
Expand Down
18 changes: 9 additions & 9 deletions ClassTranscribeServer/Utils/WakeDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ public virtual void UpdatePlaylist(string playlistId)
Wake(msg);
}

public virtual void UpdateVTTFile(string transcriptionId)
{
JObject msg = new JObject
{
{ "Type", TaskType.GenerateVTTFile.ToString() },
{ "TranscriptionId", transcriptionId }
};
Wake(msg);
}
// public virtual void UpdateVTTFile(string transcriptionId)
// {
// JObject msg = new JObject
// {
// { "Type", TaskType.GenerateVTTFile.ToString() },
// { "TranscriptionId", transcriptionId }
// };
// Wake(msg);
// }

public void UpdateOffering(string offeringId)
{
Expand Down
5 changes: 4 additions & 1 deletion TaskEngine/Tasks/DownloadPlaylistInfoTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected override async Task OnConsume(string playlistId, TaskParameters taskPa
} catch(Exception) {
// ignored (e.g. no media). Tried DefaultIfEmpty but that threw an Entity Framework runtime error; hence this slightly clunky exception implementation
}
GetLogger().LogInformation($"Playlist {playlistId}: Starting index = {index}");
GetLogger().LogInformation($"Playlist {playlistId}: Starting index={index}, SourceType={playlist.SourceType}");
List<Media> medias = new List<Media>();
switch (playlist.SourceType)
{
Expand Down Expand Up @@ -105,6 +105,7 @@ public async Task<List<Media>> GetKalturaPlaylist(Playlist playlist, int index,
CTGrpc.JsonString jsonString = null;
try
{
GetLogger().LogError($"playlist=({playlist.Id}):GetKalturaChannelEntriesRPCAsync({playlist.PlaylistIdentifier}) - rpc starting");
jsonString = await _rpcClient.PythonServerClient.GetKalturaChannelEntriesRPCAsync(new CTGrpc.PlaylistRequest
{
Url = playlist.PlaylistIdentifier
Expand All @@ -121,6 +122,8 @@ public async Task<List<Media>> GetKalturaPlaylist(Playlist playlist, int index,
GetLogger().LogError($"playlist=({playlist.Id}):{e.Message}");
}
return newMedia;
} finally {
GetLogger().LogError($"playlist=({playlist.Id}):GetKalturaChannelEntriesRPCAsync({playlist.PlaylistIdentifier}) - rpc complete");
}
JArray jArray = JArray.Parse(jsonString.Json);

Expand Down
2 changes: 1 addition & 1 deletion UnitTests/GlobalFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public GlobalFixture()
Directory.CreateDirectory(_testDataDirectory);

var mockWake = new Mock<WakeDownloader>(MockBehavior.Strict, null);
mockWake.Setup(wake => wake.UpdateVTTFile(It.IsAny<string>()));
// mockWake.Setup(wake => wake.UpdateVTTFile(It.IsAny<string>()));
mockWake.Setup(wake => wake.UpdatePlaylist(It.IsAny<string>()));
mockWake.Setup(wake => wake.SceneDetection(It.IsAny<string>(), It.IsAny<bool>()));

Expand Down

0 comments on commit fa1a49d

Please sign in to comment.