1jQuery(document).ready(function($) { 2 if (config._lfm_api_abfragen_ <= 0) { 3 console.error('Error (Database): Database entry does not exist. Further requests were canceled.'); 4 return; 5 } 6 var obj = JSON.parse(config._lfm_api_abfragen_); 7 if (obj.lfm_station_name.length <= 0) { 8 console.error('Error (Station name): Station name does not exist. Further requests were canceled.'); 9 } else { 10 $(document).ready(function() { 11 function update_data() { 12 $.ajax({ 13 type: "GET", 14 url: "https://api.laut.fm/time", 15 // url: "https://api.tools.paeddy.de/time.json", 16 dataType: "json", 17 timeout: 5000, 18 }).done(function(lfm_time) { 19 20 var api_lfm_date = new Date(lfm_time.replaceAll('-', '\/')); 21 var weekday = [0,1,2,3,4,5,6]; 22 var get_day = (weekday[api_lfm_date.getDay()] || 7) - 1; 23 var get_time = api_lfm_date.getHours(); 24 25 const days = []; 26 days['mon'] = 0; 27 days['tue'] = 1; 28 days['wed'] = 2; 29 days['thu'] = 3; 30 days['fri'] = 4; 31 days['sat'] = 5; 32 days['sun'] = 6; 33 34 var max_history = parseInt(obj.lfm_max_history)+1; 35 var stations = obj.lfm_station_name.toLowerCase().split(','); 36 var s_id = obj.lfm_station_name.toLowerCase().split(','); 37 var weekdays = {mon: "Montag", tue: "Dienstag", wed: "Mittwoch", thu: "Donnerstag", fri: "Freitag", sat: "Samstag", sun: "Sonntag"}; 38 var weekdays_number = {mon: 0, tue: 1, wed: 2, thu: 3, fri: 4, sat: 5, sun: 6}; 39 if (obj.lfm_station_playlists_time_text === undefined) { 40 var uhrzeit_playlist = ':00 Uhr'; 41 } else if (obj.lfm_station_playlists_time_text.length > 0){ 42 var uhrzeit_playlist = obj.lfm_station_playlists_time_text; 43 } else { 44 var uhrzeit_playlist = ''; 45 } 46 47 if (obj.lfm_station_history_distance === undefined || obj.lfm_station_history_distance.length === 0) { 48 var history_distance = '8px'; 49 } else { 50 var history_distance = obj.lfm_station_history_distance + 'px'; 51 } 52 53 if (obj.lfm_station_top_artists_distance === undefined || obj.lfm_station_top_artists_distance.length === 0) { 54 var top_artists_distance = '1px'; 55 } else { 56 var top_artists_distance = obj.lfm_station_top_artists_distance + 'px'; 57 } 58 59 if (obj.lfm_station_genres_distance === undefined || obj.lfm_station_genres_distance.length === 0) { 60 var genres_distance = '1px'; 61 } else { 62 var genres_distance = obj.lfm_station_top_artists_distance + 'px'; 63 } 64 65 if (obj.lfm_station_next_artists_distance === undefined || obj.lfm_station_next_artists_distance.length === 0) { 66 var next_artists_distance = '1px'; 67 } else { 68 var next_artists_distance = obj.lfm_station_next_artists_distance + 'px'; 69 } 70 71 if (obj.lfm_station_history_separator === undefined || obj.lfm_station_history_separator.length === 0) { 72 var history_separator = '-'; 73 } else { 74 var history_separator = obj.lfm_station_history_separator; 75 } 76 77 if (obj.lfm_station_history_order === undefined || obj.lfm_station_history_order.length == 0 || obj.lfm_station_history_order == "1") { 78 var lfm_station_history_order = 1; 79 } else { 80 var lfm_station_history_order = 2; 81 } 82 83 // var schedule_quelle = "schedule"; 84 if (obj.schedule === undefined || obj.schedule === "standard") { 85 var schedule_quelle = "standard"; 86 } else { 87 var schedule_quelle = obj.schedule; 88 } 89 if (obj.timeout == null){ 90 var timeout = 1000; 91 } else { 92 var timeout = obj.timeout; 93 } 94 var LocalStorage_Stations = []; 95 var CurrentTime = new Date; 96 var unix_now = (Date.now()/1000).toFixed(0);; 97 var next_check = (Date.now()/1000) + 3600 - (CurrentTime.getMinutes() * 60 + CurrentTime.getSeconds()) + 20; 98 next_check = next_check.toFixed(0); 99 if(localStorage.getItem('lfm_next_attempt_after')) { 100 if (unix_now >= localStorage.getItem('lfm_next_attempt_after')) { 101 localStorage.removeItem('lfm_stations_with_errors'); 102 localStorage.removeItem('lfm_next_attempt_after'); 103 } 104 } 105 stations.forEach(function(stations_array, station_number) { 106 if (stations.length == 1) { 107 s_id[station_number] = ''; 108 } else { 109 s_id[station_number] = '_' + stations_array; 110 } 111 112 if (localStorage.getItem('lfm_stations_with_errors')) { 113 if (localStorage.getItem('lfm_stations_with_errors').indexOf(stations_array) >= 1) { 114 // continue; 115 return; 116 } 117 } 118 119 // Allgemeine Informationen der Station 120 $.ajax({
121 type: "GET", 122 url: "https://api.laut.fm/station/" + stations_array, 123 dataType: "json", 124 timeout: timeout, 125 }).done(function(StationInfos) { 126 if (StationInfos.active == false) { 127 console.warn('Warning: /' + stations_array + ' not active'); 128 localStorage.setItem("lfm_next_attempt_after", next_check); 129 if(!localStorage.getItem('lfm_stations_with_errors')) { 130 LocalStorage_Stations.push(stations_array); 131 localStorage.setItem('lfm_stations_with_errors', JSON.stringify(LocalStorage_Stations)); 132 } else { 133 LocalStorage_Stations = JSON.parse(localStorage.getItem('lfm_stations_with_errors')); 134 LocalStorage_Stations.push(stations_array); 135 localStorage.setItem('lfm_stations_with_errors', JSON.stringify(LocalStorage_Stations)); 136 } 137 } else { 138 139 if (schedule_quelle === undefined || schedule_quelle === "standard") { 140 141 // Name der aktuellen Playliste 142 $('.api_lfm_current_playlist_name' + s_id[station_number] + '').html(StationInfos.current_playlist.name); 143 144 // Startzeit der aktuellen Playliste 145 var current_playlist_started_at_correct_format = StationInfos.current_playlist.started_at.replace(/\-/g,'/'); 146 var current_playlist_started_at_date = new Date(current_playlist_started_at_correct_format.substr(0, StationInfos.current_playlist.started_at.length-6)); 147 var current_playlist_started_at_h = current_playlist_started_at_date.getHours(); if (current_playlist_started_at_h < 10) { current_playlist_started_at_h = '0' + current_playlist_started_at_h }; 148 $('.api_lfm_current_playlist_started_at' + s_id[station_number] + '').html(current_playlist_started_at_h + uhrzeit_playlist); 149 150 // Endzeit der aktuellen Playliste 151 var current_playlist_ends_at_correct_format = StationInfos.current_playlist.ends_at.replace(/\-/g,'/'); 152 var current_playlist_ends_at_date = new Date(current_playlist_ends_at_correct_format.substr(0, StationInfos.current_playlist.ends_at.length-6)); 153 var current_playlist_ends_at_h = current_playlist_ends_at_date.getHours(); if (current_playlist_ends_at_h < 10) { current_playlist_ends_at_h = '0' + current_playlist_ends_at_h }; 154 $('.api_lfm_current_playlist_ends_at' + s_id[station_number] + '').html(current_playlist_ends_at_h + uhrzeit_playlist); 155 156 // Beschreibung der aktuellen Playliste 157 if (StationInfos.current_playlist.description) { 158 $('.api_lfm_current_playlist_description' + s_id[station_number] + '').html(StationInfos.current_playlist.description); 159 } else { 160 $('.api_lfm_current_playlist_description' + s_id[station_number] + '').html(''); 161 } 162 // } 163 164 // Beginn (Wochentag) der nächsten Playliste 165 $('.api_lfm_next_playlist_start_day' + s_id[station_number] + '').html(weekdays[StationInfos.next_playlist.day]); 166 167 168 // Beginn (Wochentag) der nächsten Playliste 169 if (days[StationInfos.next_playlist.day] == (get_day)) { 170 $('.api_lfm_next_playlist_start_day' + s_id[station_number] + '').html('Heute'); 171 } else if (days[StationInfos.next_playlist.day] == (get_day+1) || days[StationInfos.next_playlist.day] == 0 && get_day == 6) { 172 $('.api_lfm_next_playlist_start_day' + s_id[station_number] + '').html('Morgen'); 173 } else { 174 $('.api_lfm_next_playlist_start_day' + s_id[station_number] + '').html(weekdays[StationInfos.next_playlist.day]); 175 } 176 177 // Name der nächsten Playliste 178 $('.api_lfm_next_playlist_name' + s_id[station_number] + '').html(StationInfos.next_playlist.name); 179 180 // Startzeit der nächsten Playliste 181 var next_playlist_started_at_correct_format = StationInfos.next_playlist.started_at.replace(/\-/g,'/'); 182 var next_playlist_started_at_date = new Date(next_playlist_started_at_correct_format.substr(0, StationInfos.next_playlist.started_at.length-6)); 183 var next_playlist_started_at_h = next_playlist_started_at_date.getHours(); if (next_playlist_started_at_h < 10) { next_playlist_started_at_h = '0' + next_playlist_started_at_h }; 184 $('.api_lfm_next_playlist_started_at' + s_id[station_number] + '').html(next_playlist_started_at_h + uhrzeit_playlist); 185 186 // Endzeit der nächsten Playliste 187 var next_playlist_ends_at_correct_format = StationInfos.next_playlist.ends_at.replace(/\-/g,'/'); 188 var next_playlist_ends_at_date = new Date(next_playlist_ends_at_correct_format.substr(0, StationInfos.next_playlist.ends_at.length-6)); 189 var next_playlist_ends_at_h = next_playlist_ends_at_date.getHours(); if (next_playlist_ends_at_h < 10) { next_playlist_ends_at_h = '0' + next_playlist_ends_at_h }; 190 $('.api_lfm_next_playlist_ends_at' + s_id[station_number] + '').html(next_playlist_ends_at_h + uhrzeit_playlist); 191 192 // Beschreibung der nächsten Playliste 193 if (StationInfos.next_playlist.description) { 194 $('.api_lfm_next_playlist_description' + s_id[station_number] + '').html(StationInfos.next_playlist.description); 195 } else { 196 $('.api_lfm_next_playlist_description' + s_id[station_number] + '').html(''); 197 } 198 } 199 200 201 // Display-Name der Station 202 if (StationInfos.display_name) { 203 $('.api_lfm_station_display_name' + s_id[station_number] + '').html(StationInfos.display_name); 204 } else { 205 $('.api_lfm_station_display_name' + s_id[station_number] + '').html(StationInfos.name); 206 } 207 208 // Beschreibung der Station 209 if (StationInfos.description) { 210 $('.api_lfm_station_description' + s_id[station_number] + '').html(StationInfos.description); 211 } else { 212 $('.api_lfm_station_description' + s_id[station_number] + '').html(''); 213 } 214 215 // DJs der Station 216 if (StationInfos.djs) { 217 $('.api_lfm_station_djs' + s_id[station_number] + '').html(StationInfos.djs); 218 } else { 219 $('.api_lfm_station_djs' + s_id[station_number] + '').html(''); 220 } 221 222 // Genres der Station 223 if (obj.lfm_station_genres_symbol === undefined) { 224 var genres_symbol = '» '; 225 } else if (obj.lfm_station_genres_symbol.length > 0) { 226 var genres_symbol = obj.lfm_station_genres_symbol + ' '; 227 } else { 228 var genres_symbol = ''; 229 } 230 231 if (obj.lfm_station_genres_separator === undefined) { 232 var genres_separator = ', '; 233 } else if (obj.lfm_station_genres_separator.length > 0) { 234 var genres_separator = obj.lfm_station_genres_separator + ' '; 235 } else { 236 var genres_separator = ' '; 237 } 238 239 if (obj.lfm_station_genres_last_separator === undefined) { 240 var genres_last_separator = ' & '; 241 } else if (obj.lfm_station_genres_last_separator.length > 0) { 242 var genres_last_separator = ' ' + obj.lfm_station_genres_last_separator + ' '; 243 } else { 244 var genres_last_separator = ' '; 245 } 246 247 if (StationInfos.genres) { 248 if (obj.genre_option_out == 2) { 249 for (i=0; i<StationInfos.genres.length; i++) { 250 if (i == 0) { 251 var genres = StationInfos.genres[i]; 252 } else if (StationInfos.genres.length-1 == i) { 253 var genres = '<span style="padding-bottom:' + genres_distance +';">' + genres + genres_last_separator + StationInfos.genres[i] + '</span>'; 254 } else { 255 var genres = genres + '<span style="padding-bottom:' + genres_distance +';">' + genres_separator + StationInfos.genres[i] + '</span>'; 256 } 257 } 258 } else { 259 for (i=0; i<StationInfos.genres.length; i++) { 260 if (i == 0) { 261 var genres = '<div style="padding-bottom:' + genres_distance +';">' + genres_symbol + StationInfos.genres[i] + '</div>'; 262 } else { 263 var genres = genres + '<div style="padding-bottom:' + genres_distance +';">' + genres_symbol + StationInfos.genres[i] + '</div>'; 264 } 265 } 266 } 267 } else { 268 var genres = ''; 269 } 270 if (typeof genres === "undefined") { 271 $('.api_lfm_station_genres' + s_id[station_number] + '').html('Unbekannt'); 272 } else { 273 $('.api_lfm_station_genres' + s_id[station_number] + '').html(genres); 274 } 275 276 // Top-Artists der Station 277 if (obj.lfm_station_top_artists_symbol === undefined) { 278 var top_artists_symbol = '» '; 279 } else if (obj.lfm_station_top_artists_symbol.length > 0) { 280 var top_artists_symbol = obj.lfm_station_top_artists_symbol + ' '; 281 } else { 282 var top_artists_symbol = ''; 283 } 284 285 if (obj.lfm_station_top_artists_separator === undefined) { 286 var top_artists_separator = ', '; 287 } else if (obj.lfm_station_top_artists_separator.length > 0) { 288 var top_artists_separator = obj.lfm_station_top_artists_separator + ' '; 289 } else { 290 var top_artists_separator = ' '; 291 } 292 293 if (obj.lfm_station_top_artists_last_separator === undefined) { 294 var top_artists_last_separator = ' & '; 295 } else if (obj.lfm_station_top_artists_last_separator.length > 0) { 296 var top_artists_last_separator = ' ' + obj.lfm_station_top_artists_last_separator + ' '; 297 } else { 298 var top_artists_last_separator = ' '; 299 } 300 if (StationInfos.top_artists) { 301 if (StationInfos.top_artists.length >= obj.lfm_max_top_artists) { 302 if (obj.top_artists_option_out == 2) { 303 for (i=0; i<obj.lfm_max_top_artists; i++) { 304 if (i == 0) { 305 var top_artists = StationInfos.top_artists[i]; 306 } else if (obj.lfm_max_top_artists-1 == i) { 307 var top_artists = top_artists + top_artists_last_separator + StationInfos.top_artists[i]; 308 } else { 309 var top_artists = top_artists + top_artists_separator + StationInfos.top_artists[i]; 310 } 311 } 312 } else { 313 for (i=0; i<obj.lfm_max_top_artists; i++) { 314 if (i == 0) { 315 var top_artists = '<div style="padding-bottom:'+ top_artists_distance +';">' + top_artists_symbol + StationInfos.top_artists[i] + '</div>'; 316 } else { 317 var top_artists = top_artists + '<div style="padding-bottom:' + top_artists_distance +';">' + top_artists_symbol + StationInfos.top_artists[i] + '</div>'; 318 } 319 } 320 } 321 } else { 322 if (obj.top_artists_option_out == 2) { 323 for (i=0; i<StationInfos.top_artists.length; i++) { 324 if (i == 0) { 325 var top_artists = StationInfos.top_artists[i]; 326 } else if (StationInfos.top_artists.length-1 == i) { 327 var top_artists = top_artists + top_artists_last_separator + StationInfos.top_artists[i]; 328 } else { 329 var top_artists = top_artists + top_artists_separator + StationInfos.top_artists[i]; 330 } 331 } 332 } else { 333 for (i=0; i<StationInfos.top_artists.length; i++) { 334 if (i == 0) { 335 var top_artists = history_time + '<div style="padding-bottom:' + top_artists_distance +';">' + top_artists_symbol + ' - ' + StationInfos.top_artists[i] + '</div>'; 336 } else { 337 var top_artists = top_artists + '<div style="padding-bottom:' + top_artists_distance +';">' + top_artists_symbol + StationInfos.top_artists[i] + '</div>'; 338 } 339 } 340 } 341 } 342 } else { 343 var top_artists = ''; 344 } 345 if (typeof top_artists === "undefined") { 346 $('.api_lfm_station_top_artists' + s_id[station_number] + '').html('Unbekannt'); 347 } else { 348 $('.api_lfm_station_top_artists' + s_id[station_number] + '').html(top_artists); 349 } 350 } 351 }).fail(function(xhr, status, error) { 352 if (schedule_quelle === undefined || schedule_quelle === "standard") { 353 $('.api_lfm_current_playlist_name' + s_id[station_number] + '').html(obj.error_message); 354 $('.api_lfm_current_playlist_started_at' + s_id[station_number] + '').html(obj.error_message); 355 $('.api_lfm_current_playlist_ends_at' + s_id[station_number] + '').html(obj.error_message); 356 $('.api_lfm_current_playlist_description' + s_id[station_number] + '').html(obj.error_message); 357 $('.api_lfm_next_playlist_name' + s_id[station_number] + '').html(obj.error_message); 358 $('.api_lfm_next_playlist_started_at' + s_id[station_number] + '').html(obj.error_message); 359 $('.api_lfm_next_playlist_ends_at' + s_id[station_number] + '').html(obj.error_message); 360 $('.api_lfm_next_playlist_description' + s_id[station_number] + '').html(obj.error_message); 361 } 362 $('.api_lfm_station_display_name' + s_id[station_number] + '').html(obj.error_message); 363 $('.api_lfm_station_description' + s_id[station_number] + '').html(obj.error_message); 364 $('.api_lfm_station_djs' + s_id[station_number] + '').html(obj.error_message); 365 $('.api_lfm_station_genres' + s_id[station_number] + '').html(obj.error_message); 366 $('.api_lfm_station_top_artists' + s_id[station_number] + '').html(obj.error_message); 367
368 if (xhr.status == "404" && error == "Not Found") { 369 console.warn('Warning: /' + stations_array + ' does not exist'); 370 localStorage.setItem("lfm_next_attempt_after", next_check); 371 if(!localStorage.getItem('lfm_stations_with_errors')) { 372 LocalStorage_Stations.push(stations_array); 373 localStorage.setItem('lfm_stations_with_errors', JSON.stringify(LocalStorage_Stations)); 374 } else { 375 LocalStorage_Stations = JSON.parse(localStorage.getItem('lfm_stations_with_errors')); 376 LocalStorage_Stations.push(stations_array); 377 localStorage.setItem('lfm_stations_with_errors', JSON.stringify(LocalStorage_Stations)); 378 } 379 } else { 380 console.warn('Warning (API): Station infos reports: ' + xhr.status + ' ' + error + ' | Station name: /' + stations_array); 381 } 382 }); 383 384 // Current Song & Track-History 385 $.ajax({ 386 type: "GET", 387 url: "https://api.laut.fm/station/" + stations_array + "/last_songs", 388 dataType: "json", 389 timeout: timeout, 390 }).done(function(LastSongs) { 391 if (LastSongs.length >= 1) { 392 393 // Verlinkungen 394 var artist = LastSongs[0].artist.name 395 .replace("'","`") 396 .replace("~","-") 397 .replace("!","") 398 .replace("*","") 399 .replace("(","[") 400 .replace(")","]"); 401 var title = LastSongs[0].title 402 .replace("'","`") 403 .replace("~","-") 404 .replace("!","") 405 .replace("*","") 406 .replace("(","[") 407 .replace(")","]"); 408 var song_title = encodeURIComponent(artist + ' - ' + title); 409 410 var current_song_link = ''; 411 if (obj.link_amazon == true) { 412 current_song_link = current_song_link + "<span><a class='api_lfm_current_song_link' title='Amazon: " + artist + " - " + title +"' target='_blank' href='https://www.amazon.de/s?k=" + song_title + "&i=digital-music'>Amazon</a></span>"; 413 } 414 415 if (obj.link_apple == true) { 416 if (current_song_link.length >= 1) { 417 current_song_link = current_song_link + " / "; 418 } 419 current_song_link = current_song_link + "<span><a class='api_lfm_current_song_link' title='Apple Music: " + artist + " - " + title +"' target='_blank' href='https://music.apple.com/search?term=" + song_title + "'>Apple Music</a></span>"; 420 } 421 422 if (obj.link_youtube == true) { 423 if (current_song_link.length >= 1) { 424 current_song_link = current_song_link + " / "; 425 } 426 current_song_link = current_song_link + "<span><a class='api_lfm_current_song_link' title='YouTube: " + artist + " - " + title +"' target='_blank' href='https://www.youtube.com/results?search_query=" + song_title + "'>YouTube</a></span>"; 427 } 428 429 if (obj.link_spotify == true) { 430 if (current_song_link.length >= 1) { 431 current_song_link = current_song_link + " / "; 432 } 433 current_song_link = current_song_link + "<span><a class='api_lfm_current_song_link' title='Spotify: " + artist + " - " + title +"' target='_blank' href='https://open.spotify.com/search/" + song_title + "'>Spotify</a></span>"; 434 } 435 436 if (obj.link_laut == true) { 437 if (current_song_link.length >= 1) { 438 current_song_link = current_song_link + " / "; 439 } 440 current_song_link = current_song_link + "<span><a class='api_lfm_current_song_link' title='laut.de: " + artist + "' target='_blank' href='https://www.laut.de/Suche?q=" + artist + "'>laut.de</a></span>"; 441 } 442 if (LastSongs[0].type === "song") { 443 $('.api_lfm_current_song_links' + s_id[station_number] + '').html(current_song_link); 444 } else { 445 $('.api_lfm_current_song_links' + s_id[station_number] + '').html(''); 446 } 447 // Aktueller Track 448 $('.api_lfm_currentsong' + s_id[station_number] + '').html(LastSongs[0].artist.name + ' - ' + LastSongs[0].title); 449 450 // Aktueller Artist 451 $('.api_lfm_currentsong_artist' + s_id[station_number] + '').html(LastSongs[0].artist.name); 452 453 // Aktueller Titel 454 $('.api_lfm_currentsong_title' + s_id[station_number] + '').html(LastSongs[0].title); 455 456 // Album vom aktuellen Track 457 if (obj.lfm_station_current_song_album_text === undefined) { 458 var current_song_album_text = ''; 459 } else if (obj.lfm_station_current_song_album_text.length > 0) { 460 var current_song_album_text = obj.lfm_station_current_song_album_text + ' '; 461 } else { 462 var current_song_album_text = ''; 463 } 464 if (LastSongs[0].album) { 465 $('.api_lfm_currentsong_album' + s_id[station_number] + '').html(current_song_album_text + LastSongs[0].album); 466 } else { 467 $('.api_lfm_currentsong_album' + s_id[station_number] + '').html(''); 468 } 469 470 // Releaseyear vom aktuellen Track 471 if (obj.lfm_station_current_song_releaseyear_text === undefined) { 472 var current_song_releaseyear_text = ''; 473 } else if (obj.lfm_station_current_song_releaseyear_text.length > 0) { 474 var current_song_releaseyear_text = obj.lfm_station_current_song_releaseyear_text + ' '; 475 } else { 476 var current_song_releaseyear_text = ''; 477 } 478 if (LastSongs[0].releaseyear) { 479 $('.api_lfm_currentsong_releaseyear' + s_id[station_number] + '').html(current_song_releaseyear_text + LastSongs[0].releaseyear); 480 } else { 481 $('.api_lfm_currentsong_releaseyear' + s_id[station_number] + '').html(''); 482 } 483 484 // Station live? 485 if (LastSongs[0].live == true) { 486 $('.api_lfm_station_live' + s_id[station_number] + '').html(obj.lfm_station_live_txt); 487 $('.api_lfm_station_next_artists' + s_id[station_number] + '').html(obj.lfm_station_next_artists_live_txt); 488 } else { 489 $.ajax({
490 type: "GET", 491 url: "https://api.laut.fm/station/" + stations_array + "/next_artists", 492 dataType: "json", 493 timeout: timeout, 494 }).done(function(NextArtists) { 495 if (obj.lfm_station_next_artists_symbol === undefined) { 496 var next_artists_symbol = '» '; 497 } else if (obj.lfm_station_next_artists_symbol.length > 0) { 498 var next_artists_symbol = obj.lfm_station_next_artists_symbol + ' '; 499 } else { 500 var next_artists_symbol = ''; 501 } 502 503 if (obj.lfm_station_next_artists_separator === undefined) { 504 var next_artists_separator = ', '; 505 } else if (obj.lfm_station_next_artists_separator.length > 0) { 506 var next_artists_separator = obj.lfm_station_next_artists_separator + ' '; 507 } else { 508 var next_artists_separator = ' '; 509 } 510 511 if (obj.lfm_station_next_artists_last_separator === undefined) { 512 var next_artists_last_separator = ' & '; 513 } else if (obj.lfm_station_next_artists_last_separator.length > 0) { 514 var next_artists_last_separator = ' ' + obj.lfm_station_next_artists_last_separator + ' '; 515 } else { 516 var next_artists_last_separator = ' '; 517 } 518 if (obj.next_artists_option_out == 2) { 519 for (i=0; i<NextArtists.length; i++) { 520 if (i == 0) { 521 var next_artists = NextArtists[i].artist.name; 522 } else if (NextArtists.length-1 == i) { 523 var next_artists = next_artists + next_artists_last_separator + NextArtists[i].artist.name; 524 } else { 525 var next_artists = next_artists + next_artists_separator + NextArtists[i].artist.name; 526 } 527 } 528 } else { 529 for (i=0; i<NextArtists.length; i++) { 530 if (i == 0) { 531 var next_artists = '<div style="padding-bottom:' + next_artists_distance +';">' + next_artists_symbol + NextArtists[i].artist.name + '</div>'; 532 } else { 533 var next_artists = next_artists + '<div style="padding-bottom:' + next_artists_distance +';">' + next_artists_symbol + NextArtists[i].artist.name + '</div>'; 534 } 535 } 536 } 537 if (typeof next_artists === "undefined") { 538 $('.api_lfm_station_next_artists' + s_id[station_number] + '').html('Unbekannt'); 539 } else { 540 $('.api_lfm_station_next_artists' + s_id[station_number] + '').html(next_artists); 541 } 542 }).fail(function(xhr, status, error) { 543 $('.api_lfm_station_live' + s_id[station_number] + '').html(obj.error_message); 544 console.warn('Warning (API): Next Artists: ' + xhr.status + ' ' + error + ' | Station name: /' + stations_array); 545 546 }); 547 $('.api_lfm_station_live' + s_id[station_number] + '').html(obj.lfm_station_not_live_txt); 548 } 549 550 // Track-History 551 // for (i=1; i<parseInt(obj.lfm_max_history)+1; i++) { 552 var x=0; 553 for (i=1; i<10; i++) { 554 if (x === parseInt(obj.lfm_max_history)) { 555 break; 556 } 557 var artist = LastSongs[i].artist.name; 558 var title = LastSongs[i].title; 559 var song_title = encodeURIComponent(artist + ' - ' + title); 560 if (obj.history_link) { 561 var history_link = ''; 562 if (obj.link_amazon == true) { 563 history_link = history_link + "<span><a class='lfm_station_history_link' title='Amazon: " + artist + " - " + title +"' target='_blank' href='https://www.amazon.de/s?k=" + song_title + "&i=digital-music'>Amazon</a></span>"; 564 } 565 566 if (obj.link_apple == true) { 567 if (history_link.length >= 1) { 568 history_link = history_link + " / "; 569 } 570 history_link = history_link + "<span><a class='lfm_station_history_link' title='Apple Music: " + artist + " - " + title +"' target='_blank' href='https://music.apple.com/search?term=" + song_title + "'>Apple Music</a></span>"; 571 } 572 573 if (obj.link_youtube == true) { 574 if (history_link.length >= 1) { 575 history_link = history_link + " / "; 576 } 577 history_link = history_link + "<span><a class='lfm_station_history_link' title='YouTube: " + artist + " - " + title +"' target='_blank' href='https://www.youtube.com/results?search_query=" + song_title + "'>YouTube</a></span>"; 578 } 579 580 if (obj.link_spotify == true) { 581 if (history_link.length >= 1) { 582 history_link = history_link + " / "; 583 } 584 history_link = history_link + "<span><a class='lfm_station_history_link' title='Spotify: " + artist + " - " + title +"' target='_blank' href='https://open.spotify.com/search/" + song_title + "'>Spotify</a></span>"; 585 } 586 587 if (obj.link_laut == true) { 588 if (history_link.length >= 1) { 589 history_link = history_link + " / "; 590 } 591 history_link = history_link + "<span><a class='lfm_station_history_link' title='laut.de: " + artist + "' target='_blank' href='https://www.laut.de/Suche?q=" + artist + "'>laut.de</a></span>"; 592 } 593 if (LastSongs[i].type === "song") { 594 history_link = '<br><span class="lfm_station_history_links"><small>' + history_link + '</small></span>'; 595 } else { 596 history_link = ""; 597 } 598 } else { 599 history_link = ""; 600 } 601 602 var last_track_started_at_correct_format = LastSongs[i].started_at.replace(/\-/g,'/'); 603 var last_track_started_at_date = new Date(last_track_started_at_correct_format.substr(0, LastSongs[i].started_at.length-6)); 604 var last_track_started_at_h = last_track_started_at_date.getHours() < 10 ? '0' + last_track_started_at_date.getHours() : last_track_started_at_date.getHours(); 605 var last_track_started_at_m = last_track_started_at_date.getMinutes() < 10 ? '0' + last_track_started_at_date.getMinutes() : last_track_started_at_date.getMinutes(); 606 607 var last_track_end_at_correct_format = LastSongs[i].ends_at.replace(/\-/g,'/'); 608 var last_track_end_at_date = new Date(last_track_end_at_correct_format.substr(0, LastSongs[i].ends_at.length-6)); 609 var last_track_end_at_h = last_track_end_at_date.getHours() < 10 ? '0' + last_track_end_at_date.getHours() : last_track_end_at_date.getHours(); 610 var last_track_end_at_m = last_track_end_at_date.getMinutes() < 10 ? '0' + last_track_end_at_date.getMinutes() : last_track_end_at_date.getMinutes(); 611 612 if (obj.lfm_history_time_text === undefined) { 613 var uhrzeit_history = " Uhr"; 614 } else if (obj.lfm_history_time_text.length > 0){ 615 var uhrzeit_history = " " + obj.lfm_history_time_text; 616 } else { 617 var uhrzeit_history = obj.lfm_history_time_text; 618 } 619 var last_track_started_at = last_track_started_at_h + ':' + last_track_started_at_m; 620 var last_track_end_at = last_track_end_at_h + ':' + last_track_end_at_m; 621 622 623 if (obj.lfm_history_time == "start_and_end") { 624 var history_time = '<span class="lfm_station_history_time">' + last_track_started_at + " - " + last_track_end_at + uhrzeit_history + "</span><br>"; 625 } else if (obj.lfm_history_time == "start_at") { 626 var history_time = '<span class="lfm_station_history_time">' + last_track_started_at + uhrzeit_history + "</span><br>"; 627 } else { 628 var history_time = ''; 629 } 630 if (LastSongs[i].type == "song") { 631 632 } 633 if (LastSongs[i].type == "jingle" && obj.lfm_show_history_jingles == false) { 634 if (i == 1) { 635 var last_songs = ''; 636 } else { 637 var last_songs = last_songs + ''; 638 } 639 } else if (LastSongs[i].type == "news" && obj.lfm_show_history_news == false) { 640 if (i == 1) { 641 var last_songs = ''; 642 } else { 643 var last_songs = last_songs + ''; 644 } 645 } else if (LastSongs[i].type == "moderation" && obj.lfm_show_history_moderationen == false) { 646 if (i == 1) { 647 var last_songs = ''; 648 } else { 649 var last_songs = last_songs + ''; 650 } 651 } else { 652 if (lfm_station_history_order == 1) { 653 if (i == 1) { 654 var last_songs = history_time + '<div style="padding-bottom:' + history_distance +';">' + '<span class="lfm_station_history_artist">' + LastSongs[i].artist.name + '</span> ' + history_separator + ' ' + '<span class="lfm_station_history_title">' + LastSongs[i].title + '</span>' + history_link + '</div>'; 655 } else { 656 var last_songs = last_songs + '<div style="padding-bottom:' + history_distance +';">' + history_time + '<span class="lfm_station_history_artist">' + LastSongs[i].artist.name + '</span> ' + history_separator + ' ' + '<span class="lfm_station_history_title">' + LastSongs[i].title + '</span>' + history_link + '</div>'; 657 } 658 } else { 659 if (i == 1) { 660 var last_songs = history_time + '<div style="padding-bottom:' + history_distance +';">' + '<span class="lfm_station_history_title">' + LastSongs[i].title + '</span> ' + history_separator + ' ' + '<span class="lfm_station_history_artist">' + LastSongs[i].artist.name + '</span>' + history_link + '</div>'; 661 } else { 662 var last_songs = last_songs + '<div style="padding-bottom:' + history_distance +';">' + history_time + '<span class="lfm_station_history_title">' + LastSongs[i].title + '</span> ' + history_separator + ' ' + '<span class="lfm_station_history_artist">' + LastSongs[i].artist.name + '</span>' + history_link + '</div>'; 663 } 664 } 665 x++; 666 } 667 } 668 $('.api_lfm_station_last_songs_flex' + s_id[station_number] + '').html(last_songs); 669 } else { 670 $('.api_lfm_station_last_songs_flex' + s_id[station_number] + '').html('Unbekannt'); 671 } 672 }).fail(function(xhr, status, error) { 673 $('.api_lfm_currentsong' + s_id[station_number] + '').html(''); 674 $('.api_lfm_currentsong_artist' + s_id[station_number] + '').html(''); 675 $('.api_lfm_currentsong_title' + s_id[station_number] + '').html(''); 676 $('.api_lfm_currentsong_album' + s_id[station_number] + '').html(''); 677 $('.api_lfm_current_song_links' + s_id[station_number] + '').html(obj.error_message); 678 $('.api_lfm_currentsong_releaseyear' + s_id[station_number] + '').html(''); 679 $('.api_lfm_station_live' + s_id[station_number] + '').html(obj.error_message); 680 $('.api_lfm_station_next_artists' + s_id[station_number] + '').html(obj.error_message); 681 $('.api_lfm_station_last_songs_flex' + s_id[station_number] + '').html(obj.error_message); 682 console.warn('Warning (API): Last Songs reports: ' + xhr.status + ' ' + error + ' | Station name: /' + stations_array); 683 }); 684 685 // Sendeplan 686 $.ajax({
687 type: "GET", 688 url: "https://api.laut.fm/station/" + stations_array + "/schedule", 689 // url: "https://api.tools.paeddy.de/test.json", 690 dataType: "json", 691 timeout: timeout, 692 }).done(function(Schedule) { 693 694 // Aktuelle Playliste etc. 695 if (schedule_quelle === "schedule") { 696 // Serverzeit von laut fm abfragen 697 // $.ajax({ 698 // type: "GET", 699 // url: "https://api.laut.fm/time", 700 // // url: "https://api.tools.paeddy.de/time.json", 701 // dataType: "json", 702 // timeout: 3000, 703 // }).done(function(lfm_time) { 704 705 // var api_lfm_date = new Date(lfm_time.replaceAll('-', '\/')); 706 // var weekday = [0,1,2,3,4,5,6]; 707 // var get_day = (weekday[api_lfm_date.getDay()] || 7) - 1; 708 // var get_time = api_lfm_date.getHours(); 709 var groupLength = Schedule.length; 710 711 712 // const days = []; 713 // days['mon'] = 0; 714 // days['tue'] = 1; 715 // days['wed'] = 2; 716 // days['thu'] = 3; 717 // days['fri'] = 4; 718 // days['sat'] = 5; 719 // days['sun'] = 6; 720 721 Array.prototype.slice.call(Schedule).forEach(function(schedule_entry, index) { 722 723 if (get_time < 10) { 724 var time_current = '0' + get_time; 725 } else { 726 var time_current = get_time; 727 } 728 var current = get_day + "" + time_current; 729 730 if(index + 1 === groupLength) { 731 var entryindex = "TheEnd"; 732 if(Schedule[0].hour < 10) { 733 var ts_2 = days[Schedule[0].day] + "0" + Schedule[0].hour; 734 } else { 735 var ts_2 = days[Schedule[0].day] + "" + Schedule[0].hour; 736 } 737 } else { 738 var entryindex = (index + 1); 739 if (Schedule[index+1].hour < 10) { 740 var ts_2 = days[Schedule[index+1].day] + "0" + Schedule[index+1].hour; 741 } else { 742 var ts_2 = days[Schedule[index+1].day] + "" + Schedule[index+1].hour; 743 } 744 } 745 if (schedule_entry.hour < 10) { 746 var ts_1 = days[schedule_entry.day] + "0" + schedule_entry.hour; 747 } else { 748 var ts_1 = days[schedule_entry.day] + "" + schedule_entry.hour; 749 } 750 751 if(ts_1 <= current && ts_2 > current || ts_1 <= current && entryindex === "TheEnd") { 752 // Name der aktuellen Playliste 753 $('.api_lfm_current_playlist_name' + s_id[station_number] + '').html(schedule_entry.name); 754 // $('.tscurrent').html(current); 755 // $('.ts1').html(ts_1); 756 // $('.ts2').html(ts_2); 757 758 // Beginn (Wochentag) der aktuellen Playliste 759 $('.api_lfm_current_playlist_start_day' + s_id[station_number] + '').html(weekdays[schedule_entry.day]); 760 761 // Startzeit der aktuellen Playliste 762 var current_playlist_started_at_h = schedule_entry.hour; 763 if (current_playlist_started_at_h < 10) { current_playlist_started_at_h = '0' + current_playlist_started_at_h }; 764 $('.api_lfm_current_playlist_started_at' + s_id[station_number] + '').html(current_playlist_started_at_h + uhrzeit_playlist); 765 766 // Endzeit der aktuellen Playliste 767 if (schedule_entry.end_time === null) { 768 var current_playlist_ends_at_h = 0; 769 } else { 770 var current_playlist_ends_at_h = schedule_entry.end_time; 771 } 772 if (current_playlist_ends_at_h < 10) { current_playlist_ends_at_h = '0' + current_playlist_ends_at_h }; 773 $('.api_lfm_current_playlist_ends_at' + s_id[station_number] + '').html(current_playlist_ends_at_h + uhrzeit_playlist); 774 775 // Beschreibung der aktuellen Playliste 776 if (schedule_entry.description) { 777 $('.api_lfm_current_playlist_description' + s_id[station_number] + '').html(schedule_entry.description); 778 } else { 779 $('.api_lfm_current_playlist_description' + s_id[station_number] + '').html(''); 780 } 781 782 if (entryindex != "TheEnd") { 783 var next_pl = Schedule[entryindex]; 784 } else { 785 var next_pl = Schedule[0]; 786 } 787 788 // Name der nächsten Playliste 789 $('.api_lfm_next_playlist_name' + s_id[station_number] + '').html(next_pl.name); 790 791 // Beginn (Wochentag) der nächsten Playliste 792 if (days[next_pl.day] == (get_day)) { 793 $('.api_lfm_next_playlist_start_day' + s_id[station_number] + '').html('Heute'); 794 } else if (days[next_pl.day] == (get_day+1) || days[next_pl.day] == 0 && get_day == 6) { 795 $('.api_lfm_next_playlist_start_day' + s_id[station_number] + '').html('Morgen'); 796 } else { 797 $('.api_lfm_next_playlist_start_day' + s_id[station_number] + '').html(weekdays[next_pl.day]); 798 } 799 800 // Startzeit der nächsten Playliste 801 var next_playlist_started_at_h = next_pl.hour; 802 if (next_playlist_started_at_h < 10) { next_playlist_started_at_h = '0' + next_playlist_started_at_h }; 803 $('.api_lfm_next_playlist_started_at' + s_id[station_number] + '').html(next_playlist_started_at_h + uhrzeit_playlist); 804 805 // Endzeit der nächsten Playliste 806 if (next_pl.end_time === null) { 807 var next_playlist_ends_at_h = 0; 808 } else { 809 var next_playlist_ends_at_h = next_pl.end_time; 810 } 811 if (next_playlist_ends_at_h < 10) { next_playlist_ends_at_h = '0' + next_playlist_ends_at_h }; 812 $('.api_lfm_next_playlist_ends_at' + s_id[station_number] + '').html(next_playlist_ends_at_h + uhrzeit_playlist); 813 814 // Beschreibung der nächsten Playliste 815 if (next_pl.description) { 816 $('.api_lfm_next_playlist_description' + s_id[station_number] + '').html(next_pl.description); 817 } else { 818 $('.api_lfm_next_playlist_description' + s_id[station_number] + '').html(''); 819 } 820 } 821 822 823 });
824 // }).fail(function(xhr, status, error) { 825 826 // }); 827 } 828 829 830 if (obj.lfm_station_schedule_symbol === undefined) { 831 var schedule_symbol = ''; 832 } else if (obj.lfm_station_schedule_symbol.length > 0) { 833 var schedule_symbol = obj.lfm_station_schedule_symbol + ' '; 834 } else { 835 var schedule_symbol = ''; 836 } 837 if (obj.lfm_station_schedule_text === undefined) { 838 var uhrzeit_sendeplan = ':00 Uhr - '; 839 } else if (obj.lfm_station_schedule_text.length > 0){ 840 var uhrzeit_sendeplan = obj.lfm_station_schedule_text + ' - '; 841 } else { 842 var uhrzeit_sendeplan = ' - '; 843 } 844 845 for (i=0; i<Schedule.length; i++) { 846 var start_time = Schedule[i].hour; 847 if (start_time < 10) { start_time = '0' + start_time } 848 849 // Montag 850 if (Schedule[i].day == "mon") { 851 if (mon === undefined) { 852 var mon = '<span style="display: inline-block; padding-bottom:8px;">' + schedule_symbol + start_time + uhrzeit_sendeplan + Schedule[i].name + '</span>'; 853 } else { 854 var mon = mon + '<br><span style="display: inline-block; padding-bottom:8px;">' + schedule_symbol + start_time + uhrzeit_sendeplan + Schedule[i].name + '</span>'; 855 } 856 } 857 858 // Dienstag 859 if (Schedule[i].day == "tue") { 860 if (tue === undefined) { 861 var tue = '<span style="display: inline-block; padding-bottom:8px;">' + schedule_symbol + start_time + uhrzeit_sendeplan + Schedule[i].name + '</span>'; 862 } else { 863 var tue = tue + '<br><span style="display: inline-block; padding-bottom:8px;">' + schedule_symbol + start_time + uhrzeit_sendeplan + Schedule[i].name + '</span>'; 864 } 865 } 866 867 // Mittwoch 868 if (Schedule[i].day == "wed") { 869 if (wed === undefined) { 870 var wed = '<span style="display: inline-block; padding-bottom:8px;">' + schedule_symbol + start_time + uhrzeit_sendeplan + Schedule[i].name + '</span>'; 871 } else { 872 var wed = wed + '<br><span style="display: inline-block; padding-bottom:8px;">' + schedule_symbol + start_time + uhrzeit_sendeplan + Schedule[i].name + '</span>'; 873 } 874 } 875 876 // Donnerstag 877 if (Schedule[i].day == "thu") { 878 if (thu === undefined) { 879 var thu = '<span style="display: inline-block; padding-bottom:8px;">' + schedule_symbol + start_time + uhrzeit_sendeplan + Schedule[i].name + '</span>'; 880 } else { 881 var thu = thu + '<br><span style="display: inline-block; padding-bottom:8px;">' + schedule_symbol + start_time + uhrzeit_sendeplan + Schedule[i].name + '</span>'; 882 } 883 } 884 885 // Freitag 886 if (Schedule[i].day == "fri") { 887 if (fri === undefined) { 888 var fri = '<span style="display: inline-block; padding-bottom:8px;">' + schedule_symbol + start_time + uhrzeit_sendeplan + Schedule[i].name + '</span>'; 889 } else { 890 var fri = fri + '<br><span style="display: inline-block; padding-bottom:8px;">' + schedule_symbol + start_time + uhrzeit_sendeplan + Schedule[i].name + '</span>'; 891 } 892 } 893 894 // Samstag 895 if (Schedule[i].day == "sat") { 896 if (sat === undefined) { 897 var sat = '<span style="display: inline-block; padding-bottom:8px;">' + schedule_symbol + start_time + uhrzeit_sendeplan + Schedule[i].name + '</span>'; 898 } else { 899 var sat = sat + '<br><span style="display: inline-block; padding-bottom:8px;">' + schedule_symbol + start_time + uhrzeit_sendeplan + Schedule[i].name + '</span>'; 900 } 901 } 902 903 // Sonntag 904 if (Schedule[i].day == "sun") { 905 if (sun === undefined) { 906 var sun = '<span style="display: inline-block; padding-bottom:8px;">' + schedule_symbol + start_time + uhrzeit_sendeplan + Schedule[i].name + '</span>'; 907 } else { 908 var sun = sun + '<br><span style="display: inline-block; padding-bottom:8px;">' + schedule_symbol + start_time + uhrzeit_sendeplan + Schedule[i].name + '</span>'; 909 } 910 } 911 912 if (typeof mon === "undefined") { 913 $('.api_lfm_station_schedule_mon' + s_id[station_number] + '').html(obj.lfm_schedule_not_entry_txt); 914 } else { 915 $('.api_lfm_station_schedule_mon' + s_id[station_number] + '').html(mon); 916 } 917 918 if (typeof tue === "undefined") { 919 $('.api_lfm_station_schedule_tue' + s_id[station_number] + '').html(obj.lfm_schedule_not_entry_txt); 920 } else { 921 $('.api_lfm_station_schedule_tue' + s_id[station_number] + '').html(tue); 922 } 923 924 if (typeof wed === "undefined") { 925 $('.api_lfm_station_schedule_wed' + s_id[station_number] + '').html(obj.lfm_schedule_not_entry_txt); 926 } else { 927 $('.api_lfm_station_schedule_wed' + s_id[station_number] + '').html(wed); 928 } 929 930 if (typeof thu === "undefined") { 931 $('.api_lfm_station_schedule_thu' + s_id[station_number] + '').html(obj.lfm_schedule_not_entry_txt); 932 } else { 933 $('.api_lfm_station_schedule_thu' + s_id[station_number] + '').html(thu); 934 } 935 936 if (typeof fri === "undefined") { 937 $('.api_lfm_station_schedule_fri' + s_id[station_number] + '').html(obj.lfm_schedule_not_entry_txt); 938 } else { 939 $('.api_lfm_station_schedule_fri' + s_id[station_number] + '').html(fri); 940 } 941 942 if (typeof sat === "undefined") { 943 $('.api_lfm_station_schedule_sat' + s_id[station_number] + '').html(obj.lfm_schedule_not_entry_txt); 944 } else { 945 $('.api_lfm_station_schedule_sat' + s_id[station_number] + '').html(sat); 946 } 947 948 if (typeof sun === "undefined") { 949 $('.api_lfm_station_schedule_sun' + s_id[station_number] + '').html(obj.lfm_schedule_not_entry_txt); 950 } else { 951 $('.api_lfm_station_schedule_sun' + s_id[station_number] + '').html(sun); 952 } 953 } 954 955 // Playlists from current day 956 var schedule_day; 957 958 switch (new Date().getDay()) { 959 case 0: 960 schedule_day = sun; 961 break; 962 case 1: 963 schedule_day = mon; 964 break; 965 case 2: 966 schedule_day = tue; 967 break; 968 case 3: 969 schedule_day = wed; 970 break; 971 case 4: 972 schedule_day = thu; 973 break; 974 case 5: 975 schedule_day = fri; 976 break; 977 case 6: 978 schedule_day = sat; 979 break; 980 default: 981 schedule_day = "Unbekannter Fehler"; 982 } 983 $('.api_lfm_station_schedule_cur_day' + s_id[station_number] + '').html(schedule_day); 984 985 }).fail(function(xhr, status, error) { 986 if (schedule_quelle === "schedule") { 987 $('.api_lfm_current_playlist_name' + s_id[station_number] + '').html(obj.error_message); 988 $('.api_lfm_current_playlist_started_at' + s_id[station_number] + '').html(obj.error_message); 989 $('.api_lfm_current_playlist_ends_at' + s_id[station_number] + '').html(obj.error_message); 990 $('.api_lfm_current_playlist_description' + s_id[station_number] + '').html(obj.error_message); 991 $('.api_lfm_next_playlist_name' + s_id[station_number] + '').html(obj.error_message); 992 $('.api_lfm_next_playlist_started_at' + s_id[station_number] + '').html(obj.error_message); 993 $('.api_lfm_next_playlist_ends_at' + s_id[station_number] + '').html(obj.error_message); 994 $('.api_lfm_next_playlist_description' + s_id[station_number] + '').html(obj.error_message); 995 } 996 $('.api_lfm_station_schedule_mon' + s_id[station_number] + '').html(obj.error_message); 997 $('.api_lfm_station_schedule_tue' + s_id[station_number] + '').html(obj.error_message); 998 $('.api_lfm_station_schedule_wed' + s_id[station_number] + '').html(obj.error_message); 999 $('.api_lfm_station_schedule_thu' + s_id[station_number] + '').html(obj.error_message); 1000 $('.api_lfm_station_schedule_fri' + s_id[station_number] + '').html(obj.error_message); 1001 $('.api_lfm_station_schedule_sat' + s_id[station_number] + '').html(obj.error_message); 1002 $('.api_lfm_station_schedule_sun' + s_id[station_number] + '').html(obj.error_message); 1003 console.warn('Warning (API): Schedule reports: ' + xhr.status + ' ' + error + ' | Station name: /' + stations_array); 1004 }); 1005 1006 // Hörerzahl 1007 $.ajax({
1008 type: "GET", 1009 url: "https://api.laut.fm/station/" + stations_array + "/listeners", 1010 dataType: "json", 1011 timeout: timeout, 1012 }).done(function(Listeners) { 1013 if (typeof Listeners === "undefined") { 1014 $('.api_lfm_station_listeners' + s_id[station_number] + '').html('Unbekannt'); 1015 } else { 1016 $('.api_lfm_station_listeners' + s_id[station_number] + '').html(Listeners); 1017 } 1018 }).fail(function(xhr, status, error) { 1019 $('.api_lfm_station_listeners' + s_id[station_number] + '').html(obj.error_message); 1020 console.warn('Warning (API): Listeners reports: ' + xhr.status + ' ' + error + ' | Station name: /' + stations_array); 1021 }); 1022 // } 1023 }); 1024 }).fail(function(xhr, status, error) { 1025 }); 1026 } 1027 update_data(); 1028 setInterval(update_data, obj.refresh + '000'); 1029 }); 1030 } 1031});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.