impoort stuff!

This commit is contained in:
Lars Behrends
2025-10-24 16:04:34 +02:00
parent 73d8441787
commit 218d0c28c0
17 changed files with 3043 additions and 277 deletions

View File

@@ -25,9 +25,27 @@ class Game extends Model
'is_favorite',
'metadata',
'platform_achievements',
'platform_stats',
'source_id',
'last_played_at'
'background_image',
'cover_image',
'icon',
'genres_json',
'developers_json',
'publishers_json',
'tags_json',
'features_json',
'links_json',
'series_json',
'age_ratings_json',
'play_count',
'install_size',
'completion_status',
'critic_score',
'community_score',
'user_score',
'is_custom_game',
'installation_status',
'added_at',
'modified_at'
];
protected array $casts = [
@@ -39,7 +57,23 @@ class Game extends Model
'release_date' => 'date',
'last_played_at' => 'datetime',
'platform_achievements' => 'array',
'platform_stats' => 'array'
'critic_score' => 'int',
'community_score' => 'int',
'user_score' => 'int',
'play_count' => 'int',
'install_size' => 'int',
'installation_status' => 'int',
'is_custom_game' => 'bool',
'added_at' => 'datetime',
'modified_at' => 'datetime',
'genres_json' => 'array',
'developers_json' => 'array',
'publishers_json' => 'array',
'tags_json' => 'array',
'features_json' => 'array',
'links_json' => 'array',
'series_json' => 'array',
'age_ratings_json' => 'array'
];
public function source()
@@ -295,4 +329,110 @@ class Game extends Model
return $games;
}
/**
* Get Playnite-specific genres
*/
public function getGenres(): array
{
return $this->genres_json ?? [];
}
/**
* Get Playnite-specific developers
*/
public function getDevelopers(): array
{
return $this->developers_json ?? [];
}
/**
* Get Playnite-specific publishers
*/
public function getPublishers(): array
{
return $this->publishers_json ?? [];
}
/**
* Get Playnite-specific tags
*/
public function getTags(): array
{
return $this->tags_json ?? [];
}
/**
* Get Playnite-specific features
*/
public function getFeatures(): array
{
return $this->features_json ?? [];
}
/**
* Get Playnite-specific links
*/
public function getLinks(): array
{
return $this->links_json ?? [];
}
/**
* Get Playnite-specific series
*/
public function getSeries(): array
{
return $this->series_json ?? [];
}
/**
* Get Playnite-specific age ratings
*/
public function getAgeRatings(): array
{
return $this->age_ratings_json ?? [];
}
/**
* Get formatted install size
*/
public function getFormattedInstallSize(): string
{
if (!$this->install_size) {
return 'Unknown';
}
$units = ['B', 'KB', 'MB', 'GB', 'TB'];
$bytes = $this->install_size;
$i = 0;
while ($bytes >= 1024 && $i < count($units) - 1) {
$bytes /= 1024;
$i++;
}
return round($bytes, 2) . ' ' . $units[$i];
}
/**
* Get Steam store URL if available
*/
public function getSteamUrl(): ?string
{
if (!$this->steam_app_id) {
return null;
}
return "https://store.steampowered.com/app/{$this->steam_app_id}";
}
/**
* Check if game has rich Playnite data
*/
public function hasPlayniteData(): bool
{
return !empty($this->genres_json) || !empty($this->tags_json) ||
!empty($this->links_json) || !empty($this->background_image);
}
}