Giter VIP home page Giter VIP logo

lastfm-red's Introduction

Jamie (flare)

Hi, my name is Jamie, otherwise known as flare. Computer Applications & Software Engineering graduate from Dublin City University. My current interests mainly reside around Discord and integrating other features and automation of actions.

Projects

I work on various projects in my spare time, mainly surrounding Discord and bots. These projects are mostly relating to Red-DiscordBot and Ballsdex, a discord bot currently in over 250,000 servers. I work on projects on the side, some of which include:

  • flare-cogs - Various cogs for Red-DiscordBot.
  • pokecord-red - Pokecord rewrite for Red-DiscordBot.
  • r6statsapi - Asynchronous python wrapper for the R6Stats website.
  • lastfm-red - A last-fm cog for Red-DiscordBot.
  • lastfm-charts/lastfm-backend - CHart visualization frontend + backend site for LastFM.
  • dcuical - Generate an ICAL file of DCU course timetables, which can be integrated into applications such as Google Calendar.

Information

Some information on my socials can be found @ www.jamiemcg.ie

Contact Me

Metrics

flare's GitHub metrics

lastfm-red's People

Contributors

fixator10 avatar flaree avatar ryan5453 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lastfm-red's Issues

nowplaying - KeyError: 'userloved'

Traceback:

Exception in command 'fm nowplaying'
Traceback (most recent call last):
  File "/home/redbot/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/redbot/data/cogs/CogManager/cogs/lastfm/nowplaying.py", line 68, in command_nowplaying
    loved = trackdata["track"]["userloved"] == "1"
KeyError: 'userloved'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/redbot/.local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/home/redbot/.local/lib/python3.9/site-packages/redbot/core/commands/commands.py", line 832, in invoke
    await super().invoke(ctx)
  File "/home/redbot/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 1348, in invoke
    await ctx.invoked_subcommand.invoke(ctx)
  File "/home/redbot/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/redbot/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 'userloved'

Not ending the scrobble

when playing, on lastfm shows that are scrobbling the music, but when the music ends, the music not appear on the lastfm.

Future Ideas

Feel free to comment on this issue if you have any ideas!

Long Term:

  • Add SQLite DB and migrate config to it - This will allow us to do a lot more cool commands if we're able to save last.fm data to it so we don't need to query the API for every command which can be extremely slow in some cases.

New Features:

  • Add [p]fm album command

  • Port [p]fm colorchart command - Best to wait until the SQLite stuff is done so we can save the hash-color matches in there.

  • Add [p]tag to view stuff from a specific tag (invoke when subcommand isn't passed)

  • Implement recommendation system (maybe integrate w audio too)

Enhancements:

  • Make it so wkt and wka dont need artists
  • Use buttons for menus (dpy2)
  • Use flags
  • More user args in cmds
  • Custom [p]fm np modes (show custom tags, reactions, spotify url)

Some errors in last.fm

i've gotten 3 errors from the cog on dpy2.

This is from fm server nowplaying

Traceback (most recent call last):
  File "/home/max/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 235, in wrapped
    ret = await coro(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/max/redbot/cogs/CogManager/cogs/lastfm/nowplaying.py", line 151, in command_servernp
    icon_url=ctx.guild.icon_url_as(size=64),
             ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Guild' object has no attribute 'icon_url_as'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/max/redenv/lib/python3.11/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
    await ctx.command.invoke(ctx)
  File "/home/max/redenv/lib/python3.11/site-packages/redbot/core/commands/commands.py", line 791, in invoke
    await super().invoke(ctx)
  File "/home/max/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 1650, in invoke
    await ctx.invoked_subcommand.invoke(ctx)
  File "/home/max/redenv/lib/python3.11/site-packages/redbot/core/commands/commands.py", line 791, in invoke
    await super().invoke(ctx)
  File "/home/max/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 1650, in invoke
    await ctx.invoked_subcommand.invoke(ctx)
  File "/home/max/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 1029, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/max/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 244, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Guild' object has no attribute 'icon_url_as'

This is from fm nowplaying, it only shows in logs when a user hasn't logged in yet.

Traceback (most recent call last):
  File "/home/max/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 235, in wrapped
    ret = await coro(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/max/redbot/cogs/CogManager/cogs/lastfm/nowplaying.py", line 25, in command_nowplaying
    self.check_if_logged_in(conf, user == ctx.author)
  File "/home/max/redbot/cogs/CogManager/cogs/lastfm/utils/base.py", line 265, in check_if_logged_in
    raise NotLoggedInError(
lastfm.exceptions.NotLoggedInError: They need to log into a last.fm account. Please log in with `fm login`.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/max/redenv/lib/python3.11/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
    await ctx.command.invoke(ctx)
  File "/home/max/redenv/lib/python3.11/site-packages/redbot/core/commands/commands.py", line 791, in invoke
    await super().invoke(ctx)
  File "/home/max/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 1650, in invoke
    await ctx.invoked_subcommand.invoke(ctx)
  File "/home/max/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 1029, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/max/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 244, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotLoggedInError: They need to log into a last.fm account. Please log in with `fm login`.

This is from whoknows

Traceback (most recent call last):
  File "/home/max/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 235, in wrapped
    ret = await coro(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/max/redbot/cogs/CogManager/cogs/lastfm/whoknows.py", line 30, in command_whoknows
    trackname, artistname, albumname, image_url = await self.get_current_track(
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/max/redbot/cogs/CogManager/cogs/lastfm/utils/api.py", line 83, in get_current_track
    raise NotScrobblingError("You aren't currently listening to anything.")
lastfm.exceptions.NotScrobblingError: You aren't currently listening to anything.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/max/redenv/lib/python3.11/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
    await ctx.command.invoke(ctx)
  File "/home/max/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 1029, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/max/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 244, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotScrobblingError: You aren't currently listening to anything.

LastFm & Hybrid commands

Currently, we make use of *args and *, args in places as we have the parse func which deals with parsing the information to get the required arguments. Hybrid does not support these.

We also have multi nested commands which slash does not support in general. Ex fm tag track add, this would have to become fm track tagadd and so forth.

Creating this issue as a way to try and come up with a best approach.

Currently I see two solutions.
1. We create separate slash commands and not hybrids, which would mean moving code out to its own functions and then having the prefix and slash command call them. This would allow us to keep prefix commands as is and just add slash command funcs.
2. We reformat all commands to fix the structure to accommodate hybrids. Would need to figure out better way to handle both points listed above.

@Ryan5453

Error in [p]fm server recent

[00:12:49] ERROR    [red] Exception in command 'fm server recent'
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /home/container/.local/lib/python3.11/site-packages/discord/ext/commands/cor │
│ e.py:235 in wrapped                                                          │
│ ❱  235             ret = await coro(*args, **kwargs)                         │
│ /home/container/.local/share/Red-DiscordBot/data/pterodactyl/cogs/CogManager │
│ /cogs/lastfm/recent.py:111 in command_recent_server                          │
│ ❱ 111             icon_url=ctx.guild.icon_url,                               │
╰──────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'Guild' object has no attribute 'icon_url'

fm artist scraping is failing

All forms of [p]fm artist are failing

[17:19:29] ERROR    [red] Exception in command 'fm artist'
╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ C:\Users\Jamie\redenv\Lib\site-packages\discord\ext\commands\core.py:229 in wrapped                                  │
│ ❱  229             ret = await coro(*args, **kwargs)                                                                 │
│ C:\Users\Jamie\Documents\red-stuff\lastfm-red\lastfm\lastfm.py:203 in command_artist                                 │
│ ❱ 203         artist, data = await self.artist_top(ctx, period, artistname, datatype,                                │
│       username)                                                                                                      │
│ C:\Users\Jamie\Documents\red-stuff\lastfm-red\lastfm\utils\scraping.py:27 in artist_top                              │
│ ❱  27             .find("img")                                                                                       │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'NoneType' object has no attribute 'find'

Posting this as a tracker.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.