Cov txheej txheem:

Khaws Nws Stoopid Yooj Yim Internet Xov Tooj Cua: KISSIR: 13 Kauj Ruam
Khaws Nws Stoopid Yooj Yim Internet Xov Tooj Cua: KISSIR: 13 Kauj Ruam

Video: Khaws Nws Stoopid Yooj Yim Internet Xov Tooj Cua: KISSIR: 13 Kauj Ruam

Video: Khaws Nws Stoopid Yooj Yim Internet Xov Tooj Cua: KISSIR: 13 Kauj Ruam
Video: Musicians talk about Buckethead 2024, Hlis ntuj nqeg
Anonim
Khaws Nws Stoopid Yooj Yim Internet Xov Tooj Cua: KISSIR
Khaws Nws Stoopid Yooj Yim Internet Xov Tooj Cua: KISSIR
Khaws Nws Stoopid Yooj Yim Internet Xov Tooj Cua: KISSIR
Khaws Nws Stoopid Yooj Yim Internet Xov Tooj Cua: KISSIR

Qee lub sij hawm nws tsuas yog yuav tsum muaj kev paub tab. Tsis muaj Interface ntawm txhua yam. Tsuas yog Nyees khawm.

Raspberry Pi ua tus siv xov tooj cua hauv internet tsis muaj dab tsi tshiab, thiab muaj ntau cov lus qhia yuav ua li cas los tsim lub xov tooj cua siv internet siv raspberry pi nrog lossis tsis muaj tus saib xyuas kom rub tau cov chaw siv internet los ntawm thoob ntiaj teb. Yog tias koj tau xaiv mus tsis muaj lub taub hau (tsis muaj tus saib xyuas), koj tseem yuav xav tau txhais tau tias cuam tshuam rau pi player, feem ntau yog lub web interface yog tsis yog txhais tau tias ncaj qha ntawm kev sib txuas lus rau tus tswv tsev, xws li ssh. Cov lus qhia no yuav txawv me ntsis; peb yuav siv khawm yooj yim nias xa cov lus txib mus rau pi, yog li tshem tawm qhov xav tau ntawm lub vev xaib sib txuas thiab lub vijtsam LCD. Suab yooj yim txaus, txoj cai (?)

Peb yuav pib nrog kev tsim qauv yooj yim heev siv cov cim xim xim, txhua xim yuav sawv cev rau lub chaw xov tooj cua internet. Peb yuav qhia qee tus nab npawb nab npawb los tuav lub pob nyem: Cov xovxwm yuav ua tus hais kom ua lub xov tooj cua hauv xov tooj cua ua ntej siv MPG123, cov cuab yeej hais kom ua zoo rau ua suab ntawm peb pi.

Koj qhov kev txawj ntse nab nab tsis tas yuav nce qib. Qhov tseeb kuv tau mus los ntawm "Nyob Zoo Ntiaj Teb" los sau qhov no, thiab raws li koj yuav pom, kuv tau qiv ntau tus lej - yog li yog kuv tuaj yeem ua nws thiab muaj qee cov ntaub ntawv, lwm tus neeg yuav tsum tsis muaj teeb meem.

Wb mus!

Khoom siv:

Cov Ntaub Ntawv Xav Tau

  • Raspberry pi/ pi zero w nrog txhua qhov kev teeb tsa: Lub hwj chim muab, SD daim npav thiab Raspbian lossis Raspbian lite.
  • Wifi thiab internet siv
  • Lwm lub PC los ua qee qhov web browsing thiab muaj peev xwm SSH rau raspberry pi
  • Digital to Analog Converter (DAC) - yeem tab sis koj yuav tsum ua tsaug.
  • Amplifier
  • Hais lus
  • Hookup hlau thiab Jumpers
  • Soldering hlau thiab solder
  • Perf Board rau cov nyees khawm
  • Tactile nyees khawm: Ib txwm Qhib- ib qho rau txhua hom suab paj nruag, khawm lub hwj chim, thiab xaiv tau khawm ntsiag to (7 khawm pom zoo)
  • Ib chav tsev nyob rau txhua qhov saum toj no (xaiv tau tab sis huv si)

Kauj ruam 1: Yuav tsum tau ua ntej:

Yam yuav tsum tau ua ua ntej
Yam yuav tsum tau ua ua ntej

Peb yuav pib tawm piv txwv tias koj twb tau teeb tsa koj li raspberry pi, DAC thiab lub tshuab ua kom nrov nrov, thiab tseem yuav xav tias koj tau nkag mus rau internet. Vim tias qhov ntau ntawm cov cuab yeej siv suab xaiv, nyiam, thiab xaiv rau mloog lub suab, peb yuav xav tias koj teeb tsa tau ua tiav: koj yuav tsum muaj lub suab tawm los ntawm koj tus hais lus ua ntej koj pib qhov haujlwm no. Peb tseem yuav xav tau ssh rau raspberry pi, yog li siv pi teeb tsa, xyuas kom muaj kev cuam tshuam tau ssh qhib. Kuv yuav siv Raspbian lite, thiab pom zoo tias koj muaj kev txhim kho tshiab ntawm daim ntawv theej tshiab ntawm daim npav sd tshiab tshwj xeeb rau txoj haujlwm no. Yog tias ua tiav peb yuav tsim lub teeb ib leeg nyob ib leeg uas tuaj yeem tso tawm ntawm 24/7 raws li lub cuab yeej mloog zoo.

Kauj ruam 2: Nruab Python thiab Pip

Kuv nyiam ssh rau pi siv lub pc sib txawv, thiab ua txhua txoj haujlwm uas yuav tsum tau siv lub sijhawm ssh, tab sis kuv kwv yees nws muaj peev xwm pib teeb tsa pi mus rau tus saib xyuas, keyboard thiab nas thiab ua haujlwm ncaj qha ntawm pi kom txog thaum nws yog ua haujlwm thiab tom qab ntawd xa tawm raws li tus kheej.

Thawj zaug ua ib qho kev saib xyuas ib txwm muaj ntawm peb cov kab ke thiab cov nab npawb version:

sudo apt-tau hloov tshiab

sudo apt-tau hloov tshiab

Xyuas kom Python tau teeb tsa. Hauv kev sib tham davhlau ya nyob twg ntaus cov hauv qab no ntawm qhov hais kom ua:

nab hab sej --version

Yog tias koj pom nab nab 2.7.13 (lossis ntxov dua) cia peb nruab sej 3.+:

sudo apt-tau nruab python3

sudo apt-tau nruab nruab sej-pip

sudo apt-tau nruab python3-pip

sudo pip3 nruab -hloov kho pip

Kauj Ruam 3: Nruab MPG123 thiab Adafruit Blinka

Tam sim no tias lub hauv paus tau tso, tsuas yog ob peb qho ntxiv:

MPG123 yog lub suab software uas yuav ua rau peb cov nkauj. Kev teeb tsa yog yooj yim heev:

sudo apt-tau nruab mpg123

Kuv tau tshawb fawb ntau, thiab pom tus qauv zoo ntawm Adafruit lub vev xaib hais txog kev ua cov ntaub ntawv suab siv khawm nias, yog li es tsis pib los ntawm kos, cia mus txuas ntxiv ntawm txoj kev cov neeg ntawm Adafruit twb tau blazed rau peb. Lawv txoj haujlwm nug tias peb nruab Adafruit Blinka:

$ sudo pip3 nruab adafruit-blinka

Ua ntej peb mus ntxiv, cia ua qhov kev tshuaj xyuas sai kom paub tseeb tias peb muaj Alsa teeb tsa:

aplay -kev hloov pauv

peb cov txiaj ntsig yuav tsum nyeem: version 1.1.3 los ntawm Jaroslav Kysela

Kauj Ruam 4: Kho Ntim rau 50% hauv Alsamixer

Kho Volume rau 50% hauv Alsamixer
Kho Volume rau 50% hauv Alsamixer
Kho Volume rau 50% hauv Alsamixer
Kho Volume rau 50% hauv Alsamixer

Tam sim no cia ua ib qho kev ntsuas ua ntej thiab kho peb ntim mus rau 50% kom tsis txhob muaj kev ceeb laj lag ntseg:

Ntawm qhov hais kom ua, ntaus alsamixer:

alsamixer

Yog tias peb saib lub vijtsam liab liab thiab ntsuab, lossis 100% qhov ntim ntau, nws yog lub tswv yim zoo kom txo lub ntim mus rau 50% kom txuag tau peb lub pob ntseg. Peb tuaj yeem hloov kho tom qab (nce lossis nqis) yog xav tau.

Kauj Ruam 5: Qee Cov Ntawv Hauv Tsev: Nrhiav 5 Lub Xov Tooj Cua Tsim Nyog Tsim Nyog Rau

Qee Cov Ntawv Hauv Tsev: Nrhiav 5 Lub Xov Tooj Cua Tsim Nyog Tsim Nyog Rau
Qee Cov Ntawv Hauv Tsev: Nrhiav 5 Lub Xov Tooj Cua Tsim Nyog Tsim Nyog Rau
Qee Cov Ntawv Hauv Tsev: Nrhiav 5 Lub Xov Tooj Cua Tsim Nyog Tsim Nyog Rau
Qee Cov Ntawv Hauv Tsev: Nrhiav 5 Lub Xov Tooj Cua Tsim Nyog Tsim Nyog Rau

Peb yuav xav tau ib lub chaw nres tsheb rau txhua lub pob. Qhov tseeb, peb yuav xav tau qhov url rau lub chaw nres tsheb. Lub pob nyem yuav hu rau url ntawm xov tooj cua internet hauv xov tooj cua hauv qhov yooj yim, ib kab ntawm kab ntawv. Txawm li cas los xij peb tau ua ntej ntawm peb tus kheej yog li peb muaj qee cov ntawv ua hauv tsev ua; nrhiav 5 lub xov tooj cua thiab lawv cov url. Nrhiav 5 lub xov tooj cua tsis yog qhov nyuaj, tab sis nrhiav lawv cov url tuaj yeem yog qhov nyuaj. Kuv mam piav qhia vim li cas hauv ib pliag.

SomaFm * yog lub hauv paus zoo los pib nrog, tshwj xeeb tshaj yog tias koj tsis muaj lub tswv yim ntawm yam koj xav mloog tam sim no. Lawv muaj ntau yam kev xaiv suab paj nruag xaiv, tsis muaj ib qho uas kuv pom tsis txaus ntseeg, tsis muaj kev tshaj tawm, thiab qhov zoo tshaj plaws: Lawv tau qhib lawv cov url. Txhawm rau rub qhov url, nyem rau ntawm daim duab ntawm lub chaw nres tsheb uas koj muaj kev txaus siab, thiab nyob rau sab laug ntawm kab lus qhia kab, nyem "Ncaj Ncig Ncig Txuas". Los ntawm qhov ntawd, nrhiav ntu MP3, thiab khawb qhov url ntawm qhov ua tau zoo tshaj plaws (piv txwv li 128 ntaus 64). Muab tshuaj txhuam qhov url rau hauv cov ntawv sau lossis sau ntawv rau tam sim no.

Ua piv txwv, txhawm rau khawb Christmas Pob Zeb, qhov url yuav yog: (peb tsis xav tau cov lus piav qhia server)

ice4.somafm.com/xmasrocks-128-mp3

Nws tau txais me ntsis dicier sab nraum lub ntiaj teb ntawm SomaFm. Ntau lub chaw siv tus neeg nruab nrab nruab nrab ntawm tus mloog thiab lub chaw nres tsheb, txawm tias nws yog rau kev tshaj tawm, kev lag luam lossis tej zaum yuav taug qab - thiab kuv feem ntau sim zam cov hom kev noj haus no. Txij li cov neeg nruab nrab xav kom koj mloog lub chaw nres tsheb hla lawv, feem ntau nws tsis yooj yim mus nrhiav qhov url; thiab qhov ntawd yog qhov uas Vtuner nkag los.

*Kuv yuav tsis nco yog tias kuv tsis tau thov kom koj txiav txim siab muab nyiaj pub dawb rau koj lub xov tooj cua uas koj nyiam, vim tias ntau lub chaw tso siab rau tus neeg mloog nkaus xwb.

Kauj Ruam 6: Xaiv tau: Khaws URL's Siv Vtuner

Yeem: Scrape URL's Siv Vtuner
Yeem: Scrape URL's Siv Vtuner
Yeem: Scrape URL's Siv Vtuner
Yeem: Scrape URL's Siv Vtuner

Tam sim no los txog qhov lom zem…. Ntawm Vtuner home page, txheeb xyuas lawv cov chaw nres tsheb loj loj txuas rau ntawm kaum sab xis. Xaiv ib hom nkauj uas koj nyiam, thiab tom qab ntawd txheeb xyuas qhov nrawm tshaj plaws, qhov twg koj yuav pom cov npe ntawm cov chaw nres tsheb. Xaiv qhov chaw nres tsheb uas koj xav tias koj yuav nyiam, nyem rau ntawm qhov txuas lossis khawm ua si thiab coj cov nkauj tawm. Yog tias nws tsis yog rau koj, tsis muaj kev txhawj xeeb, rov ua cov txheej txheem kom txog thaum peb pom ib qho haum rau kev lom zem mus sij hawm ntev. Hauv kuv qhov screen txhaj tshuaj, Kuv tau xaiv qhov digital impulse version ntawm Lub Tebchaws nkauj thiab ntawm lub vijtsam tom ntej, Kuv pom tias nws tau tawm ntawm Croatia. Lub Tebchaws Suab Nkauj los ntawm Croatia suab zoo li nthuav.

Kuv nyiam nws Tab sis kuv yuav ua li cas thiaj tau qhov url? Cias ua txoj nyem rau ntawm qhov chaw dawb rau sab xis ntawm daim duab chaw nres tsheb, hauv qab lub npe Chaw Nres Tsheb, thiab xaiv "Saib Nplooj Ntawv Source" thiab nqes mus txog kab 150. Peb tab tom nrhiav kab uas hais tias "// Sim los tuav dej khov ". Thiab qhov url tau pom tam sim hauv qab!

orion.shoutca.st:8110/stream

Zoo nkauj heev!

Rov ua cov kauj ruam no kom txog thaum peb muaj tsawg kawg 5 qhov chaw nres tsheb ntawm peb cov npe.

Ob Qhov Kev Xaiv: Rau kev ntsuas ntxiv, yog tias koj tuaj yeem pom 5 hom nkauj uas koj nyiam (tsis zoo li 5 lub chaw nres tsheb), tsim cov npe xov tooj cua rau txhua hom thiab khaws cov npe ua cov ntawv. Peb yuav rov los rau tom qab no.

Kauj Ruam 7: Teeb Peb Cov Khawm

Teeb Peb Cov Khawm
Teeb Peb Cov Khawm
Teeb Peb Cov Khawm
Teeb Peb Cov Khawm

Qhov tseem ceeb tshaj plaws! Plua plav tawm cov hlau qub qub lossis tsawg kawg ntsaws nws thiab ci hmoov av tawm. Nws yog lub sijhawm rau Solder. Kuv tab tom siv 4 lub ntsej muag thawb khawm ib ntus, ib txwm qhib. Kuv yuav tsim cov kab ntawm cov nyees khawm (sab laug daim duab), thiab khawm lawv rau qee lub rooj sib txig sib luag. Nws nyuaj rau qhia hauv daim duab, tab sis cov lus qhia ntawm lub khawm prongs yog txhua yam khiav North-South. Ntawm sab xis, koj tuaj yeem pom qhov twg kuv tau khiav txoj kev tsheb nqaj hlau rau kuv cov xov hlau hauv av thiab txuas qee tus txiv neej xaus cov hlua txuas txuas rau sab nraud ntawm txhua khawm. Ntau dua li muaj 7 qhov kev sib txuas hauv av, txoj kev tsheb nqaj hlau yuav tso cai rau peb qhia ib qho kev txuas hauv av rau pi rau txhua tus. Qhov kawg tshwm sim yog lub rooj tsav xwm me me wafer uas yuav nyob rau sab saum toj ntawm lub xov tooj cua siv qee qhov ntsia hlau los ntawm qhov ntsuas qhov muab. Tsuas yog lub pob khawm yuav tshwm los ntawm qhov zawj kuv tau txiav tawm ntawm sab saud. Txij li kuv sab saum toj tsuas yog 1/4 tuab, Kuv xav kom ceev faj kom tsis txhob ntsia hlau ntau ntxiv.

Kauj Ruam 8: Txheeb Peb Cov GPIO Pins

Txheeb Peb Peb GPIO Pins
Txheeb Peb Peb GPIO Pins
Txheeb Peb Peb GPIO Pins
Txheeb Peb Peb GPIO Pins

Hauv kuv tsuas yog lwm yam qhia, Kuv nthuav qhia kev siv tshiab rau qub Google AIY version 1 lub kaus mom lub suab. Hauv qhov kev nthuav dav tsis nyiam (lossis nqaim nrov) qhia, Kuv tau hais txog qhov ua rau kuv zoo siab nrog kev tsim lub kaus mom nws tus kheej. Kuv muaj ob peb tso nyob ib puag ncig, yog li kuv yuav tsim lub qauv siv lub kaus mom vim tias nws muaj ob lub dac thiab lub suab nrov nyob hauv.

Tam sim no cia peb txheeb rau tus pin uas yuav tuav peb lub pob nyem. Kuv yuav nug koj kom tsom mus rau sab laug ntawm Google AIY lub kaus mom, qhov uas nws hais tias "servos". Muaj ib kab ntawm 6 lub qhov muag rau tus Pin uas kuv yuav muab txuas thiab txuas kuv tus txiv neej khawm kom xaus ntawm peb cov kauj ruam dhau los. Koj puas yuav tsum tau ua haujlwm yam tsis muaj google aiy lub suab lub kaus mom, tsis muaj kev txhawj xeeb, - daim duab ntawm sab xis yuav coj koj mus. Hauv ob qho xwm txheej peb yuav ua haujlwm nrog gpio (BCM) tus pin 26, 06, 13, 05, 12, thiab 24 los ntawm saum toj mus rau hauv qab (lossis 0-5). GPIO #24 yuav raug tshwj tseg rau khawm xaiv ncua.

Tsis txhob hnov qab ntxiv rau txuas hauv av.

Kauj ruam 9: Code

Kuv tsis ntseeg tus lej yuav hloov pauv ntau los ntawm no, txawm li cas los xij rau qhov tseeb version ntawm nab nab nab, thov mus saib kuv tus github. Kuv tau txuas daim ntawv theej ntawm 2019-18-12 hu ua pytiful3.py.

Nws tsis yog txoj cai zoo tshaj plaws uas koj yuav tau pom dua, thiab nws zoo nkauj heev, tab sis nws tau ua txoj haujlwm tiav.

Cia peb pib los ntawm kev tsim lub sandbox los ua si. Los ntawm peb cov npe hauv tsev, tsim cov npe ntawm peb cov raspberry pi hu ua kissir:

mkdir hnia/

thiab luam cov ntawv pytiful3.py cov ntsiab lus rau hauv phau ntawv teev npe los ntawm kev qhib cov ntawv ua piv txwv hauv kab ntawv sau, thiab siv

sudo nano kissir/pytiful3.py

theej / muab cov ntawv tso rau hauv peb tsab ntawv tsim nab nab. Tsis txhob hnov qab txuag peb txoj haujlwm los ntawm kev siv Ctrl-x, Y thiab nkag mus.

Yog tias koj xav tau nrawm ntawm tsab ntawv, peb ntshuam cov nab npawb nab npawb modules peb yuav xav tau, thiab tom qab ntawd peb txhais peb cov nyees khawm thiab muab tus pin gpio rau txhua ntawm 7 lub pob. Yuav muaj 5 lub xov tooj cua (xav kom hloov kho rau koj qhov chaw nyiam), khawm nres, thiab khawm kaw. Lub sijhawm lub voj muaj tseeb khiav thiab khiav mus txog thaum lub pob nyem, uas feem ntau yuav nres ib qho uas twb muaj lawm mpg123 rov ua dua thiab pib ua si lub chaw nres tsheb tau muab rau lub khawm uas tau nias. Lub sijhawm ncua/nres khawm tsis yog lub khawm khawm tiag tiag tab sis ntau dua ntawm kev tua vim peb tsis tuaj yeem ncua xov tooj cua internet. Internet xov tooj cua tos tsis muaj leej twg.

Kauj Ruam 10: Xeem hauv Peb Lub Sandbox

Xeem hauv Peb Sandbox
Xeem hauv Peb Sandbox

Ua ntej peb tshaj tawm peb lub xov tooj cua, thaum tseem nyob hauv peb qhov kev sib tham ssh, taw mus rau daim nplaub tshev kissir qhov twg peb cov ntawv sau cia. Peb tuaj yeem yooj yim khiav cov ntawv los ntawm kab hais kom ua tus kheej los ntawm kev ntaus:

python3 pytiful3.py

Yog tias koj saib ntawm tus lej ua ntej, tej zaum koj yuav pom tias kuv tso qee cov ntawv luam tawm kom peb tuaj yeem qhia dab tsi tshwm sim. Yog tias txhua yam ua haujlwm tau zoo, peb yuav muaj qhov hais kom sai sai uas nyeem "Nias lub Khawm". Qhov ntawd qhia peb peb tsab ntawv tau ua haujlwm thiab nws dhau qhov kev kuaj ua ntej. Kuv qhov kev sim ua thawj zaug muaj lub voj tsis kawg ntawm "suab paj nruag raug ncua - nias lub pob kom txuas ntxiv mus", thiab kuv pom tias kuv muaj kuv lub pob khawm ncua kom txuas mus ib txhis, tsis yog ib txwm qhib. Vam tias koj tau muaj hmoov zoo nrog cov kauj ruam soldering.

Ctrl-C yuav tso tseg tsab ntawv yog tias koj xav rho menyuam.

Yog li yog tias koj pom "Nias lub pob", peb tos dab tsi? Xaiv ib qho ntawm peb tsib lub xov tooj cua xov tooj cua khawm.

Muaj feem yuav koj yuav hnov tus neeg hais lus pop pib ua suab paj nruag, thiab kuv tsis tuaj yeem pab nrog qhov ntawd rau lub sijhawm no. Mpg123 tso cai rau "-preload 1" tom qab qhov chaw nyob chaw nyob hauv os.system hais kom ua, txawm li cas los xij kuv tsis tuaj yeem qhia yog tias nws ua qhov txawv. Nws yuav tsum tso cai me ntsis.

Lwm qhov chaws koj yuav xav tsis thoob txog: muaj tus chij "-f 7000" tom qab hu mpg123. Qhov no txo qhov ntim mus rau qhov deb deb ntawm qhov ntim ntau. Qhov ntim tag nrho yuav yog 32K. Raws li kuv nkag siab, lub ntim ntim tsis yog qhov ntsuas kab, yog li kuv tsis tuaj yeem hais nws tsuas yog ib feem tsib ntawm qhov ntim siab, tab sis tseem nrov heev. Kuv yuav tsum ua qhov no vim tias kuv daim npav suab - Google AIY lub suab kaw suab, tsis ua si zoo nrog Alsamixer qee zaum.

Txuas ntxiv xaiv cov nyees khawm ntawm koj xaiv, zaum rov qab, so kom txaus thiab txaus siab rau kev mloog zoo rau tam sim no.

Kauj Ruam 11: Teeb Peb Txoj Cai Kom Ua Tau Zoo ntawm Boot

Yog li yog tias txhua yam tau ua haujlwm zoo, thiab koj tau txaus siab rau peb qhov sandbox hais kom ua tam sim no, tam sim no yog lub sijhawm zoo los siv cov ntawv sau cia. Nco ntsoov tias koj tseem nyob hauv phau ntawv kissir, thiab tso cov ntawv sau rau hauv cov neeg siv hauv:

sudo cp pytiful3.py/usr/zos/bin/

Ua nws executable:

sudo chmod +x /usr/local/bin/pytiful3.py

Sau lub plhaub tsab ntawv los khiav nws thaum pib:

sudo nano pytiful3.sh

Thiab ntxig cov ntawv hauv qab no:

#! /bin/sh ### BEGIN INIT INFO # Muab: pytiful3.py # Yuav tsum-Pib: $ remote_fs $ syslog # Yuav tsum-Nres: $ remote_fs $ syslog # Default-Pib: 2 3 4 5 # Default-Stop: 0 1 6 ### Xaus INIT INFO # xyuas kom lub ntim tsis nrov nrov TODO # Ua cov haujlwm tshwj xeeb thaum nug los ntawm cov txheej txheem "$ 1" thaum pib) ncha "Pib pytiful3.py" /usr/local/bin/pytiful3.py &;; nres) ncha "Nres pytiful3.py" pkill -f /usr/local/bin/pytiful3.py;; *) ncha "Siv: /etc/init.d/pytiful3.sh {pib | nres}" tawm 1;; esac Exit 0

Tsiv nws mus rau init.d:

sudo mv pytiful3.sh /etc/init.d/

Ua nws executable:

sudo chmod +x /etc/init.d/pytiful3.sh

Sau npe tsab ntawv kom khiav ntawm kev pib:

sudo hloov tshiab-rc.d pytiful3.sh defaults

Kauj Ruam 12: Kuaj dua

Tam sim no peb muaj peb cov ntawv sau los khiav ntawm kev pib, tsuas yog nco ntsoov tias txhua qhov kev hloov pauv uas peb hloov pauv yuav tsum tau coj mus rau tus neeg siv hauv, thiab peb zoo nkauj, kissir/pytiful3.py tsab ntawv tsuas yog menyuam ntsuag tam sim no. Tab sis ntawm qhov ci ntsa iab, peb tseem muaj lub sandbox los ua si. Kuv yuav zaum txuas ntxiv ua si nrog tsab ntawv, hloov pauv thiab txuag nws raws li qhov tshiab nyob rau yav tom ntej. Nws tseem yog txoj haujlwm ua haujlwm.

Cia peb rov pib dua, tos tus pi rov pib dua, thiab tom qab li ib feeb, nyem lub pob dua.

Yog tias koj lub suab qis heev, nco ntsoov peb muaj alsamixer ntim ntawm 50%, yog li peb tuaj yeem nce nws raws li los ntawm kev hais kom ua tam sim ntawd.

Rau cov pib, ib yam uas xav tau yog tus nqi thoob ntiaj teb, tsis txhob hloov pauv qib 5 ntau zaus sib txawv.

Hav, dab tsi txog cov npe xov tooj cua uas peb tau ua hauv qib #6? Zoo, nws hloov tawm MPG123 muaj qhov xaiv xaiv yuam kev. Nws yog qhov yooj yim raws li tsim cov npe chaw nres tsheb url, thiab tsis txhob hu rau ib lub xov tooj cua chaw nres tsheb url, tsuas yog siv

"btn1234_choice = random.choice (btn1234)", tam sim tom qab txheeb xyuas peb cov npe ntawm cov chaw nres tsheb, qhov twg btn1234_choice yog peb cov npe. Tsis txhob hnov qab siv cov kab zauv nyob ib puag ncig peb cov npe ntawm cov chaw sib cais los ntawm tus lej. Kev hais kom ua subprocess tom qab ntawd ua rau peb xaiv tsis raug:

subprocess.call (['mpg123', '-q', btn1234_choice, "-ua ntej 1"])

Kauj Ruam 13: Thauj Nws, thiab Peb Ua Tiav

Box Nws Up, thiab Peb Ua Tiav
Box Nws Up, thiab Peb Ua Tiav
Box Nws Up, thiab Peb Ua Tiav
Box Nws Up, thiab Peb Ua Tiav
Box Nws Up, thiab Peb Ua Tiav
Box Nws Up, thiab Peb Ua Tiav

Yog tias koj tau mus txog qib no, txoj haujlwm tiav! Nrog koj zoo siab - koj nyuam qhuav tsim lub xov tooj cua siv internet nyob ib leeg.

Nyob ntawm cov cuab yeej koj muaj (tus hais lus, dac thiab lub tshuab hluav taws xob), koj yuav xav tsis thoob tias yuav zais qee cov xov hlau tso li cas. Tej zaum lwm qhov kev qhia rau lwm hnub, tab sis yog tias koj npaj yuav tsim chav tsev nyob rau ntsaws qee qhov xov hlau rau hauv, Kuv pom zoo kom muab koj tus kheej kom muaj chav nyob ntxiv.

Raws li koj tuaj yeem pom hauv cov duab saum toj no - Kuv tau ua ob qhov hnia, ib qho siv cov seem ntawm cov kua nplaum ua qhov tsis zoo ntawm kuv thawj zaug sim (los ntawm kev lom zem tsis zoo los ua cov laug cam). Chav tsev thib ob siv lub suab hais lus ntau dua li cov neeg hais lus zoo, thiab yog tias koj khaws lub npe ntawm lub cuab yeej ntawm ib qho ntawm kuv cov screenshots, kuv tau hu nws lub slimbox.

Kuv pom qhov haujlwm no lom zem heev. Ob zaug. Yeej tsis yog txoj haujlwm nyuaj, tej zaum siv sijhawm me ntsis tab sis muaj txiaj ntsig heev. Kuv vam tias koj yuav txaus siab rau koj mloog zoo li.

Pom zoo: