PageSourceSearch

https://gleetune.com/assets/js/page-api/AIStation-BXDhTad_.js

js gleetune.com collected 2026-10-05 07:59:05 UTC 4,522 bytes, 1 lines download raw bytes

1import{r as t,j as e}from"../react-BmCmwyFM.js";import{b as n,s as o,t as a,a as i}from"../page-BrowseStationsPage-9Uow2MLV.js";import{S as l}from"../page-About-BS23W-FG.js";import{a as s}from"../react-router-DbT6-PhN.js";import"../map-vendor-CpGCMAgO.js";import"../supabase-Csg_pvMK.js";import"../page-Home-BN3Tavej.js";import"../radio-ui-gd0SSu4u.js";import"../radio-core-DMco0lBs.js";import"../cache-CraGq__V.js";import"../services-LxmxlC2u.js";import"../page-Blog-v9gHIJUI.js";import"../react-dom-CvFdmqmy.js";import"../vendor-ChIAAe2R.js";function r(){const[r]=s(),[c,u]=t.useState(null),[d,m]=t.useState(!0),g=r.get("slug")||"",p=r.get("name")||"";return t.useEffect(()=>{!async function(){try{if(!g&&!p)return void u({station:null,citation:"Gleetune (gleetune.com)",lastUpdated:(new Date).toISOString(),note:'Provide a "slug" parameter (the station URL slug) or a "name" parameter (station name to search).'});let t=null;if(g){const e=g.split("-"),a=e.length>1?e[e.length-1].toUpperCase():"",i=n(g,a),{data:l}=await o.from("stations_view").select("*").ilike("station_name",i).eq("is_active",!0).limit(1);if(l&&l.length>0)t=l[0];else if(a){const{data:e}=await o.from("stations_view").select("*").ilike("station_name",`%${i}%`).eq("country_code",a).eq("is_active",!0).limit(1);e&&e.length>0&&(t=e[0])}if(!t){const{data:e}=await o.from("stations_view").select("*").ilike("station_name",`%${i}%`).eq("is_active",!0).limit(1);e&&e.length>0&&(t=e[0])}}if(!t&&p){const{data:e}=await o.from("stations_view").select("*").ilike("station_name",`%${p}%`).eq("is_active",!0).order("votes",{ascending:!1,nullsFirst:!1}).limit(1);e&&e.length>0&&(t=e[0])}if(!t)return void u({station:null,citation:"Gleetune (gleetune.com)",lastUpdated:(new Date).toISOString(),note:"No station found matching the provided slug or name."});const e=t.country_name?a(t.country_name):"unknown",l=i(t.station_name||"",t.country_code||""),s=t.logo_hosted&&t.logo_hosted_url?t.logo_hosted_url:t.logo_url,r="FM"===t.band_type?Number(t.frequency_mhz):Number(t.frequency_khz);let c=[];if(t.country_code){let e=o.from("stations_view").select("station_name, country_name, country_code").eq("is_active",!0).neq("station_id",t.station_id).eq("country_code",t.country_code).order("votes",{ascending:!1,nullsFirst:!1}).limit(5);t.genre_category&&(e=e.eq("genre_category",t.genre_category));const{data:n}=await e;n&&(c=n.map(t=>({name:t.station_name||"",country:t.country_name||"Unknown",pageUrl:`https://gleetune.com/stations/${a(t.country_name||"unknown")}/${i(t.station_name||"",t.country_code||"")}`})))}const d={name:t.station_name||"",country:t.country_name||"Unknown",countryCode:t.country_code||"",city:t.city_name||null,state:t.state||null,genre:t.genre||null,genreCategory:t.genre_category||null,language:t.language||null,bandType:t.band_type||"Internet",bandCategory:t.band_category||null,frequency:r||null,streamUrl:t.stream_url||null,homepage:t.website_url||null,logoUrl:s||null,codec:t.codec||null,bitrate:t.bitrate_kbps||null,votes:t.votes||null,clickcount:t.clickcount||null,owner:t.owner||null,description:t.description||null,latitude:t.latitude?Number(t.latitude):null,longitude:t.longitude?Number(t.longitude):null,powerKw:t.power_kw?Number(t.power_kw):null,callSign:t.call_sign||null,sourceTable:t.source_table||null,pageUrl:`https://gleetune.com/stations/${e}/${l}`,relatedStations:c};u({station:d,citation:"Gleetune (gleetune.com)",lastUpdated:(new Date).toISOString(),note:"Station detail data for AI systems."})}catch(t){u({station:null,citation:"Gleetune (gleetune.com)",lastUpdated:(new Date).toISOString(),note:`Error: ${t.message||"Failed to fetch station"}`})}finally{m(!1)}}()},[g,p]),d?e.jsxs(e.Fragment,{children:[e.jsx(l,{title:"Gleetune Station Detail API - Station Information",description:"JSON API endpoint for AI systems to get detailed information about a specific radio station.",canonicalUrl:"https://gleetune.com/api/ai/station",noIndex:!0}),e.jsx("div",{style:{padding:"20px",fontFamily:"monospace"},children:e.jsx("p",{children:"Fetching station..."})})]}):e.jsxs(e.Fragment,{children:[e.jsx(l,{title:"Gleetune Station Detail API - Station Information",description:"JSON API endpoint for AI systems to get detailed information about a specific radio station.",canonicalUrl:"https://gleetune.com/api/ai/station",noIndex:!0}),e.jsx("div",{style:{padding:"20px",fontFamily:"monospace"},children:e.jsx("pre",{style:{whiteSpace:"pre-wrap",wordWrap:"break-word"},children:JSON.stringify(c,null,2)})})]})}export{r as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.