mirror of
https://github.com/9001/copyparty.git
synced 2026-03-24 17:13:01 +10:00
initial thumbnail and icon stuff
This commit is contained in:
21
copyparty/th_cli.py
Normal file
21
copyparty/th_cli.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
|
||||
from .th_srv import thumb_path, THUMBABLE
|
||||
|
||||
|
||||
class ThumbCli(object):
|
||||
def __init__(self, broker):
|
||||
self.broker = broker
|
||||
self.args = broker.args
|
||||
|
||||
def get(self, ptop, rem, mtime):
|
||||
ext = rem.rsplit(".")[-1].lower()
|
||||
if ext not in THUMBABLE:
|
||||
return None
|
||||
|
||||
tpath = thumb_path(ptop, rem, mtime)
|
||||
if os.path.exists(tpath):
|
||||
return tpath
|
||||
|
||||
x = self.broker.put(True, "thumbsrv.get", ptop, rem, mtime)
|
||||
return x.get()
|
||||
Reference in New Issue
Block a user