diff --git a/src/Podsync/Controllers/FeedController.cs b/src/Podsync/Controllers/FeedController.cs
index 0218237..d0e2cb9 100644
--- a/src/Podsync/Controllers/FeedController.cs
+++ b/src/Podsync/Controllers/FeedController.cs
@@ -8,7 +8,6 @@ using Microsoft.AspNetCore.Mvc;
using Podsync.Helpers;
using Podsync.Services;
using Podsync.Services.Links;
-using Podsync.Services.Resolver;
using Podsync.Services.Rss;
using Podsync.Services.Rss.Contracts;
using Podsync.Services.Storage;
@@ -47,7 +46,7 @@ namespace Podsync.Controllers
Provider = linkInfo.Provider,
LinkType = linkInfo.LinkType,
Id = linkInfo.Id,
- Quality = request.Quality ?? ResolveFormat.VideoHigh,
+ Quality = request.Quality ?? Constants.DefaultFormat,
PageSize = request.PageSize ?? Constants.DefaultPageSize
};
@@ -59,7 +58,8 @@ namespace Podsync.Controllers
}
else
{
- feed.Quality = ResolveFormat.VideoHigh;
+ feed.Quality = Constants.DefaultFormat;
+ feed.PageSize = Constants.DefaultPageSize;
}
var feedId = await _feedService.Create(feed);
diff --git a/src/Podsync/Services/Rss/Builders/YouTubeRssBuilder.cs b/src/Podsync/Services/Rss/Builders/YouTubeRssBuilder.cs
index 0c9eca9..e2f0a93 100644
--- a/src/Podsync/Services/Rss/Builders/YouTubeRssBuilder.cs
+++ b/src/Podsync/Services/Rss/Builders/YouTubeRssBuilder.cs
@@ -50,10 +50,10 @@ namespace Podsync.Services.Rss.Builders
}
// Get video ids from this playlist
- var ids = await _youTube.GetPlaylistItemIds(new PlaylistItemsQuery { PlaylistId = channel.Guid });
+ var ids = await _youTube.GetPlaylistItemIds(new PlaylistItemsQuery { PlaylistId = channel.Guid, Count = metadata.PageSize });
// Get video descriptions
- var videos = await _youTube.GetVideos(new VideoQuery { Id = string.Join(",", ids) });
+ var videos = await _youTube.GetVideos(new VideoQuery { Ids = ids });
channel.Items = videos.Select(youtubeVideo => MakeItem(youtubeVideo, metadata)).ToArray();
diff --git a/src/Podsync/Services/Rss/FeedService.cs b/src/Podsync/Services/Rss/FeedService.cs
index 68746e0..7a58676 100644
--- a/src/Podsync/Services/Rss/FeedService.cs
+++ b/src/Podsync/Services/Rss/FeedService.cs
@@ -24,8 +24,6 @@ namespace Podsync.Services.Rss
throw new ArgumentException("Only YouTube supports audio feeds");
}
- metadata.PageSize = Constants.DefaultPageSize;
-
return _storageService.Save(metadata);
}
diff --git a/src/Podsync/Services/Videos/YouTube/VideoQuery.cs b/src/Podsync/Services/Videos/YouTube/VideoQuery.cs
index 1b32af7..68ee669 100644
--- a/src/Podsync/Services/Videos/YouTube/VideoQuery.cs
+++ b/src/Podsync/Services/Videos/YouTube/VideoQuery.cs
@@ -1,9 +1,9 @@
-namespace Podsync.Services.Videos.YouTube
+using System.Collections.Generic;
+
+namespace Podsync.Services.Videos.YouTube
{
public struct VideoQuery
{
- public string Id { get; set; }
-
- public int? Count { get; set; }
+ public ICollection Ids { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Podsync/Services/Videos/YouTube/YouTubeClient.cs b/src/Podsync/Services/Videos/YouTube/YouTubeClient.cs
index f4bd4a8..81e2b2f 100644
--- a/src/Podsync/Services/Videos/YouTube/YouTubeClient.cs
+++ b/src/Podsync/Services/Videos/YouTube/YouTubeClient.cs
@@ -71,17 +71,18 @@ namespace Podsync.Services.Videos.YouTube
{
var request = _youtube.Videos.List("id,snippet,contentDetails");
- request.Id = query.Id;
+ var totalCount = query.Ids.Count;
+ var pageIndex = 0;
- return AggregatePages
diff --git a/src/Podsync/wwwroot/js/site.js b/src/Podsync/wwwroot/js/site.js
index 70fb4a0..bd8a3fe 100644
--- a/src/Podsync/wwwroot/js/site.js
+++ b/src/Podsync/wwwroot/js/site.js
@@ -52,26 +52,29 @@ $(function () {
Tooltips
*/
- $(document).on('mouseenter', 'i', function() {
- var title = $(this).attr('title');
- if (!title) {
- return;
- }
- $(this).data('tipText', title).removeAttr('title');
- $('').text(title).appendTo('body').fadeIn('fast');
- });
+ if (!isMobile()) {
+ $(document).on('mouseenter', 'i', function () {
+ var title = $(this).attr('title');
+ if (!title) {
+ return;
+ }
- $(document).on('mouseleave', 'i', function() {
- var text = $(this).data('tipText');
- $(this).attr('title', text);
- $('.tooltip').remove();
- });
+ $(this).data('tipText', title).removeAttr('title');
+ $('').text(title).appendTo('body').fadeIn('fast');
+ });
- $(document).on('mousemove', 'i', function(e) {
- var x = e.pageX + 10;
- var y = e.pageY + 5;
- $('.tooltip').css({ top: y, left: x });
- });
+ $(document).on('mouseleave', 'i', function () {
+ var text = $(this).data('tipText');
+ $(this).attr('title', text);
+ $('.tooltip').remove();
+ });
+
+ $(document).on('mousemove', 'i', function (e) {
+ var x = e.pageX + 10;
+ var y = e.pageY + 5;
+ $('.tooltip').css({ top: y, left: x });
+ });
+ }
/*
Control panel
@@ -112,6 +115,28 @@ $(function () {
}
}
+ function pageSwitch(evt) {
+ if (isLocked()) {
+ return;
+ }
+
+ $('#page-controls > a').removeClass('selected-option');
+ $(evt.target).addClass('selected-option');
+
+ getPageCount();
+ }
+
+ function getPageCount() {
+ try {
+ var text = $('#page-controls > a.selected-option').text();
+ return parseInt(text);
+ } catch (e) {
+ return 50;
+ }
+ }
+
+ $('#page-controls > a').click(pageSwitch);
+
/* Modal */
function closeModal() {
@@ -156,13 +181,21 @@ $(function () {
}
}
+ $('body').on('keydown', function (e) {
+ // ESC
+ if ($('#modal').is(':visible') && e.keyCode === 27) {
+ $('#close-modal').click();
+ }
+ e.stopPropagation();
+ });
+
/*
Attach handlers
*/
$('#get-link').click(function(e) {
var url = $('#url-input').val();
- createFeed({ url: url, quality: getQuality() }, displayLink);
+ createFeed({ url: url, quality: getQuality(), pageSize: getPageCount() }, displayLink);
e.preventDefault();
});
@@ -175,19 +208,11 @@ $(function () {
$('#video-format, #audio-format').click(formatSwith);
$('#best-quality, #worst-quality').click(qualitySwitch);
-
+
$('#close-modal').click(closeModal);
$('#modal-copy').click(copyLink);
if (!canCopy()) {
$('#modal-copy').hide();
}
-
- $('body').on('keydown', function (e) {
- // ESC
- if ($('#modal').is(':visible') && e.keyCode === 27) {
- $('#close-modal').click();
- }
- e.stopPropagation();
- });
});
\ No newline at end of file
diff --git a/test/Podsync.Tests/Services/Videos/YouTube/YouTubeClientTests.cs b/test/Podsync.Tests/Services/Videos/YouTube/YouTubeClientTests.cs
index 91cc13b..412b9a2 100644
--- a/test/Podsync.Tests/Services/Videos/YouTube/YouTubeClientTests.cs
+++ b/test/Podsync.Tests/Services/Videos/YouTube/YouTubeClientTests.cs
@@ -89,11 +89,10 @@ namespace Podsync.Tests.Services.Videos.YouTube
{
var query = new VideoQuery
{
- Id = "OlYH4gDi0Sk,kkcKnWrCZ7k"
+ Ids = new[] { "OlYH4gDi0Sk,kkcKnWrCZ7k" }
};
- var response = await _client.GetVideos(query);
- var list = response as IList ?? response.ToList();
+ var list = await _client.GetVideos(query);
Assert.Equal(2, list.Count);