Download app/Models/Video.php from ken1402/myiptv: direct link, hf CLI and curl.
- Browser
- Download file 1.25 kB
-
https://huggingface.co/spaces/ken1402/myiptv/resolve/main/app/Models/Video.php
- Command line
-
hf download hf://spaces/ken1402/myiptv/app/Models/Video.php
-
curl -L -o Video.php https://huggingface.co/spaces/ken1402/myiptv/resolve/main/app/Models/Video.php
1.25 kB
| namespace App\Models; | |
| use Illuminate\Database\Eloquent\Model; | |
| class Video extends Model | |
| { | |
| protected $fillable = [ | |
| 'title', | |
| 'name', | |
| 'path', | |
| 'size', | |
| 'duration', | |
| 'thumbnail', | |
| 'converted', | |
| 'hls_enabled', | |
| 'hls_playlist', | |
| 'hls_type', | |
| 'webViewLink', | |
| 'user_id' | |
| ]; | |
| protected $casts = [ | |
| 'size' => 'integer', | |
| 'duration' => 'float', | |
| 'converted' => 'boolean', | |
| 'hls_enabled' => 'boolean', | |
| 'created_at' => 'datetime', | |
| 'updated_at' => 'datetime', | |
| ]; | |
| public function user() | |
| { | |
| return $this->belongsTo(User::class); | |
| } | |
| public function getFormattedSizeAttribute() | |
| { | |
| $bytes = $this->size; | |
| $units = ['B', 'KB', 'MB', 'GB']; | |
| for ($i = 0; $bytes > 1024; $i++) { | |
| $bytes /= 1024; | |
| } | |
| return round($bytes, 2) . ' ' . $units[$i]; | |
| } | |
| public function getFormattedDurationAttribute() | |
| { | |
| $seconds = $this->duration; | |
| $hours = floor($seconds / 3600); | |
| $minutes = floor(($seconds % 3600) / 60); | |
| $secs = $seconds % 60; | |
| return sprintf('%02d:%02d:%02d', $hours, $minutes, $secs); | |
| } | |
| } | |