Add file hash to things
Hehehe we have plans now
This commit is contained in:
parent
e058faf49e
commit
f87bdc7d35
@ -11,8 +11,8 @@ class OdyseeChannelAdmin(admin.ModelAdmin):
|
||||
|
||||
@admin.register(OdyseeRelease)
|
||||
class OdyseeReleaseAdmin(admin.ModelAdmin):
|
||||
list_display = ['name', 'channel', 'released', 'url', 'id']
|
||||
search_fields = ['name', 'url']
|
||||
list_display = ['name', 'channel', 'released', 'filehash', 'id']
|
||||
search_fields = ['name', 'url', 'filehash']
|
||||
ordering = ['channel', 'name', 'released']
|
||||
list_filter = ['channel', 'tags', 'released']
|
||||
|
||||
|
@ -25,9 +25,10 @@ class Command(BaseCommand):
|
||||
channel = channel,
|
||||
name = data['title'],
|
||||
description = data['description'],
|
||||
released = datetime.datetime.utcfromtimestamp(int(data['publishdate'])).strftime("%Y-%m-%d"),
|
||||
released = datetime.datetime.utcfromtimestamp(data['publishdate']).strftime("%Y-%m-%d"),
|
||||
url = data['url'],
|
||||
thumbnail = data['thumbnail'],
|
||||
filehash = data['filehash']
|
||||
)
|
||||
self.stdout.write(f'Imported release: {str(channel)} - {data['title']}')
|
||||
updates += 1
|
||||
|
20
odyseescraper/migrations/0006_odyseerelease_released.py
Normal file
20
odyseescraper/migrations/0006_odyseerelease_released.py
Normal file
@ -0,0 +1,20 @@
|
||||
# Generated by Django 5.1.5 on 2025-01-24 08:56
|
||||
|
||||
import django.utils.timezone
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('odyseescraper', '0005_odyseechannel_description'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='odyseerelease',
|
||||
name='released',
|
||||
field=models.DateField(default=django.utils.timezone.now),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
19
odyseescraper/migrations/0007_odyseerelease_filehash.py
Normal file
19
odyseescraper/migrations/0007_odyseerelease_filehash.py
Normal file
@ -0,0 +1,19 @@
|
||||
# Generated by Django 5.1.5 on 2025-01-24 09:11
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('odyseescraper', '0006_odyseerelease_released'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='odyseerelease',
|
||||
name='filehash',
|
||||
field=models.CharField(default='', max_length=512),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
@ -28,6 +28,7 @@ class OdyseeRelease(models.Model):
|
||||
released = models.DateField()
|
||||
url = models.URLField(max_length=512)
|
||||
thumbnail = models.URLField(max_length=512)
|
||||
filehash = models.CharField(max_length=512)
|
||||
|
||||
tags = models.ManyToManyField(Tag)
|
||||
|
||||
|
@ -51,7 +51,8 @@ def odysee_get_releases(handle):
|
||||
"publishdate": int(item["value"].get("release_time", 0)),
|
||||
"description": item["value"].get("description", "No description provided for this release"),
|
||||
"thumbnail": item["value"].get("thumbnail", {}).get("url", ""),
|
||||
"url": f"{odysee_get_channel_url(handle)}/{item['name']}"
|
||||
"url": f"{odysee_get_channel_url(handle)}/{item['name']}",
|
||||
"filehash": item["value"].get("source", {}).get("hash", "NOHASH")
|
||||
}
|
||||
if i == lastpage:
|
||||
break
|
||||
|
Loading…
x
Reference in New Issue
Block a user