def StationsMenu(): oc = ObjectContainer(title2=L('Stations')) oc.add(DirectoryObject(key=Callback(GetStationTracks, name=L('Lucky Radio'), id='IFL'), title=L('Lucky Radio'))) stations = API.get_all_stations() for station in sorted(stations, key = lambda x: int(x.get('recentTimestamp')), reverse=True): do = DirectoryObject(key=Callback(GetStationTracks, name=station['name'], id=station['id']), title=station['name']) if 'imageUrl' in station: do.thumb = station['imageUrl'] oc.add(do) return oc
def StationsMenu(): oc = ObjectContainer(title2=L('Stations')) oc.add( DirectoryObject(key=Callback(GetStationTracks, name=L('Lucky Radio'), id='IFL'), title=L('Lucky Radio'))) stations = API.get_all_stations() for station in sorted(stations, key=lambda x: int(x.get('recentTimestamp')), reverse=True): do = DirectoryObject(key=Callback(GetStationTracks, name=station['name'], id=station['id']), title=station['name']) if 'imageUrl' in station: do.thumb = station['imageUrl'] oc.add(do) return oc