MCPcopy Create free account
hub / github.com/bumptop/BumpTop / requestSourceUpdate

Method requestSourceUpdate

trunk/win/Source/BT_FlickrPhotoFrameSource.cpp:61–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void FlickrPhotoFrameSource::requestSourceUpdate()
62{
63 // just load the images from cache if there is no internet connection
64 if (!ftManager->hasInternetConnection())
65 loadPhotosFromCache();
66
67 // ensure we have a valid flickr source
68 if (!isValidFlickrPhotoFrame())
69 return;
70
71 // remove existing downloads
72 ftManager->removeTransfersToHandler(this);
73
74 // See how many photos we currently have cached
75 int maxNumFilesToCache = 64;
76 createLocalCacheDirectory();
77 StrList filesToDelete = fsManager->getDirectoryContents(native(_localCacheDirectory));
78 if (filesToDelete.size() > maxNumFilesToCache)
79 {
80 for (int i = 0; i < filesToDelete.size(); ++i)
81 {
82 QFile::remove(filesToDelete[i]);
83 }
84 }
85
86 // Determine what kind of photos to download
87 // The order is important here since both getting photos from favourite
88 // and getting photos from a specific user both involve the same parameter
89 FlickrClient flickrClient(FLICKR_AUTH_TOKEN);
90 if (_rssFeedUrl.contains("photos_faves"))
91 flickrClient.requestFavouritePhotosFromId(_userId, this);
92 else if (!_userId.isEmpty())
93 flickrClient.requestPhotosFromId(_userId, false, this);
94 else if (!_groupId.isEmpty())
95 flickrClient.requestPhotosFromId(_groupId, true, this);
96 else
97 flickrClient.requestPhotosByTag(_tag, this);
98}
99
100void FlickrPhotoFrameSource::onSourceUpdate(const FileTransfer& transfer)
101{

Callers

nothing calls this directly

Calls 11

hasInternetConnectionMethod · 0.80
getDirectoryContentsMethod · 0.80
requestPhotosFromIdMethod · 0.80
requestPhotosByTagMethod · 0.80
nativeFunction · 0.70
removeFunction · 0.50
sizeMethod · 0.45
containsMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected