| 100 | return total_seconds |
| 101 | |
| 102 | async 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 | |
| 121 | async def add_prefix_suffix(input_string, prefix='', suffix=''): |
| 122 | pattern = r'(?P<filename>.*?)(\.\w+)?$' |