Cov txheej txheem:

Rho tawm Cov Tsis Xav Tau iTunes Nkauj Los Ntawm Koj Lub Computer: 10 Kauj Ruam
Rho tawm Cov Tsis Xav Tau iTunes Nkauj Los Ntawm Koj Lub Computer: 10 Kauj Ruam

Video: Rho tawm Cov Tsis Xav Tau iTunes Nkauj Los Ntawm Koj Lub Computer: 10 Kauj Ruam

Video: Rho tawm Cov Tsis Xav Tau iTunes Nkauj Los Ntawm Koj Lub Computer: 10 Kauj Ruam
Video: xum yog tus maiv siab dawb/ Maiv thoj/ nkauj taw. tshiab 2023 2024, Kaum ib hlis
Anonim
Rho tawm Cov Tsis Xav Tau iTunes Nkauj Los Ntawm Koj Lub Computer
Rho tawm Cov Tsis Xav Tau iTunes Nkauj Los Ntawm Koj Lub Computer

Nyob zoo cov poj niam thiab txiv neej, qhov no yog kuv thawj qhov kev qhia paub, yog li thov, thaum tawm tswv yim, tso koj rab phom nyob tom tsev (txawm li cas los xij rab riam yog qhov siv tau). Nrog rau qhov tshwm sim ntawm cov neeg ua si mp3, nws tau ua rau cov neeg nqa tau yam tsis tau muaj dua los ntawm cov nkauj ib puag ncig nrog lawv hauv lawv lub hnab ris. Nws tsis yog qhov yooj yim hnov ntawm cov neeg muaj sau ntawm 5, 10, txawm tias 15 txhiab nkauj (thiab qee tus neeg, txawm tias ntau dua). Ntawm cov neeg siv mp3, tsis muaj ib tus neeg nyiam tshaj li Apple lub iPod thiab software uas ua haujlwm, iTunes. Lub suab paj nruag loj xws li, txawm li cas los xij, nws tuaj yeem dhau los ua qee yam nyuaj rau tshem cov nkauj uas yooj yim tsis zoo lossis txaus siab rau koj lawm. Nws tuaj yeem siv lub hnub nyoog los taug qab los ntawm kev hla koj cov nkauj sau hauv iTunes thiab tshem cov nkauj uas koj tsis nyiam. uas yog qhov yooj yim tsuas yog txaus ntshai, nrog qee qhov kev pab los ntawm kuv tus phooj ywg zoo, Perl. Kev paub zoo hauv paus ntawm Perl yog qhov muaj txiaj ntsig zoo thaum sim rov ua cov lus qhia no, txawm hais tias tsis xav tau (koj tuaj yeem yeej tsuas yog ua tiav cov lej khoom tiav thiab luam/muab tshuaj txhuam. nws thiab nws yuav ua haujlwm zoo xwb). Rau cov uas txaus siab rau Perl, Kuv pom zoo kom phau ntawv "Kawm Perl" los ntawm O'Reilly, nws tau nyeem zoo thiab yog ib qho ntawm cov ntawv sau zoo tshaj plaws ntawm Perl Kuv tau muaj sijhawm los nyeem. yog ua tiav qhov raug, kuv ua tsis tau thiab yooj yim yuav tsis lees paub lub luag haujlwm yog tias koj ua qee yam ruam thiab rho tawm koj cov nkauj uas muaj nqi. Thov xav txiav txim siab thim koj cov ntaub ntawv suab paj nruag ua ntej sim sau lossis ua ib tsab ntawv xws li hauv qab no. Tsuas yog ua yuam kev ntawm kev ceev faj kom peb tsis muaj kev mob siab yog tias koj tsis ua, ua tsaug. Nyeem cov lus ceeb toom? (Yog, txawm tias koj, tus neeg uas tsis tau nyeem cov lus ceeb toom) Zoo heev! Cia peb pib:-) Hloov tshiab: Nws zoo li qee tus kws sau ntawv tau nyuaj ntawm kev ua haujlwm sau iTunes cov ntawv. Txog ntau yam ntawm cov ntawv ntsig txog iTunes, txheeb xyuas Teridon's Scripts.

Kauj ruam 1: Pib

Pib Pib
Pib Pib

Ib yam li txhua yam, muaj kev npaj me me uas yuav tsum tau ua ua ntej peb tuaj yeem ua cov ntawv no. Yog li, yam koj yuav xav tau kom rho tawm nkauj ntawm iTunes: 1) Lub khoos phis tawj (duh) 2) iTunes (ob npaug duh) 3) Perl (nyuaj rau sau ntawv Perl yam tsis muaj Perl, koj puas tau hais?) 4) Koj nyiam tus kws kho mob (Kuv yog tus txhawb nqa vi thiab vim kuv tus kheej, tab sis ib tus kws sau ntawv yuav tsum ua qhov dag) 5) iPod (tsis yog yuav tsum tau ua, tab sis zoo kom muaj laj thawj uas yuav tau hais meej sai sai) Tau Txais: Ua raws cov lus qhia ntawm no, yuav tsum yooj yim txaus: https://www.perl.com/download.csp Thaum koj muaj Perl rub tawm, teeb tsa, thiab npaj mus, peb yuav xav tau qee cov ntaub ntawv keeb kwm yav dhau los ntawm qhov nws peb tab tom ua. Nws yuav tsum raug sau tseg tias tsab ntawv tau pib tsim rau Mac OS X, txawm hais tias tib txoj hauv kev yuav tsum ua haujlwm ntawm tsis-Unix raws li OSes xws li Windows. Lub sijhawm rau qhov tsis txaus ntseeg, er, "kev kawm" ib feem ntawm Cov Lus Qhia.

Kauj Ruam 2: Lub Tswv Yim Sau Ntawv Yooj Yim

iTunes suav nrog 5-hnub qub kev ntsuas kom tso cai rau cov neeg siv ntsuas cov nkauj. Cov nkauj uas muaj 5-lub hnub qub raug suav tias yog cov nkauj zoo tshaj thaum cov nkauj nrog qib 1-lub hnub qub raug suav tias yog qee zaj nkauj tsis zoo. Rau peb lub hom phiaj, peb yuav xav tias txhua zaj nkauj uas tsis muaj kev ntsuas (aka 0 lub hnub qub) yog ib qho uas tus neeg siv tseem tsis tau muaj sijhawm los ntaus nqi. Kuv tus kheej, thaum ntsuas cov nkauj, yog tias nkauj muaj qhov ntsuas 1-hnub qub, Kuv pom nws yog qhov tsis zoo txaus uas nws tsis tsim nyog qhov chaw nyuaj nyuaj uas cov nkauj siv. Yog li ntawd, Tsab Ntawv Perl Kuv yuav nthuav qhia rau koj hauv Phau Ntawv Qhia no yuav cais los ntawm iTunes Library thiab tshem tawm ib qho kev taug uas tau muab rau 1-lub hnub qub ntsuas. Ua li ntxiv qhov ntxiv, cov nkauj tuaj yeem ntsuas tau thaum tus neeg siv mus siv iPod. Txoj hauv kev no, koj tuaj yeem xaiv cov nkauj kom tshem tawm thaum mus yooj yim los ntawm kev ntsuas lawv, thiab lawv yuav raug rho tawm thaum koj sync koj iPod rau koj lub computer tom qab (yog tias koj cia li sync koj iPod rau koj lub computer). peb tab tom ua, cia saib seb peb yuav rub cov nkauj li cas los ntawm iTunes rau Tsab Ntawv Perl.

Kauj Ruam 3: XML Library: ITunes 'Goto Guy

XML Lub Tsev Qiv Ntawv: ITunes 'Goto Guy
XML Lub Tsev Qiv Ntawv: ITunes 'Goto Guy

Txhawm rau tshem tawm ib zaj nkauj los ntawm lub khoos phis tawj raws li nws tau ntsuas, peb xav tau 2 daim ntaub ntawv: zaj nkauj ntsuas thiab qhov chaw ntawm zaj nkauj. Hmoov zoo rau peb muaj cov ntaub ntawv yooj yim uas peb tuaj yeem tau txais tag nrho cov ntaub ntawv peb xav tau txog iTunes los ntawm: iTunes Music Library XML file. Cov ntaub ntawv XML hu ua "iTunes Music Library.xml" thiab yuav tsum nyob hauv koj li Music directory ntawm koj lub hard drive loj.

Txog XML cov ntaub ntawv: iTunes xml cov ntaub ntawv yog cov ntaub ntawv khaws tseg los ntawm iTunes, thiab ib txwm khaws cia txog hnub. Thaum qhov kev hloov pauv tau ua hauv iTunes, ntu sib xws ntawm iTunes XML cov ntaub ntawv raug hloov kho kom pom qhov kev hloov pauv no. Ib qho piv txwv nkag los ntawm kuv li iTunes XML cov ntaub ntawv tau muab hauv qab no: 1218Track ID1218NameTake On MeArtistA-HaGenre80'sKindMPEG audio fileSize3682382Tag nrho Lub Sijhawm230138Date Modified2007-09-24T02: 11: 30ZDate Added2008-05-28T05: 00: 24PlayTub Sijhawm: 28PlayPub Sijhawm: 28PlayTub Hnub: 28PlayPub Sijhawm: 28PlayTub Hnub: Playback: 28 25T01: 26: 58ZRating40Album Rating40Album Rating ComputedPersistent ID9AC5DB9713240B44Track TypeFileLocationfile: //localhost/Volumes/HD1/iTunes%20Music/A-Ha/Unknown%20Album/Take%20On%20Mloog.mp3 cov ntaub ntawv XML muaj cov txiaj ntsig ib puag ncig los ntawm HTML-style cim npe. Rau lub hom phiaj ntawm tsab ntawv, peb yuav txaus siab rau Track ID, Lub Npe, Tus Kws Tshaj Lij, Kev Ntsuas, thiab Qhov Chaw ntawm cov ntaub ntawv. Yog tias koj tab tom saib cov ntaub ntawv XML, koj yuav pom los ntawm saum toj no tias zaj nkauj no muaj "kev ntsuas" ntawm 40. iTunes muab txhua zaj nkauj ua ib tus lej, suav txij 0 txog 100, nrog rau txhua 20 lub ntsiab lus yog lub hnub qub ntxiv rau qhov ntsuas. Yog li, qhov ntsuas ntawm 20 sib piv rau 1 lub hnub qub ntsuas, ntsuas ntawm 40 yog qhov ntsuas 2 lub hnub qub, thiab ntxiv rau, nrog 100 yog qhov ntsuas 5 lub hnub qub. Yog li tam sim no uas peb paub txog cov ntaub ntawv XML, cia peb pib sau ntawv

Kauj Ruam 4: Koj Tus Phooj Ywg Hash (txawm tias Koj Tsis Nyob Hauv Amsterdam)

Koj Tus Phooj Ywg Hash (txawm hais tias Koj Tsis Nyob Hauv Amsterdam)
Koj Tus Phooj Ywg Hash (txawm hais tias Koj Tsis Nyob Hauv Amsterdam)

Ua ntej peb tuaj yeem tshem tawm cov ntaub ntawv, peb xav tau cov ntaub ntawv ua haujlwm uas cuam tshuam tag nrho cov nkauj cov ntaub ntawv ua ke. Txawm hais tias cov ntaub ntawv xav tau ntau dua, xws li cov array ntawm hashes lossis hash ntawm hashes, tuaj yeem siv tau, cov ntawv no yooj yim txaus kom tsim nyog siv cov npe yooj yim ntawm hashes. yog ntsuas los ntawm cov hlua, lossis jumbled loj ntawm qhov tseem ceeb/tus nqi khub. Ib tus tuaj yeem xav txog qhov hash ua lub thoob loj nrog cov khoom (qhov txiaj ntsig) hauv nws, thiab txhua yam hauv cov lus piv txwv muaj cov cim npe (cov yuam sij) txuas nrog. Koj tuaj yeem rub ib yam khoom hauv lub thoob tawm yooj yim los ntawm kev nrhiav nws daim ntawv. Yog xav paub ntau ntxiv txog hashes, qhov txuas hauv qab no yuav muaj txiaj ntsig: https://www.tutorialspoint.com/perl/perl_hashes.htm Peb tuaj yeem siv cov ntaub ntawv uas txhua zaj nkauj hauv iTunes XML cov ntaub ntawv raug xa mus rau tus lej cim tshwj xeeb kom taug qab cov nkauj Vim li no, trackID ua tus yuam sij zoo rau cov hashes. Yog li, peb tuaj yeem teeb tsa 4 hashes rau zaj nkauj lub npe, tus kws kos duab, kev ntaus nqi, thiab qhov chaw nyob. Thaum cov no tau tsim, peb tuaj yeem luam theej tawm cov ntaub ntawv thiab sau peb cov hash database siv qee cov lus yooj yooj yim, uas yuav nthuav tawm tom ntej.

Kauj Ruam 5: A (heev) Cov Lus Qhia luv luv ntawm Kev Hais Qhia Li Cas

Txhawm rau rub peb cov ntawv hash los ntawm XML cov ntaub ntawv, thiab tseem txuag lub sijhawm tshawb fawb me ntsis, peb yuav xav hu los ntawm kev pab ntawm ib qho ntawm Perl cov yam ntxwv muaj zog dua: cov lus qhia tsis tu ncua. Kuv yuav ua zaj lus qhia luv luv ntawm kab lus niaj zaus, tab sis rau koj ntawm cov uas xav tau cov lus piav qhia ntxaws ntxiv, muaj ntau ntau cov lus qhia zoo niaj hnub qhia online. Txheeb xyuas https://perldoc.perl.org/perlretut.html rau qhov qhia tau zoo tsis tu ncua Hauv cov lus luv, cov kab lus niaj zaus muab rau peb nrog cov txheej txheem los mus hla cov hlua, hloov ib txoj hlua nrog lwm txoj hlua, lossis txuag ib feem ntawm ib txoj hlua rau siv tom qab. Cov kab lus niaj zaus muab 2 lub luag haujlwm, sib txuam (m //) thiab hloov (s //) cov tswv, uas yuav siv rau txoj haujlwm no. Txhawm rau siv ib qho ntawm cov haujlwm no hauv cov ntsiab lus ua haujlwm, peb yuav siv Perl tus neeg ua haujlwm khi (= ~), uas yog siv los khi tus qauv rau txoj hlua sib txawv ntawm kev xaiv. Piv txwv:

$ tawm tswv yim = ~ /Purduecer /; #rov qab muaj tseeb yog tias $ kab lus muaj kab lus "Purduecer" s/[a-z]/[A-Z]/; #Txhua tag nrho cov tsiaj ntawv me hauv kab ntawv thiab siv lawv ntau hauv $ _ hluaIb qho txiaj ntsig thib ob ntawm cov kab lus niaj zaus yog qhov cim xeeb hloov pauv. Hauv cov kab lus niaj zaus, koj tuaj yeem tso qee yam khoom hauv kab lus, thiab tom qab ntawd siv cov qauv tshwj xeeb sib xws cim xeeb sib txawv $ 1, $ 2, thiab lwm yam.

/(Qhia paub) Neeg Hlau/; #Sib piv cov kab nrog kab lus "Qhia Neeg Hlau" $ lub vev xaib = $ 1; #Txuag qhov tshwm sim ntawm kev ua tiav tus qauv sib xws muaj nyob hauv thawj txheej ntawm parens #(qhov no, qhov sib txawv $ 1 muaj "Cov Lus Qhia")Thaum kawg, hauv kab lus niaj zaus, muaj qee cov cim uas ua haujlwm tshwj xeeb. Cov no yog cov rov qab khiav tawm (txhua yam uas yuav tsum zoo li paub txog C programmers), chav kawm tus yam ntxwv thiab tus yam ntxwv ua piv txwv. Piv txwv li, kom phim ib tsab ntawv twg uas muaj tab ntawm ob sab, peb tuaj yeem hais

/\ t [a-zA-Z] t/Cov kab zauv plaub no tau siv nyob rau hauv kab lus niaj hnub los txheeb xyuas cov yam ntxwv hauv chav kawm. Piv txwv li, txawm li cas los xij, uas peb xav nrhiav cov ntawv uas tau muab ntim rau hauv kab zauv kab hauv kab. Peb tsis tuaj yeem sau nws zoo li yog, raws li qhia hauv qab no

/

/

Kauj Ruam 6: Ua Ntawv Thov Li niaj zaus rau ITunes Script

Ua Ntawv Thov Li niaj zaus rau ITunes Script
Ua Ntawv Thov Li niaj zaus rau ITunes Script

Tam sim no peb cia siab tias muaj qee qhov kev nkag siab ntawm cov hauv paus ntsiab lus txhawb lub zog cov lus ib txwm muaj, nws yog lub sijhawm los siv cov no rau hauv tsab ntawv iTunes. Thaum nyeem xml code, qee cov cim, xws li cov ntawv tom ntej, tau ntsib ntau zaus. Yog li ntawd, peb yuav ua kom zoo dua qhov tseeb tias m // tus neeg teb xov tooj cia koj xaiv qhov delimiters uas koj xav tau hauv cov cai (peb yuav siv cov kab sib luag, txawm hais tias lwm tus delimiters yuav ua haujlwm tiag) Ua ntej tshaj, peb tsuas yog yuav tsum tau nyeem ib feem ntawm tag nrho iTunes XML cov ntaub ntawv. Ib feem ntawm cov ntawv uas muaj cov ntaub ntawv xws li playlists, thiab lwm yam tsis tsim nyog. Thawj kab ntawm tshooj playlists, uas los tom qab cov ntaub ntawv nkauj, zoo li cov hauv qab no: Playlists Yog li ntawd, nyob rau lub sijhawm luv, peb tuaj yeem ntxiv hauv kab lus uas dhia mus rau qhov kawg ntawm cov ntaub ntawv nyeem yog tias kab ntawd ntsib.

thaum () {#loop_instructions_here kawg yog ($ _ = ~ m [Playlists])}Tom ntej no, txhawm rau tsim cov hash IDs, peb tuaj yeem siv tsob ntoo yog-elsif los tsim peb cov hashes database, siv cov cim cim sib txawv uas peb tau kawm txog hauv cov kauj ruam dhau los txhawm rau txuag qhov tseem ceeb hauv qhov hashes.

yog ($ _ = ~ m [(d+)]) {$ id = $ 1; } elsif ($ _ = ~ m [Rating (d+)]) {$ rate_hash {$ id} = $ 1; } elsif ($ _ = ~ m [Npe (.+)]) {$ name_hash {$ id} = $ 1; } elsif ($ _ = ~ m [Artist (.+)]) {$ art_hash {$ id} = $ 1; } elsif ($ _ = ~ m [Locationfile: // localhost (.*)]) {$ loc_hash {$ id} = $ 1; }Tam sim no peb tau tsim lub hauv paus ntawm peb cov ntaub ntawv hash, peb yuav npog qhov chaw thiab tshem tawm 1-Star cov ntaub ntawv, yog li mus rau qib tom ntej!

Kauj Ruam 7: Nrhiav thiab Tshem Tawm Cov 1-Star Tracks

Nrhiav thiab rho tawm cov 1-Star Tracks
Nrhiav thiab rho tawm cov 1-Star Tracks

Tam sim no peb muaj peb muaj cov ntaub ntawv teeb tsa, nws yog lub sijhawm los tua rau 1-hnub qub kev, kom peb tuaj yeem tshem tawm lawv. Perl muab cov txiaj ntsig looping tsim hu ua foreach loop uas tuaj yeem siv rov ua dua txhua qhov yuam sij ntawm peb cov hashes. Qhov no yog vim cov nkauj uas tsis muaj kev ntsuas tsis tau muab cov kab ntawv ntsuas kab hauv iTunes XML cov ntawv. Yog li ntawd, thaum rov hla qhov hashes, peb yuav xav siv cov kev tsim hauv qab no:

foreach $ id (txheeb cov yuam sij %rate_hash) { #… ntxig looping code ntawm no}Tom qab ntawd, nws yooj yim li siv cov lus hauv qab no

unlink $ loc_hash {$ id} yog $ rate_hash {$ id} == 20;Qhov tsis ua haujlwm txuas uas siv hauv tus qauv piv txwv saum toj no yog Perl txoj hauv kev tshem cov ntaub ntawv. Tej zaum koj yuav raug ntxias kom siv lub kaw lus hu rau koj lub operating system tshem tawm kev ua haujlwm, tab sis rau qhov laj thawj yooj yim vim li cas cov cai kuv tau sau tsis siv qhov kev hu xov tooj. Peb tam sim no muaj cov qauv yooj yim rau peb cov cai. Hauv cov kauj ruam hauv qab no, peb yuav ua qee qhov kev hloov kho rau txoj cai kom koj tuaj yeem muaj cov ntawv tshwj xeeb, ua haujlwm kom tshem tawm cov neeg phem 1-hnub qub.

Kauj Ruam 8: URI Escapes thiab Yuav Ua Li Cas Nyob Ib Leeg Lawv

Yog tias koj sim ua cov ntawv raws li yog, koj yuav ua rau ntau qhov yuam kev los ntawm koj lub operating system, thiab yog tias koj saib cov kab ntawv uas koj tab tom sim rho tawm, koj yuav pom cov cim txawv txawv nyob hauv txoj hauv kev uas tsis xav tau. Muaj txoj hmoo zoo uas txoj hauv kev no muaj URI cov cim khiav tawm. URI khiav dim dab tsi? Hauv HTML thiab XML, URI cov cim khiav tawm (aka URI khiav tawm) yog cov yam ntxwv tshwj xeeb uas siv los tshawb nrhiav qhov tseeb ntawm tus yam ntxwv ntawd. Piv txwv li, koj yuav tsis pom qhov chaw yooj yim hauv kab lus XML. Txawm li cas los xij, koj yuav pom XML sawv cev ntawm qhov chaw yooj yim, %20. (Muaj tseeb koj tau pom cov no hauv URL kab ntawv hauv koj tus browser thiab xav tsis thoob tias lawv yog dab tsi. Zoo, tam sim no koj paub) URI kev khiav tawm suav nrog % kos npe ua raws los ntawm 2-tus lej hexadecimal code sawv cev rau tus ua cim tus lej ASCII. taw tes, koj tuaj yeem sau tag nrho cov pawg ntawm cov lus hloov pauv ntawm qhov chaw hash los hloov txhua qhov ua tau zoo uas koj ntsib (piv txwv li $ loc_hash {$ id} = ~ s/%20//; thiab ntxiv rau). Hmoov zoo, txawm li cas los xij, Perl muab txoj hauv kev zoo los saib xyuas cov no. Perl los nrog cov qauv hu ua URI:: Escape, uas muaj lub luag haujlwm ua haujlwm, uri_unescape, uas yuav ua txoj haujlwm tshem tawm URI kev khiav tawm rau peb. Txhawm rau siv tus qauv, tsuas yog ntxiv kab hauv qab no rau saum koj cov cai:

siv URI:: Escape;Tam sim no, tom qab peb muab $ loc_hash {$ id} array hauv XML cov ntaub ntawv voj, peb tuaj yeem ntxiv kab hauv qab no tom qab ntawd

uri_unescape ($ loc_hash {$ id});Cov kab saum toj no txiav tawm txhua qhov cim URI khiav tawm. Raws li kev ntxiv nyiaj ntxiv, nws txhais qee cov cim thoob ntiaj teb ib yam. Kuv tau khiav tsab ntawv nrog ob peb kab ntawv kab ntawv uas muaj Japanese konji hauv lawv, thiab uri_unescape muaj nuj nqi txhais cov XML cov qauv ntawm cov cim ntawd rau lawv cov cim qub kom tsis txuas tuaj yeem ua tiav tshem tawm cov ntawv.. Rau qhov laj thawj uas kuv tsis nkag siab tag nrho, iTunes cim lub ampersand (&) cim li & hauv nws cov hlua. Yog leej twg paub vim li cas qhov no yog, thov qhia rau kuv paub. Lub sijhawm no, peb tshem tawm qhov teeb meem no los ntawm kev ntxiv kab hauv qab no hauv kab uri_unescape

$ loc_hash {$ id} = ~ s/&#/&/;Tam sim no tsab ntawv yuav muaj filepaths tshem tawm cov cim coj txawv txawv, thiab kev ua haujlwm tsis txuas yuav tuaj yeem nrhiav cov ntaub ntawv hauv lawv qhov chaw tsim nyog kom tshem tawm lawv. Zoo, nws yuav yog tias koj siv Mac OSX (thiab feem ntau yog lwm yam Unix-based OSes ib yam nkaus). Nyeem rau txhawm rau ua tsab ntawv sib xws ntawm lwm lub tshuab ua haujlwm (uas yog, Windows).

Kauj Ruam 9: Ntxiv Script Compatibility rau Windows

Ntxiv Script Compatibility rau Windows
Ntxiv Script Compatibility rau Windows

Tsab ntawv, raws li tau sau los txog tam sim no, tshem tawm txoj hauv kev ntawm Unix-based operating systems. Txhawm rau nws ua haujlwm ntawm Windows, yuav tsum muaj qhov sib ntxiv me me. Unlike Mac thiab lwm yam Unix-based OSes, Windows tsis txhawb lub tswv yim ntawm cov npe hauv paus nkaus xwb. Yog li ntawd, txhua txoj hauv kev pib nrog ntim (C: lossis E: lossis lwm yam ntawv uas koj tuaj yeem xav txog, rau qhov teeb meem ntawd) tsis zoo li cov hauv paus hauv paus (/). Luckily rau peb, Perl muaj qhov tshwj xeeb sib txawv, $O (uas yog lub peev o, tsis yog xoom), uas qhia peb tias kev ua haujlwm uas peb tab tom siv tam sim no. Yog li, yog tias tus nqi khaws cia hauv qhov sib txawv muaj "Yeej", peb yuav xav tshem tawm qhov ua rau ntawm peb XML qhov chaw filepath. Qhov no tuaj yeem ua tiav nrog cov kab hauv qab no (ntxiv tom qab peb ua tiav kev txheeb xyuas qhov chaw ntawm txoj kab los ntawm XML cov ntaub ntawv):

$ loc_hash {$ id} = substr ($ loc_hash {$ id}, 1) yog $^O = ~ /Yeej /kuv;Tam sim no, tsab ntawv yuav ua haujlwm txawm tias nws tau khiav ntawm OS X lossis Windows.

Kauj ruam 10: Tsab Ntawv Ua tiav

Tsab Ntawv Tiav
Tsab Ntawv Tiav

Cov ntawv txuas nrog yog kuv qhov kev ua tiav ntawm iTunes tsab ntawv autodeletion tiav, rau cov ntawm koj uas tsuas yog xav tau cov khoom kawg thiab tsis yog piav qhia seb nws ua haujlwm li cas.

Txhawm rau siv tsab ntawv koj yuav xav khaws cov ntawv ua perl file (.pl extension) thiab tom qab ntawd ua kom nws ua tiav (chmod 751 hauv Unix, tsis paub meej tias nws yog dab tsi rau Windows systems).

Pom zoo: