MCPcopy Create free account
hub / github.com/TechifyBots/Rename-Bot / get_seconds

Function get_seconds

helper/utils.py:102–119  ·  view source on GitHub ↗
(time_string)

Source from the content-addressed store, hash-verified

100 return total_seconds
101
102async def get_seconds(time_string):
103 conversion_factors = {
104 's': 1,
105 'min': 60,
106 'hour': 3600,
107 'day': 86400,
108 'month': 86400 * 30,
109 'year': 86400 * 365
110 }
111
112 total_seconds = 0
113 pattern = r'(\d+)\s*(\w+)'
114 matches = re.findall(pattern, time_string)
115
116 for value, unit in matches:
117 total_seconds += int(value) * conversion_factors.get(unit, 0)
118
119 return total_seconds
120
121async def add_prefix_suffix(input_string, prefix='', suffix=''):
122 pattern = r'(?P<filename>.*?)(\.\w+)?$'

Callers 1

add_premiumFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected