| 123 | } |
| 124 | |
| 125 | getBroadcastCountries(): Collection<sdk.Models.Country> { |
| 126 | const countries = new Collection<sdk.Models.Country>() |
| 127 | |
| 128 | const feed = this.getFeed() |
| 129 | if (!feed) return countries |
| 130 | |
| 131 | feed |
| 132 | .getBroadcastArea() |
| 133 | .getLocations() |
| 134 | .forEach((location: sdk.Models.BroadcastAreaLocation) => { |
| 135 | let country: sdk.Models.Country | undefined |
| 136 | switch (location.type) { |
| 137 | case 'country': { |
| 138 | country = data.countriesKeyByCode.get(location.code) |
| 139 | break |
| 140 | } |
| 141 | case 'subdivision': { |
| 142 | const subdivision = data.subdivisionsKeyByCode.get(location.code) |
| 143 | if (!subdivision) break |
| 144 | country = data.countriesKeyByCode.get(subdivision.country) |
| 145 | break |
| 146 | } |
| 147 | case 'city': { |
| 148 | const city = data.citiesKeyByCode.get(location.code) |
| 149 | if (!city) break |
| 150 | country = data.countriesKeyByCode.get(city.country) |
| 151 | break |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | if (country) countries.add(country) |
| 156 | }) |
| 157 | |
| 158 | return countries.uniqBy((country: sdk.Models.Country) => country.code) |
| 159 | } |
| 160 | |
| 161 | getBroadcastSubdivisions(): Collection<sdk.Models.Subdivision> { |
| 162 | const subdivisions = new Collection<sdk.Models.Subdivision>() |