# Generated by Django 4.1 on 2022-08-25 13:16

import django.core.validators
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Downloader",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="创建时间"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, verbose_name="更新时间"),
                ),
                ("name", models.CharField(max_length=12, verbose_name="名称")),
                (
                    "category",
                    models.CharField(
                        choices=[("Qb", "qBittorrent")],
                        default="Qb",
                        max_length=128,
                        verbose_name="下载器",
                    ),
                ),
                ("username", models.CharField(max_length=16, verbose_name="用户名")),
                ("password", models.CharField(max_length=128, verbose_name="密码")),
                ("host", models.CharField(max_length=32, verbose_name="HOST")),
                (
                    "port",
                    models.IntegerField(
                        default=8999,
                        validators=[
                            django.core.validators.MaxValueValidator(65535),
                            django.core.validators.MinValueValidator(1001),
                        ],
                        verbose_name="端口",
                    ),
                ),
                (
                    "reserved_space",
                    models.IntegerField(
                        default=30,
                        help_text="单位GB，最小为1G，最大512G",
                        validators=[
                            django.core.validators.MinValueValidator(1),
                            django.core.validators.MaxValueValidator(512),
                        ],
                        verbose_name="预留磁盘空间",
                    ),
                ),
            ],
            options={"verbose_name": "下载器", "verbose_name_plural": "下载器",},
        ),
        migrations.CreateModel(
            name="MySite",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="创建时间"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, verbose_name="更新时间"),
                ),
                ("sort_id", models.IntegerField(default=1, verbose_name="排序")),
                ("user_id", models.CharField(max_length=16, verbose_name="用户ID")),
                ("passkey", models.CharField(max_length=128, verbose_name="PassKey")),
                ("cookie", models.TextField(verbose_name="COOKIE")),
                (
                    "hr",
                    models.BooleanField(
                        default=False, help_text="是否下载HR种子", verbose_name="开启HR下载"
                    ),
                ),
                (
                    "sign_in",
                    models.BooleanField(
                        default=True, help_text="是否开启签到", verbose_name="开启签到"
                    ),
                ),
                (
                    "search",
                    models.BooleanField(
                        default=True, help_text="是否开启搜索", verbose_name="开启搜索"
                    ),
                ),
                ("invitation", models.IntegerField(default=0, verbose_name="邀请资格")),
                (
                    "time_join",
                    models.DateTimeField(blank=True, null=True, verbose_name="注册时间"),
                ),
                (
                    "latest_active",
                    models.DateTimeField(blank=True, null=True, verbose_name="最近活动时间"),
                ),
                (
                    "sp_hour",
                    models.CharField(default="", max_length=8, verbose_name="时魔"),
                ),
                (
                    "my_level",
                    models.CharField(default="", max_length=16, verbose_name="用户等级"),
                ),
                (
                    "my_hr",
                    models.CharField(default="", max_length=16, verbose_name="H&R"),
                ),
                ("leech", models.IntegerField(default=0, verbose_name="当前下载")),
                ("seed", models.IntegerField(default=0, verbose_name="当前做种")),
                ("mail", models.IntegerField(default=0, verbose_name="新邮件")),
                ("publish", models.IntegerField(default=0, verbose_name="发布种子")),
            ],
            options={"verbose_name": "我的站点", "verbose_name_plural": "我的站点",},
        ),
        migrations.CreateModel(
            name="Site",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="创建时间"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, verbose_name="更新时间"),
                ),
                ("name", models.CharField(max_length=32, verbose_name="站点名称")),
                (
                    "url",
                    models.URLField(
                        default="", help_text='请保留网址结尾的"/"', verbose_name="站点网址"
                    ),
                ),
                (
                    "logo",
                    models.URLField(
                        default="", help_text="站点logo图标", verbose_name="站点logo"
                    ),
                ),
                (
                    "sign_in_support",
                    models.BooleanField(default=True, verbose_name="签到支持"),
                ),
                (
                    "get_torrent_support",
                    models.BooleanField(default=True, verbose_name="拉取首页种子"),
                ),
                (
                    "get_userinfo_support",
                    models.BooleanField(default=True, verbose_name="获取个人数据"),
                ),
                (
                    "search_support",
                    models.BooleanField(default=False, verbose_name="搜索支持"),
                ),
                (
                    "page_default",
                    models.CharField(
                        default="torrents.php", max_length=64, verbose_name="默认搜索页面"
                    ),
                ),
                (
                    "page_sign_in",
                    models.CharField(
                        default="attendance.php", max_length=64, verbose_name="默认签到链接"
                    ),
                ),
                (
                    "page_detail",
                    models.CharField(
                        default="details.php?id={}",
                        max_length=64,
                        verbose_name="详情页面链接",
                    ),
                ),
                (
                    "page_download",
                    models.CharField(
                        default="download.php?id={}",
                        max_length=64,
                        verbose_name="默认下载链接",
                    ),
                ),
                (
                    "page_user",
                    models.CharField(
                        default="userdetails.php?id={}",
                        max_length=64,
                        verbose_name="用户信息链接",
                    ),
                ),
                (
                    "page_search",
                    models.CharField(
                        default="torrents.php?search={}",
                        max_length=64,
                        verbose_name="搜索链接",
                    ),
                ),
                (
                    "page_leeching",
                    models.CharField(
                        default="getusertorrentlistajax.php?userid={}&type=leeching",
                        max_length=64,
                        verbose_name="当前下载信息",
                    ),
                ),
                (
                    "page_uploaded",
                    models.CharField(
                        default="getusertorrentlistajax.php?userid={}&type=uploaded",
                        max_length=64,
                        verbose_name="发布种子信息",
                    ),
                ),
                (
                    "page_seeding",
                    models.CharField(
                        default="getusertorrentlistajax.php?userid={}&type=seeding",
                        max_length=64,
                        verbose_name="当前做种信息",
                    ),
                ),
                (
                    "page_completed",
                    models.CharField(
                        default="getusertorrentlistajax.php?userid={}&type=completed",
                        max_length=64,
                        verbose_name="完成种子信息",
                    ),
                ),
                (
                    "page_mybonus",
                    models.CharField(
                        default="mybonus.php", max_length=64, verbose_name="魔力值页面"
                    ),
                ),
                (
                    "page_viewfilelist",
                    models.CharField(
                        default="viewfilelist.php?id={}",
                        max_length=64,
                        verbose_name="文件列表链接",
                    ),
                ),
                (
                    "page_viewpeerlist",
                    models.CharField(
                        default="viewpeerlist.php?id={}",
                        max_length=64,
                        verbose_name="当前用户列表",
                    ),
                ),
                (
                    "sign_in_method",
                    models.CharField(
                        default="get",
                        help_text="get或post，请使用小写字母，默认get",
                        max_length=5,
                        verbose_name="签到请求方法",
                    ),
                ),
                (
                    "sign_in_captcha",
                    models.BooleanField(
                        default=False, help_text="有签到验证码的站点请开启", verbose_name="签到验证码"
                    ),
                ),
                (
                    "sign_in_params",
                    models.CharField(
                        blank=True,
                        default="{}",
                        help_text="默认无参数",
                        max_length=128,
                        null=True,
                        verbose_name="签到请求参数",
                    ),
                ),
                (
                    "sign_in_headers",
                    models.CharField(
                        default="{}",
                        help_text='字典格式：{"accept":"application/json","c":"d"},默认无参数',
                        max_length=128,
                        verbose_name="签到请求头",
                    ),
                ),
                (
                    "hr",
                    models.BooleanField(
                        default=False, help_text="站点是否开启HR", verbose_name="H&R"
                    ),
                ),
                (
                    "hr_rate",
                    models.IntegerField(
                        default=2, help_text="站点要求HR种子的分享率，最小：1", verbose_name="HR分享率"
                    ),
                ),
                (
                    "hr_time",
                    models.IntegerField(
                        default=10,
                        help_text="站点要求HR种子最短做种时间，单位：小时",
                        verbose_name="HR时间",
                    ),
                ),
                (
                    "sp_full",
                    models.FloatField(default=0, help_text="时魔满魔", verbose_name="满魔"),
                ),
                (
                    "limit_speed",
                    models.IntegerField(
                        default=100,
                        help_text="站点盒子限速，家宽用户无需理会，单位：MB/S",
                        verbose_name="上传速度限制",
                    ),
                ),
                (
                    "torrents_rule",
                    models.CharField(
                        default='//table[@class="torrents"]/tr',
                        max_length=128,
                        verbose_name="种子行信息",
                    ),
                ),
                (
                    "name_rule",
                    models.CharField(
                        default='.//td[@class="embedded"]/a/b/text()',
                        max_length=128,
                        verbose_name="种子名称",
                    ),
                ),
                (
                    "title_rule",
                    models.CharField(
                        default=".//tr/td[1]/text()",
                        max_length=128,
                        verbose_name="种子标题",
                    ),
                ),
                (
                    "detail_url_rule",
                    models.CharField(
                        default='.//td[@class="embedded"]/a[contains(@href,"detail")]/@href',
                        max_length=128,
                        verbose_name="种子详情",
                    ),
                ),
                (
                    "category_rule",
                    models.CharField(
                        default='.//td[@class="rowfollow nowrap"][1]/a[1]/img/@class',
                        max_length=128,
                        verbose_name="分类",
                    ),
                ),
                (
                    "poster_rule",
                    models.CharField(
                        default=".//table/tr/td[1]/img/@src",
                        max_length=128,
                        verbose_name="海报",
                    ),
                ),
                (
                    "magnet_url_rule",
                    models.CharField(
                        default='.//td/a[contains(@href,"download")]/@href',
                        max_length=128,
                        verbose_name="下载链接",
                    ),
                ),
                (
                    "download_url_rule",
                    models.CharField(
                        default='.//a[contains(@href,"download.php?id=") and contains(@href,"passkey")]/@href',
                        max_length=128,
                        verbose_name="种子链接",
                    ),
                ),
                (
                    "size_rule",
                    models.CharField(
                        default=".//td[5]/text()", max_length=128, verbose_name="文件大小"
                    ),
                ),
                (
                    "hr_rule",
                    models.CharField(
                        default='.//table/tr/td/img[@class="hitandrun"]/@title',
                        max_length=128,
                        verbose_name="H&R",
                    ),
                ),
                (
                    "sale_rule",
                    models.CharField(
                        default='.//table/tr/td/img[contains(@class,"pro_")]/@alt',
                        max_length=128,
                        verbose_name="促销信息",
                    ),
                ),
                (
                    "sale_expire_rule",
                    models.CharField(
                        default=".//table/tr/td/font/span/@title",
                        max_length=128,
                        verbose_name="促销时间",
                    ),
                ),
                (
                    "release_rule",
                    models.CharField(
                        default=".//td[4]/span/@title",
                        max_length=128,
                        verbose_name="发布时间",
                    ),
                ),
                (
                    "seeders_rule",
                    models.CharField(
                        default=".//td[6]/b/a/text()",
                        max_length=128,
                        verbose_name="做种人数",
                    ),
                ),
                (
                    "leechers_rule",
                    models.CharField(
                        default=".//td[7]/b/a/text()",
                        max_length=128,
                        verbose_name="下载人数",
                    ),
                ),
                (
                    "completers_rule",
                    models.CharField(
                        default=".//td[8]/a/b/text()",
                        max_length=128,
                        verbose_name="完成人数",
                    ),
                ),
                (
                    "viewfilelist_rule",
                    models.CharField(
                        default=".//td/text()", max_length=128, verbose_name="解析文件结构"
                    ),
                ),
                (
                    "viewpeerlist_rule",
                    models.CharField(
                        default=".//tr/td[9]/nobr/text()",
                        max_length=128,
                        verbose_name="平均下载进度",
                    ),
                ),
                (
                    "peer_speed_rule",
                    models.CharField(
                        default=".//tr/td[5]/nobr/text()",
                        max_length=128,
                        verbose_name="平均上传速度",
                    ),
                ),
                (
                    "remark",
                    models.TextField(
                        blank=True, default="", null=True, verbose_name="备注"
                    ),
                ),
                (
                    "invitation_rule",
                    models.CharField(
                        default='//a[contains(@href,"invite.php?id=")]/following-sibling::text()[1]',
                        max_length=128,
                        verbose_name="邀请资格",
                    ),
                ),
                (
                    "time_join_rule",
                    models.CharField(
                        default='//td[contains(text(),"加入")]/following-sibling::td/span/@title',
                        max_length=128,
                        verbose_name="注册时间",
                    ),
                ),
                (
                    "latest_active_rule",
                    models.CharField(
                        default='//td[contains(text(),"最近动向")]/following-sibling::td/span/@title',
                        max_length=128,
                        verbose_name="最后活动时间",
                    ),
                ),
                (
                    "uploaded_rule",
                    models.CharField(
                        default='//font[@class="color_uploaded"]/following-sibling::text()[1]',
                        max_length=128,
                        verbose_name="上传量",
                    ),
                ),
                (
                    "downloaded_rule",
                    models.CharField(
                        default='//font[@class="color_downloaded"]/following-sibling::text()[1]',
                        max_length=128,
                        verbose_name="下载量",
                    ),
                ),
                (
                    "ratio_rule",
                    models.CharField(
                        default='//font[@class="color_ratio"][1]/following-sibling::text()[1]',
                        max_length=128,
                        verbose_name="分享率",
                    ),
                ),
                (
                    "my_sp_rule",
                    models.CharField(
                        default='//a[@href="mybonus.php"]/following-sibling::text()[1]',
                        max_length=128,
                        verbose_name="魔力值",
                    ),
                ),
                (
                    "hour_sp_rule",
                    models.CharField(
                        default='//div[contains(text(),"每小时能获取")]/text()[1]',
                        max_length=128,
                        verbose_name="时魔",
                    ),
                ),
                (
                    "my_bonus_rule",
                    models.CharField(
                        default='//font[@class="color_bonus" and contains(text(),"积分")]/following-sibling::text()[1]',
                        max_length=128,
                        verbose_name="保种积分",
                    ),
                ),
                (
                    "my_level_rule",
                    models.CharField(
                        default='//span[@class="medium"]/span[@class="nowrap"]/a[contains(@class,"_Name")]/@class',
                        max_length=128,
                        verbose_name="用户等级",
                    ),
                ),
                (
                    "my_hr_rule",
                    models.CharField(
                        default="//tr[14]/td[2]/a/text()",
                        max_length=128,
                        verbose_name="H&R",
                    ),
                ),
                (
                    "leech_rule",
                    models.CharField(
                        default='//img[@class="arrowdown"]/following-sibling::text()[1]',
                        max_length=128,
                        verbose_name="下载数量",
                    ),
                ),
                (
                    "seed_rule",
                    models.CharField(
                        default='//img[@class="arrowup"]/following-sibling::text()[1]',
                        max_length=128,
                        verbose_name="做种数量",
                    ),
                ),
                (
                    "record_count_rule",
                    models.CharField(
                        default="/html/body/b/text()",
                        max_length=128,
                        verbose_name="种子记录数",
                    ),
                ),
                (
                    "seed_vol_rule",
                    models.CharField(
                        default="//tr/td[3]",
                        help_text="需对数据做处理",
                        max_length=128,
                        verbose_name="做种大小",
                    ),
                ),
                (
                    "mailbox_rule",
                    models.CharField(
                        default='//a[@href="messages.php"]/following-sibling::text()[1]',
                        help_text="获取新邮件",
                        max_length=128,
                        verbose_name="邮件规则",
                    ),
                ),
                (
                    "hash_rule",
                    models.CharField(
                        default='//tr[11]//td[@class="no_border_wide"][2]/text()',
                        max_length=128,
                        verbose_name="种子HASH",
                    ),
                ),
            ],
            options={
                "verbose_name": "站点信息",
                "verbose_name_plural": "站点信息",
                "ordering": ["name"],
            },
        ),
        migrations.CreateModel(
            name="TorrentInfo",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="创建时间"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, verbose_name="更新时间"),
                ),
                (
                    "name",
                    models.CharField(default="", max_length=256, verbose_name="种子名称"),
                ),
                (
                    "title",
                    models.CharField(default="", max_length=256, verbose_name="标题"),
                ),
                (
                    "category",
                    models.CharField(default="", max_length=128, verbose_name="分类"),
                ),
                (
                    "poster_url",
                    models.URLField(default="", max_length=512, verbose_name="海报链接"),
                ),
                (
                    "detail_url",
                    models.URLField(default="", max_length=512, verbose_name="种子详情"),
                ),
                ("magnet_url", models.URLField(verbose_name="下载链接")),
                (
                    "download_url",
                    models.URLField(max_length=255, unique=True, verbose_name="种子链接"),
                ),
                ("size", models.IntegerField(default=0, verbose_name="文件大小")),
                (
                    "state",
                    models.BooleanField(
                        default=False, max_length=16, verbose_name="推送状态"
                    ),
                ),
                (
                    "save_path",
                    models.FilePathField(
                        default="/downloads/brush", verbose_name="保存路径"
                    ),
                ),
                ("hr", models.BooleanField(default=False, verbose_name="H&R")),
                (
                    "sale_status",
                    models.CharField(default="无促销", max_length=16, verbose_name="优惠状态"),
                ),
                (
                    "sale_expire",
                    models.CharField(default="无限期", max_length=32, verbose_name="到期时间"),
                ),
                (
                    "on_release",
                    models.CharField(default="", max_length=32, verbose_name="发布时间"),
                ),
                (
                    "seeders",
                    models.CharField(default="0", max_length=8, verbose_name="做种人数"),
                ),
                (
                    "leechers",
                    models.CharField(default="0", max_length=8, verbose_name="下载人数"),
                ),
                (
                    "completers",
                    models.CharField(default="0", max_length=8, verbose_name="完成人数"),
                ),
                (
                    "hash_string",
                    models.CharField(
                        default="", max_length=128, verbose_name="Info_hash"
                    ),
                ),
                (
                    "viewfilelist",
                    models.CharField(default="", max_length=128, verbose_name="文件列表"),
                ),
                (
                    "viewpeerlist",
                    models.FloatField(default=0, max_length=128, verbose_name="下载总进度"),
                ),
                (
                    "peer_list_speed",
                    models.FloatField(default=0, max_length=128, verbose_name="平均上传速度"),
                ),
                (
                    "downloader",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="pt_site.downloader",
                        verbose_name="下载器",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="pt_site.site",
                        verbose_name="所属站点",
                    ),
                ),
            ],
            options={"verbose_name": "种子管理", "verbose_name_plural": "种子管理",},
        ),
        migrations.CreateModel(
            name="SiteStatus",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="创建时间"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, verbose_name="更新时间"),
                ),
                (
                    "uploaded",
                    models.CharField(default="0", max_length=16, verbose_name="上传量"),
                ),
                (
                    "downloaded",
                    models.CharField(default="0", max_length=16, verbose_name="下载量"),
                ),
                ("ratio", models.FloatField(default=0, verbose_name="分享率")),
                ("my_sp", models.FloatField(default=0, verbose_name="魔力值")),
                ("my_bonus", models.FloatField(default=0, verbose_name="做种积分")),
                ("seed_vol", models.IntegerField(default=0, verbose_name="做种体积")),
                (
                    "site",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="pt_site.mysite",
                        verbose_name="站点名称",
                    ),
                ),
            ],
            options={"verbose_name": "我的数据", "verbose_name_plural": "我的数据",},
        ),
        migrations.CreateModel(
            name="SignIn",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="创建时间"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, verbose_name="更新时间"),
                ),
                (
                    "sign_in_today",
                    models.BooleanField(default=False, verbose_name="签到"),
                ),
                (
                    "site",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="pt_site.mysite",
                        verbose_name="站点名称",
                    ),
                ),
            ],
            options={"verbose_name": "签到", "verbose_name_plural": "签到",},
        ),
        migrations.AddField(
            model_name="mysite",
            name="site",
            field=models.OneToOneField(
                on_delete=django.db.models.deletion.CASCADE,
                to="pt_site.site",
                verbose_name="站点",
            ),
        ),
    ]
