so://phie

verbal

A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal

blob: 6ec96def19262815534046100b489125edc79028 (943 bytes)[doc][blame][raw]

1use serde::Deserialize;

2

3use crate::utils::{to_array, upgrade_to_https};

4use crate::models::Station;

5

6#[derive(Debug, Deserialize)]

7pub struct StationAdapter {

8 pub stationuuid: String,

9 pub name: String,

10 pub url: String,

11 pub votes: i32,

12 pub favicon: String,

13 pub homepage: String,

14 pub tags: String,

15 pub countrycode: String,

16 pub languagecodes: String,

17 pub state: String,

18}

19

20impl Into<Station> for StationAdapter {

21 fn into(self) -> Station {

22 Station {

23 id: 0,

24 uuid: self.stationuuid,

25 name: self.name,

26 stream_url: upgrade_to_https(self.url),

27 votes: self.votes,

28 favicon: Some(self.favicon),

29 homepage: Some(self.homepage),

30 tags: to_array(self.tags),

31 country: Some(self.countrycode),

32 languages: to_array(self.languagecodes),

33 state: Some(self.state),

34 }

35 }

36}