mirror of
				https://github.com/recloudstream/cloudstream.git
				synced 2024-08-15 01:53:11 +00:00 
			
		
		
		
	Merge remote-tracking branch 'origin/master'
This commit is contained in:
		
						commit
						789f3db554
					
				
					 1 changed files with 24 additions and 3 deletions
				
			
		|  | @ -1143,9 +1143,9 @@ fun getDurationFromString(input: String?): Int? { | |||
|         if (values.size == 3) { | ||||
|             val hours = values[1].toIntOrNull() | ||||
|             val minutes = values[2].toIntOrNull() | ||||
|             return if (minutes != null && hours != null) { | ||||
|                 hours * 60 + minutes | ||||
|             } else null | ||||
|             if (minutes != null && hours != null) { | ||||
|                 return hours * 60 + minutes | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     Regex("([0-9]*)m").find(cleanInput)?.groupValues?.let { values -> | ||||
|  | @ -1153,6 +1153,27 @@ fun getDurationFromString(input: String?): Int? { | |||
|             return values[1].toIntOrNull() | ||||
|         } | ||||
|     } | ||||
|     Regex("(\\s\\d+\\shr)|(\\s\\d+\\shour)|(\\s\\d+\\smin)|(\\s\\d+\\ssec)").findAll(input).let { values -> | ||||
|         var seconds = 0 | ||||
|         values.forEach { | ||||
|             val time_text = it.value | ||||
|             if (time_text.isNotBlank()) { | ||||
|                 val time = time_text.filter { s -> s.isDigit() }.trim().toInt() | ||||
|                 val scale = time_text.filter { s -> !s.isDigit() }.trim() | ||||
|                 //println("Scale: $scale") | ||||
|                 val timeval = when (scale) { | ||||
|                     "hr", "hour" -> time * 60 * 60 | ||||
|                     "min" -> time * 60 | ||||
|                     "sec" -> time | ||||
|                     else -> 0 | ||||
|                 } | ||||
|                 seconds += timeval | ||||
|             } | ||||
|         } | ||||
|         if (seconds > 0) { | ||||
|             return seconds / 60 | ||||
|         } | ||||
|     } | ||||
|     return null | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue