Beispiel #1
0
def get_station_by_id(stationid, additional_info=False):
    station_id_prefix = generic.get_stationid_prefix(stationid)
    if station_id_prefix == my_stations.ID_PREFIX:
        return my_stations.get_station_by_id(generic.get_stationid_without_prefix(stationid))
    elif station_id_prefix == radiobrowser.ID_PREFIX:
        station = radiobrowser.get_station_by_id(generic.get_stationid_without_prefix(stationid))
        if additional_info:
            station.get_playable_url()
        return station
    return None
Beispiel #2
0
def get_station_by_id(uid):
    my_stations_yaml = get_stations_yaml()
    if my_stations_yaml:
        for category in my_stations_yaml:
            for station in get_stations_by_category(category):
                if uid == generic.get_stationid_without_prefix(station.id):
                    return station
    return None
Beispiel #3
0
 def get_playable_url(self):
     try:
         playable_url_json = request(
             'url/' + generic.get_stationid_without_prefix(self.id))[0]
         self.url = playable_url_json['url']
     except (IndexError, KeyError):
         logging.error(
             "Could not retrieve first playlist item for station with id '%s'",
             self.id)