Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.

Commit 62d194d

Browse files
committed
Further fixes to playlists, thumb gen
1 parent 308efd7 commit 62d194d

File tree

6 files changed

+13
-25
lines changed

6 files changed

+13
-25
lines changed

WPFMETRO/Localization/Strings.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WPFMETRO/Localization/Strings.pt-BR.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@
289289
<value>Para aplicar as mudanças de idioma, reinicie o programa</value>
290290
</data>
291291
<data name="RetrievingFormats" xml:space="preserve">
292-
<value>Buscando Formatos...</value>
292+
<value>Buscando Dados...</value>
293293
</data>
294294
<data name="SaveChanges" xml:space="preserve">
295295
<value>Salvar</value>

WPFMETRO/Localization/Strings.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@
289289
<value>Restart the program to apply language changes</value>
290290
</data>
291291
<data name="RetrevingFormats" xml:space="preserve">
292-
<value>Retrieving Formats...</value>
292+
<value>Retrieving Video Metadata...</value>
293293
</data>
294294
<data name="SaveChanges" xml:space="preserve">
295295
<value>Save Changes</value>

WPFMETRO/MainWindow.xaml.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ private bool IsRunningAsAdmin()
134134

135135
private async void SelectButton_Click(object sender, RoutedEventArgs e)
136136
{
137+
DownloadStatus.Text = Localization.Strings.RetrevingFormats;
137138
UrlBox.Background = Brushes.Transparent;
138139
formats.Clear();
139140
string Url = UrlBox.Text;
@@ -145,11 +146,12 @@ private async void SelectButton_Click(object sender, RoutedEventArgs e)
145146
FiletypeBox.ItemsSource = formats;
146147
FiletypeBox.IsEnabled = AddToQueueButton.IsEnabled = true;
147148
UrlBox.Background = Brushes.DarkGreen;
149+
150+
148151
}
149152
else
150153
{
151154
UrlBox.Text = UrlBox.Text.Contains(@"&list=") ? UrlBox.Text.Substring(0, UrlBox.Text.IndexOf(@"&list=")) : UrlBox.Text;
152-
DownloadStatus.Text = Localization.Strings.RetrevingFormats;
153155

154156
await Task.Run(() => formats=queue.GetFormats(Url));
155157
await Task.Run(() => videoInfo=queue.GetInfo(Url));
@@ -284,7 +286,9 @@ public void UpdateCard()
284286

285287
if (video.ThumbURL != null)
286288
{
287-
var imageData = new WebClient().DownloadData(new Uri(video.ThumbURL + ".jpg"));
289+
string extension = video.ThumbURL.Substring(video.ThumbURL.LastIndexOf("."));
290+
video.ThumbURL = extension == ".jpg" ? video.ThumbURL : video.ThumbURL + ".jpg";
291+
var imageData = new WebClient().DownloadData(new Uri(video.ThumbURL));
288292
var bitmapImage = new BitmapImage { CacheOption = BitmapCacheOption.OnLoad };
289293
bitmapImage.BeginInit();
290294
bitmapImage.StreamSource = new MemoryStream(imageData);

WPFMETRO/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("1.5.0.6")]
55-
[assembly: AssemblyFileVersion("1.5.0.6")]
54+
[assembly: AssemblyVersion("1.5.0.7")]
55+
[assembly: AssemblyFileVersion("1.5.0.7")]

WPFMETRO/Queue.cs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public Dictionary<string, string> GetFormats(string url)
101101
{
102102
output = f.Data ?? "null";
103103

104-
if (output != "null")
104+
if (output != "null" && !output.Contains("["))
105105
{
106106
if (isNext)
107107
{
@@ -172,23 +172,7 @@ public void DownloadPlaylist(string ID, string filename, string path, string fil
172172

173173
foreach (var playlistItem in playlistItemsListResponse.Items)
174174
{
175-
var videoRequest = yt.Videos.List("snippet,status");
176-
177-
videoRequest.Id = playlistItem.Id;
178-
179-
var videoListResponse = videoRequest.Execute();
180-
181-
if (videoListResponse.Items.Count < 1)
182-
{
183-
throw new QueueException(Localization.Strings.InvalidURL);
184-
}
185-
foreach (var videoItem in videoListResponse.Items)
186-
{
187-
if (videoItem.Status != null)
188-
{
189-
ModifyQueue(videoItem.Snippet.Title, videoItem.Snippet.Thumbnails.Default__.Url, "https://www.youtube.com/watch?v=" + playlistItem.Snippet.ResourceId.VideoId, filename, path, filetype, formats);
190-
}
191-
}
175+
ModifyQueue(playlistItem.Snippet.Title, playlistItem.Snippet.Thumbnails.Default__.Url, "https://www.youtube.com/watch?v=" + playlistItem.Snippet.ResourceId.VideoId, filename, path, filetype, formats);
192176
}
193177

194178
nextPageToken = playlistItemsListResponse.NextPageToken;

0 commit comments

Comments
 (0)