mirror of
https://github.com/fergalmoran/podnoms.git
synced 2025-12-22 09:18:08 +00:00
Fix playlist in production
This commit is contained in:
1
docker/log.sh
Executable file
1
docker/log.sh
Executable file
@@ -0,0 +1 @@
|
|||||||
|
eval $(docker-machine env podnoms-vm) && docker-compose logs -f
|
||||||
@@ -20,6 +20,7 @@ using PodNoms.Api.Services.Auth;
|
|||||||
using PodNoms.Api.Services.Jobs;
|
using PodNoms.Api.Services.Jobs;
|
||||||
using PodNoms.Api.Services.Processor;
|
using PodNoms.Api.Services.Processor;
|
||||||
using PodNoms.Api.Services.Storage;
|
using PodNoms.Api.Services.Storage;
|
||||||
|
using PodNoms.Api.Utils.RemoteParsers;
|
||||||
|
|
||||||
namespace PodNoms.Api.Controllers {
|
namespace PodNoms.Api.Controllers {
|
||||||
|
|
||||||
@@ -115,9 +116,11 @@ namespace PodNoms.Api.Controllers {
|
|||||||
var result = _mapper.Map<PodcastEntry, PodcastEntryViewModel>(entry);
|
var result = _mapper.Map<PodcastEntry, PodcastEntryViewModel>(entry);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} else if (status == AudioType.Playlist && _hostingEnvironment.IsDevelopment()) {
|
} else if (status == AudioType.Playlist && YouTubeParser.ValidateUrl(item.SourceUrl)) {
|
||||||
entry.ProcessingStatus = ProcessingStatus.Deferred;
|
entry.ProcessingStatus = ProcessingStatus.Deferred;
|
||||||
return Accepted(entry);
|
return Accepted(entry);
|
||||||
|
} else {
|
||||||
|
return BadRequest("Processor failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return BadRequest($"Unable to find podcast with ID: {item.PodcastId}");
|
return BadRequest($"Unable to find podcast with ID: {item.PodcastId}");
|
||||||
|
|||||||
@@ -44,15 +44,14 @@ namespace PodNoms.Api.Services.Jobs {
|
|||||||
var info = downloader.GetInfo();
|
var info = downloader.GetInfo();
|
||||||
var id = ((PlaylistDownloadInfo)downloader.RawProperties).Id;
|
var id = ((PlaylistDownloadInfo)downloader.RawProperties).Id;
|
||||||
if (info == AudioType.Playlist && downloader.RawProperties is PlaylistDownloadInfo) {
|
if (info == AudioType.Playlist && downloader.RawProperties is PlaylistDownloadInfo) {
|
||||||
if (_youTubeParser.ValidateUrl(playlist.SourceUrl)) {
|
if (YouTubeParser.ValidateUrl(playlist.SourceUrl)) {
|
||||||
var searchTerm = (playlist.SourceUrl.Contains("/user/")) ? "forUsername" : "id";
|
var searchTerm = (playlist.SourceUrl.Contains("/user/")) ? "forUsername" : "id";
|
||||||
resultList = await _youTubeParser.GetPlaylistEntriesForId(id);
|
resultList = await _youTubeParser.GetPlaylistEntriesForId(id);
|
||||||
//make sure the items are sorted in ascending date order
|
//make sure the items are sorted in ascending date order
|
||||||
//so they will be processed in the order they were created
|
//so they will be processed in the order they were created
|
||||||
} else if (_mixcloudParser.ValidateUrl(playlist.SourceUrl)) {
|
} else if (MixcloudParser.ValidateUrl(playlist.SourceUrl)) {
|
||||||
resultList = await _mixcloudParser.GetEntries(id);
|
resultList = await _mixcloudParser.GetEntries(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
foreach (var item in resultList?.OrderBy(r => r.UploadDate)) {
|
foreach (var item in resultList?.OrderBy(r => r.UploadDate)) {
|
||||||
if (!playlist.ParsedPlaylistItems.Any(p => p.VideoId == item.Id)) {
|
if (!playlist.ParsedPlaylistItems.Any(p => p.VideoId == item.Id)) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace PodNoms.Api.Utils.RemoteParsers {
|
|||||||
public MixcloudParser(IHttpClientFactory httpClientFactory) {
|
public MixcloudParser(IHttpClientFactory httpClientFactory) {
|
||||||
this._httpClientFactory = httpClientFactory;
|
this._httpClientFactory = httpClientFactory;
|
||||||
}
|
}
|
||||||
public bool ValidateUrl(string url) {
|
public static bool ValidateUrl(string url) {
|
||||||
var regex = new Regex(URL_REGEX);
|
var regex = new Regex(URL_REGEX);
|
||||||
var result = regex.Match(url);
|
var result = regex.Match(url);
|
||||||
return result.Success;
|
return result.Success;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace PodNoms.Api.Utils.RemoteParsers {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ValidateUrl(string url) {
|
public static bool ValidateUrl(string url) {
|
||||||
var regex = new Regex(URL_REGEX);
|
var regex = new Regex(URL_REGEX);
|
||||||
var result = regex.Match(url);
|
var result = regex.Match(url);
|
||||||
return result.Success;
|
return result.Success;
|
||||||
|
|||||||
Reference in New Issue
Block a user