<commit_before><?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\File;
use App\Copyable;
use App\SharedCopyableLogic;
use App\FormattingHelpers;

class TorrentEntry extends Model implements Copyable
{
    use SharedCopyableLogic;
    use FormattingHelpers;

    protected $guarded = [];

    protected $casts = [
        'was_copied' => 'boolean',
    ];

    protected $diskName = 'torrents';

    public function formattedEta()
    {
        if ($this->isStillDownloading()) {
            return intval($this->eta / 60) . 'min';
        }
        return 'Done';
    }

    public function isStillDownloading()
    {
        return $this->eta >= 0;
    }

    public function wasAlreadyCopied()
    {
        return $this->was_copied;
    }

    public function isFile()
    {
        return File::isFile($this->path);
    }

    public function isDirectory()
    {
        return ! $this->isFile();
    }

    public function getBasename()
    {
        return File::basename($this->path);
    }

    public function getFullPath()
    {
        return $this->path;
    }

    public function getPath()
    {
        return $this->getBasename();
    }
}
<commit_msg>Fix ETA display and possibly better checking of completed status<commit_after><?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\File;
use App\Copyable;
use App\SharedCopyableLogic;
use App\FormattingHelpers;

class TorrentEntry extends Model implements Copyable
{
    use SharedCopyableLogic;
    use FormattingHelpers;

    protected $guarded = [];

    protected $casts = [
        'was_copied' => 'boolean',
    ];

    protected $diskName = 'torrents';

    public function formattedEta()
    {
        if ($this->isComplete()) {
            return 'Done';
        }

        $mins = intval($this->eta / 60);
        if ($mins < 60) {
            return $mins . 'min';
        }

        $hours = intval($mins / 60);
        $mins = $mins % 60;
        return "{$hours}hr {$mins}mins";
    }

    public function isStillDownloading()
    {
        return $this->percent < 1.0;
    }

    public function isComplete()
    {
        return ! $this->isStillDownloading();
    }

    public function wasAlreadyCopied()
    {
        return $this->was_copied;
    }

    public function isFile()
    {
        return File::isFile($this->path);
    }

    public function isDirectory()
    {
        return ! $this->isFile();
    }

    public function getBasename()
    {
        return File::basename($this->path);
    }

    public function getFullPath()
    {
        return $this->path;
    }

    public function getPath()
    {
        return $this->getBasename();
    }
}

{'fraction_non_alphanumeric': 0.12001463593121112, 'fraction_numerical': 0.004756677643615075, 'mean_word_length': 2.231678486997636, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3583065', 'n_tokens_mistral': 867, 'n_tokens_neox': 829, 'n_words': 186}