webpfix
This commit is contained in:
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
@@ -0,0 +1,29 @@
|
||||
class Test:
|
||||
attributdeclasse = 'attributdeclasse'
|
||||
|
||||
def __init__(self):
|
||||
self.attributdinstance = 'attributdinstance'
|
||||
|
||||
def methodedinstance(self):
|
||||
return self.attributdinstance
|
||||
|
||||
@classmethod
|
||||
def methodedeclasse(cls):
|
||||
return cls.attributdeclasse
|
||||
|
||||
@staticmethod
|
||||
def methodestatique():
|
||||
return 'methodestatique'
|
||||
|
||||
@property
|
||||
def propriete(self):
|
||||
return 'propriete'
|
||||
|
||||
t = Test()
|
||||
print(t.attributdinstance)
|
||||
print(t.methodedinstance())
|
||||
print(t.propriete)
|
||||
|
||||
print(Test.attributdeclasse)
|
||||
print(Test.methodedeclasse())
|
||||
print(Test.methodestatique())
|
||||
@@ -0,0 +1,45 @@
|
||||
class Test:
|
||||
attributdeclasse = 'attributdeclasse'
|
||||
|
||||
def __init__(self):
|
||||
self.attributdinstance = 'attributdinstance'
|
||||
self.proprietedinstance = 'proprietedinstance'
|
||||
|
||||
def methodedinstance(self):
|
||||
return self.attributdinstance
|
||||
|
||||
@classmethod
|
||||
def methodedeclasse(cls):
|
||||
return cls.attributdeclasse
|
||||
|
||||
@staticmethod
|
||||
def methodestatique():
|
||||
return 'methodestatique'
|
||||
|
||||
@property
|
||||
def propriete(self):
|
||||
return self.proprietedinstance
|
||||
|
||||
@propriete.setter
|
||||
def propriete(self, value):
|
||||
self.proprietedinstance = value
|
||||
|
||||
@propriete.deleter
|
||||
def propriete(self):
|
||||
del self.proprietedinstance
|
||||
|
||||
|
||||
|
||||
|
||||
t = Test()
|
||||
print(t.attributdinstance)
|
||||
print(t.methodedinstance())
|
||||
print(t.propriete)
|
||||
t.propriete = 'proprietemodifie'
|
||||
print(t.propriete)
|
||||
print(t.proprietedinstance)
|
||||
del t.propriete
|
||||
|
||||
print(Test.attributdeclasse)
|
||||
print(Test.methodedeclasse())
|
||||
print(Test.methodestatique())
|
||||
@@ -0,0 +1,4 @@
|
||||
import urllib.request
|
||||
urllib.request.urlretrieve(
|
||||
"https://upload.wikimedia.org/wikipedia/commons/thumb/3/36/Playing_card_club_A.svg/1024px-Playing_card_club_A.svg.png",
|
||||
"as de trêfle.jpg")
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def webtojpg():
|
||||
for file in os.listdir(os.getcwd()):
|
||||
if file.endswith('.webp'):
|
||||
name = file[:-5]
|
||||
print(f"ffmpeg -i '{file}' '{name}.jpg'")
|
||||
os.system(f"ffmpeg -i '{file}' '{name}.jpg'")
|
||||
|
||||
def jpgtomp3():
|
||||
for file in os.listdir(os.getcwd()):
|
||||
if file.endswith('.jpg'):
|
||||
print(file)
|
||||
name = file[:-4]
|
||||
print(f"ffmpeg -i '{name}.mp3' -i '{name}.jpg' -map_metadata 0 \
|
||||
-map 0 -map 1 -acodec copy '{name}.mp3'")
|
||||
os.system(f"ffmpeg -i '{name}.mp3' -i '{name}.jpg' -map_metadata 0 \
|
||||
-map 0 -map 1 -acodec copy '{name}.tempo.mp3'")
|
||||
|
||||
def rename():
|
||||
for file in os.listdir(os.getcwd()):
|
||||
if file.endswith('.tempo.mp3'):
|
||||
name = file[:-len('.tempo.mp3')]
|
||||
os.rename(f"{name}.tempo.mp3", f"{name}.mp3")
|
||||
|
||||
|
||||
def clean_temp():
|
||||
for file in os.listdir(os.getcwd()):
|
||||
if file.endswith('.temp.mp3'):
|
||||
os.remove(file)
|
||||
|
||||
def clean_jpg():
|
||||
for file in os.listdir(os.getcwd()):
|
||||
if file.endswith('.jpg'):
|
||||
os.remove(file)
|
||||
|
||||
def clean_webp():
|
||||
for file in os.listdir(os.getcwd()):
|
||||
if file.endswith('.webp'):
|
||||
os.remove(file)
|
||||
|
||||
def clean():
|
||||
clean_jpg()
|
||||
clean_temp()
|
||||
clean_webp()
|
||||
|
||||
if 'webptojpg' in sys.argv:
|
||||
webtojpg()
|
||||
|
||||
if 'jpgtomp3' in sys.argv:
|
||||
jpgtomp3()
|
||||
|
||||
if 'rename' in sys.argv:
|
||||
rename()
|
||||
|
||||
if 'clean' in sys.argv:
|
||||
clean()
|
||||
|
||||
if 'clean-jpg' in sys.argv:
|
||||
clean_jpg()
|
||||
|
||||
if 'clean-temp' in sys.argv:
|
||||
clean_temp()
|
||||
|
||||
if 'clean-webp' in sys.argv:
|
||||
clean_webp()
|
||||
|
||||
if len(sys.argv)==1:
|
||||
webtojpg()
|
||||
jpgtomp3()
|
||||
rename()
|
||||
clean()
|
||||
|
||||
Reference in New Issue
Block a user