Skip to content

Commit 80abb86

Browse files
committed
start of assignment 5
1 parent 3836b2c commit 80abb86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2116
-3
lines changed

FlickrMonsterGeo/FlickrMonster.xcodeproj/project.pbxproj

+415
Large diffs are not rendered by default.

FlickrMonsterGeo/FlickrMonster.xcodeproj/project.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges</key>
6+
<true/>
7+
<key>SnapshotAutomaticallyBeforeSignificantChanges</key>
8+
<true/>
9+
</dict>
10+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Bucket
3+
type = "1"
4+
version = "1.0">
5+
<FileBreakpoints>
6+
<FileBreakpoint
7+
shouldBeEnabled = "No"
8+
ignoreCount = "0"
9+
continueAfterRunningActions = "No"
10+
filePath = "FlickrMonster/cs193LastViewedPicsViewController.m"
11+
timestampString = "365615947.56234"
12+
startingColumnNumber = "9223372036854775807"
13+
endingColumnNumber = "9223372036854775807"
14+
startingLineNumber = "55"
15+
endingLineNumber = "55"
16+
landmarkName = "-viewWillAppear:"
17+
landmarkType = "5">
18+
</FileBreakpoint>
19+
<FileBreakpoint
20+
shouldBeEnabled = "No"
21+
ignoreCount = "0"
22+
continueAfterRunningActions = "No"
23+
filePath = "FlickrMonster/cs193LastViewedPicsViewController.m"
24+
timestampString = "365615679.879423"
25+
startingColumnNumber = "9223372036854775807"
26+
endingColumnNumber = "9223372036854775807"
27+
startingLineNumber = "43"
28+
endingLineNumber = "43"
29+
landmarkName = "@implementation cs193LastViewedPicsViewController"
30+
landmarkType = "3">
31+
</FileBreakpoint>
32+
</FileBreakpoints>
33+
</Bucket>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0440"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "F2D8887E15C1A13B00340813"
18+
BuildableName = "FlickrMonster.app"
19+
BlueprintName = "FlickrMonster"
20+
ReferencedContainer = "container:FlickrMonster.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
27+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
28+
shouldUseLaunchSchemeArgsEnv = "YES"
29+
buildConfiguration = "Debug">
30+
<Testables>
31+
</Testables>
32+
<MacroExpansion>
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "F2D8887E15C1A13B00340813"
36+
BuildableName = "FlickrMonster.app"
37+
BlueprintName = "FlickrMonster"
38+
ReferencedContainer = "container:FlickrMonster.xcodeproj">
39+
</BuildableReference>
40+
</MacroExpansion>
41+
</TestAction>
42+
<LaunchAction
43+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
44+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
45+
launchStyle = "0"
46+
useCustomWorkingDirectory = "NO"
47+
buildConfiguration = "Debug"
48+
ignoresPersistentStateOnLaunch = "NO"
49+
debugDocumentVersioning = "YES"
50+
allowLocationSimulation = "YES">
51+
<BuildableProductRunnable>
52+
<BuildableReference
53+
BuildableIdentifier = "primary"
54+
BlueprintIdentifier = "F2D8887E15C1A13B00340813"
55+
BuildableName = "FlickrMonster.app"
56+
BlueprintName = "FlickrMonster"
57+
ReferencedContainer = "container:FlickrMonster.xcodeproj">
58+
</BuildableReference>
59+
</BuildableProductRunnable>
60+
<AdditionalOptions>
61+
</AdditionalOptions>
62+
</LaunchAction>
63+
<ProfileAction
64+
shouldUseLaunchSchemeArgsEnv = "YES"
65+
savedToolIdentifier = ""
66+
useCustomWorkingDirectory = "NO"
67+
buildConfiguration = "Release"
68+
debugDocumentVersioning = "YES">
69+
<BuildableProductRunnable>
70+
<BuildableReference
71+
BuildableIdentifier = "primary"
72+
BlueprintIdentifier = "F2D8887E15C1A13B00340813"
73+
BuildableName = "FlickrMonster.app"
74+
BlueprintName = "FlickrMonster"
75+
ReferencedContainer = "container:FlickrMonster.xcodeproj">
76+
</BuildableReference>
77+
</BuildableProductRunnable>
78+
</ProfileAction>
79+
<AnalyzeAction
80+
buildConfiguration = "Debug">
81+
</AnalyzeAction>
82+
<ArchiveAction
83+
buildConfiguration = "Release"
84+
revealArchiveInOrganizer = "YES">
85+
</ArchiveAction>
86+
</Scheme>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SchemeUserState</key>
6+
<dict>
7+
<key>FlickrMonster.xcscheme</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
<key>SuppressBuildableAutocreation</key>
14+
<dict>
15+
<key>F2D8887E15C1A13B00340813</key>
16+
<dict>
17+
<key>primary</key>
18+
<true/>
19+
</dict>
20+
</dict>
21+
</dict>
22+
</plist>
356 Bytes
Loading
375 Bytes
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//
2+
// FlickrAPIKey.h
3+
//
4+
// Created for Stanford CS193p Fall 2011.
5+
// Copyright 2011 Stanford University. All rights reserved.
6+
//
7+
// Get your own key!
8+
// No Flickr fetches will work without the API Key!
9+
//
10+
11+
#define FlickrAPIKey @"c9a9691e436e1e84c265c8dd59140cd5"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// FlickrFetcher.h
3+
//
4+
// Created for Stanford CS193p Fall 2011.
5+
// Copyright 2011 Stanford University. All rights reserved.
6+
//
7+
8+
#import <Foundation/Foundation.h>
9+
10+
#define FLICKR_PHOTO_TITLE @"title"
11+
#define FLICKR_PHOTO_DESCRIPTION @"description._content"
12+
#define FLICKR_PLACE_NAME @"_content"
13+
#define FLICKR_PHOTO_ID @"id"
14+
#define FLICKR_PHOTO_OWNER @"ownername"
15+
#define FLICKR_LATITUDE @"latitude"
16+
#define FLICKR_LONGITUDE @"longitude"
17+
18+
typedef enum {
19+
FlickrPhotoFormatSquare = 1,
20+
FlickrPhotoFormatLarge = 2,
21+
FlickrPhotoFormatOriginal = 64
22+
} FlickrPhotoFormat;
23+
24+
@interface FlickrFetcher : NSObject
25+
26+
+ (NSArray *)topPlaces;
27+
+ (NSArray *)photosInPlace:(NSDictionary *)place maxResults:(int)maxResults;
28+
+ (NSURL *)urlForPhoto:(NSDictionary *)photo format:(FlickrPhotoFormat)format;
29+
30+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
//
2+
// FlickrFetcher.m
3+
//
4+
// Created for Stanford CS193p Fall 2011.
5+
// Copyright 2011 Stanford University. All rights reserved.
6+
//
7+
8+
#import "FlickrFetcher.h"
9+
#import "FlickrAPIKey.h"
10+
11+
#define FLICKR_PLACE_ID @"place_id"
12+
13+
@implementation FlickrFetcher
14+
15+
+ (NSDictionary *)executeFlickrFetch:(NSString *)query
16+
{
17+
query = [NSString stringWithFormat:@"%@&format=json&nojsoncallback=1&api_key=%@", query, FlickrAPIKey];
18+
query = [query stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
19+
// NSLog(@"[%@ %@] sent %@", NSStringFromClass([self class]), NSStringFromSelector(_cmd), query);
20+
NSData *jsonData = [[NSString stringWithContentsOfURL:[NSURL URLWithString:query] encoding:NSUTF8StringEncoding error:nil] dataUsingEncoding:NSUTF8StringEncoding];
21+
NSError *error = nil;
22+
NSDictionary *results = jsonData ? [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error] : nil;
23+
if (error) NSLog(@"[%@ %@] JSON error: %@", NSStringFromClass([self class]), NSStringFromSelector(_cmd), error.localizedDescription);
24+
25+
// NSLog(@"[%@ %@] received %@", NSStringFromClass([self class]), NSStringFromSelector(_cmd), results);
26+
27+
return results;
28+
}
29+
30+
+ (NSArray *)recentGeoreferencedPhotos
31+
{
32+
NSString *request = [NSString stringWithFormat:@"http://api.flickr.com/services/rest/?method=flickr.photos.search&per_page=500&license=1,2,4,7&has_geo=1&extras=original_format,tags,description,geo,date_upload,owner_name,place_url"];
33+
return [[self executeFlickrFetch:request] valueForKeyPath:@"photos.photo"];
34+
}
35+
36+
+ (NSArray *)topPlaces
37+
{
38+
NSString *request = [NSString stringWithFormat:@"http://api.flickr.com/services/rest/?method=flickr.places.getTopPlacesList&place_type_id=7"];
39+
return [[self executeFlickrFetch:request] valueForKeyPath:@"places.place"];
40+
}
41+
42+
+ (NSArray *)photosInPlace:(NSDictionary *)place maxResults:(int)maxResults
43+
{
44+
NSString *placeId = [place objectForKey:FLICKR_PLACE_ID];
45+
if (placeId) {
46+
NSString *request = [NSString stringWithFormat:@"http://api.flickr.com/services/rest/?method=flickr.photos.search&has_geo=1&place_id=%@&per_page=%d&extras=original_format,tags,description,geo,date_upload,owner_name,place_url", placeId, maxResults];
47+
return [[self executeFlickrFetch:request] valueForKeyPath:@"photos.photo"];
48+
}
49+
return nil;
50+
}
51+
52+
+ (NSString *)urlStringForPhoto:(NSDictionary *)photo format:(FlickrPhotoFormat)format
53+
{
54+
id farm = [photo objectForKey:@"farm"];
55+
id server = [photo objectForKey:@"server"];
56+
id photo_id = [photo objectForKey:@"id"];
57+
id secret = [photo objectForKey:@"secret"];
58+
if (format == FlickrPhotoFormatOriginal) secret = [photo objectForKey:@"originalsecret"];
59+
60+
NSString *fileType = @"jpg";
61+
if (format == FlickrPhotoFormatOriginal) fileType = [photo objectForKey:@"originalformat"];
62+
63+
if (!farm || !server || !photo_id || !secret) return nil;
64+
65+
NSString *formatString = @"s";
66+
switch (format) {
67+
case FlickrPhotoFormatSquare: formatString = @"s"; break;
68+
case FlickrPhotoFormatLarge: formatString = @"b"; break;
69+
// case FlickrPhotoFormatThumbnail: formatString = @"t"; break;
70+
// case FlickrPhotoFormatSmall: formatString = @"m"; break;
71+
// case FlickrPhotoFormatMedium500: formatString = @"-"; break;
72+
// case FlickrPhotoFormatMedium640: formatString = @"z"; break;
73+
case FlickrPhotoFormatOriginal: formatString = @"o"; break;
74+
}
75+
76+
return [NSString stringWithFormat:@"http://farm%@.static.flickr.com/%@/%@_%@_%@.%@", farm, server, photo_id, secret, formatString, fileType];
77+
}
78+
79+
+ (NSURL *)urlForPhoto:(NSDictionary *)photo format:(FlickrPhotoFormat)format
80+
{
81+
return [NSURL URLWithString:[self urlStringForPhoto:photo format:format]];
82+
}
83+
84+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>${PRODUCT_NAME}</string>
9+
<key>CFBundleExecutable</key>
10+
<string>${EXECUTABLE_NAME}</string>
11+
<key>CFBundleIcons</key>
12+
<dict>
13+
<key>CFBundlePrimaryIcon</key>
14+
<dict>
15+
<key>CFBundleIconFiles</key>
16+
<array>
17+
<string>flickr_57.png</string>
18+
<string>flickr_114.png</string>
19+
</array>
20+
</dict>
21+
</dict>
22+
<key>CFBundleIdentifier</key>
23+
<string>me.chrisblazek.kingbin.${PRODUCT_NAME:rfc1034identifier}</string>
24+
<key>CFBundleInfoDictionaryVersion</key>
25+
<string>6.0</string>
26+
<key>CFBundleName</key>
27+
<string>${PRODUCT_NAME}</string>
28+
<key>CFBundlePackageType</key>
29+
<string>APPL</string>
30+
<key>CFBundleShortVersionString</key>
31+
<string>1.0</string>
32+
<key>CFBundleSignature</key>
33+
<string>????</string>
34+
<key>CFBundleVersion</key>
35+
<string>1.0</string>
36+
<key>LSRequiresIPhoneOS</key>
37+
<true/>
38+
<key>UIMainStoryboardFile</key>
39+
<string>MainStoryboard_iPhone</string>
40+
<key>UIMainStoryboardFile~ipad</key>
41+
<string>MainStoryboard_iPad</string>
42+
<key>UIRequiredDeviceCapabilities</key>
43+
<array>
44+
<string>armv7</string>
45+
</array>
46+
<key>UISupportedInterfaceOrientations</key>
47+
<array>
48+
<string>UIInterfaceOrientationPortrait</string>
49+
<string>UIInterfaceOrientationLandscapeLeft</string>
50+
<string>UIInterfaceOrientationLandscapeRight</string>
51+
</array>
52+
<key>UISupportedInterfaceOrientations~ipad</key>
53+
<array>
54+
<string>UIInterfaceOrientationPortrait</string>
55+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
56+
<string>UIInterfaceOrientationLandscapeLeft</string>
57+
<string>UIInterfaceOrientationLandscapeRight</string>
58+
</array>
59+
</dict>
60+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// Prefix header for all source files of the 'FlickrMonster' target in the 'FlickrMonster' project
3+
//
4+
5+
#import <Availability.h>
6+
7+
#ifndef __IPHONE_5_0
8+
#warning "This project uses features only available in iOS SDK 5.0 and later."
9+
#endif
10+
11+
#ifdef __OBJC__
12+
#import <UIKit/UIKit.h>
13+
#import <Foundation/Foundation.h>
14+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// NSObject+Players.h
3+
// FlickrMonster
4+
//
5+
// Created by Chris Blazek on 7/27/12.
6+
// Copyright (c) 2012 Chris Blazek. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
@interface Player : NSObject
12+
@property (nonatomic, copy) NSString *name;
13+
@property (nonatomic, copy) NSString *game;
14+
@property (nonatomic, assign) int rating;
15+
@end

0 commit comments

Comments
 (0)