diff --git a/.gitignore b/.gitignore
index b2bf6fd..df089c2 100755
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ promotion
.working
extension
client/tags
+NYoutubeDL
diff --git a/client/src/app/components/debug/debug.component.html b/client/src/app/components/debug/debug.component.html
index b175847..17f2f69 100755
--- a/client/src/app/components/debug/debug.component.html
+++ b/client/src/app/components/debug/debug.component.html
@@ -28,6 +28,10 @@
+
+
diff --git a/client/src/app/components/debug/debug.component.ts b/client/src/app/components/debug/debug.component.ts
index 16eab78..da5aa41 100755
--- a/client/src/app/components/debug/debug.component.ts
+++ b/client/src/app/components/debug/debug.component.ts
@@ -1,14 +1,14 @@
-import { Observable } from 'rxjs/Observable';
-import { SignalRService } from 'app/services/signalr.service';
-import { Component, OnInit } from '@angular/core';
-import { DebugService } from 'app/services/debug.service';
-import { environment } from 'environments/environment';
-import { JobsService } from 'app/services/jobs.service';
+import { Observable } from "rxjs/Observable";
+import { SignalRService } from "app/services/signalr.service";
+import { Component, OnInit } from "@angular/core";
+import { DebugService } from "app/services/debug.service";
+import { environment } from "environments/environment";
+import { JobsService } from "app/services/jobs.service";
@Component({
- selector: 'app-debug',
- templateUrl: './debug.component.html',
- styleUrls: ['./debug.component.css']
+ selector: "app-debug",
+ templateUrl: "./debug.component.html",
+ styleUrls: ["./debug.component.css"]
})
export class DebugComponent implements OnInit {
realtimeMessage: string;
@@ -17,35 +17,59 @@ export class DebugComponent implements OnInit {
debugInfo$: Observable;
apiHost = environment.API_HOST;
signalrHost = environment.SIGNALR_HOST;
- pingPong = '';
+ pingPong = "";
- constructor(private _debugService: DebugService, private _jobsService: JobsService,
- private _signalrService: SignalRService) {}
+ constructor(
+ private _debugService: DebugService,
+ private _jobsService: JobsService,
+ private _signalrService: SignalRService
+ ) {}
ngOnInit() {
this._signalrService
.init(`${environment.SIGNALR_HOST}hubs/debug`)
.then(() => {
- this._signalrService.connection.on('Send', data => {
- console.log('DebugService', 'signalr', data);
+ this._signalrService.connection.on("Send", data => {
+ console.log("DebugService", "signalr", data);
this.messagesReceived.push(data);
- this.realtimeMessage = '';
+ this.realtimeMessage = "";
});
this.debugInfo$ = this._debugService.getDebugInfo();
})
- .catch(err => console.error('debug.component.ts', '_signalrService.init', err));
+ .catch(err =>
+ console.error("debug.component.ts", "_signalrService.init", err)
+ );
this._debugService.ping().subscribe(r => (this.pingPong = r));
}
sendMessage() {
- this._debugService.sendRealtime(this.realtimeMessage).subscribe(r => console.log(r));
+ this._debugService
+ .sendRealtime(this.realtimeMessage)
+ .subscribe(r => console.log(r));
}
doSomething() {
- alert('doSomething was did');
+ alert("doSomething was did");
}
- processOrphans(){
- this._jobsService.processOrphans()
- .subscribe(e => console.log('debug.component.ts', 'processOrphans', e));
+ processOrphans() {
+ this._jobsService
+ .processOrphans()
+ .subscribe(e =>
+ console.log("debug.component.ts", "processOrphans", e)
+ );
+ }
+ processPlaylists() {
+ this._jobsService
+ .processPlaylists()
+ .subscribe(e =>
+ console.log("debug.component.ts", "processPlaylists", e)
+ );
+ }
+ updateYouTubeDl() {
+ this._jobsService
+ .updateYouTubeDl()
+ .subscribe(e =>
+ console.log("debug.component.ts", "updateYouTubeDl", e)
+ );
}
}
diff --git a/client/src/app/services/jobs.service.ts b/client/src/app/services/jobs.service.ts
index 12f52e2..4d5c9ca 100755
--- a/client/src/app/services/jobs.service.ts
+++ b/client/src/app/services/jobs.service.ts
@@ -6,9 +6,16 @@ import { environment } from 'environments/environment';
@Injectable()
export class JobsService {
- constructor(private _http: AuthHttp) {}
+ constructor(private _http: AuthHttp) { }
processOrphans(): Observable {
return this._http.get(environment.API_HOST + '/job/processorphans');
}
+
+ processPlaylists(): Observable {
+ return this._http.get(environment.API_HOST + '/job/processplaylists');
+ }
+ updateYouTubeDl(): Observable {
+ return this._http.get(environment.API_HOST + '/job/updateyoutubedl');
+ }
}
diff --git a/server/Controllers/JobController.cs b/server/Controllers/JobController.cs
index 93a8324..8db8431 100755
--- a/server/Controllers/JobController.cs
+++ b/server/Controllers/JobController.cs
@@ -4,18 +4,25 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using PodNoms.Api.Services.Jobs;
-namespace PodNoms.Api.Controllers
-{
+namespace PodNoms.Api.Controllers {
[Authorize]
[Route("[controller]")]
[ApiExplorerSettings(IgnoreApi = true)]
- public class JobController : Controller
- {
+ public class JobController : Controller {
[HttpGet("processorphans")]
- public IActionResult ProcessOrphans()
- {
+ public IActionResult ProcessOrphans() {
var infoJobId = BackgroundJob.Enqueue(service => service.Execute());
return Ok();
}
+ [HttpGet("processplaylists")]
+ public IActionResult ProcessPlaylists() {
+ var infoJobId = BackgroundJob.Enqueue(service => service.Execute());
+ return Ok();
+ }
+ [HttpGet("updateyoutubedl")]
+ public IActionResult UpdateYouTubeDl() {
+ var infoJobId = BackgroundJob.Enqueue(service => service.Execute());
+ return Ok();
+ }
}
}
\ No newline at end of file
diff --git a/server/PodNoms.Api.csproj b/server/PodNoms.Api.csproj
index ce388e0..b2fe915 100755
--- a/server/PodNoms.Api.csproj
+++ b/server/PodNoms.Api.csproj
@@ -16,7 +16,7 @@
-
+
diff --git a/server/Services/Downloader/AudioDownloader.cs b/server/Services/Downloader/AudioDownloader.cs
index 8a99654..9e99a2f 100755
--- a/server/Services/Downloader/AudioDownloader.cs
+++ b/server/Services/Downloader/AudioDownloader.cs
@@ -16,7 +16,11 @@ namespace PodNoms.Api.Services.Downloader {
private readonly string _url;
private readonly string _downloader;
- public VideoDownloadInfo Properties { get; private set; }
+
+ private DownloadInfo _properties;
+ public VideoDownloadInfo Properties => _properties is VideoDownloadInfo ? (VideoDownloadInfo)_properties : null;
+ public DownloadInfo RawProperties => _properties;
+
protected const string DOWNLOADRATESTRING = "iB/s";
protected const string DOWNLOADSIZESTRING = "iB";
protected const string ETASTRING = "ETA";
@@ -55,15 +59,15 @@ namespace PodNoms.Api.Services.Downloader {
await Task.Run(() => {
var youtubeDl = new YoutubeDL();
youtubeDl.VideoUrl = this._url;
- DownloadInfo info = youtubeDl.GetDownloadInfo();
+ var info = youtubeDl.GetDownloadInfo();
if (info != null &&
(info.Errors.Count == 0 || info.VideoSize != null)) {
- if (info is PlaylistDownloadInfo) {
+ this._properties = info;
+ if (info is PlaylistDownloadInfo && ((PlaylistDownloadInfo)info).Videos.Count > 0) {
ret = AudioType.Playlist;
} else if (info is VideoDownloadInfo) {
ret = AudioType.Valid;
- this.Properties = (VideoDownloadInfo)info;
}
}
});
diff --git a/server/Services/Jobs/ProcessPlaylistsJob.cs b/server/Services/Jobs/ProcessPlaylistsJob.cs
index fe3ff85..5afcbab 100755
--- a/server/Services/Jobs/ProcessPlaylistsJob.cs
+++ b/server/Services/Jobs/ProcessPlaylistsJob.cs
@@ -27,8 +27,8 @@ namespace PodNoms.Api.Services.Jobs {
var downloader = new AudioDownloader(playlist.SourceUrl, _applicationsSettings.Downloader);
var info = await downloader.GetInfo();
if (info == AudioType.Playlist){
- var
- for (var item in downloader.Properties.)
+ //var
+ //for (var item in downloader.Properties.)
}
}
}
diff --git a/server/Services/Jobs/UpdateYouTubeDlJob.cs b/server/Services/Jobs/UpdateYouTubeDlJob.cs
new file mode 100644
index 0000000..cf3176f
--- /dev/null
+++ b/server/Services/Jobs/UpdateYouTubeDlJob.cs
@@ -0,0 +1,15 @@
+using System.Threading.Tasks;
+using NYoutubeDL;
+using PodNoms.Api.Services.Jobs;
+
+namespace PodNoms.Api.Services.Jobs {
+ public class UpdateYouTubeDlJob : IJob {
+ public async Task Execute() {
+ await Task.Run(() => {
+ var yt = new YoutubeDL();
+ yt.Options.GeneralOptions.Update = true;
+ yt.Download("https://www.youtube.com/watch?v=OJ2wOKDzKyI");
+ });
+ }
+ }
+}
\ No newline at end of file
diff --git a/server/commands b/server/commands
new file mode 100644
index 0000000..d34c3bb
--- /dev/null
+++ b/server/commands
@@ -0,0 +1,3 @@
+get-info
+youtube-dl --flat-playlist -i -J -s
+