Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting which image to use #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion MMM-WeatherBackground.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Module.register("MMM-WeatherBackground", {
externalCollections: "collections.json", // or null
collections: {},
clientID: "",
unsplashSize: "full",
sources: {
weather: {
notification: "CURRENTWEATHER_TYPE",
Expand Down Expand Up @@ -208,6 +209,19 @@ Module.register("MMM-WeatherBackground", {
const response = await fetch(baseUrl + "?query=" + query + "&client_id=" + this.config.clientID)
const data = await response.json()

return data.urls.full
switch(this.config.unsplashSize) {
case "raw":
return data.urls.raw
case "full":
return data.urls.full
case "regular":
return data.urls.regular
case "small":
return data.urls.small
case "thumb":
return data.urls.thumb
default:
return data.urls.full
}
}
});