mirror of
				https://github.com/zoriya/Kyoo.git
				synced 2025-10-31 02:27:11 -04:00 
			
		
		
		
	Fixing the regex identifier
This commit is contained in:
		
							parent
							
								
									6ebf8a8361
								
							
						
					
					
						commit
						f1887d1fab
					
				| @ -38,30 +38,40 @@ namespace Kyoo.Controllers | |||||||
| 			if (!match.Success) | 			if (!match.Success) | ||||||
| 				throw new IdentificationFailed($"The episode at {path} does not match the episode's regex."); | 				throw new IdentificationFailed($"The episode at {path} does not match the episode's regex."); | ||||||
| 
 | 
 | ||||||
| 			(Collection collection, Show show, Season season, Episode episode) ret = new(); | 			(Collection collection, Show show, Season season, Episode episode) ret = ( | ||||||
| 			 | 				collection: new Collection | ||||||
| 			ret.collection.Name = match.Groups["Collection"].Value; | 				{ | ||||||
| 			ret.collection.Slug = Utility.ToSlug(ret.collection.Name); | 					Slug = Utility.ToSlug(match.Groups["Collection"].Value), | ||||||
| 			 | 					Name = match.Groups["Collection"].Value | ||||||
| 			ret.show.Title = match.Groups["Show"].Value; | 				}, | ||||||
| 			ret.show.Slug = Utility.ToSlug(ret.show.Title); | 				show: new Show | ||||||
| 			ret.show.Path = Path.GetDirectoryName(path); | 				{ | ||||||
| 			ret.episode.Path = path; | 					Slug = Utility.ToSlug(match.Groups["Show"].Value), | ||||||
|  | 					Title = match.Groups["Show"].Value, | ||||||
|  | 					Path = Path.GetDirectoryName(path), | ||||||
|  | 					StartAir = match.Groups["StartYear"].Success  | ||||||
|  | 						? new DateTime(int.Parse(match.Groups["StartYear"].Value), 1, 1)  | ||||||
|  | 						: null | ||||||
|  | 				}, | ||||||
|  | 				season: null, | ||||||
|  | 				episode: new Episode | ||||||
|  | 				{ | ||||||
|  | 					SeasonNumber = match.Groups["Season"].Success  | ||||||
|  | 						? int.Parse(match.Groups["Season"].Value)  | ||||||
|  | 						: null, | ||||||
|  | 					EpisodeNumber = match.Groups["Episode"].Success  | ||||||
|  | 						? int.Parse(match.Groups["Episode"].Value)  | ||||||
|  | 						: null, | ||||||
|  | 					AbsoluteNumber = match.Groups["Absolute"].Success  | ||||||
|  | 						? int.Parse(match.Groups["Absolute"].Value)  | ||||||
|  | 						: null, | ||||||
|  | 					Path = path | ||||||
|  | 				} | ||||||
|  | 			); | ||||||
| 
 | 
 | ||||||
| 			if (match.Groups["StartYear"].Success && int.TryParse(match.Groups["StartYear"].Value, out int tmp)) | 			if (ret.episode.SeasonNumber.HasValue) | ||||||
| 				ret.show.StartAir = new DateTime(tmp, 1, 1); | 				ret.season = new Season { SeasonNumber = ret.episode.SeasonNumber.Value }; | ||||||
| 			 |  | ||||||
| 			if (match.Groups["Season"].Success && int.TryParse(match.Groups["Season"].Value, out tmp)) |  | ||||||
| 			{ |  | ||||||
| 				ret.season.SeasonNumber = tmp; |  | ||||||
| 				ret.episode.SeasonNumber = tmp; |  | ||||||
| 			} |  | ||||||
| 
 | 
 | ||||||
| 			if (match.Groups["Episode"].Success && int.TryParse(match.Groups["Episode"].Value, out tmp)) |  | ||||||
| 				ret.episode.EpisodeNumber = tmp; |  | ||||||
| 			 |  | ||||||
| 			if (match.Groups["Absolute"].Success && int.TryParse(match.Groups["Absolute"].Value, out tmp)) |  | ||||||
| 				ret.episode.AbsoluteNumber = tmp; |  | ||||||
| 
 | 
 | ||||||
| 			if (ret.episode.SeasonNumber == null && ret.episode.EpisodeNumber == null | 			if (ret.episode.SeasonNumber == null && ret.episode.EpisodeNumber == null | ||||||
| 				&& ret.episode.AbsoluteNumber == null) | 				&& ret.episode.AbsoluteNumber == null) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user