devmil / muzei-bingimageoftheday

Bing Image of the Day plugin for Muzei
Apache License 2.0
22 stars 4 forks source link

Upgrade to the new Muzei API 3.0 #5

Closed coreequip closed 3 years ago

coreequip commented 6 years ago

Hi Michael,

there is the new Muzei API out which solves also issues like #4 . Do you have any plans/time to upgrade to the new API level? Would be great to hear from the author of the best Muzei plugin!

BTW: Thank you for the great work. Your plugin makes my daily use of my phone better. 👍

devmil commented 6 years ago

Ok, I had a look at the changes involved for the new API - quite a few. As it seems this is the near future of Muzei so there is no way to implement this new API. I have some problems moving the current Bing image of the day functionality directly to the new API:

The new API changes the way the images get downloaded Formerly The plugin was responsible to download the image(s) and controlled what image has been displayed. This means that the Bin plugin has a timer and whenever the current day changes, it updates its cache and sends the new image to Muzei. When a user pressed "back" the plugin received this, selected the next image and sent it to Muzei.

Now All images get passed to Muzei. Muzei controlls what image is displayed and also handles the "next" logic completely. Without the plugin being involved.

What does this mean for the Bing plugin? The Bing plugin now has to decide: a) Completely move to the new way of Muzei's plugin handling meaning passing all images to Muzei and no longer control the current image directly. This means new images are only fetched when Muzei decides to do so, b) Use the new Muzei way of passing all images at once but keeping the part of the Bing plugin that triggers a new set of images (mostly one new image). This means this plugin will still need special battery treatment (being on a "exclude from battery saving" list). c) Keep everything as is, invent a custom Next command and only pass the current image to Muzei

I think c) makes no sense as it has no advantage over b) but complicates the integration of the "next" command

The problem is that I think there is no way for the plugin of controlling what the "image of the day" shall be. So Muzei has this list of X Bing images of the last X days and chooses what image to show by its own. This might not be what the Bing image of the day users are up to. This might lead to option c) being a better option.

Might be a good idea to have that behavior configurable?

coreequip commented 6 years ago

Might be a good idea to have that behavior configurable?

I think there is no need for that. Lets keep it simple. There are apps for checking the history of Bing Images, so there is no need to implement a history feature.

This means new images are only fetched when Muzei decides to do so

Well, you set in Muzei the "how often should the background image change". Which is a kind of useless approach for a "image of the day". So lets call it "how often should the plugin check for a new image". You (as the user) can set it to 24h to save data / battery. And every 24h would make sense for a "image of a day". :smile:

Every time Muzei comes around and asks for an images update, the plugin fetches the Bing POTD API and compares the token. If different - yay - new image. So you hand out the URL and as the token the "hsh" field seems to be perfect. :thumbsup:

A "previous image" custom command is kind of easy to implement. Just check the current image token an pick the next image from the list of eight last bing images. So you can rotate through the images.

zanhecht commented 5 years ago

I would think that a 24 hour period between checking new images is too long. Most users would expect to wake up to a new image each day (or, depending on the time zone, for the plugin to update within an hour or two of the time that Bing does).

devmil commented 5 years ago

24h ist sufficient in normal cases because Bing also updates every 24h. The plug-in calculates the next image change and will fetch the new image accordingly. When any setting changes (market, orientation) the plug-in will update immediately.

devmil commented 5 years ago

I have pushed a new version to the PlayStore beta channel. If you like you can try it out by activating the beta for the plug-in in the PlayStore.

coreequip commented 5 years ago

How to access the Beta Channel? I have no "Join Beta" button in my playstore infopage. Is this a closed beta, Michael?

devmil commented 5 years ago

You are right! I changed it to an open Beta. Should be available soon.

devmil commented 5 years ago

Did you already have a chance to try the Beta version?

coreequip commented 5 years ago

I did and it works like a charm. Every morning a new picture -- automatically. 😍