public void Login() { // Create Flickr instance m_flickr = new Flickr(API_KEY, SECRET); m_frob = m_flickr.AuthGetFrob(); string flickrUrl = m_flickr.AuthCalcUrl(m_frob, AuthLevel.Write); // The following line will load the URL in the users default browser. System.Diagnostics.Process.Start(flickrUrl); bool bIsAuthorized = false; m_auth = new Auth(); // do nothing until flickr authorizes. while (!bIsAuthorized) { try { m_auth = m_flickr.AuthGetToken(m_frob); m_flickr.AuthToken = m_auth.Token; } catch (FlickrException ex) { ; } if (m_flickr.IsAuthenticated) { bIsAuthorized = true; } } }
public static void OpenAuthURL() { Flickr flickr = new Flickr(ApiKey, SharedSecret); frob = flickr.AuthGetFrob(); AuthUrl = flickr.AuthCalcUrl(frob, AuthLevel.Write); System.Diagnostics.Process.Start(AuthUrl); }
public string TestAuth () { // Flickr downloader = new Flickr (this._apikey, this._email, this._password ); uploader = new Flickr (_apikey, _sharedsecret); return uploader.AuthGetFrob (); // Looking to licenses try { Licenses licenses = uploader.PhotosLicensesGetInfo(); //foreach (License license in licenses.LicenseCollection) { // Console.WriteLine("License: {0} {1}", license.LicenseName, license.LicenseId); //} } catch( FlickrNet.FlickrException e ) { Console.WriteLine( e.Code + ": " + e.Verbose ); } // Searching some photos with a license int licenseNumber = 5; // att-sa string text = "infinity"; string[] tags = {"infinity", "love"}; photoURL = "http://www.flickr.com/photo_zoom.gne?id="; //for (int i=0; i < 2; i++) { // searchPags (text, 10, 1); // searchText (text); // searchTextLicense (text, licenseNumber); // searchTags (tags); //} }
public Backup(string apiKey, string sharedSecret) { flickr = new Flickr(apiKey, sharedSecret); Frob = flickr.AuthGetFrob(); AuthToken = flickr.AuthCalcUrl(Frob, AuthLevel.Write); }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { FlickrNet.Flickr flickr1 = new FlickrNet.Flickr("ab782e182b4eb406d285211811d625ff", "b080496c05335c3d"); this._frob = flickr1.AuthGetFrob(); string text1 = flickr1.AuthCalcUrl(this._frob, AuthLevel.Delete); Process.Start(text1); this.linkLabel1.Visible = false; this.linkLabel2.Visible = true; }
protected virtual void OnAuthBtnClicked(object sender, EventArgs e) { flickr = new FlickrNet.Flickr(ApiKey, ApiSecret); Frob = flickr.AuthGetFrob(); Services.Environment.OpenUrl(flickr.AuthCalcUrl(Frob, AuthLevel.Write)); Widget image = auth_btn.Image; auth_btn.Label = AddinManager.CurrentLocalizer.GetString("Click to complete authorization"); auth_btn.Image = image; auth_btn.Clicked -= new EventHandler(OnAuthBtnClicked); auth_btn.Clicked += new EventHandler(OnCompleteBtnClicked); }
private void Step1Button_Click(object sender, EventArgs e) { Flickr flickr = new Flickr(ApiKey.Text, SharedSecret.Text); Frob = flickr.AuthGetFrob(); OutputTextbox.Text += "Frob = " + Frob + "\r\n"; string url = flickr.AuthCalcUrl(Frob, AuthLevel.Write); OutputTextbox.Text += "Url = " + url + "\r\n"; System.Diagnostics.Process.Start(url); Step1Button.Enabled = false; Step2Button.Enabled = true; Step3Button.Enabled = true; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ReadConfig(); if (AuthToken.Length == 0) { // Create Flickr instance Flickr flickr = new Flickr(Program.ApiKey, Program.SharedSecret); // Get Frob Program.tempFrob = flickr.AuthGetFrob(); // Calculate the URL at Flickr to redirect the user to string flickrUrl = flickr.AuthCalcUrl(Program.tempFrob, AuthLevel.Read); // The following line will load the URL in the users default browser. System.Diagnostics.Process.Start(flickrUrl); Application.Run(new DialogAuth()); } else Application.Run(new MainForm()); }
private void buttonAuthenticate_Click(object sender, EventArgs e) { Flickr flickr = new Flickr(FlickrUtils.Flickr_API_KEY, FlickrUtils.Flickr_SHARED_SECRET); if (string.IsNullOrEmpty(flickrFrob)) { flickrFrob = flickr.AuthGetFrob(); string url = flickr.AuthCalcUrl(flickrFrob, AuthLevel.Write); System.Diagnostics.Process.Start(url); } else { flickrFrob = string.Empty; Auth auth = flickr.AuthGetToken(flickrFrob); textBoxAuthToken.Text = auth.Token; } }
private string FlickrGetToken() { try { Flickr f = new Flickr(Properties.Settings.Default.FlickrApiKey, Properties.Settings.Default.FlickrShared); f.Proxy = GetProxy(true); string Frob = f.AuthGetFrob(); string url = f.AuthCalcUrl(Frob, AuthLevel.Read | AuthLevel.Write | AuthLevel.Delete); System.Diagnostics.Process.Start(url); if (messages_level==MessagesLevel.MessagesNone || MessageBox.Show("Please confirm that you've authorized FlickrSync to access your flickr account", "Confirmation", MessageBoxButtons.OKCancel) == DialogResult.OK) { Auth auth = f.AuthGetToken(Frob); Properties.Settings.Default.FlickrToken = auth.Token; SaveConfig(); return Properties.Settings.Default.FlickrToken; } } catch (Exception e) { if (Properties.Settings.Default.FlickrToken == "") Error("Unable to obtain Flickr Token", e, ErrorType.Connect); else Error("Error obtaining Flickr Token", e, ErrorType.Normal); } return ""; }
protected virtual void OnAuthBtnClicked(object sender, EventArgs e) { flickr = new FlickrNet.Flickr (ApiKey, ApiSecret); Frob = flickr.AuthGetFrob (); Services.Environment.OpenUrl (flickr.AuthCalcUrl (Frob, AuthLevel.Write)); Widget image = auth_btn.Image; auth_btn.Label = AddinManager.CurrentLocalizer.GetString ("Click to complete authorization"); auth_btn.Image = image; auth_btn.Clicked -= new EventHandler (OnAuthBtnClicked); auth_btn.Clicked += new EventHandler (OnCompleteBtnClicked); }
public string GetFrobAuthUrl() { _flickrObj = CreateFlickr(); _frob = _flickrObj.AuthGetFrob(); return _flickrObj.AuthCalcUrl(_frob, AuthLevel.Write); }
public static void Main(string[] args) { Console.WriteLine("ThumbSync - Flickr Sync by Tristan Phillips v0.4"); if (!ParseArgs(args)) { Console.WriteLine("usage: ThumbSync.exe -u <userIDs , seperated> -o <out directory>\n" + "Optionals:\n" + "-c <count, default 20> \n" + "-s get small photos (default medium) \n" + "-t get thumbnails (default medium) \n" + "-l get large photos (default medium) \n" + "-T <pre authenticated token> \n" + "-O overwrite existing local copy \n" + "-p <start at page> \n" + "-th <throttle millisecs> \n" + "-W use white average file validation"); return; } string[] userIDs = userIds.Split(','); FlickrNet.Flickr f = new FlickrNet.Flickr("5f9dbe6d11086346eacc6d9b9d81a5f5", "826ddba13f621f18"); if (token == "") { string frob = f.AuthGetFrob(); string url = f.AuthCalcUrl(frob, AuthLevel.Read); Console.WriteLine("Go here & authenticate: " + url); Console.WriteLine("When you are done, press return . . . I'll be waiting . . ."); try { /* * System.Diagnostics.Process p = new System.Diagnostics.Process(); * p.StartInfo.FileName="c:\\program files\\internet explorer\\iExplore.exe"; * p.StartInfo.Arguments = url; * p.Start(); * System.Diagnostics.Process p2 = new System.Diagnostics.Process(); * p2.StartInfo.FileName="/Applications/Safari.app/Contents/MacOS/Safari"; * p2.StartInfo.Arguments = "\"" + url + "\""; * p2.Start(); */ } catch {} Console.ReadLine(); FlickrNet.Auth auth = f.AuthGetToken(frob); Console.WriteLine("Token (you can re-use this with -T): " + auth.Token); token = auth.Token; } f.AuthToken = token; foreach (string userId in userIDs) { Person per = f.PeopleGetInfo(userId); string personName = per.UserName; Console.WriteLine("Processing " + maxPerPerson + " from " + per.UserName + "(" + per.RealName + ")"); while (collected < maxPerPerson) { PhotoCollection res = f.PeopleGetPhotos(userId, page, pageSize); collected += res.Count; if (res.Page == res.Pages) { collected = maxPerPerson; } foreach (Photo p in res) { bool processed = false; int tries = 0; int startSecsWait = 120; int maxTries = 15; while (!processed && tries < maxTries) { try { tries++; Console.Write(". "); if (x % 10 == 0) { Console.Write(x + " "); } PhotoInfo info = f.PhotosGetInfo(p.PhotoId); string tag = info.Tags.Count > 0 ? info.Tags[0].Raw : "NotTagged"; if (!System.IO.Directory.Exists(OutDir + System.IO.Path.DirectorySeparatorChar + personName + "-" + tag)) { System.IO.Directory.CreateDirectory(OutDir + System.IO.Path.DirectorySeparatorChar + personName + "-" + tag); } string url = smallPhotos ? p.SmallUrl : p.MediumUrl; url = largeSize ? p.LargeUrl : url; url = thumbnailSize ? p.ThumbnailUrl: url; string[] pNames = url.Split('/'); string pName = pNames[pNames.Length - 1]; string fileName = OutDir + System.IO.Path.DirectorySeparatorChar + personName + "-" + tag + System.IO.Path.DirectorySeparatorChar + pName; if (!System.IO.File.Exists(fileName) || overwrite) { new System.Net.WebClient().DownloadFile(url, fileName); if (checkForWhiteFiles) { WhiteCheck(fileName); } } processed = true; x++; } catch (Exception e) { int wait = startSecsWait * tries; Console.WriteLine(String.Format("There was a problem processing page {0} (x={1}, page={2}, pageSize={3}, collected={4})", page, x, page, pageSize, collected)); Console.WriteLine(e.Message); if (tries < maxTries) { Console.WriteLine("Will retry in " + wait / 60 + " mins . . ."); } System.Threading.Thread.Sleep(wait * 1000); } } if (throttle > 0) { System.Threading.Thread.Sleep(throttle); } } page++; } } Console.WriteLine("Done"); }
private void AuthorizeFlickrButton_Click(object sender, EventArgs e) { // Create Flickr instance Flickr flickr = new Flickr(Program.FlickrAPIKey, Program.FlickrSharedSecretKey); // Get Frob tempFrob = flickr.AuthGetFrob(); // Calculate the URL at Flickr to redirect the user to string flickrUrl = flickr.AuthCalcUrl(tempFrob, AuthLevel.Write); // The following line will load the URL in the users default browser. System.Diagnostics.Process.Start(flickrUrl); CompleteAuthButton.Enabled = true; }