Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 15:09

    gazpachoking on main

    fix incorrect docker-compose fi… Merge pull request #12 from got… (compare)

  • 15:09
    gazpachoking closed #12
  • 12:54
    github-actions[bot] closed #2804
  • 12:54
    github-actions[bot] commented #2804
  • 08:23
    gotson opened #12
  • Dec 03 21:43
    gazpachoking commented #3625
  • Dec 03 20:46
    bobcatthebaker synchronize #3625
  • Dec 03 20:41
    bobcatthebaker edited #3625
  • Dec 03 20:40
    bobcatthebaker edited #3625
  • Dec 03 20:33
    bobcatthebaker edited #3625
  • Dec 03 20:32
    bobcatthebaker synchronize #3625
  • Dec 03 20:26
    bobcatthebaker edited #3625
  • Dec 03 20:01
    bobcatthebaker opened #3625
  • Dec 03 12:30
    OmegaZero commented #3620
  • Dec 03 06:59
    bobcatthebaker commented #3624
  • Dec 03 06:50
    gazpachoking commented #3624
  • Dec 03 06:49
    bobcatthebaker commented #3624
  • Dec 03 06:48
    BrutuZ commented #3624
  • Dec 03 06:47
    BrutuZ commented #3624
  • Dec 03 06:42
    bobcatthebaker commented #3624
FlexGet Bot
@FlexGet-Bot
Ram-Z (irc) I've found --cli-config which suggests using $var inside the config the call exec --cli-config="var=value" but $var does not validate the config.
FlexGet Bot
@FlexGet-Bot
gazpachoking (discord) @Ram-Z Yeah, cli-config is not great right now. I had started something to try to fix it up a bit, but I can't remember how much I liked it. Flexget/Flexget#2398
FlexGet Bot
@FlexGet-Bot
Ram-Z (irc) Thanks. Turns out I don't actually need it.
FlexGet Bot
@FlexGet-Bot
chewy75 (discord) I'm getting like 40 to 50 crash reports per day for this
Flexget/Flexget#3432
FlexGet Bot
@FlexGet-Bot
BrutuZ (discord) Is there a schema format to validate DateTime in a plugin's config?
gazpachoking (discord) Don't think so
FlexGet Bot
@FlexGet-Bot
gazpachoking (discord) One time events aren't normally in the config, what's the use case?
BrutuZ (discord) Would like to integrate Discord Timestamps (https://discord.com/developers/docs/resources/channel#embed-object-embed-structure)
BrutuZ (discord) That field isn't in the schema currently, so defining it in the config returns an error. I changed the schema locally as a simple string field, but if going for a PR validating would be nice
gazpachoking (discord) I guess I'm still not sure what this would do
gazpachoking (discord) What goes into the config that has a timestamp?
gazpachoking (discord) For notifications?
BrutuZ (discord) Yes
gazpachoking (discord) And it'll be a fixed date?
BrutuZ (discord) You pass it a date in ISO8601, Discord formats it
FlexGet Bot
@FlexGet-Bot
gazpachoking (discord) But, wouldn't you want the date to be 'now' and not some arbitrary date put into the config?
gazpachoking (discord) I think I'm missing something
BrutuZ (discord) There's a "now" already in the message time
BrutuZ (discord) This is a nice way to tell when the entry was uploaded for example
gazpachoking (discord) I'm still confused how it goes in the config though
gazpachoking (discord) Because it'll need to be dynamic, not static
BrutuZ (discord) Not if you have a field formatted as TimeDate
FlexGet Bot
@FlexGet-Bot

BrutuZ (discord) ```yaml
notify:
entries:
message: "New Entry: {{title_pretty|d(title)}}"
via:

      - discord:
          web_hook_url: XXXXXXXXXXX
          embeds:
            - color: 0xf15478
              author: 
                name: "{{artist}}"
              url: "{{url}}"
              title: "{{original_title|d(title_pretty)|d(title)|d}}"
              description: "{{title_jp|d}}"
              timestamp: "{{upload_date}}"
              image: {url: "{{cover}}"}
              fields:
                - name: "Tags"
                  value: "> {{tags|d([])|join('\\n> ')|title}}"
                  inline: False
                - name: Uploaded
                  value: "{{(now-upload_date)|string|re_replace(':\\d\\d\\.\\d{6}','')}} ago"
                  inline: True
                - name: Reason
                  value: "{{reason|d('Unknown')|re_replace('regexp .(.+?). matched field .(\\w+).*','\\\\2 - \\\\1')|replace('\\\\b','')|replace('[- ]?',' ')|replace('(?!-oh)','')|capitalize}}"
                  inline: True

```
https://cdn.discordapp.com/attachments/536690097496784906/975227795586310224/unknown.png

FlexGet Bot
@FlexGet-Bot
BrutuZ (discord) Hmm, domain_delay doesn't apply to Notifiers... Sound the rate-limits 🪦
FlexGet Bot
@FlexGet-Bot
BrutuZ (discord) Think I got a compromise validating the timestamp config on the notify call. Thoughts @gazpachoking ?
        for embed in config.get('embeds', []):
            ts = embed.get('timestamp')
            if ts:
                if isinstance(ts, str):
                    if ts.isdigit():
                        try:
                            ts = datetime.utcfromtimestamp(int(ts))
                        except ValueError:
                            logger.info(
                                f"Value provided for 'timestamp' ({embed['timestamp']}) "
                                f"is not a timestamp ({int(datetime.now().timestamp())})."
                            )
                    else:
                        try:
                            ts = isoparse(ts)
                            embed['timestamp'] = ts
                        except (ParserError, ValueError) as e:
                            logger.info(f"'timestamp' is in an invalid format: {e}")
                if not isinstance(ts, datetime):
                    embed.pop('timestamp', None)
                    logger.warning("'timestamp' is invalid, dropping it")
                else:
                    embed['timestamp'] = datetime.strftime(ts, r'%Y-%m-%dT%H:%M:%S%z')
FlexGet Bot
@FlexGet-Bot
gazpachoking (discord) @BrutuZ Oh, I gotcha, it's jinja
gazpachoking (discord) Well, the validation will never run on that, so that bit doesn't really matter. That bit only runs on startup, and ignores jinja fields because they wouldn't normally pass.
gazpachoking (discord) I think using dateutil is probably easier than doing parsing on your own
gazpachoking (discord) I also don't think it could ever actually be a datetime already, could it?
BrutuZ (discord) I am using it. isoparse is from dateuril
gazpachoking (discord) Oh, gotcha
gazpachoking (discord) I think it's possible that field ends up as a number though, if it comes from a timestamp
gazpachoking (discord) So str/float/int, but not datetime are the things that would need to be handled.
BrutuZ (discord) I'm not sure, felt like a possiblity at the time before realizing Jinja turns even Integers into strings
FlexGet Bot
@FlexGet-Bot
BrutuZ (discord) I tried setting it as int in a mock, became string even with the |int() filter, that's why I put the isdigit() instead of another isinstance for int
gazpachoking (discord) Depends on if native parsing is used
gazpachoking (discord) Not sure if it is in this case
gazpachoking (discord) Looks like it isn't at the moment
gazpachoking (discord) In any case, your solution seems reasonable
FlexGet Bot
@FlexGet-Bot
BrutuZ (discord) Will whip it in a PR then. Also added the TimedLimiter to prevent losing notifications to rate-limit 😛
FlexGet Bot
@FlexGet-Bot
BrutuZ (discord) Pre-commit GH action failed because black changed a completely unrelated file 😅
FlexGet Bot
@FlexGet-Bot
gazpachoking (discord) Probably the same file that's blocking our release task on master already
BrutuZ (discord) The odd thing is that when I ran black on that file manually it didn't change anything
BrutuZ (discord) Was going for a "make pre-commit happy" commit (even though pre-commit should be running locally already) just to pass the test, turns out I couldn't
FlexGet Bot
@FlexGet-Bot
gazpachoking (discord) Hmm. Maybe old version of black? I just ran it on that file then pushed the commit. Things should be better again on develop branch now.
gazpachoking (discord) It just wanted an extra newline somewhere.
gazpachoking (discord) You might need to pull or rebase from develop
gazpachoking (discord) Or, I could just click merge. Lemme double check it
BrutuZ (discord) Shouldn't be, my launch script install both requirements files with every update