File size: 1,958 Bytes
9793ed6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100d5f6
 
 
 
b818488
100d5f6
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from datetime import datetime
import pytz
import os
import shutil



def hex_to_rgb(hex_color):
    # Remove the '#' character if it exists
    hex_color = hex_color.lstrip('#')

    # Convert the hex string to integers
    r, g, b = tuple(int(hex_color[i:i + 2], 16) for i in (0, 2, 4))
    return r, g, b


def get_kr_time():
    # ν•œκ΅­ μ‹œκ°„λŒ€ μ„€μ •
    korea_time_zone = pytz.timezone('Asia/Seoul')

    # ν˜„μž¬ μ‹œκ°„μ„ ν•œκ΅­ μ‹œκ°„λŒ€λ‘œ λ³€ν™˜
    current_time_in_korea = datetime.now(korea_time_zone)

    # μ›ν•˜λŠ” ν˜•μ‹μœΌλ‘œ μ‹œκ°„ ν¬λ§·νŒ…
    return current_time_in_korea.strftime("%Y%m%d-%H%M%S")

def url_mapping(url):
    # 각 λ¬Έμžμ—΄μ— λŒ€μ‘ν•˜λŠ” URL 맀핑
    url_mapping = {
        "tripleS website": "https://triplescosmos.com/",
        "tripleS youtube": "https://youtube.com/@triplescosmos",
        "tripleS 𝕏": "https://x.com/triplescosmos",
        "tripleS discord": "https://discord.gg/triplescosmos"
    }

    # qr_url이 λ§€ν•‘λœ λ¬Έμžμ—΄ 쀑 ν•˜λ‚˜λΌλ©΄ ν•΄λ‹Ή URL을, μ•„λ‹ˆλΌλ©΄ qr_url κ·ΈλŒ€λ‘œλ₯Ό λ°˜ν™˜
    return url_mapping.get(url, url)


def zip(name):
    # '/data' 폴더λ₯Ό 'data.zip'으둜 μ••μΆ•
    shutil.make_archive(f'/data/{name}', 'zip', f'/data/{name}')
    shutil.rmtree(f'/data/{name}')

def remove(filename):
    # './data/' 디렉터리 경둜 μ„€μ •
    directory = '/data/'

    file_path = os.path.join(directory, filename)
        # 파일이 zip νŒŒμΌμΈμ§€ 확인
    if filename.endswith('.zip'):
            # 파일 μ‚­μ œ
        os.remove(file_path)


def transform_number(n):
    n = n + 1
    if n < 1 or n > 29:
        raise ValueError("μž…λ ₯ 값은 1λΆ€ν„° 29 사이여야 ν•©λ‹ˆλ‹€.")

    if 1 <= n <= 14:
        return n
    elif n == 15:
        return 19
    elif 16 <= n <= 24:
        return n + 5
    elif 25 <= n <= 28:
        return n - 10
    elif n == 29:
        return 20