$status) { $season_path = seriesPath($series) . '/Season ' . $season; $monitored = $data[ 'season_' . $season ]; $monitored_path = $season_path . '/season_done'; if ($monitored) { if (file_exists($monitored_path)) { unlink($monitored_path); } } else { if (!file_exists($monitored_path)) { touch($monitored_path); } } $url = $data[ 'url_' . $season ]; $url_path = $season_path . '/url'; if ($url) { if (isMonitored($season_path)) { file_put_contents($url_path, $url . "\n"); } } else { if ($seasons_last[ $season ] && isMonitored($season_path)) { if (file_exists($url_path)) { unlink($url_path); } } } } } # Add the specified season folder function addSeason($series, $season) { # Ensure the series exists if (!seriesExists($series)) { die('Invalid series: ' . htmlspecialchars($series) . "\n"); } # Ensure the season does not exist $season_path = seriesPath($series) . '/Season ' . intval($season); if (file_exists($season_path)) { die('Invalid season: ' . htmlspecialchars($season) . "\n"); } # Create the directory mkdir($season_path); } # Remove the specified season folder, if possible (i.e. if empty) function delSeason($series, $season) { # Ensure the series exists if (!seriesExists($series)) { die('Invalid series: ' . htmlspecialchars($series) . "\n"); } # Ensure the season exists $season_path = seriesPath($series) . '/Season ' . intval($season); if (!file_exists($season_path)) { die('Invalid season: ' . htmlspecialchars($season) . "\n"); } # Remove the directory (or fail silently) @rmdir($season_path); } ?>