- Nzwisisa zvinofambiswa nemetadata Drive (zita, ma tag, indexableText, uye zvidhoma) uye kuti ndeapi metadata yemamwe masevhisi eGoogle Cloud.
- Shandisa Drive API kubvunza uye kugadzirisa metadata; chenesa EXIF uye yakamisikidzwa data usati waisa mafaera.
- Remekedza miganhu nemitemo (zvidhori, indexable mavara, edzedzero) uye simbisa negcloud yemunharaunda REST bvunzo.
Iwe unoda kudzora metadata yemafaira ako mukati Google Drive uye hauzive pekutangira? Pano tinotsanangura, zvakadzama, Maitiro ekubvisa metadata muGoogle Drive zvinobudirira uye zvakachengeteka (iyo metadata yemafaira akaiswa). Isu tinokuudza zvakare izvo zvinotemerwa neGoogle pamazita emafaira, saizi, uye mvumo.
Gwaro iri rinokupa kunzwisisa kwakazara uye kwechokwadi kwezvinogona (uye zvisingagone) "kubviswa" kana zvasvika kune metadata muGoogle Drive.
Chii chinogona kuchinjwa kana "kudzimwa" muDrive
Izvi ndizvo metadata iyo inogona kubviswa kubva kumafaira akaiswa kuGoogle Drive:
Zita uye kuwedzera: Paunenge uchigadzira faira kuburikidza neAPI, ipfungwa yakanaka kutsanangura kuwedzera mundima yezita, semuenzaniso, "cat.jpg." Dhiraivha inogona kugonesa kuwedzera kubva kurudzi rweMIME kana ukasaitsanangura, asi zviri nani kuzvitsanangura iwe pachako. Mune mhinduro dzinotevera, kuverenga-chete fairaExtension inogona kuoneka nekuwedzera kwakazara kubva muzita. Kana mushandisi akadhawunirodha faira, Dhiraivha inounganidza zita rekupedzisira kubva pazita (uye kuwedzera kwayo).
- Indexable text (contentHints.indexableText): Dhiraivha indekisi zvinyorwa zvakajairika uye mhando (PDFs, OCR-inogonesa mifananidzo, nezvimwewo) nekukasira. Kana app yako ichichengeta mamwe mafomati (madhirowa, mavhidhiyo, mapfupi), unogona kupa indexable mavara ekuvandudza kutsvaga. Ichi chinyorwa chinogadziriswa seHTML: kana ukapasa tambo ine ma tag, zvinyorwa zvinoiswa indexed, kwete tag hunhu. Pane 128KB saizi inogumira ye contentHints.indexableText, uye zvinokurudzirwa kuti uigadzirise pasevha yega yega uye ichengetedze zvinoenderana nefaira.
- Zvigunwe (contentHints.thumbnail): Dhiraivha inogadzira zvigunwe zvemhando dzakawanda, asi kune mafomati asingazvigadzirise, unogona kurodha yako paunogadzira kana kugadzirisa faira. Iwe unofanirwa kuseta mufananidzo kuURL-yakachengeteka base64 uye inoenderana mimeType. Mitemo yakakosha: Mafomati anotsigirwa iPNG, GIF, kana JPG; hupamhi hunokurudzirwa ndeye 1600px (minimum 220px), uye saizi yepamusoro i2MB. Zvigunwe hazvishande kana zvirimo zvefaira zvachinja; metadata shanduko haina.
- Kuwana zvigunwe: Iyo ThumbnailLink munda inodzosa URL pfupi, inowanikwa chete kana iyo app ine mvumo yekuverenga iyo faira (kana isiri yeruzhinji, unozofanira kuikumbira nemagwaro). Unogona kubvunza kune rimwe faira kana rondedzero yakasefa nemhando.
- Labels: Dhiraivha inobvumidza iwe kubatanidza mavara nemafaira. Kuti uzviwane, unogona kushandisa mafaira.listLabels, uye kuti uagadzirise, unofanira kutarisisa iyo inoenderana labelId uye fileId. Iyi meshini inobatsira pakuronga uye, kana zvichidikanwa, "kuchenesa" zvisingadiwe kupatsanura pasina kubata zvirimo.
Dzima metadata muGoogle Drive: "yakavanzika" metadata kubva kufaira pachayo
Iko hakuna bhatani remashiripiti rekubvisa metadata muGoogle Drive (senge EXIF mumafoto kana data rakamisikidzwa mumaPDF). Dhiraivha inobata yayo metadata, asi metadata iri mukati mefaira inotsamira pane chishandiso chakaigadzira.
Iyo inokurudzirwa tsika ndeye chenesa faira usati waisa kuDrive, Uchishandisa maturusi ehurongwa kana maapplication akasarudzika anobvisa EXIF data kubva pamifananidzo kana zvinyorwa zvivakwa. Nenzira iyi, izvo zvaunochengeta muDrive zvinosvika "zvakacheneswa."
Kana iwe uchitova nemafaira akaiswa nemetadata yakadzikwa, pane kubvisa metadata muGoogle Drive, zviri nyore dhawunirodha, chenesa uye rodha zvakare, kutsiva yepakutanga kana zvichibvira. NemaPDF kana mapikicha, izvi zvakajairika kana iwe uchida kuchengetedza vanyori, nzvimbo, kana nhoroondo yekugadzirisa.
Kune iyo chaiyo chikamu cheDrive, tarisa pakugadzirisa zita, mavara uye zvirimoHints (indexableText/thumbnail), zviri pasi pesimba rako. Kana iwe zvakare uchitonga mvumo yekuwana, iwe zvakare unoderedza kuratidzwa kweinooneka metadata (semuenzaniso, thumbnail links inowanikwa kune avo vane kodzero dzekuverenga).
Usakanganwa izvozvo Kuchinja chete Dhiraivha metadata hakubvisi EXIF kana zvemukati zvivakwa. Naizvozvo, zano rako rinofanirwa kusanganisa pre-kuchenesa faira neiyo yakanaka-grained metadata manejimendi iyo Dhivha inobvumidza iwe kubata.
Inowanzo kuvhiringika metadata muGoogle Cloud: VMs, gcloud, uye miganhu
Kana ukashanda neGoogle Cloud, uchaona akawanda inotungamira nezve "metadata" iyo inoreva chaizvo kuCompute Injini kana Cloud Storage, kwete Dhiraivha. Kunyangwe zvakadaro, iwe unenge uchida kuziva mapoinzi aya kuti usaasanganise paunenge uchitsvaga.
Basic gcloud CLI kumisikidzwa
Mushure mekuisa Google Cloud CLI, tanga ne:
gcloud init
Izvo zvakakosha kuve nechokwadi kuti une yazvino vhezheni ine:
gcloud components update
Kana iwe ukashandisa wekunze chitupa chinopa, Pinda nechitupa chako chemubatanidzwa usati washanda negcloud, kunyanya kana iwe uchizotendesa kuita REST mafoni kubva munharaunda yako. REST API samples inogona kushandisa zvitupa zvawagadzira mugcloud.
VMs
Mvumo uye mabasa (Compute Injini): Kuwedzera, kugadzirisa, kana kudzima tsika metadata paVM, unoda mvumo yeIAM yakakodzera. Mienzaniso yakajairika inosanganisira:
- Kana maVM ako akashandisa maakaundi ebasa: mvumo
iam.serviceAccounts.actAsmubasa kana purojekiti account. - Project metadata:
compute.projects.getycompute.projects.setCommonInstanceMetadata. - Zonal metadata:
compute.instanceSettings.getycompute.instanceSettings.updatekune nzvimbo inoenderana. - Muenzaniso metadata:
compute.instances.getycompute.instances.setMetadata.
Zvinogumira
Aya ndiwo maganhuriro makuru atakasangana nawo pakuedza kubvisa metadata muGoogle Drive:
- Size Limitations (Compute Engine): Iyo yakasanganiswa yakazara yezvinyorwa zvemetadata zvakavharwa pa512 KB. Kiyi yega yega inogumira ku128 bytes, uye kukosha kwega kwega kunogumira ku256 KB. Kana, semuenzaniso, iwe ukashandisa ssh-kiyi kiyi uye ukapfuura iyo 256 KB muganho, haugone kuwedzera mamwe makiyi kusvika wachenesa.
- Upper kesi uye yakaderera kesi: Makiyi ane nyaya-sensitive; hunhu zvakare, kunze kweBooleans. Muzonal, haugone kugadzira makiyi maviri anosiyana chete kana (zonal-metadata-kiyi vs. ZONAL-METADATA-KEY).
- Zonal metadata: akaiswa kana kubviswa uchishandisa gcloud kana REST. Iwe haugone kutsanangura zonal kukosha zveSSH makiyi (ssh-kiyi). Mune inonzwisisika purojekiti / dhairekitori, kana paine purojekiti-chikamu uye zonal kukosha kwekiyi imwechete, kukosha kwezonal kunotora pamberi munzvimbo yayo.
- Inotsigirwa neboolean values: Kuwedzera kune CHOKWADI/KUNYEPA, unogona kushandisa Y/Hongu/1 uye N/Kwete/0 (nyaya isinganzwe).
- Configuration Scopes (Compute Engine):
- Chirongwa: metadata yakajairika kune ese maVM ari muprojekiti.
- Zonal: mapindiro anobata maVM ese mune imwe nzvimbo uye anogona kudarika kukosha kweprojekiti.
- Muenzaniso: metadata yeVM chaiyo (iri kugadzirwa kana kutovapo).

Zvigunwe, kuisa indexing, uye kudzoreredza metadata muDrive (REST nemaitiro akanaka)
Ngatitarisei basa rezvigunwe pakubvisa metadata muGoogle Drive. Uye zvakare nzira yakanakisa yekuvadzosera:
- Kusimbiswa kweREST panzvimbo: Kana uri kuyedza REST mienzaniso kubva kumushini wako, shandisa zvitupa zvakagadzirirwa ne gcloud. Nenzira iyi, yako Drive API mafoni anoremekedza kuzivikanwa uye mvumo yawakatoisa.
- Custom thumbnail upload: set contentHints.thumbnail ine zvikamu zviviri: the URL-safe base64 image uye mimeType chaiyo. Kana Dhiraivha ichigona kuburitsa chigunwe otomatiki, ichashandisa yayo uye yosvetuka yako. Zvikasadaro, ichashandisa iyo yaunopa.
Mitemo yakakosha yezvigunwe muDrive:
- Mafomati: PNG, GIF kana JPG.
- Upamhi hunokurudzirwa: 1600 px (zvishoma 220 px).
- Kukura kwepamusoro: 2MB.
- Gadzirisa pikicha nesevha yega yega kana ichiri kushanda.
Zvakakosha nezve kusashanda: Zvigunwe hazvishande kana zviri mukati mefaira zvachinjwa; metadata shanduko haidaro. Kana ukangochinja ma tag kana zita, usatarisire chigunwe chitsva kunze kwekunge wagadzirisa faira.
Indexable text
Usayedze "kunyengedza" kutsvaga nema buzzwords. Bata pfungwa uye mazwi ayo mushandisi angatsvaga zvine musoro faira iro, uye tarisa iyo 128KB muganho. Igadzirise pese kana zvirimo zvachinja zvakanyanya.
Shandisa mazita anoenderana uye mawedzeroPese pazvinogoneka, sanganisira kuwedzera muzita kana uchiisa; kana isipo, Dhiraivha inoedza kuifungira neMIME. Kuchengeta mazita akajeka kunodzivirira kusanzwisisika uye kunobvumira kutsvaga nyore kwekuwedzera.
Tags muDhivha
Kuti ugadzirise mavara, cherechedza zviziviso zvinodiwa. Iwe unozoda iyo label's labelId uye faira's fileId. Unogona kutanga wanyora nemafiles.listLabels wobva waisa shanduko dzinoenderana kune faira yawakatariswa.
// Al modificar etiquetas de un archivo en Drive:
// - labelId: identificador de la etiqueta a cambiar
// - fileId: identificador del archivo al que aplicas la etiqueta
// Usa files.listLabels para localizarlas antes de actualizar.
Rangarira kuti, Kunyangwe Dhiraivha iri iyo inotariswa, zviitiko zvakawanda zvinosanganisa Dhivha ne Cloud Storage kana mamwe masevhisi, Saka iwe uchaona mienzaniso yeKuchengeta kuti uongorore hunhu hwechinhu.
// Ejemplo en Go para obtener atributos de un objeto en Cloud Storage (no Drive)
// e imprimir metadatos como ContentType, CacheControl, MD5, etc.
// Útil si tu flujo sube primero a Storage y luego a Drive.
import (
"context"
"fmt"
"io"
"time"
"cloud.google.com/go/storage"
)
func getMetadata(w io.Writer, bucket, object string) (*storage.ObjectAttrs, error) {
ctx := context.Background()
client, err := storage.NewClient(ctx)
if err != nil { return nil, fmt.Errorf("storage.NewClient: %w", err) }
defer client.Close()
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()
o := client.Bucket(bucket).Object(object)
attrs, err := o.Attrs(ctx)
if err != nil { return nil, fmt.Errorf("Object(%q).Attrs: %w", object, err) }
fmt.Fprintf(w, "Bucket: %v\n", attrs.Bucket)
fmt.Fprintf(w, "CacheControl: %v\n", attrs.CacheControl)
fmt.Fprintf(w, "ContentDisposition: %v\n", attrs.ContentDisposition)
fmt.Fprintf(w, "ContentEncoding: %v\n", attrs.ContentEncoding)
fmt.Fprintf(w, "ContentLanguage: %v\n", attrs.ContentLanguage)
fmt.Fprintf(w, "ContentType: %v\n", attrs.ContentType)
fmt.Fprintf(w, "Crc32c: %v\n", attrs.CRC32C)
fmt.Fprintf(w, "Generation: %v\n", attrs.Generation)
fmt.Fprintf(w, "KmsKeyName: %v\n", attrs.KMSKeyName)
fmt.Fprintf(w, "Md5Hash: %v\n", attrs.MD5)
fmt.Fprintf(w, "MediaLink: %v\n", attrs.MediaLink)
fmt.Fprintf(w, "Metageneration: %v\n", attrs.Metageneration)
fmt.Fprintf(w, "Name: %v\n", attrs.Name)
fmt.Fprintf(w, "Size: %v\n", attrs.Size)
fmt.Fprintf(w, "StorageClass: %v\n", attrs.StorageClass)
fmt.Fprintf(w, "TimeCreated: %v\n", attrs.Created)
fmt.Fprintf(w, "Updated: %v\n", attrs.Updated)
fmt.Fprintf(w, "Event-based hold enabled? %t\n", attrs.EventBasedHold)
fmt.Fprintf(w, "Temporary hold enabled? %t\n", attrs.TemporaryHold)
fmt.Fprintf(w, "Retention expiration time %v\n", attrs.RetentionExpirationTime)
fmt.Fprintf(w, "Custom time %v\n", attrs.CustomTime)
fmt.Fprintf(w, "Retention: %+v\n", attrs.Retention)
fmt.Fprintf(w, "\n\nMetadata\n")
for key, value := range attrs.Metadata {
fmt.Fprintf(w, "\t%v = %v\n", key, value)
}
return attrs, nil
}
Kudzima mafaira maringe nekudzima metadata muGoogle Drive
Kana zvauri kuda zviripo bvisa faira kubva kuDriveSemuridzi, unokwanisa kuiendesa kumarara kubva pawebhu nekudzvanya-kurudyi uye kusarudza Enda kumarara. Kana muridzi ari mumwe munhu, unogona chete "Bvisa" faira kubva pakuona kwako; vamwe vachakwanisa kuzviona.
Para Kuti udzime zvachose faira, unofanirwa kudurura marara kana kushandisa sarudzo yekudzima zvachose, Muchiitiko ichi, hauzokwanisi kuidzorera. Izvi, zvega, "hazvibvisi metadata" kubva kune mamwe mafaera - zvinongoshanda kune icho chinhu chete.
Iwe haugone kudzima metadata muGoogle Drive kubva kumafaira ausiri ako, nekuti kutonga kwavo ndekwemunhu akavasika kana kune mumwe munhu ane mvumo yepamusoro mukati mesangano. Muzviitiko izvi, iwe unongobvisa kuwana kwako kana kuoneka.
Zvinoenderana nemetadata: Kudzima faira kunodzima metadata yayo muDrive pamwe chete nayo, asi haikanganisi metadata mune mamwe makopi kana metadata yakamisikidzwa mune mamwe magwaro anoramba ari muhurongwa.
Nezvose zviri pamusoro, iwe zvino unogona kusiyanisa zvakanaka Ndeapi metadata Drive anodzora (zita, ma tag, mazano ekutsvaga, uye zvigunwe), nzira yekuvabvunza nayo kuburikidza neREST, ndeapi maitiro akanakisa ekutevera ekuchenesa akadzamirwa data usati waisa, uye ndeapi miganhu nemvumo zvinopinda mukutamba kana iwe ukasangana neGoogle Cloud zvinyorwa zvinotaura nezve "metadata" mune mamwe mamiriro.
Mharidzo inyanzvi mune tekinoroji uye internet nyaya ine anopfuura makore gumi echiitiko mune akasiyana dhijitari media. Ndakashanda semupepeti uye mugadziri wezvemukati we e-commerce, kutaurirana, online kushambadzira uye kushambadzira makambani. Ndanyorawo pane zvehupfumi, mari uye mamwe masekete mawebhusaiti. Basa rangu ndirowo shungu dzangu. Zvino, kuburikidza nezvinyorwa zvangu mu Tecnobits, Ndinoedza kuongorora nhau dzose nemikana mitsva iyo nyika yetekinoroji inotipa zuva rega rega kuvandudza hupenyu hwedu.