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

Commit 918a3d1

Browse files
committed
Fixes issue with downloading videos with no audio
1 parent 5b70710 commit 918a3d1

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

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.1.0")]
55-
[assembly: AssemblyFileVersion("1.5.1.0")]
54+
[assembly: AssemblyVersion("1.5.1.1")]
55+
[assembly: AssemblyFileVersion("1.5.1.1")]

WPFMETRO/Queue.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ public Dictionary<string, string> GetFormats(string url)
113113
desc = values[1].ToString() + " (";
114114
if (values[2].ToString() == "audio")
115115
{
116+
hasAudio = true;
116117
code = values[0].ToString();
117118
desc += "audio";
118119
desc += values.Count > 5 && values[5].ToString() != "audio" ? " " + values[5].ToString() + ")" : ")";
@@ -128,7 +129,7 @@ public Dictionary<string, string> GetFormats(string url)
128129
code = values[0].ToString();
129130
desc = values[1].ToString() + " (" + values[2].ToString() + ")";
130131
}
131-
hasAudio = !hasAudio && values[1].ToString() == "mp4" || values[1].ToString() == "webm" || values[1].ToString() == "m4a" ? true : hasAudio;
132+
132133
code += output.Contains("video only") ? "-y" : "-n";
133134

134135
formats.Add(code, desc);

WPFMETRO/Resources/Splash.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,7 @@ Vi sittar h
5858
Life's a lot more fun when you aren't responsible for your actions.
5959
Get in there, Lewis!
6060
Drive through penalty, drive through penalty
61-
Escort, 3, 4, 5, 6, 6.5, WRX
61+
Escort, 3, 4, 5, 6, 6.5, WRX
62+
This splash text file is getting out of hand
63+
I hope you'll take it as a sign, that everything will be OK
64+
This program may cause cardiovascular issues

WPFMETRO/Video.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,14 @@ public void DownloadVideo()
5656
break;
5757
default:
5858
arguments += "-f ";
59-
60-
if (SelectedFormat.Contains(" "))
59+
if (SelectedFormat.Contains(" ") && AvailableFormats[AvailableFormats.Count - 1].Value == "flac")
6160
{
6261
arguments += SelectedFormat.Substring(0, SelectedFormat.IndexOf(" "));
6362
if (SelectedFormat.Substring(SelectedFormat.Length - 1) == "y")
6463
{
6564
int spaceIndex = SelectedFormat.IndexOf(" ");
6665
arguments += SelectedFormat.Contains("mp4") ? "+bestaudio[ext!=webm]" : "+bestaudio[ext=webm]‌";
67-
arguments += " --merge-output-format" + SelectedFormat.Substring(spaceIndex, SelectedFormat.Length - spaceIndex - 2);
66+
arguments += " --merge-output-format" + SelectedFormat.Substring(spaceIndex, SelectedFormat.Length - spaceIndex - 2);
6867
}
6968
}
7069
else
@@ -75,8 +74,11 @@ public void DownloadVideo()
7574
break;
7675
}
7776
}
78-
arguments += SelectedFormat == "default" ? "-o \"" + Path + Name + "\"" : " -o \"" + Path + Name + "\"";
79-
arguments += " -i " + ID;
77+
78+
string formatAndID = SelectedFormat == "default" ? "" : " ";
79+
formatAndID += "-o \"" + Path + Name + "\"" + " -i " + ID;
80+
81+
arguments += formatAndID;
8082

8183
ytbDLInfo.Arguments = arguments;
8284
ytbDL = Process.Start(ytbDLInfo);

WPFMETRO/WPFMETRO.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<UpdateRequired>false</UpdateRequired>
2727
<MapFileExtensions>false</MapFileExtensions>
2828
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
29-
<ApplicationRevision>0</ApplicationRevision>
29+
<ApplicationRevision>3</ApplicationRevision>
3030
<ApplicationVersion>1.5.1.%2a</ApplicationVersion>
3131
<UseApplicationTrust>false</UseApplicationTrust>
3232
<PublishWizardCompleted>true</PublishWizardCompleted>

0 commit comments

Comments
 (0)