shaarli / Shaarli

The personal, minimalist, super-fast, database free, bookmarking service - community repo
https://shaarli.readthedocs.io/
Other
3.44k stars 294 forks source link

Daily Shaarli used as Anki cards #1373

Closed immanuelfodor closed 5 years ago

immanuelfodor commented 5 years ago

To be honest, I never put the Daily Shaarli a good use as I couldn't find the use case why would I want to see the links of today/previous day/etc when I'm using Shaarli as a note taking app.

This is why I wondered on creating a plugin that would add to today's links some older links that was added a week/month/year ago. It could work like Anki cards if I could see what I added before in these intervals to retain memory of information.

https://en.m.wikipedia.org/wiki/Anki_(software)

Anki is a free and open-source flashcard program that utilizes spaced repetition. Spaced repetition has been shown to increase rate of memorization.

When I checked the demo plugin and how the showDaily function works in index.php, I quickly realized that the plugin only receives the links of the filtered day prepared and adjusted, so I couldn't do my own link addition here.

Just in theory, could my idea work with the current plugin/database system? Before I start experimenting, I'd like to know if I could access all the links from a plugin's daily hook to make it work as described.

Ideally, it should be separate sections with its own subtitles that contains the additional links but I'd be happy even if I could mix today's links with the links posted on the same day a week/month/year ago.

nodiscc commented 5 years ago

I don't think it's possible, considering the way the daily page currently works. As you said

the plugin only receives the links of the filtered day prepared and adjusted

immanuelfodor commented 5 years ago

If I'd add another hook after this line, would it be merged in a PR? https://github.com/shaarli/Shaarli/blob/master/index.php#L424

I think of something like this:

/* Hook to modify the raw links that will eventually be displayed on the Daily Shaarli. */
$pluginManager->executeHooks('filter_raw_daily', $linksToDisplay, $LINKSDB, array('loggedin' => $loginManager->isLoggedIn()));

This way a new/my new plugin could add more links (pseudocode):

$linksToDisplay += $LINKSDB->filterDay($this_day_last_week);
$linksToDisplay += $LINKSDB->filterDay($this_day_last_month);
$linksToDisplay += $LINKSDB->filterDay($this_day_last_year);
ArthurHoaro commented 5 years ago

Plugins shouldn't manipulate $LINKSDB directly as its format may change in the future.

However #160 and #161 are still open, which are feature requests to have more filter on the daily page.

immanuelfodor commented 5 years ago

Thanks, I've subscribed to those. Well, then I might patch the showDaily function directly through my custom dockerfile 😃