Git Product home page Git Product logo

discord.fm's Introduction

CURRENTLY WORKING ON: Discord.fm

sup, I make some apps/programs/scripts/programming and I'm currently doing some Python projects. I have some intermediate C#, intermediate Python experience and next on my learning list is JS frameworks. looking to collaborate on anything, really depends on what you bring to the table and what level of dumb you're willing to deal with.

shoot me an email at [email protected]

discord.fm's People

Contributors

androidwg avatar gust4oliveira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

emanuelvh

discord.fm's Issues

Alert user of inavlid Last.fm Username

Show alert (either trhu system notification, dialog box or something else inside settings app) to inform that Discord.fm didn't find a valid username.

Add translations

Add translations on UI and notifications through a simple custom system.

DiscordError when starting while Discord is open but not logged in

Just started Windows 10 normally with Discord.fm configured to start with the system, and got this exception:

Traceback (most recent call last):
  File "main.py", line 101, in <module>
  File "wrappers\system_tray_icon.py", line 25, in __init__
  File "wrappers\system_tray_icon.py", line 67, in wait_for_discord
  File "wrappers\discord_rp.py", line 21, in connect
  File "pypresence\presence.py", line 45, in connect
  File "asyncio\base_events.py", line 642, in run_until_complete
  File "pypresence\baseclient.py", line 121, in handshake
pypresence.exceptions.DiscordError: Error Code: 1000 Message: User logged out

Probably just have to catch it and wait until Discord is fully started.

Rich presence on discord shows no image at all

image

When using this plugin, everything syncs except the image for the song/album never shows up, no matter which song or service I use, and it shows on LastFM. I am using windows 10 Version 21H2 build 19044.2604 and I am happy to provide any more information that is needed :)

WSError: User not found

Randomly received this error while running on the background. Couldn't figure out why it happens - may be an internal Last.fm error that PyLast is interpreting incorrectly? The username in my settings is correct.

Traceback (most recent call last):
  File "main.py", line 25, in <module>
  File "app_manager.py", line 74, in start
  File "loop_handler.py", line 30, in handle_update
  File "sched.py", line 151, in run
  File "loop_handler.py", line 41, in _lastfm_update
  File "wrappers\last_fm_user.py", line 29, in now_playing
  File "util\request_handler.py", line 104, in attempt_request
  File "util\request_handler.py", line 126, in _wrapper
  File "pylast\__init__.py", line 2327, in get_now_playing
  File "pylast\__init__.py", line 1142, in _request
  File "pylast\__init__.py", line 978, in execute
  File "pylast\__init__.py", line 967, in _download_response
  File "pylast\__init__.py", line 997, in _check_response_for_errors
pylast.WSError: User not found

"pylast.WSError: Operation failed" happened randomly

Fix this error that happened randomly while using the computer normally:

Traceback (most recent call last):
  File "main.py", line 20, in <module>
  File "app_manager.py", line 79, in start
  File "loop_handler.py", line 30, in handle_update
  File "sched.py", line 151, in run
  File "loop_handler.py", line 41, in _lastfm_update
  File "wrappers\last_fm_user.py", line 29, in now_playing
  File "util\request_handler.py", line 103, in attempt_request
  File "util\request_handler.py", line 125, in _wrapper
  File "pylast\__init__.py", line 2327, in get_now_playing
  File "pylast\__init__.py", line 1142, in _request
  File "pylast\__init__.py", line 978, in execute
  File "pylast\__init__.py", line 967, in _download_response
  File "pylast\__init__.py", line 997, in _check_response_for_errors
pylast.WSError: Operation failed - Most likely the backend service failed. Please try again.

Rich Presence doesn't work after program sits idle for too long

The program works completely fine. However, it seems that Discord silently ignores rich presence updates if a program connected too long ago? Or something of that sort.

I noticed recently Discord.fm simply wasn't showing what I was playing recently and after some debugging, the only thing that fixed it was closing and opening the program. After that, restarting does nothing.

Possible solution is connecting and disconnecting RP to Discord when the app gets a scrobble and stops receiving one, respectively.

Add Libre.fm support

For a version beyond 1.0. Since PyLast makes Libre.fm very easy, I don't see a reason not to.

Doesn't display activity

Description

As title says, it doesn't want to track scrobbles and display them, despite the web scrobbler definitely working. Logs don't return anything useful to tell whats going on to fix it. Relaunching the program, (or completely closing it out with task manager), does not fix the issue and leaves the program stuck on "checking current scrobbling". There is a good chance it might have to do with me locking my pc, although it shouldnt since tasks are still running and it should be able to track, going off how programs like PreMid work.

To reproduce
Steps to reproduce the behaviour:

  1. Literally just lock your computer
  2. It could also be playing a video that has a filter to not be tracked by last.fm

Expected behaviour
The program to track properly

Versions & technical info

Logs
discord.fm_2023-12-30_23-14-19.log

Windows version info
Edition Windows 10 Home
Version 22H2
Installed on ‎5/‎10/‎2022
OS build 19045.3803
Experience Windows Feature Experience Pack 1000.19053.1000.0

Additional context and info
It works fine after you completely reinstall the program from the launcher, but then you'll eventually run into the same issue.

The app regularly has to be forcefully exited & rebooted for Rich Presence to function as intended

I really love the app and there appears to be nothing quite like it on the web, but unfortunately it just doesn't work reliably as it should. Often the app is running in the taskbar tray, and the Rich Presence functionality just doesn't work properly. I have to manually close it and run it again.

I understand that the app was still being worked on so it's okay with me for now -- if the dev or other knowledgeable programmer around is still here to assist/hopefully fix whatever the bug is, that'd be fantastic!

Edit: it also opens up the directory folder where it's stored rather than actually booting at launch.

Could not find Discord installed and running on this machine

Happened while starting Discord.fm on system startup:

Traceback (most recent call last):
  File "main.py", line 6, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
  File "tray.py", line 14, in <module>
  File "wrappers\__init__.py", line 67, in __init__
  File "pypresence\presence.py", line 13, in __init__
  File "pypresence\baseclient.py", line 28, in __init__
pypresence.exceptions.DiscordNotFound: Could not find Discord installed and running on this machine.

pystray catches SystemExit exception when closing from tray and app never exits

When running close_app from the tray icon thread, it always hangs on sys.exit() since pystray catches the SystemExit exception. Log output:

Closing app...
Closed Discord Rich Presence
An error occurred when calling message handler
Traceback (most recent call last):
  File "C:\Users\samu-\Repos\Discord.fm\venv\lib\site-packages\pystray\_win32.py", line 401, in _dispatcher
    return int(icon._message_handlers.get(
  File "C:\Users\samu-\Repos\Discord.fm\venv\lib\site-packages\pystray\_win32.py", line 213, in _on_notify
    descriptors[index - 1](self)
  File "C:\Users\samu-\Repos\Discord.fm\venv\lib\site-packages\pystray\_base.py", line 306, in inner
    callback(self)
  File "C:\Users\samu-\Repos\Discord.fm\venv\lib\site-packages\pystray\_base.py", line 431, in __call__
    return self._action(icon, self)
  File "C:\Users\samu-\Repos\Discord.fm\main.py", line 67, in close_app
    sys.exit()
SystemExit

Move settings UI to Tk

Test Tk interface to check if file sizes end up smaller, and if so, move Qt interface to Tk.

[Bug] No module named 'pywintypes' on startup for GitHub Actions Windows builds

I got this notification after just starting the app on Windows. Probably hidden import, but never had this issue before. Seems weird it'd start to do that only now.

Traceback (most recent call last):
  File "main.py", line 7, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "app_manager.py", line 16, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "ui\__init__.py", line 21, in <module>
  File "ui\__init__.py", line 25, in SettingsWindow
  File "util\install\__init__.py", line 29, in get_install
  File "importlib\__init__.py", line 126, in import_module
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "util\install\windows.py", line 7, in <module>
ModuleNotFoundError: No module named 'pywintypes'

Show settings app on first boot

Instead of relying on the setup to show the settings app, if the settings file isn't found, make Discord.fm sit and wait for the user to input username to continue.

Handle network errors

Currently network errors aren't treated correctly and make the app behave incorrectly and unexpectedly.

Songs with one character names throw an exception

Discord doesn't allow activities with a "detail" field smaller than 2 characters. A possible fix is to add space or invisible Unicode chars in front of the single character.

Now playing: 傘
Uncaught exception
Traceback (most recent call last):
  File "C:\Users\samu-\Repos\Discord.fm\main.py", line 70, in <module>
    loop.handle_update()
  File "C:\Users\samu-\Repos\Discord.fm\loop.py", line 65, in handle_update
    sc.run()
  File "C:\Users\samu-\AppData\Local\Programs\Python\Python39\lib\sched.py", line 151, in run
    action(*argument, **kwargs)
  File "C:\Users\samu-\Repos\Discord.fm\loop.py", line 35, in lastfm_update
    tray.rp.update_status(track)
  File "C:\Users\samu-\Repos\Discord.fm\wrappers\__init__.py", line 105, in update_status
    self.presence.update(details=track.name, state=track.artist,
  File "C:\Users\samu-\Repos\Discord.fm\venv\lib\site-packages\pypresence\presence.py", line 36, in update
    return self.loop.run_until_complete(self.read_output())
  File "C:\Users\samu-\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "C:\Users\samu-\Repos\Discord.fm\venv\lib\site-packages\pypresence\baseclient.py", line 88, in read_output
    raise ServerError(payload["data"]["message"])
pypresence.exceptions.ServerError: Child "activity" fails because child "details" fails because "details" length must be at least 2 characters long

No tray icon on Windows 11 22H2 22623.875

Edition Windows 11 Home
Version 22H2
OS build 22623.875
Experience Windows Feature Experience Pack 1000.22636.1000.0

I'm in the Windows Insider beta channel, and these builds have a remade system tray that doesn't work with some apps. It seems like this is one of them

Fix mysterious "OSError" when printing

Found this log file where the app had an unexpected exception when printing the name of a setting being retrieved:

19:11:54.115 | DEBUG    | Finished running function "get_now_playing"
19:11:54.161 | DEBUG    | Thread result: None
19:11:54.192 | DEBUG    | Not playing anything
19:11:58.195 | DEBUG    | Thread ID: 18688
19:11:58.195 | DEBUG    | user.getRecentTracks
19:11:58.731 | DEBUG    | Finished running function "get_now_playing"
19:11:58.746 | DEBUG    | Thread result: None
19:11:58.762 | DEBUG    | Not playing anything
19:12:02.774 | DEBUG    | Thread ID: 5352
19:12:02.789 | DEBUG    | user.getRecentTracks
19:12:05.865 | DEBUG    | Finished running function "get_now_playing"
19:12:05.911 | DEBUG    | Thread result: None
19:12:05.958 | DEBUG    | Not playing anything
19:12:05.959 | DEBUG    | Running misc update
19:12:05.959 | CRITICAL | Uncaught exception
Traceback (most recent call last):
  File "C:\Users\samu-\Repos\Discord.fm\main.py", line 105, in <module>
    loop_handler.handle_update()
  File "C:\Users\samu-\Repos\Discord.fm\loop_handler.py", line 28, in handle_update
    self.sc.run()
  File "C:\Users\samu-\AppData\Local\Programs\Python\Python39\lib\sched.py", line 151, in run
    action(*argument, **kwargs)
  File "C:\Users\samu-\Repos\Discord.fm\loop_handler.py", line 63, in misc_update
    self.cooldown = local_settings.get("cooldown")
  File "C:\Users\samu-\Repos\Discord.fm\settings.py", line 78, in get
    print(f"Getting {name} setting")
OSError: [Errno 22] Invalid argument
19:12:06.003 | DEBUG    | Attempting to find Windows install...
19:12:06.003 | WARNING  | Discord.fm installation not found
19:13:58.270 | DEBUG    | Attempting to find Windows install...
19:13:58.270 | WARNING  | Discord.fm installation not found
19:14:03.771 | INFO     | Closing app...
19:14:03.792 | INFO     | Closed Discord Rich Presence
19:14:03.792 | DEBUG    | Closing 1 events...
19:14:03.793 | ERROR    | An error occurred when calling message handler
Traceback (most recent call last):
  File "C:\Users\samu-\Repos\Discord.fm\venv\lib\site-packages\pystray\_win32.py", line 401, in _dispatcher
    return int(icon._message_handlers.get(
  File "C:\Users\samu-\Repos\Discord.fm\venv\lib\site-packages\pystray\_win32.py", line 213, in _on_notify
    descriptors[index - 1](self)
  File "C:\Users\samu-\Repos\Discord.fm\venv\lib\site-packages\pystray\_base.py", line 306, in inner
    callback(self)
  File "C:\Users\samu-\Repos\Discord.fm\venv\lib\site-packages\pystray\_base.py", line 431, in __call__
    return self._action(icon, self)
  File "C:\Users\samu-\Repos\Discord.fm\main.py", line 55, in close_app
    sys.exit()
SystemExit
19:14:03.847 | INFO     | Closing app...

Pull username from browser cookies

I don't know if this is possible but theoretically could be. When the user first launches the app, it scans the folders of Edge, Chrome, Firefox, Brave, Opera, Safari, whatever to retrieve the currently logged-in user on Last.fm and use that username.

Auto Updating

Automatically download the latest release from GitHub and install it using the program's setup app.

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.