feat: update YouTube API integration with enhanced release date parsing, improved topic channel resolution, and localization updates for music productions
This commit is contained in:
@@ -67,8 +67,8 @@ class SyncYoutubeReleases extends Command
|
||||
}
|
||||
|
||||
$title = $release['title'] ?? __('music_productions.youtube_untitled_release');
|
||||
$releaseDate = filled($release['published_at'] ?? null)
|
||||
? Carbon::parse($release['published_at'])
|
||||
$releaseDate = filled($release['release_date'] ?? null)
|
||||
? Carbon::parse($release['release_date'])
|
||||
: null;
|
||||
$youtubeUrl = $release['youtube_url'] ?? null;
|
||||
$coverUrl = $release['cover_url'] ?? null;
|
||||
@@ -121,7 +121,7 @@ class SyncYoutubeReleases extends Command
|
||||
$attributes['title'] = $title;
|
||||
}
|
||||
|
||||
if (blank($production->production_date) && $releaseDate) {
|
||||
if ($releaseDate) {
|
||||
$attributes['production_date'] = $releaseDate;
|
||||
}
|
||||
|
||||
@@ -171,11 +171,16 @@ class SyncYoutubeReleases extends Command
|
||||
|
||||
$slug = Str::slug($title);
|
||||
|
||||
$bySlug = MusicProduction::where('slug', '=', $slug, 'and')->first();
|
||||
$bySlug = MusicProduction::whereNull('youtube_video_id')
|
||||
->where('slug', '=', $slug, 'and')
|
||||
->first();
|
||||
|
||||
if ($bySlug) {
|
||||
return $bySlug;
|
||||
}
|
||||
|
||||
return MusicProduction::whereRaw('LOWER(title) = ?', [Str::lower($title)], 'and')->first();
|
||||
return MusicProduction::whereNull('youtube_video_id')
|
||||
->whereRaw('LOWER(title) = ?', [Str::lower($title)], 'and')
|
||||
->first();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user