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