Images and seasons? #2
Closed this issue · 7 comments
Hi @eouia, a couple of weeks ago I read "Images and seasons? # 1" and I went to work to see if I could get a code for it. Today I finished this code and I would like to share it with you so that you can use it in your module. The first thing I want to tell you is that if you do not want to do it (what I thought of the answers you gave in Images and seasons? # 1), I do not know how to create a new project or branch of yours. Therefore my proposal is for you to modify your code if it seems to you.
What the code that I propose does is the following:
Calculate the season of the year in relation to the months. It is not in relation to the exact date they start, but it is a monthly approximation, in my opinion quite good.
Modify the search keywords that are obtained from the information given by the different climate modules, in such a way that they add the word spring, summer, autumn or winter to what your code originally gets.
Redirect, based on these keywords, to collections already created on unsplash.com
In general these collections are divided into seasons of the year and day and night when the selection of photos was possible. Conditions such as hail or drizzle were hard to find. When it was not possible, the approach I think is also quite good.
Difference, through a configuration in config.js, between northern hemisphere (n) or south (s), to obtain the correct season of the year.
Collections should no longer be configured in config.js, since they would overwrite the default collections.
Since I can not paste the code here, it shows an incorrect format, I send you an attachment.
Search for word "check" into the code to see my adds.
// ✓ means a satisfactory collection.
// x means a collection not so satisfactory.
Thats all. Thank you Sean for your wonderful module.
Edited: Bad file, some code mistakes. MMM-WeatherBackground.zip
Fixed code: MMM-WeatherBackground.zip
config.js
{
module: "MMM-WeatherBackground",
config: {
targetDOM: ".MMM-Dummy", //null or DomSelector for target.
// if null, currentweather will be targeted.
// examples: ".newsfeed", "#SOME_SPECIAL_DOM", ".top.left .module"
hemisphere: "n",
source : "currentweather", //currentweather
,MMM-NOAA3
,MMM-DarkSkyForecast
defaultCollection: "featured", // If not assigned in collections, this will be used.
}
},
All collections are in:
https://unsplash.com/@mohace/collections
thanks for your contribution. how about making it as PR(pull request) it's more natural and easy way to managing open source.
thanks for your contribution. how about making it as PR(pull request) it's more natural and easy way to managing open source.
Hi Sean. I don't know how to make PR, neither almost anything related with github. In any case, I read that first I need to create an issue before any PR was accepted.
Also, my English is very bad, and for me it is very difficult to explain such technical things.
But I beg You, please, if You agree with my contribution, please modify You your original code.
I edited my first post attaching a fixed file.
Regards for You.
Hello Sean, what do you think? It would be better to update the README.md file to show how the module should be configured now.
I mean:
New hemisphere option.
No need to select collections as they are predetermined in the module, reflecting the different weather conditions, day or night, and the different seasons of the year.
If collections are defined in config.js, the default collections will not be taken into account. In addition, the keywords will be complex and cumbersome to configure.
I think that defaultCollection: "featured" is no longer necessary.
In addition, the update should be explained, as you have been doing until now.
@mohace
As I've wrote in #3 (comment),
I think we need more detail explanation and config sample in README. Can you provide it?
Ok Sean. All updated, thank you. Maybe this issue must to be closed now.