Skip to content

Commit 6028fc4

Browse files
committed
Ask for app key and secret if needed
1 parent cdc760b commit 6028fc4

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

FlickrDownloaderApp.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ namespace FlickrDownloader
1717
public static class FlickrDownloaderApp
1818
{
1919
// TODO: Fill these in with your app details
20-
private const string appKey = "";
21-
private const string appSecret = "";
22-
20+
private static string appKey = "";
21+
private static string appSecret = "";
2322
private static Flickr f;
2423
private static string userId;
2524
private static string userName;
@@ -28,6 +27,7 @@ private static void Authenticate()
2827
{
2928
Console.WriteLine("You need to login to Flickr.");
3029
Console.Write("Press ENTER to open a browser to Flickr. Return here when done.");
30+
Console.Write("--> ");
3131
Console.ReadLine();
3232
string frob = f.AuthGetFrob();
3333
string url = f.AuthCalcUrl(frob, AuthLevel.Read);
@@ -199,7 +199,7 @@ private static void DownloadVideos()
199199
{
200200
sleepSpan = TimeSpan.FromSeconds(10.0);
201201
}
202-
Console.WriteLine("Press ENTER once browser stops downloading videos or to abort.");
202+
Console.WriteLine("Press ENTER once browser stops downloading videos or to abort early.");
203203
Console.Write("--> ");
204204

205205
foreach (string file in videoTextFiles)
@@ -357,6 +357,18 @@ public static int Main(string[] args)
357357
{
358358
try
359359
{
360+
if (string.IsNullOrWhiteSpace(appKey))
361+
{
362+
Console.WriteLine("Enter app API key:");
363+
Console.Write("--> ");
364+
appKey = Console.ReadLine();
365+
}
366+
if (string.IsNullOrWhiteSpace(appSecret))
367+
{
368+
Console.WriteLine("Enter app API secret:");
369+
Console.Write("--> ");
370+
appSecret = Console.ReadLine();
371+
}
360372
f = new Flickr(appKey, appSecret);
361373
f.InstanceCacheDisabled = true;
362374
startOver:

0 commit comments

Comments
 (0)