mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-24 05:56:37 +00:00
Update media.py
This commit is contained in:
parent
4cd2178edb
commit
004d98efa5
@ -37,20 +37,10 @@ from ..choices import ( Val, CapChoices, Fallback, FileExtension,
|
|||||||
SponsorBlock_Category, YouTube_AudioCodec,
|
SponsorBlock_Category, YouTube_AudioCodec,
|
||||||
YouTube_SourceType, YouTube_VideoCodec)
|
YouTube_SourceType, YouTube_VideoCodec)
|
||||||
from .source import Source
|
from .source import Source
|
||||||
from .misc import media_file_storage, _srctype_dict
|
from .misc import (
|
||||||
|
media_file_storage, _srctype_dict,
|
||||||
def get_media_thumb_path(instance, filename):
|
get_media_thumb_path, get_media_file_path,
|
||||||
# we don't want to use alternate names for thumb files
|
)
|
||||||
if instance.thumb:
|
|
||||||
instance.thumb.delete(save=False)
|
|
||||||
fileid = str(instance.uuid).lower()
|
|
||||||
filename = f'{fileid}.jpg'
|
|
||||||
prefix = fileid[:2]
|
|
||||||
return Path('thumbs') / prefix / filename
|
|
||||||
|
|
||||||
|
|
||||||
def get_media_file_path(instance, filename):
|
|
||||||
return instance.filepath
|
|
||||||
|
|
||||||
|
|
||||||
class Media(models.Model):
|
class Media(models.Model):
|
||||||
|
Loading…
Reference in New Issue
Block a user