Magic Cards - Queue music, play movies, or trigger events with RFID cards

Hey everyone, after seeing the cool music cards project that went around last week, I decided to try to wrap up the idea into a tighter package in hopes to make it easier for everyone to do it themselves.

What I ended up with was Magic Cards! - https://github.com/maddox/magic-cards

It makes it a little easier to manage the cards that can be scanned without having to physically be near your card reading setup. It has built in support for Home Assistant and all you have to do is trigger off of a custom event. There’s more information in the docs.

I hope you find it useful!

9 Likes

Thanks for putting all this information together! I just ordered the RFID reader and will try to built a music / audiobook system for my two year old nephew.

2 Likes

Superb
This would be fantastic even for people with reduced accessibility (Hope that no-one will be hurt, cause google bad translation for this word)

Hi,

First, this is a brilliant idea!

I am currently working on this but am having an issue after installation. I apologise if this is a really basic question (I’m new to this).

I’ve followed all the installation checks but am not able to connect via http://localhost:5000/. I have checked firewalls etc but just cannot access anything (obviously I am replacing localhost with the ip address). I know the ip address is correct because I am connected via ssh using terminal.

My error message is either:
Safari - “Safari can’t connect to server”
Chrome - “[ip address] refused to connect.”

Any ideas what is going wrong?

If anyone has any ideas, it would really help - I’ve spent hours on this and am keen to get it working!

Sorry again if this is really basic or I’ve missed something really obvious.

localhost:5000 connects to the computer you’re currently loading it on. Itself. You need to connect to the host or IP address of the raspberry pi. http://raspberrypi.local usually works because that’s the default host name.

Thanks - I actually tried that since my comment but I’m still getting an error message (although a different one):

“Safari can’t open the page “pi.local:5000” because the server unexpectedly dropped the connection. This sometimes occurs when the server is busy. Wait for a few minutes, and then try again.” (or similar on different browsers - fyi, I named my pi, hence not the default name)

Any ideas?

All I can think is that the zero can’t quite handle it maybe? Although I’m doing this from a clean raspbian install.

It handles it fine. Try to load it locally on the Pi with ssh.

curl localhost:5000

I have done a full clean install of Raspbian and your magic-cards but unfortunately when I run curl, I receive the error :

“curl: (56) Recv failure: Connection reset by peer”

I can see from docker ps that it is running:

“CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
35cb2d4e557d jonmaddox/magic-cards “/usr/bin/entry.sh s…” 21 minutes ago Up About a minute 0.0.0.0:5000->5000/tcp magic-cards”

I can also see from netstat -lptm that port 5000 is listening. There are no firewall issues etc.

Yet I still can’t get it to work - trying not to give up!

Any ideas would be appreciated, otherwise I will just keep trying everything I can think of (with my limited knowledge)

21 minutes ago Up About a minute

This makes it look like it’s restarting over and over. Maybe there’s an issue with attaching to the input?

What’s the output of ls -al /dev/input for you?

Hey @maddox This is an awesome project which I play on starting soon.

At the moment I’m having a dillema choosing between Plex DVR and Channels DVR (Currently have both setup for testing and a long time user of Plex)

Plex Disadvantages are, I hate the UI but apparently a proper list EPG is coming soon and there’s no way (that I’m aware of at least) of controlling which channel to tune to which is making me lean towards Channels DVR (Magic Cards for me will start with Music and depending on which DVR I choose also video)

The question:
What OS are you running Channels (player) on? Are you running an action that automatically launches the channel app and tunes to the desired channel ID or do you have to already have the app open?

Heya. Full disclosure, I’m one of the 2 developers on Channels so my opinions may be biased :rofl:

One big advantage of Channels DVR is that it doesn’t need to transcode the MPEG2 files when playing them. The Channels app plays them natively. That means changing channels or playing back recordings happen within a second, vs 5-10 seconds on Plex. Our customers like that a lot, along with the more traditional and simple UI. Our customers’ families like that the MOST. Plex can get a little confusing.

I personally run the Channels apps all over my house on Apple TVs. It really is the best streaming box. It’s more expensive, but it’s way more powerful, the UI is cleaner, and there’s no ads. The Apple TV app is pretty much our flagship app. It works really great on the Shield too.

It’s also important to know that only the tvOS and iOS versions have full support for DVR at the moment. The Android TV and Fire TV versions support browsing and playing back your recordings, but they don’t have all of the UI for managing things like creating season passes and stuff. That part is coming really soon though. For now you can just manage that with the web admin if you really want to go with the Shield.

As for your other question, because Apple TV apps can’t run in the background, they can’t be launched remotely. So if you were to use Magic Cards, the app would have to be open. The Android/Fire TV version can though, as long as the app has been opened once and is still running in the background.

I hope this answers some of your questions!

1 Like

I wasn’t expecting that! Great work, you’re right on the speed vs Plex, it’s instant!

I’ve just purchased the Sheild app and I’m glad to hear managing recordings is coming soon, that’s a must for my family. I can do it via the web GUI but I wouldn’t want my family having access to the settings as they would break it very quickly. Also I wouldn’t expect them to use their mobiles to manage recordings, so that is great news.

I’ve also installed your beta on Roku, will for support be coming for that too?

Other things I’ve been looking for in a DVR is:

  • ability to resume a recording on another device when recording is still active, is this possible? E.g. miss the first 10mins of a tv program so start it from the beginning… or move from one room to another and resume playing.

Launching using the API is working for me on the shield, haven’t tried with in running in the background yet but that’s import to me. At the moment one of our most used skills on Alexa is switching to a TV channel via Logitech Harmony on Sky Sat TV box, works solidly so I need to replicate that.

Anything in the pipeline for Android Phones?

Cheers and thanks for your comment and for creating a great service!!

Absolutely. We don’t expect anyone to use the web admin for anything.

There’s no real work being done on the Roku app. That app is just an R&D alpha. With no native MPEG2 support, the Roku platform isn’t a great playground for the Channels app.

This is absolutely possible. In fact, if you pick a live airing of something to watch in the guide, and it’s recording, you will be prompted if you want to watch the recording or the live stream.

Nothing near term. Shipping for different Android handsets vs Android TV is a completelyyyy different ballgame.

Awesome thank you very much. All very helpful. I’ll let you know how I get on and if I have any other questions.

This project was so much fun to set up! Now the only thing left is to hide the RFID reader inside something cool. As of now, I have hidden it inside the old casing from my iPAD classic. Suggestions anyone?

I’m so glad to hear that! I tried my best to make it easy enough to be worth doing, just because the end product is so worthwhile.

FWIW, I have mine inside a lower cabinet in my kitchen. You just tap the card to the corner of the cabinet and voila. The reader actually works through the wood, I was super surprised.

I agree. The range of the reader is quite good.

To be in compliance with the WAF at home, the card-reader will be hidden inside a frame and picture of her choosing :slight_smile:

You should use a photo of a jukebox, or her favorite nostalgic music device.

1 Like

Loving the project. Most of the integrations are in place, Hass and Spotify only so far. I am running the project just as described on git and with the pre-made Docker-config (just disabled the Sonos docker). It works most of times, but in a couple of instances I have gotten an error message and only way to resolve it, so far, have been to trigger the restart script. Error is:

Read Card ID: 5500d2b10d
magic-cards    | [1] Finding card...
magic-cards    | [1] Found card: Lounge Music. Processing...
magic-cards    | [1] Processing action: Home Assistant
magic-cards    | [1] {"message": "Event magic_card_scanned fired."}
magic-cards    | [1] events.js:165
magic-cards    | [1]       throw er; // Unhandled 'error' event
magic-cards    | [1]       ^
magic-cards    | [1] 
magic-cards    | [1] Error: ENODEV: no such device, read
magic-cards    | [1] Emitted 'error' event at:
magic-cards    | [1]     at ReadStream.<anonymous> (/usr/src/app/scanner/node_modules/input-event/lib/index.js:45:10)
magic-cards    | [1]     at ReadStream.emit (events.js:180:13)
magic-cards    | [1]     at fs.read (fs.js:2116:12)
magic-cards    |     at FSReqWrap.wrapper [as oncomplete] (fs.js:673:17)
magic-cards    | [1] error Command failed with exit code 1.
magic-cards    | [1] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
magic-cards    | [1] error Command failed with exit code 1.
magic-cards    | [1] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
magic-cards    | [1] yarn scanner exited with code 1

Anyone else experiencing this or know where I could look for a solution?

eww, could you open an issue on maddox/magic-cards repo for this? I’ll look into it.

Having to manually restart is a bummer.