Browse and listen to thousands of radio stations across the globe right from your terminal ๐ŸŒŽ ๐Ÿ“ป ๐ŸŽตโœจ
radio rust tokio web-radio command-line-tool tui
1pub mod extract; 2pub mod provider; 3pub mod types; 4 5pub mod api { 6 #[path = ""] 7 pub mod tunein { 8 use super::super::types; 9 use tunein::types::CategoryDetails; 10 11 use super::objects::v1alpha1::{Category, Station, StationLinkDetails}; 12 13 #[path = "tunein.v1alpha1.rs"] 14 pub mod v1alpha1; 15 16 pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("api/descriptor.bin"); 17 18 impl From<String> for Category { 19 fn from(name: String) -> Self { 20 Self { 21 name, 22 ..Default::default() 23 } 24 } 25 } 26 27 impl From<types::Station> for Category { 28 fn from(st: crate::types::Station) -> Self { 29 Self { 30 id: st.id, 31 name: st.name, 32 ..Default::default() 33 } 34 } 35 } 36 37 impl From<CategoryDetails> for Category { 38 fn from(category: CategoryDetails) -> Self { 39 Self { 40 id: category.guide_id.unwrap_or_default(), 41 name: category.text, 42 stations: category 43 .children 44 .map(|c| { 45 c.into_iter() 46 .map(|x| Station { 47 id: x.guide_id.unwrap_or_default(), 48 name: x.text, 49 playing: x.playing.unwrap_or_default(), 50 }) 51 .collect() 52 }) 53 .unwrap_or(vec![]), 54 } 55 } 56 } 57 58 impl From<tunein::types::Station> for Category { 59 fn from(s: tunein::types::Station) -> Self { 60 Self { 61 id: s.guide_id.unwrap_or_default(), 62 name: s.text, 63 stations: s 64 .children 65 .map(|c| { 66 c.into_iter() 67 .map(|x| Station { 68 id: x.guide_id.unwrap_or_default(), 69 name: x.text, 70 playing: x.playing.unwrap_or_default(), 71 }) 72 .collect() 73 }) 74 .unwrap_or(vec![]), 75 } 76 } 77 } 78 79 impl From<types::Station> for StationLinkDetails { 80 fn from(s: types::Station) -> Self { 81 Self { 82 bitrate: s.bitrate, 83 url: s.stream_url, 84 media_type: s.codec, 85 ..Default::default() 86 } 87 } 88 } 89 90 impl From<types::Station> for Station { 91 fn from(s: types::Station) -> Self { 92 Self { 93 id: s.id, 94 name: s.name, 95 playing: s.playing.unwrap_or_default(), 96 } 97 } 98 } 99 100 impl From<tunein::types::StationLinkDetails> for StationLinkDetails { 101 fn from(s: tunein::types::StationLinkDetails) -> Self { 102 Self { 103 bitrate: s.bitrate, 104 element: s.element, 105 is_ad_clipped_content_enabled: s.is_ad_clipped_content_enabled, 106 is_direct: s.is_direct, 107 is_hls_advanced: s.is_hls_advanced, 108 live_seek_stream: s.live_seek_stream, 109 media_type: s.media_type, 110 player_height: s.player_height, 111 player_width: s.player_width, 112 playlist_type: s.playlist_type.unwrap_or_default(), 113 position: s.position, 114 reliability: s.reliability, 115 url: s.url, 116 } 117 } 118 } 119 } 120 121 #[path = ""] 122 pub mod objects { 123 #[path = "objects.v1alpha1.rs"] 124 pub mod v1alpha1; 125 } 126}