ya trash
This commit is contained in:
1 parent
ef3fa2b0c7
commit
1ce449320c
75 files changed
+103953
-1264
No files matched your search
@@ -0,0 +1,65 @@
|
||||
import asyncio
|
||||
|
||||
# import os
|
||||
|
||||
|
||||
# async def image_magick_resize(input_file, size):
|
||||
# s = '%dx%d' % size
|
||||
# name = '{s}-{name}'.format(s=s, name=os.path.basename(input_file))
|
||||
# output_file = os.path.join('/Users/tmshv/Pyasync/', name)
|
||||
#
|
||||
# cmd = [
|
||||
# '/usr/local/bin/convert', '"%s"' % input_file,
|
||||
# '-strip',
|
||||
# '-auto-orient',
|
||||
# '-resize', s,
|
||||
# '-quality', '85',
|
||||
# '"%s"' % output_file,
|
||||
# ]
|
||||
#
|
||||
# cmd = ' '.join(cmd)
|
||||
# await asyncio.create_subprocess_shell(cmd)
|
||||
from sync.models.Image import create_image, default_url_factory
|
||||
|
||||
|
||||
async def resize(input_file):
|
||||
# from utils.image import image_magick_resize
|
||||
sizes = [
|
||||
('a', 1880, 1900),
|
||||
('b', 10, 10),
|
||||
('c', 5, 5),
|
||||
]
|
||||
|
||||
await create_image(input_file, sizes, default_url_factory, '/Users/tmshv')
|
||||
|
||||
# for size in sizes:
|
||||
# await image_magick_resize(input_file, '/Users/tmshv/AAA-{}.jpg'.format(size), size)
|
||||
|
||||
|
||||
async def run():
|
||||
from sync.data import request
|
||||
|
||||
files = {'file': open('/Users/tmshv/Downloads/39174605.png', 'rb')}
|
||||
|
||||
data = {
|
||||
'file': files
|
||||
}
|
||||
|
||||
# await request.put('https://static.shlisselburg.org/upload/art/uploads/test.jpg', data)
|
||||
await request.put('http://localhost:8080/upload/art/uploads/test.jpg', data)
|
||||
|
||||
# await asyncio.wait([
|
||||
# resize('/Users/tmshv/Yandex.Disk.localized/Hudozka/Trash/Cats/Photo 26-01-15 18 07 39.jpg'),
|
||||
#
|
||||
# # resize('/Users/tmshv/Yandex.Disk.localized/Hudozka/Trash/Cats/Photo 26-01-15 18 07 54.jpg'),
|
||||
# # resize('/Users/tmshv/Yandex.Disk.localized/Hudozka/Trash/Cats/Photo 26-01-15 18 08 14.jpg'),
|
||||
# # resize('/Users/tmshv/Yandex.Disk.localized/Hudozka/Trash/Cats/Photo 26-01-15 18 08 18.jpg'),
|
||||
# # resize('/Users/tmshv/Yandex.Disk.localized/Hudozka/Trash/Cats/Photo 26-01-15 18 08 30.jpg'),
|
||||
# # resize('/Users/tmshv/Yandex.Disk.localized/Hudozka/Trash/Cats/Photo 26-01-15 18 09 04.jpg'),
|
||||
# ])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.run_until_complete(run())
|
||||
loop.close()
|
||||
Reference in new issue
Block a user