Cov txheej txheem:

Sonos Spotify Vinyl Emulator: 26 Kauj Ruam
Sonos Spotify Vinyl Emulator: 26 Kauj Ruam

Video: Sonos Spotify Vinyl Emulator: 26 Kauj Ruam

Video: Sonos Spotify Vinyl Emulator: 26 Kauj Ruam
Video: This is a HIDDEN Feature on EVERY Xbox! 😱 2024, Hlis ntuj nqeg
Anonim
Image
Image
Sonos Spotify Vinyl Emulator
Sonos Spotify Vinyl Emulator

Thov nco ntsoov tias qhov no tsis yog cov lus qhia tshiab kawg rau txoj haujlwm no:

Thov mus saib https://www.hackster.io/mark-hank/sonos-spotify-vinyl-emulator-3be63d rau txheej txheej qhia tshiab thiab txhawb nqa

Mloog nkauj hauv vinyl yog qhov zoo. Nws yog lub cev thiab tactile. Koj mloog tag nrho cov nkauj ntau dua li cov nkauj tsis raug. Koj pom thaum nws dhau thiab nco ntsoov xaiv lwm yam. Koj tuaj yeem tsim cov ntawv sau thiab tshawb hauv nws ntau dua li yuav tsum tshawb nrhiav qhov koj xav tau.

Nws kuj tseem kim thiab loj heev, tshwj xeeb tshaj yog thaum koj txiav txim siab tias ib qho nyiaj uas koj siv rau yas yog qhov zoo li yuav muaj suab paj nruag uas koj twb tau nkag mus dhau los ntawm cov kev pabcuam streaming koj tso npe rau.

Txoj haujlwm no sim ua kom rov ua dua qhov kev txawj ntse thiab kev tsim cov khoom yas thaum tso siab rau Spotify kom xa cov nkauj. Muab cov khoom siv lub cev tso rau ntawm tus nyeem ntawv NFC txuas rau Raspberry Pi (ob qho uas tuaj yeem muab zais) yuav pib ua cov nkauj cuam tshuam nrog cov ntawv ntawd.

Kuv yuav taug koj txhua qib - los ntawm kev teeb tsa Raspberry Pi mus rau kev cim npe NFC cim npe. Nov yog kuv thawj qhov Raspberry Pi qhov haujlwm thiab kuv thawj Python code, yog li kuv tau qhia kuv tus kheej ob qho tib si thaum tsim qhov no. Raws li qhov no, cov lus qhia no xav tias tsis muaj kev paub yav dhau los thiab tham nrog koj los ntawm txhua qib.

Tus nqi tag nrho rau cov khoom tseem ceeb los tsim qhov no yog kwv yees li £ 50-60.

Kuv xav pom qhov koj tsim!

Kauj Ruam 1: Cov Khoom Siv Yuav Tsum Muaj 1: Raspberry Pi

Sab nraub qaum uas cuam tshuam nrog koj lub network, Sonos thiab Spotify yuav khiav los ntawm Raspberry Pi. Muaj qhov tsawg heev koj xav tau qhov no mus.

Qhov tseem ceeb:

Raspberry Pi: Kuv siv Raspberry Pi 3 Qauv B+ tab sis nws tseem yuav ua haujlwm nrog Raspberry Pi 3 Qauv A+ (£ 23)

USB lub zog siv hluav taws xob: Kuv muaj ib qho dag ib ncig - muaj ib qho haujlwm muaj yog tias koj tsis ua (£ 9)

Micro SD daim npav: Kuv tau txais 32gb ib, uas txaus rau daim ntawv thov no, ntawm Amazon (£ 6)

Qee cov khoom siv Sonos khiav ntawm koj lub network (Kuv kwv yees koj muaj qhov no twb yog koj nyob ntawm no …)

Ib tus account Spotify hwm

Pom zoo:

Ib rooj plaub rau Pi: muaj ntau txoj kev xaiv, pib ntawm £ 5

Lub raj mis zoo California Zinfandel: Kuv pom zoo Ridge, tab sis lwm qhov muaj

Kauj Ruam 2: Cov Khoom Siv 2: NFC Reader

Cov Khoom Siv Yuav Tsum 2: NFC Reader
Cov Khoom Siv Yuav Tsum 2: NFC Reader
Cov Khoom Siv Yuav Tsum 2: NFC Reader
Cov Khoom Siv Yuav Tsum 2: NFC Reader

Cov lus qhia no tau tsim rau ACR122U NFC nyeem ntawv uas txuas ntawm USB.

ACR122 UA

Kuv yuav qhov no los ntawm Amazon rau £ 38 (feem ntau vim tias nws tau xa khoom zoo tshaj plaws) tab sis muaj cov kev xaiv pheej yig dua los yuav tib tus nyeem ntawv no.

Tsis meej pem ACR122U zoo li tau muag nyob rau hauv ib pawg ntawm cov npe sib txawv (kuv tau los nyob deb-los-txhawb siab lub npe "Yosoo") tab sis los ntawm qhov kuv tuaj yeem qhia lawv zoo ib yam thiab tsim los ntawm American Card Systems.

Qhov pheej yig tshaj kuv tau pom ACR122U tshaj tawm yog £ 21 suav nrog kev xa khoom, tab sis qhov ntawd ncaj qha los ntawm Tuam Tshoj yog li koj yuav xav tau tos me ntsis rau qhov ntawd.

Lwm yam kev xaiv

Txoj haujlwm no vam khom lub tsev qiv ntawv nab nab hu ua nfcpy uas tswj hwm cov npe ntawm cov khoom siv txhawb nqa ntawm no:

Hauv txoj kev xav, txoj haujlwm no yuav tsum ua haujlwm nrog ib tus ntawm cov npe ntawd nrog kev koom ua ke me.

Ib qho kev xaiv uas txaus siab yog Adafruit PN532 uas yog pawg thawj coj uas yuav tsum tau txuas ncaj qha rau koj li Raspberry Pi siv cov hlua txuas. Kuv sim nws thiab pom nws tiag tiag faff. Nws yuav tsum tau soldering, piv txwv li.

Ib qhov zoo ntawm nws yog, hais txog qhov me me tab sis qhov tseeb pawg thawj coj saib xyuas yog hais txog qhov loj ib yam li lub siab ntawm ACR122U. Yog tias koj raug thawb tiag rau qhov chaw rau koj daim ntawv thov ces koj tuaj yeem tshem cov yas tawm ntawm ACR122U thiab tsuas yog siv lub rooj tsavxwm.

Kauj Ruam 3: Cov Khoom Siv Yuav Tsum Tau 3: NFC Cim npe

Cov Khoom Siv Yuav Tsum Tau 3: NFC Cim npe
Cov Khoom Siv Yuav Tsum Tau 3: NFC Cim npe

Rau txhua lub album koj xav tsim, koj yuav xav tau NFC tag uas ua tau raws li NTAG213 tus qauv.

Muaj ntau qhov chaw yuav cov no.

Kuv yuav kuv thawj pawg los ntawm Amazon, qhov twg kuv tau txais pob ntawm 10 rau £ 9 (suav nrog Prime xa tuaj)

Qhov zoo tshaj plaws muab rau kuv tau pom ntawm no hauv tebchaws Askiv yog Seritag - lawv muaj kev xaiv dav ntawm cov qauv sib txawv, cov lus qhia zoo ntawm lawv lub vev xaib, koj paub tseeb tias koj tau txais dab tsi (tsis ib txwm muaj tseeb ntawm Amazon). Lawv tsis muaj qhov txiav txim siab yam tsawg kawg nkaus thiab ib tuj ntawm kev xaiv. Cov cim pib ntawm 27p rau ib daim ntawv

Kauj Ruam 4: Rub Raspberry Pi OS rau SD Card

Rub lub Raspberry Pi OS rau SD Card
Rub lub Raspberry Pi OS rau SD Card
Rub lub Raspberry Pi OS rau SD Card
Rub lub Raspberry Pi OS rau SD Card

Hauv koj lub PC lossis Mac, rub tawm thiab khiav Raspberry PI daim duab thov.

Ntxig daim npav SD koj xav nruab Raspberry Pi kev ua haujlwm ntawm.

Nyem rau CHOOSE OS thiab xaiv lub neej Rasbian.

Nyem rau CHOOSE SD CARD thiab xaiv daim npav SD uas koj tau ntsaws.

Nyem rau WRITE. Qhov no yuav siv sijhawm me ntsis.

Thaum nws ua tiav nws yuav qhia koj kom tshem daim npav SD, uas koj yuav tsum ua. Tab sis tom qab ntawd ntsaws nws rov qab vim tias muaj ob peb lub ntsiab lus ntawm kev tu tsev uas koj yuav tsum tau ua ua ntej.

Kauj Ruam 5: Pab SSH ntawm Koj li Raspberry Pi OS Duab

Pab kom SSH ntawm koj li Raspberry Pi OS Duab
Pab kom SSH ntawm koj li Raspberry Pi OS Duab

Thaum OS tau sau rau SD daim npav, muaj ob peb yam haujlwm ntxiv uas koj yuav tsum tau ua.

Peb xav nkag mus rau Raspberry Pi yam tsis tau ntsaws rau hauv cov keyboard lossis saib xyuas (aka "headless"), uas peb tuaj yeem ua dhau peb lub network hauv zej zog siv peb lub PC lossis Mac hla txoj cai hu ua SSH. Txawm li cas los xij, rau kev ruaj ntseg yog vim li cas SSH tau xiam los ntawm lub neej ntawd. Peb yuav tsum tau pab nws.

Peb tuaj yeem ua qhov no los ntawm kev tsim cov ntawv khoob hu ua:

ssh ua

hauv SD daim npav peb nyuam qhuav tsim. Nws yog ib qho tseem ceeb uas qhov no tsis muaj kev xaiv txuas ntxiv (piv txwv li.txt). Cov ntaub ntawv nws tus kheej tsis tas yuav muaj cov ntsiab lus - tsuas yog nws muaj nyob yuav pab tau SSH thaum Pi pib khau raj.

Kauj Ruam 6: Xaiv tau: Teeb Wifi ntawm Koj Raspberry Pi

Tsis teb los tau: Teeb Wifi ntawm Koj Raspberry Pi
Tsis teb los tau: Teeb Wifi ntawm Koj Raspberry Pi
Tsis teb los tau: Teeb Wifi ntawm Koj Raspberry Pi
Tsis teb los tau: Teeb Wifi ntawm Koj Raspberry Pi

Koj tuaj yeem hla cov kauj ruam no yog tias koj npaj yuav xaim koj Raspberry Pi rau koj lub router los ntawm ethernet. (Txawm hais tias koj yuav xav xav hnyav txog qhov kev txiav txim siab ntawd - kom nws ua haujlwm dhau wifi ua rau lub neej yooj yim dua ntawm qhov muab tso rau qhov no)

Tsim cov ntawv yooj yim hu ua wpa_supplicant.conf hauv cov hauv paus hauv paus ntawm daim npav SD.

Ntxig cov ntawv hauv qab no rau hauv cov ntawv:

teb chaws = gb

update_config = 1 ctrl_interface =/var/run/wpa_supplicant network = {scan_ssid = 1 ssid = "MyNetworkSSID" psk = "MyPassword"}

Hloov lub tebchaws raws li qhov tsim nyog (GB yog UK, Asmeskas yog Asmeskas, DE yog Lub Tebchaws Yelemees, thiab lwm yam)

Hloov cov ntaub ntawv pov thawj wifi nyob rau ntawd kom yog koj li wifi router cov ntsiab lus tseeb.

Txuag cov ntawv.

Ruaj ntseg tshem tawm daim npav SD.

Kauj Ruam 7: Fais Fab Koj Raspberry Pi

Fais fab Koj Raspberry Pi
Fais fab Koj Raspberry Pi

Muab daim npav SD koj nyuam qhuav tsim rau hauv koj li Raspberry Pi.

Txuas koj lub Raspberry Pi rau hauv lub zog ntawm USB cable. Tos ib pliag kom nws khau raj.

Kauj Ruam 8: Nrhiav IP Chaw Nyob ntawm Koj Tus Raspberry Pi

Tam sim no koj yuav tsum nrhiav tus IP chaw nyob ntawm Raspberry Pi yog li koj tuaj yeem txuas rau nws. Koj tuaj yeem ua qhov no hauv ob txoj hauv kev:

  • ntawm koj nplooj teeb teeb tsa router - yog tias koj muaj lub router niaj hnub zoo li eero ces qhov no yooj yim heev;
  • lossis dhau ntawm lub xov tooj smartphone muaj rau iOS thiab Android hu ua "ntiv tes" - rub nws, txuas rau koj lub router thiab luam theej duab rau cov cuab yeej - ib qho ntawm lawv yuav tsum raug hu ua "Raspberry" - qhov no yuav yog IP chaw koj xav tau.

Kauj Ruam 9: Txuas rau Koj Kab Lus Raspberry Pi

Txuas rau Koj Cov Kab Lus Raspberry Pi
Txuas rau Koj Cov Kab Lus Raspberry Pi

Qhib Terminal ntawm koj lub mac (lossis yog tias koj siv Windows ces rub tawm thiab siv Putty).

Nkag mus rau cov lus txib hauv qab no:

ssh pi@[koj Pi tus IP chaw nyob]

Txais cov lus ceeb toom kev nyab xeeb uas koj tau txais. Koj yuav raug ceeb toom rau tus password rau tus neeg siv pi uas yog

raspberry

Kauj Ruam 10: Teeb Raspberry Pi OS GUI

Teeb tsa Raspberry Pi OS GUI
Teeb tsa Raspberry Pi OS GUI
Teeb tsa Raspberry Pi OS GUI
Teeb tsa Raspberry Pi OS GUI

Tam sim no koj tau txuas nrog koj Pi ntawm kab hais kom ua, uas yog qhov zoo tab sis koj kuj xav teeb tsa nws kom koj tuaj yeem nkag mus rau Graphical User Interface uas peb yuav nkag mus ntawm VNC (Kev Sib Txuas Network Virtual). Predictably, peb kuj yuav tsum tau pab kom qhov no.

Ua ntej tshaj plaws txheeb xyuas koj Pi software tau hloov kho tshiab los ntawm kev nkag mus rau ob qho lus txib hauv qab no (txhua tus ua raws los ntawm kev nkag mus) rau hauv kab hais kom ua:

sudo apt hloov tshiab

sudo apt nruab realvnc-vnc-server realvnc-vnc-viewer

Tom ntej no, qhib Raspberry Pi cov ntawv qhia zaub mov los ntawm kev nkag mus:

sudo raspi-teeb tsa

Nkag mus rau Kev Xaiv Ua Haujlwm> VNC> Yog.

Tawm ntawm daim ntawv thov teeb tsa los ntawm nias tus yuam sij khiav tawm thiab rov pib dua Pi los ntawm kab hais kom ua los ntawm kev ntaus ntawv:

sudo rov pib dua

Kauj ruam 11: Txuas rau thiab teeb tsa Koj Raspberry Pi GUI

Txuas mus thiab teeb tsa Koj Raspberry Pi GUI
Txuas mus thiab teeb tsa Koj Raspberry Pi GUI
Txuas mus thiab teeb tsa Koj Raspberry Pi GUI
Txuas mus thiab teeb tsa Koj Raspberry Pi GUI

Rub tawm thiab qhib VNC Viewer.

Ntaus tus IP chaw nyob rau koj li Raspberry Pi thiab nias txuas. Nws yuav qhia koj rau tus username thiab password uas yog:

Username = pib

Lo lus zais = raspberry

Qhov no yuav tsum khau raj koj mus rau GUI.

Nws yuav qhia koj kom paub meej tias koj thaj av thiab cov keyboard teeb tsa.

Tom qab ntawv nws yuav qhia koj kom hloov koj tus password (lub tswv yim zoo).

Nws yuav nug koj kom teeb tsa koj cov ntsiab lus wifi, tab sis koj tuaj yeem hla qhov no vim tias lawv twb ua haujlwm lawm. (Txawm hais tias yog tias koj tab tom khiav ntawm ethernet thiab muaj kev xav thib ob tam sim no yog koj lub caij nyoog … tab sis nco ntsoov koj tus IP chaw nyob yuav hloov)

Tom qab ntawv nws yuav tshawb xyuas, rub tawm thiab teeb tsa hloov tshiab (yuav siv sijhawm me ntsis).

Thaum koj tau dhau los ntawm tus tsim wizard Kuv xav kom hloov pauv lub vijtsam daws teeb meem raws li lub neej ntawd me me zoo nkauj. Koj tuaj yeem ua qhov no los ntawm txhaj Raspberry nyob rau sab saud> Nyiam> Raspberry Pi Kev teeb tsa> Zaub> teeb tsa kev daws teeb meem

Koj yuav tsum rov pib Pi dua kom tau txais qhov no kom siv tau.

Kauj Ruam 12: Nruab Node.js thiab NPM

Nruab Node.js thiab NPM
Nruab Node.js thiab NPM

Tom ntej no koj xav thauj Raspberry Pi kab hais kom ua los txhim kho kev vam khom peb xav tau.

Koj tuaj yeem ua qhov no los ntawm kev txuas ntawm VNC thiab nyem lub pob nyob ze rau saum uas zoo li kab lus hais kom ua; lossis koj tuaj yeem txuas ncaj qha los ntawm koj Mac/PC siv Terminal thiab Putty zoo li peb tau ua yav dhau los. Yog tias koj siv tsawg dua los ua haujlwm nrog Raspberry Pi ces nws yooj yim dua los ua qhov qub.

(Cov Lus Qhia: Koj tuaj yeem luam cov ntawv los ntawm koj Mac/PC thiab muab nws tso rau Raspberry Pi ntawm VNC los ntawm nias CONTROL-V, tab sis yog tias koj tab tom sim muab tshuaj txhuam rau hauv Terminal ces koj yuav tsum nias CONTROL-SHIFT-V)

Thawj txoj haujlwm yog txhawm rau tshuaj xyuas koj lub software tshiab dua los ntawm kev ntaus ob qho lus txib hauv qab no. Lawv yuav siv sijhawm me ntsis los rub tawm thiab teeb tsa.

sudo apt-tau hloov tshiab

sudo apt-tau hloov tshiab

Tom ntej no koj xav rub tawm thiab teeb tsa node.js thiab NPM (tsis txhob txhawj ntau txog lawv yog dab tsi, lawv tau pab thiab tsim nyog rau peb cov haujlwm tom ntej) los ntawm kev ntaus cov hauv qab no:

sudo apt-tau nruab nodejs npm

Nws yuav nug koj ob peb zaug yog tias koj zoo siab los ua qhov chaw disk nrog cov no - koj thiaj li nias Y

Kauj Ruam 13: Nruab SONOS HTTP API

Nruab SONOS HTTP API
Nruab SONOS HTTP API
Nruab SONOS HTTP API
Nruab SONOS HTTP API

Lub hauv paus ntawm qhov kawg rau peb txoj haujlwm yog node-sonos-http-api pob tsim los ntawm jishi. Koj tuaj yeem nyeem txhua yam txog nws ntawm no:

Peb yuav rub qhov no los ntawm github nrog cov lus txib hauv qab no nkag mus rau kab hais kom ua:

git clone

thiab peb yuav nruab nws nrog cov lus txib hauv qab no

cd ntawm-sonos-http-api

npm nruab --production

Peb tuaj yeem khiav nws nrog cov lus txib hauv qab no:

npm nce

Thaum qhov ntawd tiav peb yuav tsum sim tias nws ua haujlwm.

Ua ntej tshaj plaws, qhib internet browser ntawm peb Raspberry Pi thiab mus rau https:// localhost: 5005/. Lub ntsej muag zoo yuav tsum qhib nrog Sonos lub logo thiab qee cov ntaub ntawv hais txog yuav ua li cas API ua haujlwm.

Tom ntej no, cia peb txheeb xyuas tias qhov no ua haujlwm los ntawm lub network dav dua los ntawm kev siv browser ntawm lwm lub PC lossis Mac ntawm tib lub network thiab mus rau https:// [theIPaddressofyourPi]: 5005/thiab pom yog tias peb tau txais txiaj ntsig zoo ib yam. Peb yuav tsum.

Tam sim no peb yuav ua kom lub kaw lus ua qee yam. Siv tus browser thiab mus rau:

192.168.4.102:5005/ Dining Room/playpause

Koj yuav tsum hloov tus IP chaw nyob saum toj no nrog qhov chaw nyob ntawm koj tus Raspberry Pi thiab "Chav Noj Mov" nrog ib lub npe ntawm koj thaj tsam Sonos. Nws yuav tsum yog ua si lossis ncua (nyob ntawm seb lub suab nkauj twb tau ua si lossis tsis yog) cov nkauj hauv chav ntawd. Pom tseeb qee yam yuav tsum tau nyob hauv Sonos kab rau qhov ntawd los ua haujlwm.

Mus tom ntej, Kuv yuav siv tus IP chaw nyob saum toj no thiab Chav Noj Mov raws li cov piv txwv thoob plaws hauv qhov kev qhia no. Pom tseeb koj yuav tsum hloov lawv nrog koj tus IP chaw nyob thiab koj lub npe cheeb tsam ntawm txhua lub sijhawm.

Kauj Ruam 14: Ua kom Sonos HTTP API khiav tas li

Ua rau Sonos HTTP API khiav tas li
Ua rau Sonos HTTP API khiav tas li

Nws zoo heev uas peb tau txais Sonos HTTP API ua haujlwm, tab sis yuav ua li cas yog tias nws poob? Lossis koj poob lub zog lossis xav rov pib dua koj li Raspberry Pi?

Koj tuaj yeem pom cov txiaj ntsig los ntawm kev kaw lub qhov rai qhov rai thiab rov ua qhov peb nyuam qhuav sim. Nws yuav tsis ua haujlwm vim tias HTTP API tau tso tseg nrog rau lub qhov rais qhib.

Peb xav tau qhov no kom ua tas li thiab ua li ntawd los ntawm kev pib txhua lub sijhawm. Peb ua qhov no nrog qhov txias hu ua PM2.

Hauv lub qhov rai tshiab davhlau ya nyob twg, nruab thiab khiav nws raws li hauv qab no:

sudo npm nruab -g pm2

xwm pm2

Tam sim no cia nws ua kom tiav peb Sonos HTTP API:

cd ntawm-sonos-http-api

pm2 pib npm - pib pm2 pib systemd

Cov lus txib kawg no tsim qee yam uas zoo li me ntsis:

sudo env PATH = $ PATH:/usr/bin/usr/local/lib/node_modules/pm2/bin/pm2 pib systemd -u pi -hp/home/pi

Luam qhov koj Pi tsim (tsis yog cov ntawv sau saum toj no - koj li yuav txawv) thiab nkag mus rau hauv kab hais kom ua. Qhov no qhia cov txheej txheem kom khiav PM2 ntawm khau raj txhua lub sijhawm.

Thaum kawg, sau:

pm2 ruaj

uas txuag txhua yam cia.

Tam sim no sim seb qhov no puas tau ua haujlwm los ntawm kev rov pib dua koj li Raspberry Pi nrog cov lus txib

sudo rov pib dua

Cia siab tias ib zaug Pi rov pib dua nws tseem yuav pib PM2 thiab tig Sonos HTTP API. Koj tuaj yeem tshawb xyuas qhov no los ntawm kev siv browser hauv tib lub network mus rau qhov chaw nyob uas peb tau siv ua ntej thiab pom Sonos logo thiab cov lus qhia:

192.168.4.102:5005/

yog dab tsi rau kuv, tab sis koj li yuav nyob ntawm tus IP chaw nyob.

Kauj ruam 15: Ua Si Qee Spotify

Cia peb txheeb xyuas tias qhov kev pabcuam tuaj yeem nkag mus rau Spotify.

Qhib tus browser thiab mus rau qhov chaw nyob hauv qab no (pom tseeb hloov nrog koj tus IP chaw nyob thiab npe chav):

192.168.4.102:5005/ Dining Room/spotify/now/spotify/spotify: album: 2dfTV7CktUEBkZCHiB7VQB

Koj yuav tsum hnov qee John Grant. Txaus siab rau.

Kauj Ruam 16: Nrhiav Spotify URIs

Nrhiav Spotify URIs
Nrhiav Spotify URIs

Qhov txawv, kuv paub, tab sis tsis yog txhua tus nyiam John Grant. Tej zaum koj xav mloog lwm yam?

Koj tuaj yeem tau txais Spotify txuas los ntawm lub khoos phis tawj, lub vev xaib lossis mobile apps tab sis lub Desktop yog nyob deb ntawm qhov yooj yim tshaj plaws raws li nws xa URI raws li hom ntawv koj xav tau yog li pib nrog qhov ntawd.

Hauv Spotify desktop app mus rau lub album koj xav mloog (tej zaum Lemonade los ntawm Beyonce?)

Nyem rau ntawm peb qhov me me nyob ib sab ntawm lub plawv khawm.

Mus rau hauv cov ntawv qhia zaub mov Qhia thiab xaiv Luam Spotify URI

Qhov no yuav luam qee yam zoo li

spotify: album: 7dK54iZuOxXFarGhXwEXfF

rau koj daim ntawv teev lus, uas yog Spotify URI rau Beyonce's Lemondade album.

Tua koj tus browser dua thiab mus rau qhov chaw nyob hauv qab no (pom tseeb hloov tus IP chaw nyob thiab chav thiab muab tso rau hauv URI koj nyuam qhuav tau theej):

192.168.4.102:5005/Chav Dining/spotify/tam sim no/[Spotify URI koj xav ua si]

Koj yuav tsum hnov koj qhov kev xaiv ua si.

Yog tias koj xav siv lub vev xaib app nws yuav muab lub vev xaib txuas rau koj (qee yam zoo li hauv qab no):

open.spotify.com/album/7dK54iZuOxXFarGhXwEXfF

koj yuav tsum hloov qhov no mus rau spotify: album: code format saum toj no rau nws ua haujlwm.

Kauj Ruam 17: Cov Lus Cim ntawm Spotify URIs

Spotify URIs thiab lawv txoj kev lawv cuam tshuam nrog node-sonos-http-api yog qhov xav tau, feem ntau.

Koj tuaj yeem txuas ncaj qha rau albums, lem thiab playlists.

Ib album URI zoo li:

spotify: album: 6agCM9GJcebduMddgFmgsO

Ib txoj kab URI zoo li:

spotify: khiav: 4fNDKbaeEjk2P4GrRE1UbW

Playlists ua haujlwm txawv me ntsis. Thaum koj theej cov URI los ntawm Spotify nws yuav zoo ib yam li:

spotify: playlist: 5huIma0YU4iusLcT2reVEU

Txawm li cas los xij, kom tau txais nws kom ua haujlwm ntawm API koj xav tau ntxiv spotify: neeg siv: mus rau qhov pib ntawm qhov saum toj no. Qhov no siv tau txawm rau pej xeem playlists thiab, yog, nws txhais tau tias koj tau hais tias spotify ob zaug.

Yuav kom pom meej heev, tus neeg siv tsis tas yuav yog tus siv tshwj xeeb lub npe, tsuas yog cov ntawv siv. Yog li qhov URI raug rau cov npe sau saum toj no kom nws ua haujlwm yuav yog:

spotify: neeg siv: spotify: playlist: 5huIma0YU4iusLcT2reVEU

Kauj Ruam 18: Teeb Raspberry Pi Xa Ntawv Thov

Teeb Raspberry Pi kom xa HTTP Thov
Teeb Raspberry Pi kom xa HTTP Thov

Ntau dua li kev sau tus kheej thov HTTP rau hauv lub vev xaib, peb xav kom siv nws kom lub Raspberry Pi ua qhov ntawd nws tus kheej thaum nthuav tawm nrog qee qhov kev txhawb siab (NFC nyeem ntawv tau tshwm sim).

Peb yuav siv lub tsev qiv ntawv hu ua kev thov kom tso cai rau peb Raspberry Pi ua qhov no. Cia saib nws tau teeb tsa.

Qhib lub davhlau ya nyob twg ntawm koj Pi thiab ntaus cov hauv qab no:

sudo pip nruab thov

Nws zoo li nws rov qab los thiab hais tias nws tau teeb tsa lawm, hauv qhov xwm txheej twg zoo. Yog tsis yog, nws yuav nruab nws.

Kauj Ruam 19: Tsim NFCC Tag (s) Nrog Spotify Cov Ntaub Ntawv

Tsim NFCC Tag (s) Nrog Spotify Cov Ntaub Ntawv
Tsim NFCC Tag (s) Nrog Spotify Cov Ntaub Ntawv
Tsim NFCC Tag (s) Nrog Spotify Cov Ntaub Ntawv
Tsim NFCC Tag (s) Nrog Spotify Cov Ntaub Ntawv
Tsim NFCC Tag (s) Nrog Spotify Cov Ntaub Ntawv
Tsim NFCC Tag (s) Nrog Spotify Cov Ntaub Ntawv
Tsim NFCC Tag (s) Nrog Spotify Cov Ntaub Ntawv
Tsim NFCC Tag (s) Nrog Spotify Cov Ntaub Ntawv

Tam sim no peb xav sau Spotify album URI rau NFC lossis. Txhua ntawm cov cim npe no yog yam koj yuav siv los qhia rau Raspberry Pi los ua ib qho nkauj tshwj xeeb.

Koj tuaj yeem sau rau NFC lossis siv lub xov tooj Android, tab sis kuv pom nws yooj yim tshaj plaws los ntawm mac lossis PC li ntawd koj tuaj yeem tau txais qhov yooj yim tshaj plaws kom tau txais Spotify URIs los ntawm Spotify desktop app.

Txuas koj lub USB NFC nyeem ntawv rau hauv koj lub PC lossis Mac. Kuv tab tom siv ACR122U los ntawm American Card Systems.

Rub tawm NFC Cov Cuab Yeej rau koj lub PC lossis Mac. Nruab thiab qhib nws.

Nws tuaj yeem qeeb me ntsis los txuas rau tus nyeem ntawv qee zaum thiab yuav hais tias nws tsis tuaj yeem pom tus nyeem ntawv txhua. Mus rau Lwm Lub tab hauv NFC cov cuab yeej thiab nyem txhua qhov feem ntau ntawm Txuas Txuas NFC Nyeem Ntawv. Koj yuav tsum tau tshem tawm thiab rov nyeem tus nyeem ob peb zaug ua ntej nws pom nws.

Thaum kawg nws yuav muab txoj hauv kev rau koj xaiv koj tus nyeem ntawv los ntawm cov npe thiab hais tias nws tau txuas nrog. Mus rau Cov Ntaub Ntawv tab uas yuav qhia tsis muaj dab tsi tsuas yog "Tos rau NFC lossis".

Siv daim npav NFC khoob. Muab tso rau ntawm tus nyeem ntawv thiab tso nws nyob ntawd. NFC Cov Cuab Yeej yuav tso tawm cov ntaub ntawv hais txog lub cim npe.

Mus rau Sau tab thiab nyem Ntxiv cov ntaub ntawv> Ntawv. (Ceev faj tsis xaiv URL lossis URI - Kuv paub tias nws ntxias vim tias koj tau theej ib URI, tab sis koj xav tau cov ntawv)

Nqa URI los ntawm Spotify siv txoj hauv kev peb tau siv yav tas los. Yog tias koj xav tau qhov piv txwv yooj yim ces cov hauv qab no yog peb John Grant album los ntawm ua ntej.

spotify: album: 2dfTV7CktUEBkZCHiB7VQB

Nyem OK thiab tom qab ntawd nyem Sau (tsis txhob hnov qab cov kauj ruam kawg no - nws tsis tau sau nws kom txog thaum koj nyem qhov no). Nws yuav qhia koj tias nws tau sau daim ntawv ua tiav.

Tshem daim ntawv tawm ntawm tus nyeem ntawv

Kauj Ruam 20: Teeb NFC Nyeem Ntawv ntawm Raspberry Pi

Teeb NFC Nyeem Ntawv ntawm Raspberry Pi
Teeb NFC Nyeem Ntawv ntawm Raspberry Pi

Txuas koj lub NFC nyeem ntawv rau hauv ib qho ntawm USB chaw nres nkoj ntawm koj li Raspberry Pi.

Peb yuav siv nfcpy Python tsev qiv ntawv los sib tham nrog NFC nyeem ntawv. Nruab nws los ntawm kev ntaus cov hauv qab no ntawm koj Pi kab hais kom ua:

pip nruab -U nfcpy

Peb tuaj yeem tshawb xyuas seb lub tsev qiv ntawv no puas tuaj yeem pom peb NFC nyeem ntawv los ntawm kev ntaus cov hauv qab no:

sej -m nfc

Yog tias nws tau ua haujlwm ces koj yuav pom cov hauv qab no:

Nov yog 1.0.3 version of nfcpy run in Python 2.7.16 on Linux-4.19.97-v7+-armv7l-with-debian-10.3

Kuv tam sim no tshawb nrhiav koj li kab ke rau cov khoom siv tsis sib xws ** pom ACS ACR122U PN532v1.6 ntawm usb: 001: 011 Kuv tsis tau sim cov khoom siv vim tias koj tsis tau hais rau kuv-ntxiv qhov kev xaiv '--search-tty' kom kuv saib - tab sis ceev faj tias qhov no yuav ua txhaum lwm yam devs

Txawm li cas los xij muaj lub sijhawm zoo uas koj tau txais cov lus yuam kev hais tias pom tus nyeem ntawv tab sis koj tus neeg siv (pi) tsis muaj kev tso cai nkag mus rau nws. Yog tias koj tau txais cov lus yuam kev no nws tseem yuav piav qhia yuav kho qhov teeb meem li cas, uas yog los ntawm kev ntaus ob lo lus txib uas zoo li me ntsis hauv qab no:

sudo sh -c 'echo SUBSYSTEM == / "usb \", ACTION == / "ntxiv \", ATTRS {idVendor} == / "04e6 \", ATTRS {idProduct} == / "5591 \", GROUP = / "plugdev \" >> /etc/udev/rules.d/nfcdev.rules '

sudo udevadm tswj -R

Luam thiab ua ob qho ntawm cov lus txib nws muab rau koj (tsis yog raws nraim li cas saum toj no, txij li koj li yuav txawv), tom qab ntawd tshem tawm thiab rov ua dua koj li NFC nyeem ntawv los ntawm USB chaw nres nkoj.

Sim ua daim tshev hais dua:

sej -m nfc

Lub sijhawm no nws yuav tsum hais tias nws pom nws yam tsis muaj lus yuam kev.

Kauj Ruam 21: Nruab Vinylemulator Python Scripts

Tam sim no peb muaj txhua lub tsev thaiv nyob hauv qhov chaw:

  • Peb Raspberry Pi tuaj yeem mloog NFC cov tswv yim
  • Peb Raspberry Pi tuaj yeem qhia Sonos los ua Spotify playlists thaum muab Spotify URI
  • Peb muaj daim ntawv NFC nrog Spotify URI khaws cia rau nws

Tam sim no peb yuav tsum rub tag nrho cov tsev thaiv no mus rau qee yam muaj txiaj ntsig. Qhov no tau ua tiav los ntawm tsab ntawv nab hab sej luv kuv tau sau (nrog kev pab ntau los ntawm NFC/Spotify/Sonos yav dhau los) uas yog hu ua vinylemulator.

Koj tuaj yeem saib qhov chaws rau cov ntaub ntawv ntawm github:

Txhawm rau teeb tsa qhov no rau peb Raspberry Pi peb yuav tsum tau clone nws los ntawm github nrog cov lus txib hauv qab no:

git clone

Kauj Ruam 22: Hloov kho Vinylemulator

Customize Vinylemulator
Customize Vinylemulator
Customize Vinylemulator
Customize Vinylemulator

Qhib Tus Thawj Tswj Ntaub Ntawv Raspberry Pi thiab mus rau hauv tsev> pi> vinylemulator

Qhib cov ntaub ntawv usersettings.py

Ib kab ntawm kab ntawv no yuav nyeem:

sonosroom = "Chav noj mov"

Hloov "Chav Dining" kom nyob qhov twg Sonos chav npe koj xav tswj.

Kuj tseem muaj teeb tsa hauv cov ntawv no uas tso cai rau koj kho tus IP chaw nyob ntawm sonos-http-api. Koj yuav tsum tuaj yeem tawm qhov no tsis hloov pauv li "localhost" uas tsuas yog txhais tau tias nws yuav siv Raspberry Pi nws tab tom ua haujlwm.

Txuag cov ntaub ntawv thiab kaw nws.

Kauj Ruam 23: Kuaj Vinylemulator

Kuaj Vinylemulator
Kuaj Vinylemulator
Kuaj Vinylemulator
Kuaj Vinylemulator

Mus rau koj li Raspberry Pi hais kom sai.

Nkag mus rau cov lus txib hauv qab no:

nab hab sej vinylemulator/readnfc.py

Yog tias txhua yam zoo qhov no yuav thauj cov ntawv thiab hais tias tus nyeem ntawv tau npaj tiav. Lub teeb ntawm tus nyeem ntawv yuav tsum mus ntsuab.

Muab daim ntawv NFC rau ntawm tus nyeem ntawv, uas yuav beep.

Lub davhlau ya nyob twg yuav qhia qhov nws tau nyeem los ntawm NFC lossis thiab qhia HTTP qhov chaw nyob thov uas nws tau xa. Koj cov nkauj xaiv yuav tsum ua los ntawm koj tus neeg hais lus Sonos.

Tsab ntawv no yuav khiav mus txog thaum koj kaw lub qhov rai qhov rai. Koj tuaj yeem coj mus rhaub album sib txawv NFC cim npe thiab nws yuav hloov mus rau album ntawd.

Kauj Ruam 24: Tau txais Vinylemulator los ua haujlwm tas li thiab pib

Ib yam li sonos-http-api, peb xav kom vinylemulator khiav txhua lub sijhawm ntau dua li tsuas yog thaum peb hu nws. Peb tuaj yeem siv pm2 los ua qhov no dua.

Ua ntej kaw ib qho xwm txheej twg ntawm vinylemulator koj tab tom khiav los ntawm kaw lawv lub qhov rooj qhov rai.

Tom qab ntawd qhib lub qhov rai tshiab davhlau ya nyob twg thiab ntaus ob nqe lus hauv qab no:

pm2 pib vinylemulator/readnfc.py

pm2 ruaj

Cia saib seb qhov ntawd puas tau ua haujlwm los ntawm kev rov pib dua Raspberry Pi. (Koj tuaj yeem yog hom sudo reboot lossis ua li ntawd los ntawm Raspberry ntawv qhia zaub mov nrog koj nas.

Tos rau Pi pib dua thiab pom nws nws ua haujlwm los ntawm tapping NFC lossis ntawm tus nyeem ntawv. Koj yuav tsum tau txais suab paj nruag.

Kauj Ruam 25: Ua Kev Zoo Siab Rau Koj Tus Kheej

Txhua yam tam sim no ua haujlwm tau. Koj tuaj yeem txav Raspberry Pi mus rau txhua qhov chaw koj npaj rau qhov chaw. Nws yuav rov pib dua thiab ua haujlwm raws li koj tau teeb tsa nws txhua lub sijhawm koj ntsaws nws.

Koj cov dej num tom ntej yog kev lom zem: ua kom txhua yam zoo nkauj.

Kauj Ruam 26: Ua Kom Zoo Nkauj - Hide Your Reader

Ua Kom Zoo Nkauj - Hide Your Reader
Ua Kom Zoo Nkauj - Hide Your Reader
Ua Kom Zoo Nkauj - Hide Your Reader
Ua Kom Zoo Nkauj - Hide Your Reader
Ua Kom Zoo Nkauj - Hide Your Reader
Ua Kom Zoo Nkauj - Hide Your Reader
Ua Kom Zoo Nkauj - Hide Your Reader
Ua Kom Zoo Nkauj - Hide Your Reader

Thawj feem ntawm kev ua kom nws zoo nkauj yog zais qhov yas dawb yas NFC nyeem ntawv nyob deb qhov chaw.

Kuv tau mus nrog qhov kev txiav txim siab thev naus laus zis qis ntawm nws mus rau hauv qab ntawm lub txee tom ntej ntawm kuv Sonos Ua Si: 5. Cov ntoo ntawm lub txee yog nyias txaus uas NFC tuaj yeem hla tau, yog li kuv ua suab paj nruag los ntawm tapping NFC lossis ntawm qhov chaw zoo nkauj thiab pom tsis tau.

Pom zoo: