Giter Club home page Giter Club logo

itunes-discord-rp's Introduction

iTunes Rich Presence for Discord

This is an application that lets you have a personalized Discord status based on what you're listening to on iTunes (or Music, if you're on MacOS 10.15+). The status will show the song name, artist, album name, time elapsed since the track started playing and index of the track in the album. Additionally, an image with a "playing" or "paused" button will be shown in case the track is playing or paused. For some examples, see the screenshots.

Features

  • Simple to use.
  • No in-app login required.
  • Lightweight (~1.5MB file).
  • Works on both MacOS and Windows.
  • Ugly UI.
  • Some customization options on how the Discord status will be displayed.

Requirements

  • MacOS / Windows.
  • A Java Runtime Environment (JRE), minimum version 1.8 (you can download it from here).
  • If the application displays an error window even when everything is set up correctly, installing the Java Development Kit will fix the issue (you can download it from here).
  • iTunes (or Music, if using MacOS 10.15+) and Discord applications.
  • For Windows users: this application should work for iTunes version 4.7 or later.

Usage

  • Download the application as:
    • jar: it can be run on either OS.
    • dmg: image that contains the .app bundle that can be run on MacOS as a native application (double click on the .dmg file, then extract the .app file to wherever you want).
    • exe: executable that can be run on Windows as a native application.
  • All of these versions can be found here under Assets
  • Double click on it.
  • Done!

Homebrew

If you're a Mac user and have homebrew installed, you can easily install this app as a Cask (it'll also update automatically when using the cask upgrade command, and it doesn't require you to bypass Gatekeeper). All you need to do is run this command:

brew install --cask kkevinm/itunes-discord-rp/itunesdiscordrp

This will tap the itunes-discord-rp repository and then install the cask like normal.

F.A.Q.

    • Q: The application runs fine, but my status won't update, what do I do?
    • A: go to Settings -> Game Activity and make sure the option Display currently running game as a status message is on. Additionally, the status won't be displayed while your Discord status is set to invisible.
    • Q: Gatekeeper won't let me run the app/jar on my Mac!
    • A: Right-click on the app/jar file and hit Open. Then hit Open in the dialog that appears. After doing it this way, the app should open fine just by double clicking on it.
    • Q: Can I hide the app's window?
    • A: Yes, if your system supports it, the app will show a button on the menu bar / system tray. Clicking on it will hide (or show, if clicking it again) the main window.
    • Q: I'm on Mac and the app seems to freeze often (for example, the status on Discord doesn't update after a while).

    • A: This can be caused by App Nap, a feature that puts apps to sleep when they're in the background. You can try disabling App Nap by pasting this line in the Terminal and hitting enter (afterwards, restart the computer to make it take effect):

      defaults write NSGlobalDomain NSAppSleepDisabled -bool YES

    • Q: Can you make so the album cover of the playing song is shown in the status?
    • A: No, Discord doesn't allow you to upload pictures dynamically (outside of special applications like Spotify).
    • Q: Can you change "Playing Music" to "Listening to Music"?
    • A: No, the public Rich Presence API currently doesn't let you change the type of activity in the status.

Screenshots

Status preview

alt

Status while playing

alt

Status while paused

alt

Status with long names

alt

To-dos

  • Javadocs.
  • Unit tests.
  • Spotify integration (easy but rather useless).
  • Command line only interface.
  • Allow customization of the rich presence elements.
  • Make it a menu bar app for MacOS.

Acknowledgements

Disclaimer

iTunes is a trademark of Apple Inc., registered in the U.S. and other countries.
This application has not been authorized, sponsored, or otherwise approved by Apple Inc.

itunes-discord-rp's People

Contributors

ajfarino2 avatar cawc avatar gabehxd avatar kkevinm avatar realdyllon avatar sycured 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  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  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  avatar  avatar  avatar  avatar

itunes-discord-rp's Issues

Big Sur icon?

Hi,

The Music app has been updated in macOS Big Sur to be square and red...can we get an additional icon in this app to reflect this? Thanks!
image

[REQUEST] Display album art instead of the iTunes logo

Hi, would it be possible to make it so a song's album art is displayed instead of just the iTunes logo? It's not that big of an issue, but it definitely adds flare to the integrated Spotify RP.

EDIT: ah, nvm, I see that it's been addressed in an earlier post.

Hide icon from Dock while running (method discovered)

I discovered a method to hide the app icon by modifying a file after the application is built. This can presumably be done before packing the release ZIP.

Read through the answer part of this page. It still works on macOS Catalina.
Apple Discussions - Hide app icon from Dock without quitting
You may need a Mac in order to do it, I'm not sure. Mac Apps are really just a folder that Finder sees a .app on and aliases to the executable. So on a PC, you should be able to explore it. You'll have to use Notepad to open it most likely. If you have even an older Mac, use that as it is more likely to work properly. Use TextEdit or you can use Xcode if you happen to have that 12 gig app downloaded, which just gives you a little IDE to do it. Same thing.

(Request): Can we get more rich presense features?

Hey, can we get a different color background for the music icon? And then also im getting a delay issue, and when i pause music, im still seeing elapsed time going up.

Then can we get "Listening to Music" instead of "Playing Music"?

I am on macOS!

Thank you!

Additional info around the error "JRELoadError"

Thanks for building this app. Additional info on the issue if desired to work around in the future:

[~]$ /usr/libexec/java_home -V
Matching Java Virtual Machines (1):
    11.0.2, x86_64:	"OpenJDK 11.0.2"	/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home
[~]$ java -version
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
[~]$ java -jar ~/Downloads/iTunesDiscordRP-1.5.7.jar
Oct 14, 2020 7:08:10 PM com.github.kevinmussi.itunesrp.Main main
INFO: Application started running.
Exception in thread "main" java.lang.NoClassDefFoundError: com/apple/eawt/AppEventListener
	at com.github.kevinmussi.itunesrp.Main.main(Main.java:66)
Caused by: java.lang.ClassNotFoundException: com.apple.eawt.AppEventListener
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 1 more

Seems that openjdk has removed the Mac-specific classes, causing the error, but looks like there's a new API to use: http://openjdk.java.net/jeps/272 -- says "Closed / Delivered" so might work?

I'm not sure if these classes are mandatory for the app, but an alternative could be a way to detect the lack of the Mac classes, show a warning, and fallback to running without Mac desktop features.

Can you support Japanese?

Hello, I'm Japanese.
I am using a translation now.
It is quick, but Japanese is garbled.

As in this picture
c90eb8d89d159ea0d64e4eecb3a02049

It will be saved if you fix it.

No song preview?

Heyy, sorry I'm super inexperienced with everything that has to do with programming and/or coding, but I downloaded the .zip file and unzipped it. I connected "iTunes" to my Discord account in the Game Activity tab, but it doesn't show the name of the song or the Apple Music icon? I kept the contents of the .zip file in my Downloads file, do I need to move them somewhere else?
Screenshot at May 05 21-44-35

Option to change presence name?

If possible, I think being able to choose between "Music", "Apple Music" etc. being displayed would be a very nice option to have

Exception in thread "Thread-3" java.lang.NumberFormatException: For input string: "1.002723535156E 4"

At some point when testing with the streaming changes in #44 , the following error eventually occurred and silently broke the app:

Exception in thread "Thread-3" java.lang.NumberFormatException: For input string: "1.002723535156E 4"

This is the log line in my applescript:

log currentStreamTitle & ";;" & name of current track & ";;" & currentStreamUrl & ";;" & state & ";;" & player position & ";;" & "0" & ";;" & track number of current track & ";;" & track count of current track

It seems that value came from the playback position value since duration is coded to 0, if so that could also happen in the existing code rather than just in my stream-handling changes.

Might be worth adding some exception handling around the record/message parsing just in case, possibly also trying to clean up the value before parsing.

Internet streams via iTunes on MacOS older than 10.15 not working, quick fix for applescript

FYI the app wasn't working with internet streams on iTunes (older than 10.15 in my case, haven't tested with 10.15).

I made the following changes to scripts/macos/itunes_track_info_script.applescript to get it working:

set currentStreamTitle to current stream title
set currentStreamUrl to current stream URL
					
# Write the track main information in the log
log currentStreamTitle & ";;" & name of current track & ";;" & currentStreamUrl & ";;" & state & ";;" & player position & ";;" & "0" & ";;" & track number of current track & ";;" & track count of current track

Example output:

(*Wice - Asteroid Rain;;Synthwave - DI.FM Premium;;http://www.di.fm;;PLAYING;;10.006999969482;;0;;0;;0*)

Seems to be working OK. I rarely play audio tracks through iTunes so hardcoded it for myself for now. A more general approach would probably be checking if "current stream title" has a value, and if not then defaulting to "name of current track"?

I changed duration to a fixed zero because itunes was outputting something like "missing number" value, and a change in the duration value would cause the app to think it's a new track, seems to work fine with 0.

Another idea in this case would be to track the duration within the app? Eg, if itunes duration is "missing value" then use the value -1, and that tells the app to track duration internally based on when the track changes.

Maybe some internet streams might have a valid duration value. Not sure.

If anyone wants to add it in the mean time or change up the values, it's easy without having to recompile. Eg,

vim ./Contents/Java/com/github/kevinmussi/itunes-discord-rp/1.5.7/itunes-discord-rp-1.5.7.jar select the applescript file, edit, and save it. Then run the app.

Possible cover art support?

I don't know if this would be possible but if you were able to see the cover art of the track you're playing on discord it would be amazing.

Only works for Apple Music tracks in library

I don't know if this is intended or not or a limitation of the Music/iTunes app, but this is only detecting played songs that are added to my Apple Music library (and not things from random playlists/albums not added to my library). I think this should be possible since last.fm scribblers are able to read tracks played not in the user's library? But I may be wrong.

No status in Discord for me

Doesn't work for me. The track playing can be seen inside the Java application but the status in Discord won't change. Also no error in Console, see below.

PS D:\Downloads> java -jar .\iTunesDiscordRP-1.3.exe Apr 14, 2020 1:04:08 PM com.github.kevinmussi.itunesrp.Main main INFORMATION: Application started running. Apr 14, 2020 1:04:09 PM com.github.kevinmussi.itunesrp.Main main INFORMATION: View invoked. Apr 14, 2020 1:04:09 PM com.github.kevinmussi.itunesrp.preferences.PreferencesManager readPreferencesFromFile INFORMATION: Preferences correctly read from file. 13:04:09.332 [AWT-EventQueue-0] DEBUG com.jagrosh.discordipc.entities.pipe.Pipe - Searching for IPC: \\?\pipe\discord-ipc-0 13:04:09.341 [AWT-EventQueue-0] DEBUG com.jagrosh.discordipc.entities.pipe.Pipe - Sent packet: Pkt:HANDSHAKE{"v":1,"nonce":"0ee04ccb-627a-4482-ad26-9d35e4c5741f","client_id":"473069598804279309"} 13:04:09.520 [AWT-EventQueue-0] DEBUG com.jagrosh.discordipc.entities.pipe.WindowsPipe - Received packet: Pkt:FRAME{"evt":"READY","data":{"v":1,"config":{"environment":"production","api_endpoint":"//d iscordapp.com/api","cdn_host":"cdn.discordapp.com"},"user":{"premium_type":0,"bot":false,"flags":32,"id":"374207236706271252","avatar":null,"username":"dreadmyspike","discriminator":"9179"}},"cmd":"DI SPATCH","nonce":null} 13:04:09.521 [AWT-EventQueue-0] DEBUG com.jagrosh.discordipc.entities.pipe.Pipe - Found a valid client (STABLE) with packet: Pkt:FRAME{"evt":"READY","data":{"v":1,"config":{"environment":"production", "api_endpoint":"//discordapp.com/api","cdn_host":"cdn.discordapp.com"},"user":{"premium_type":0,"bot":false,"flags":32,"id":"374207236706271252","avatar":null,"username":"dreadmyspike","discriminator" :"9179"}},"cmd":"DISPATCH","nonce":null} 13:04:09.521 [AWT-EventQueue-0] INFO com.jagrosh.discordipc.entities.pipe.Pipe - Found preferred client: STABLE 13:04:09.521 [AWT-EventQueue-0] DEBUG com.jagrosh.discordipc.IPCClient - Client is now connected and ready! 13:04:09.523 [AWT-EventQueue-0] DEBUG com.jagrosh.discordipc.IPCClient - Starting IPCClient reading thread! Apr 14, 2020 1:04:09 PM com.github.kevinmussi.itunesrp.core.DiscordHelper$CommandReceiver connect INFORMATION: Client successfully connected. Apr 14, 2020 1:04:09 PM com.github.kevinmussi.itunesrp.core.ScriptHelper executeScript INFORMATION: The script started execution. Apr 14, 2020 1:04:09 PM com.github.kevinmussi.itunesrp.core.DiscordHelper onUpdate INFORMATION: Received new track. 13:04:09.676 [Thread-3] DEBUG com.jagrosh.discordipc.IPCClient - Sending RichPresence to discord: {"assets":{"small_image":"playing","small_text":"Playing","large_image":"itunes-logo","large_text":"iT unes"},"instance":true,"timestamps":{"start":1586862180},"details":"­ƒÄ Yellow","state":"­ƒæñ Emmit Fenn ­ƒÆ┐ Yellow - Single","secrets":{},"party":{"size":[1,1],"id":"aa"}} 13:04:09.685 [Thread-3] DEBUG com.jagrosh.discordipc.entities.pipe.Pipe - Sent packet: Pkt:FRAME{"args":{"activity":{"assets":{"small_image":"playing","small_text":"Playing","large_image":"itunes-logo ","large_text":"iTunes"},"instance":true,"timestamps":{"start":1586862180},"details":"­ƒÄ Yellow","state":"­ƒæñ Emmit Fenn ­ƒÆ┐ Yellow - Single","secrets":{},"party":{"size":[1,1],"id":"aa"}},"pid":1 3764},"cmd":"SET_ACTIVITY","nonce":"8ce521e8-188d-482f-b78c-db92c0a3c328"} Apr 14, 2020 1:04:09 PM com.github.kevinmussi.itunesrp.core.DiscordHelper onUpdate INFORMATION: Updated Rich Presence. 13:04:09.726 [Thread-2] DEBUG com.jagrosh.discordipc.entities.pipe.WindowsPipe - Received packet: Pkt:FRAME{"evt":null,"data":{"assets":{"small_image":"473554687535349760","small_text":"Playing","larg e_image":"473143286102622229","large_text":"iTunes"},"timestamps":{"start":1586862180000},"name":"Music","flags":1,"details":"­ƒÄ Yellow","state":"­ƒæñ Emmit Fenn ­ƒÆ┐ Yellow - Single","secrets":{}," application_id":"473069598804279309","party":{"size":[1,1],"id":"aa"}},"cmd":"SET_ACTIVITY","nonce":"8ce521e8-188d-482f-b78c-db92c0a3c328"}

Discord:
Stable 58100 (26efe4c)
Host 0.0.306

Windows 10 64-Bit (10.0.18363)

[Request] Making status appearance customizable

Hello,

I'd like to know if it would be possible for you to make an option where we could customize the appearance of the status? I'd like to be able to remove the album and (X out of Y) informations or to move them below the artist's name and above the timer.

I don't know anything about coding so please forgive me if that's impossible to do.

Also, you're the only great and convenient app I found working under macOS so thank you for that!

Doesn't work when you use radio stations

When you play a radio station (like an artist station or a personalized station) then the app doesn't recognize the songs that are playing.
Other then that great app!!

(macOS Big Sur 11.2.3)

close button bug

when I hitted the close app button on macOS I cannot open the app up again
ezgif com-video-to-gif

Extending Song Title

Is there a way to extend the appearance of the song title in the Discord status? For example, in the image below the full song title is "Round & Round (Extended Mix)." However, I only see what I see in the screenshot. Any way to fix this?
Screen Shot 2020-07-30 at 5 56 43 PM

Add support for streams

Hello,

Sometimes I listen to radio station streams in iTunes. However, iTunes RP for Discord doesn't recognize them, even when the song and artist name is showing. I would really like for my friends to see what I'm listening to, so adding support for radio streams would be greatly appreciated. Thanks!

.

.

Minimize

When minimizing a program, it remains on the panel with open programs and in the tray. When you click the tray icon, the application disappears / appears on the panel with open programs. Usually, it should be when I click "minimize" the application is removed in the tray, and does not remain on the panel.

Is there a way to change the icons?

I was wondering if I can change the iTunes icon, I'm presuming it's getting the image via the internet as the icon doesn't match my one. Don't mind if i cannot, but thanks for the app. :)

iTunes auto start-up problem.

I'm running the app on Windows. Even after closing both the apps, the iTunes app keeps popping up(starts running) automatically at a particular time interval. It would be much appreciated if the issue gets fixed.

Cannot find method “setCreated” in java.net.Socket. Unsupported JVM?

When I try to start the program via the JAR, I get this:

❯ java -jar iTunesDiscordRP-1.5.jar
Jun 03, 2020 7:47:40 PM com.github.kevinmussi.itunesrp.Main main
INFO: Application started running.
Jun 03, 2020 7:47:41 PM com.github.kevinmussi.itunesrp.Main main
INFO: View invoked.
Jun 03, 2020 7:47:42 PM com.github.kevinmussi.itunesrp.preferences.PreferencesManager readPreferencesFromFile
INFO: Preferences correctly read from file.
19:47:42.367 [AWT-EventQueue-0] DEBUG com.jagrosh.discordipc.entities.pipe.Pipe - Searching for IPC: /var/folders/_d/qfj0n5t17_gf43q1k7c773d00000gn/T//discord-ipc-0
Jun 03, 2020 7:47:43 PM com.github.kevinmussi.itunesrp.core.DiscordHelper$CommandReceiver connect
SEVERE: Something went wrong while trying to connect: org.newsclub.net.unix.AFUNIXSocketException: Cannot find method "setCreated" in java.net.Socket. Unsupported JVM?

I’m on macOS Catalina 10.15.4, and have both the JRE and JDKs instaled.

❯ javac --version
javac 14.0.1

❯ java --version
java 14.0.1 2020-04-14
Java(TM) SE Runtime Environment (build 14.0.1+7)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)

Not working on Win10 v20H2 with iTunes v12.10?

Hi,

is this application still working?

Didn't get the itunes status to show up in discord.
In the iTunes Rich Presence window the currently playing is showing up.

Windows 10 20H2
iTunes 12.10.10.2
Discord Stable 71615 (583a822)

Program not detecting when switching songs.

If i am listening to an album, the app will detect the current song playing.. but, it wont update the information when itunes switches to the next song. The app assumes its the same one and the timer keeps going.

I have the latest version of this app.
Running Mac OS Big Sur 11.0.1

V 1.5.5 (1) :: Information does not update if Music playback is paused for a prolonged period and then resumed

iTunes Discord RP Version: 1.5.5 (1) (DMG)
Client system: Retina MacBook Pro (15", Dual Graphics, Early-2013)
Client OS: macOS Catalina 10.15.6 build 19G2021
Music App version: 1.0.6.10

Issue: Playback information (song title, album info, pause/play status and playback duration, etc.) does not update if Music app playback is paused for a prolonged period of time (in my experience, more than a few minutes) and then subsequently resumed. Issue also appears if Music is quit and relaunched later without iTunes Discord RP being relaunched as well. In some cases, the song will update after a delay, and in others, it does not update at all and iTDRP is quit and relaunched to mitigate the issue.

Album artwork

Hi, just found this app because I don't use Spotify so this is great! Just if the album artwork could be displayed as well as the title, album, etc.
Also if it could be a background app in the menu bar instead of the dock would be great :D.
Keep the good work!

Request: hide to system tray on Win10

The FAQ acknowledges the feature to hide to tray if "the system supports it". Is there any reason why this isn't a supported feature on Win10.

EDIT: I've implemented it and it's working on win10.

Not working—giving error

For the past couple of months, this hasn't been working.
I'm on Mac OS X 10.10.5, Discord 0.0.254 and iTunes 12.8.0.150
Whenever I try to connect, it tells me:

An error has occurred while trying to connect to Discord!
Make sure that:
• You have the Discord app installed and currently running.
• You're logged in with your account.

Make the app work in the background without having to disable App Nap.

Having App Nap on will make the app not work when it's on the background, thus leaving the Discord status not up-to-date. Apparently, since more recent MacOS versions, it's not even possible to disable it for just specific applications (the "defaults write <app domain>" method is actually ignored) so for now the only solution is to disable App Nap globally. The ideal goal would be to make the app (and underlying osascript) not be put in sleep mode when being in the background, while also keeping App Nap active.

End of album/playlist song stuck on "playing"

Hi,

On Windows 10, occasionally when I reach the end of an album or playlist, it gets stuck saying I'm still "playing" the track, with the duration elapsed counter going up infinitely. For instance, this track is only 4 minutes but it says it's been playing for over 15:

image

Activity type: listening

Could you set the activity type to Listening, so it says Listening to iTunes, instead of Playing iTunes?

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.