Fixed API customization bug

Show-buddy feature was breaking API calls
Added snow on front-page
This commit is contained in:
aunefyren 2021-11-18 19:10:23 +01:00
parent 5593c3200f
commit ceb04fef3c
6 changed files with 72 additions and 16 deletions

2
.gitignore vendored
View file

@ -1,4 +1,4 @@
config/wrapped.log
config/config.json
config/config.json
config/cache.json

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>

View file

@ -167,55 +167,56 @@ if($config->get_user_movie_stats || $config->get_user_show_stats || $config->get
if($config->get_user_movie_stats) {
$user_movies = array("data" => $user_stats["movies"], "message" => "Success. User movie-stats are loaded.", "error" => False);
} else {
$user_movies = array("error" => True, "message" => "Disabled in config.");
$user_movies = array("error" => True, "message" => "Disabled in config.", "data" => array());
}
if($config->get_user_show_stats) {
$user_shows = array("data" => $user_stats["shows"], "message" => "Success. User show-stats are loaded.", "error" => False);
} else {
$user_shows = array("error" => True, "message" => "Disabled in config.");
$user_shows = array("error" => True, "message" => "Disabled in config.", "data" => array());
}
if($config->get_user_show_stats) {
$user_music = array("data" => $user_stats["music"], "message" => "Success. User music-stats are loaded.", "error" => False);
} else {
$user_music = array("error" => True, "message" => "Disabled in config.");
$user_music = array("error" => True, "message" => "Disabled in config.", "data" => array());
}
if($config->get_year_stats_movies) {
$year_movies = array("data" => $user_stats["year_movies"], "message" => "Success. User movie-year-stats are loaded.", "error" => False);
} else {
$year_movies = array("error" => True, "message" => "Disabled in config.");
$year_movies = array("error" => True, "message" => "Disabled in config.", "data" => array());
}
if($config->get_year_stats_shows) {
$year_shows = array("data" => $user_stats["year_shows"], "message" => "Success. User show-year-stats are loaded.", "error" => False);
} else {
$year_shows = array("error" => True, "message" => "Disabled in config.");
$year_shows = array("error" => True, "message" => "Disabled in config.", "data" => array());
}
if($config->get_year_stats_music) {
$year_music = array("data" => $user_stats["year_music"], "message" => "Success. User music-year-stats are loaded.", "error" => False);
} else {
$year_music = array("error" => True, "message" => "Disabled in config.");
$year_music = array("error" => True, "message" => "Disabled in config.", "data" => array());
}
if(($config->get_year_stats_movies || $config->get_year_stats_shows || $config->get_year_stats_music) && $config->get_year_stats_leaderboard ) {
$year_users = array("data" => $user_stats["year_users"], "message" => "Success. User year-stats are loaded.", "error" => False);
} else {
$year_users = array("error" => True, "message" => "Disabled in config.");
$year_users = array("error" => True, "message" => "Disabled in config.", "data" => array());
}
} else {
$user_movies = array("error" => True, "message" => "Disabled in config.");
$user_shows = array("error" => True, "message" => "Disabled in config.");
$user_music = array("error" => True, "message" => "Disabled in config.");
$year_movies = array("error" => True, "message" => "Disabled in config.");
$year_shows = array("error" => True, "message" => "Disabled in config.");
$year_music = array("error" => True, "message" => "Disabled in config.");
$year_users = array("error" => True, "message" => "Disabled in config.");
$user_movies = array("error" => True, "message" => "Disabled in config.", "data" => array());
$user_shows = array("error" => True, "message" => "Disabled in config.", "data" => array());
$user_music = array("error" => True, "message" => "Disabled in config.", "data" => array());
$year_movies = array("error" => True, "message" => "Disabled in config.", "data" => array());
$year_shows = array("error" => True, "message" => "Disabled in config.", "data" => array());
$year_music = array("error" => True, "message" => "Disabled in config.", "data" => array());
$year_users = array("error" => True, "message" => "Disabled in config.", "data" => array());
}
//GET SHOW BUDDY
if($config->get_year_stats_shows && $config->get_user_show_buddy && count($user_shows["data"]["shows"]) > 0) {
log_activity($id, "Getting show buddy");
$user_shows["data"] = $user_shows["data"] + array("show_buddy" => data_get_user_show_buddy($id, $user_shows["data"]["shows"][0]["title"], $tautulli_data));
@ -223,6 +224,7 @@ if($config->get_year_stats_shows && $config->get_user_show_buddy && count($user_
$user_shows["data"] = $user_shows["data"] + array("show_buddy" => array("message" => "Disabled in config.", "error" => True));
}
//GET CURRENT DATE
$now = new DateTime('NOW');
// Log wrapped create

View file

@ -398,4 +398,14 @@ input[type="checkbox" i] {
height: 2em;
color: white;
text-align: center;
}
}
/*Snowflakes*/
.snowflake {
color: #fff;
font-size: 1em;
font-family: Arial;
text-shadow: 0 0 1px #000;
}
@-webkit-keyframes snowflakes-fall{0%{top:-10%}100%{top:100%}}@-webkit-keyframes snowflakes-shake{0%{-webkit-transform:translateX(0px);transform:translateX(0px)}50%{-webkit-transform:translateX(80px);transform:translateX(80px)}100%{-webkit-transform:translateX(0px);transform:translateX(0px)}}@keyframes snowflakes-fall{0%{top:-10%}100%{top:100%}}@keyframes snowflakes-shake{0%{transform:translateX(0px)}50%{transform:translateX(80px)}100%{transform:translateX(0px)}}.snowflake{position:fixed;top:-10%;z-index:9999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default;-webkit-animation-name:snowflakes-fall,snowflakes-shake;-webkit-animation-duration:10s,3s;-webkit-animation-timing-function:linear,ease-in-out;-webkit-animation-iteration-count:infinite,infinite;-webkit-animation-play-state:running,running;animation-name:snowflakes-fall,snowflakes-shake;animation-duration:10s,3s;animation-timing-function:linear,ease-in-out;animation-iteration-count:infinite,infinite;animation-play-state:running,running}.snowflake:nth-of-type(0){left:1%;-webkit-animation-delay:0s,0s;animation-delay:0s,0s}.snowflake:nth-of-type(1){left:10%;-webkit-animation-delay:1s,1s;animation-delay:1s,1s}.snowflake:nth-of-type(2){left:20%;-webkit-animation-delay:6s,.5s;animation-delay:6s,.5s}.snowflake:nth-of-type(3){left:30%;-webkit-animation-delay:4s,2s;animation-delay:4s,2s}.snowflake:nth-of-type(4){left:40%;-webkit-animation-delay:2s,2s;animation-delay:2s,2s}.snowflake:nth-of-type(5){left:50%;-webkit-animation-delay:8s,3s;animation-delay:8s,3s}.snowflake:nth-of-type(6){left:60%;-webkit-animation-delay:6s,2s;animation-delay:6s,2s}.snowflake:nth-of-type(7){left:70%;-webkit-animation-delay:2.5s,1s;animation-delay:2.5s,1s}.snowflake:nth-of-type(8){left:80%;-webkit-animation-delay:1s,0s;animation-delay:1s,0s}.snowflake:nth-of-type(9){left:90%;-webkit-animation-delay:3s,1.5s;animation-delay:3s,1.5s}

View file

@ -17,6 +17,7 @@ function get_stats() {
if (this.readyState == 4 && (this.status == 200 || this.status == 400 || this.status == 500)) {
try {
var result= JSON.parse(this.responseText);
document.getElementById('snowflakes').style.display = 'none';
} catch(error) {
document.getElementById('results_error').innerHTML = '<p style="color:inherit; text-shadow: none;">' + "API response can't be parsed." + '</p>';
console.log('Error: ' + error);

View file

@ -78,6 +78,39 @@
</div>
</div>
<div class="snowflakes" aria-hidden="true" id="snowflakes">
<div class="snowflake">
</div>
<div class="snowflake">
</div>
<div class="snowflake">
</div>
<div class="snowflake">
</div>
<div class="snowflake">
</div>
<div class="snowflake">
</div>
<div class="snowflake">
</div>
<div class="snowflake">
</div>
<div class="snowflake">
</div>
<div class="snowflake">
</div>
</div>
</div>
</div>