HEEEY MACARENA

This commit is contained in:
Geoffrey Frogeye 2019-08-04 19:05:57 +02:00
parent 9657a8255d
commit 0cdee7b7d8
6 changed files with 60 additions and 6 deletions

View file

@ -63,7 +63,7 @@ bindsym $mod+F7 exec pactl suspend-sink @DEFAULT_SINK@ 1; exec pactl suspend-sin
bindsym XF86AudioPrev exec mpc prev bindsym XF86AudioPrev exec mpc prev
bindsym XF86AudioPlay exec mpc toggle bindsym XF86AudioPlay exec mpc toggle
bindsym XF86AudioNext exec mpc next bindsym XF86AudioNext exec mpc next
bindsym $mod+F10 exec ~/.scripts/showKeyboardLayout bindsym $mod+F10 exec ~/.config/scripts/showKeyboardLayout
bindsym $mod+F11 exec xterm -e 'pacmixer' bindsym $mod+F11 exec xterm -e 'pacmixer'
bindsym $mod+F12 exec xterm -e 'pacmixer' bindsym $mod+F12 exec xterm -e 'pacmixer'

View file

@ -0,0 +1,50 @@
#!/usr/bin/env python
import os
import re
import typing
import PIL.ExifTags
import PIL.Image
import progressbar
EXTENSION_PATTERN = re.compile(r'\.JPE?G', re.I)
COMMON_PATTERN = re.compile(r'(IMG|DSC[NF]?|100|P10)_?\d+', re.I)
EXIF_TAG_NAME = 'DateTimeOriginal'
EXIF_TAG_ID = list(PIL.ExifTags.TAGS.keys())[list(
PIL.ExifTags.TAGS.values()).index(EXIF_TAG_NAME)]
def get_pictures(directory: str = ".", skip_renamed: bool = True) \
-> typing.Generator:
for root, _, files in os.walk(directory):
for filename in files:
filename_trunk, extension = os.path.splitext(filename)
# if extension.upper() not in ('.JPEG', '.JPG'):
if not re.match(EXTENSION_PATTERN, extension):
continue
if skip_renamed:
if not re.match(COMMON_PATTERN, filename_trunk):
continue
full_path = os.path.join(root, filename)
yield full_path
def main() -> None:
print("Counting files...")
nb_imgs = len(list(get_pictures()))
print("Processing files...")
iterator = progressbar.progressbar(get_pictures(), max_value=nb_imgs)
for full_path in iterator:
img = PIL.Image.open(full_path)
exif_data = img._getexif()
if exif_data and EXIF_TAG_ID in exif_data:
date_raw = exif_data[EXIF_TAG_ID]
# print(date_raw, full_path)
img.close()
if __name__ == "__main__":
# TODO Arguments parsing
main()

View file

@ -1,2 +1,2 @@
#!/usr/bin/env sh #!/usr/bin/env sh
strace -f -t -e trace=file strace -f -t -e trace=file $@

View file

@ -1,10 +1,11 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import logging
import os import os
import subprocess import subprocess
import progressbar
import logging
import coloredlogs import coloredlogs
import progressbar
coloredlogs.install(level='DEBUG', fmt='%(levelname)s %(message)s') coloredlogs.install(level='DEBUG', fmt='%(levelname)s %(message)s')
log = logging.getLogger() log = logging.getLogger()
@ -13,8 +14,9 @@ log = logging.getLogger()
SOURCE_FOLDER = os.path.join(os.path.expanduser("~"), "Musiques") SOURCE_FOLDER = os.path.join(os.path.expanduser("~"), "Musiques")
OUTPUT_FOLDER = os.path.join(os.path.expanduser("~"), ".musicCompressed") OUTPUT_FOLDER = os.path.join(os.path.expanduser("~"), ".musicCompressed")
CONVERSIONS = {"flac": "opus"} CONVERSIONS = {"flac": "opus"}
FORBIDDEN_EXTENSIONS = ["jpg", "pdf", "ffs_db"] FORBIDDEN_EXTENSIONS = ["jpg", "png", "pdf", "ffs_db"]
FORGIVEN_FILENAMES = ["cover.jpg", "front.jpg"] FORGIVEN_FILENAMES = ["cover.jpg", "front.jpg", "folder.jpg",
"cover.png", "front.png", "folder.png"]
IGNORED_EMPTY_FOLDER = [".stfolder"] IGNORED_EMPTY_FOLDER = [".stfolder"]
# TODO FEAT Make the directory structure the same as the base one and # TODO FEAT Make the directory structure the same as the base one and

View file

@ -16,6 +16,7 @@ mkdir -p $ADOTDIR
typeset -a ANTIGEN_CHECK_FILES=(~/.config/shell/zshrc) typeset -a ANTIGEN_CHECK_FILES=(~/.config/shell/zshrc)
[ -f ~/.local/share/zsh/antigen.zsh ] || (mkdir -p ~/.local/share/zsh/ && curl -L git.io/antigen > ~/.local/share/zsh/antigen.zsh) [ -f ~/.local/share/zsh/antigen.zsh ] || (mkdir -p ~/.local/share/zsh/ && curl -L git.io/antigen > ~/.local/share/zsh/antigen.zsh)
# TODO If the downloaded file is wrong then we're doomed
source ~/.local/share/zsh/antigen.zsh source ~/.local/share/zsh/antigen.zsh
# This is better to have them installed as system since we can use them as root # This is better to have them installed as system since we can use them as root

View file

@ -88,6 +88,7 @@ let g:pandoc#syntax#conceal#use = 0
let g:LanguageClient_serverCommands = { let g:LanguageClient_serverCommands = {
\ 'python': ['pyls'], \ 'python': ['pyls'],
\ 'sh': ['bash-language-server', 'start'],
\ } \ }