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

[REQUEST] Provide a AniDB "force" refresh, which ignores the 24 hour timeout #1215

Open
Rand-Random opened this issue Jan 5, 2025 · 3 comments

Comments

@Rand-Random
Copy link

Rand-Random commented Jan 5, 2025

AniDB "force" update does currently not do what I would expect it still upholds a 24 hour timeout.
I would kindly ask for an option to ignore this time out and "force" for real, if I choose to want to

what I am currently doing is this

var settings = JsonSerializer.Deserialize<SettingsEntry>(settingsOutput, Utils.jsonSerializerOptions) ?? new SettingsEntry();
if (!string.IsNullOrEmpty(settings.Database.MySqlFullName))
{
    var conStringBuilder = new SqliteConnectionStringBuilder
    {
        DataSource = settings.Database.MySqlFullName
    };
    var conString = conStringBuilder.ToString();
    using var connection = new SqliteConnection(conString);
    connection.Open();

    using var command = connection.CreateCommand();
    command.CommandText = "select UpdatedAt from AniDB_AnimeUpdate where AnimeID = @aniDb";
    command.Parameters.AddWithValue("@aniDb", seriesAniDb);
    var updatedAt = Convert.ToDateTime(command.ExecuteScalar());

    updatedAt = updatedAt.AddDays(-1.5);

    using var commandUpdate = connection.CreateCommand();
    commandUpdate.CommandText = "update AniDB_AnimeUpdate set UpdatedAt = @updatedAt where AnimeID = @aniDb";
    commandUpdate.Parameters.AddWithValue("@aniDb", seriesAniDb);
    commandUpdate.Parameters.AddWithValue("@updatedAt", updatedAt);
    commandUpdate.ExecuteNonQuery();
}

which sets the UpdatedAt to -1.5 days in the past, so that calling this query actually refreshes an item

Series/{seriesId}/AniDB/Refresh?force=true&cacheOnly=false

You may ask why is this important to me, and maybe others?
In 99% of the time I don't care, but sometimes there are 2 use cases

  1. A new series doesn't have episodes associated on AniDB but it may have in a couple of minutes/hourse after a episode was released, so it can happen that Shoko picked up the series but can't link the file to the correct episode because there was no episode available at the time

  2. A series didn't have the correct tags associated most annoyingly the "18 restricted" tag, which is necessary to hide this kind of genres from people in my household which shouldn't see this

Shoko only can fix these issues 24 hours later, the first one is rather trivial as I can simply watch the episode 24 hours later, but the second one is more disturbing as I need to make sure for 24 hours this content doesn't fall into the wrong hands.

With the proposal I could manually fix it by simply refreshing the series ignoring the timeout.

So either the "force=true" should as I would assume actually force the update and ignore the timeout, or provide another parameter e.g. "ignoreTimeout=true"

@Cazzar
Copy link
Member

Cazzar commented Jan 13, 2025

part of the reason for a 24h timeout would be because AniDB is much more likely to ban on frequent updates, especially of the same series, so I am not sure if adding this is the best idea.

@harshithmohan
Copy link
Member

https://discord.com/channels/96234011612958720/102170710465585152/1232323368842297424

Last time we thought about adding an extra actual "Force" update option for advanced users, and also making it more clear which option does what. Since "force" means something and it's not actually forcing anything. So atleast a change in the wording may help.
Th force "force" refresh will also help people who are using a proxy and don't need to care about getting banned

@Rand-Random
Copy link
Author

Rand-Random commented Jan 13, 2025

@Cazzar
most likely, though IMHO when a user triggers a force update it should force and ignore the timeout, if user gets banned for it, I would say it's the user's fault

@harshithmohan

Last time we thought about adding an extra actual "Force" update option for advanced users

would appreciate it

and also making it more clear which option does what

yes, please
I have no idea what force update actually does compared to the non force option

when I noticed the behaviour I thought its a bug, but digging through the code seems to suggest that it is as expected

I do not suggest changing the internal handling, because many internal code is calling a refresh of anime with ForceRefresh = true and iternal should respect the 24 hours timeout, but the user should have the option to bypass the timeout

I would be against having a 3rd option in the shoko web ui, the "force refresh" option should than be the refresh bypassing the timeout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants