Skip to content

Commit

Permalink
Preventing Google Photos API limit from being exceeded #92
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeGawi committed Jan 2, 2024
1 parent 1ff53af commit 2d3ba94
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@ dmypy.json
/photo_thumb.jpg
/gen_cc_badge.py
/webtest.py
/list.fth
/list.pickle
2 changes: 1 addition & 1 deletion config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ album_names=
# Possible values: always = every frame refresh, once = once a day.
# This is to prevent a large number of photos from hitting the daily API limit (10k calls).
# Default: always
refresh_rate=always
refresh_rate=once

# Set 1 to get photos from local storage.
; The rest of the values in this section regarding local should be filled as well when enabled.
Expand Down
6 changes: 3 additions & 3 deletions ePiframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def should_data_be_refreshed(filename: str) -> bool:

def read_stored_photos(self):
photos = DataFrame()
filename: str = self.config.get("photo_list_file") + ".fth"
filename: str = self.config.get("photo_list_file") + ".pickle"
should_refresh: bool = self.should_data_be_refreshed(filename)
if (
self.config.get("refresh_rate") == Constants.REFRESH_ONCE
Expand All @@ -423,7 +423,7 @@ def read_stored_photos(self):
"Trying to read saved Google Photos data (according to refresh_rate setting set to "
"'once' a day)..."
)
photos = pandas.read_feather(filename)
photos = pandas.read_pickle(filename)
self.logging.log("Success!")
except Exception:
pass
Expand Down Expand Up @@ -570,7 +570,7 @@ def get_google_source(self) -> DataFrame:
)
self.logging.log("Success!")
if not photos.empty:
photos.to_feather(self.config.get("photo_list_file") + ".fth")
photos.to_pickle(self.config.get("photo_list_file") + ".pickle")
return photos

def get_local_source(self, photos: DataFrame) -> DataFrame:
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function install_pips {
echo -e '\n\033[0;30mInstalling Python components\033[0m'
declare -A pips=( ["Requests"]="requests>=2.26.0" ["Pillow"]="pillow==9.3.0" ["Telebot"]="pyTelegramBotAPI" ["Dateutil"]="python-dateutil" ["ConfigParser"]="configparser>=5.0.0"\
["Google components"]="google-api-python-client google-auth-httplib2 google-auth-oauthlib"\
["SPI Libs"]="spidev==3.5" ["Pandas"]="pandas==1.2.0 numpy==1.20 pyarrow" ["Flask"]="flask<2.2.0" ["Flask-WTF"]="flask-wtf==1.0.0" \
["SPI Libs"]="spidev==3.5" ["Pandas"]="pandas==1.2.0 numpy==1.20" ["Flask"]="flask<2.2.0" ["Flask-WTF"]="flask-wtf==1.0.0" \
["Flask-Login"]="flask-login==0.5.0" ["WTForms"]="wtforms>=3.0.0" ["SMBus"]="smbus2")
declare -a order;
order+=( "Requests" )
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ werkzeug==2.0.3
flask-wtf==1.0.0
flask-login==0.5.0
wtforms==3.0.1
pyarrow==14.0.2
pytest
starlette
google-api-python-client
Expand Down

0 comments on commit 2d3ba94

Please sign in to comment.