File tree Expand file tree Collapse file tree 4 files changed +38
-1
lines changed
Expand file tree Collapse file tree 4 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -214,6 +214,10 @@ from p in ps.DefaultIfEmpty()
214214 ForcedSortName = m . Num ,
215215 ExternalId = m . Num
216216 } ;
217+
218+ if ( m . CommunityRating >= 0 && m . CommunityRating <= 10 )
219+ metadataResult . Item . CommunityRating = m . CommunityRating ;
220+
217221#if ! __JELLYFIN__
218222 if ( ! string . IsNullOrWhiteSpace ( m . Set ) )
219223 metadataResult . Item . AddCollection ( m . Set ) ;
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ private async Task<JavVideo> GetById(string id)
137137 //尝试获取 a 标签的内容
138138 var aa = n . SelectNodes ( "./a" ) ;
139139 var value = aa ? . Any ( ) == true ? string . Join ( ", " , aa . Select ( o => o . InnerText . Trim ( ) ) . Where ( o => string . IsNullOrWhiteSpace ( o ) == false && ! o . Contains ( "本资源" ) ) )
140- : null ;
140+ : n . InnerText ? . Split ( ':' ) . Last ( ) ;
141141
142142 if ( string . IsNullOrWhiteSpace ( value ) == false )
143143 dic [ name ] = value ;
@@ -161,6 +161,19 @@ string getDate()
161161 return dm . Groups [ "date" ] . Value . Replace ( '/' , '-' ) ;
162162 }
163163
164+ float ? GetCommunityRating ( )
165+ {
166+ var value = GetValue ( "影片评分" ) ;
167+ if ( string . IsNullOrWhiteSpace ( value ) )
168+ return null ;
169+ var m = Regex . Match ( value , @"(?<rating>[\d.]+)" ) ;
170+ if ( m . Success == false )
171+ return null ;
172+ if ( float . TryParse ( m . Groups [ "rating" ] . Value , out var rating ) )
173+ return rating / 10.0f ;
174+ return null ;
175+ }
176+
164177 var samples = node . SelectNodes ( "//ul[@class='slides']/li/img" ) ?
165178 . Select ( o => o . GetAttributeValue ( "src" , null ) ) . Where ( o => o != null ) . Select ( o => new Uri ( client . BaseAddress , o ) . ToString ( ) ) . ToList ( ) ;
166179 var m = new JavVideo ( )
@@ -180,6 +193,7 @@ string getDate()
180193 Genres = genres ,
181194 Actors = actors ,
182195 Samples = samples ,
196+ CommunityRating = GetCommunityRating ( ) ,
183197 } ;
184198 //去除标题中的番号
185199 if ( string . IsNullOrWhiteSpace ( m . Num ) == false && m . Title ? . StartsWith ( m . Num , StringComparison . OrdinalIgnoreCase ) == true )
Original file line number Diff line number Diff line change @@ -220,6 +220,19 @@ List<string> GetActors()
220220 return ac ;
221221 }
222222
223+ float ? GetCommunityRating ( )
224+ {
225+ var value = GetValue ( "評分" ) ;
226+ if ( string . IsNullOrWhiteSpace ( value ) )
227+ return null ;
228+ var m = Regex . Match ( value , @"(?<rating>[\d.]+)分" ) ;
229+ if ( m . Success == false )
230+ return null ;
231+ if ( float . TryParse ( m . Groups [ "rating" ] . Value , out var rating ) )
232+ return rating / 5.0f * 10f ;
233+ return null ;
234+ }
235+
223236 List < string > GetSamples ( )
224237 {
225238 return doc . DocumentNode . SelectNodes ( "//div[@class='tile-images preview-images']/a" )
@@ -243,6 +256,7 @@ List<string> GetSamples()
243256 Genres = GetGenres ( ) ,
244257 Actors = GetActors ( ) ,
245258 Samples = GetSamples ( ) ,
259+ CommunityRating = GetCommunityRating ( ) ,
246260 } ;
247261
248262 m . Plot = await GetDmmPlot ( m . Num ) ;
Original file line number Diff line number Diff line change @@ -66,6 +66,11 @@ public class JavVideo : JavVideoIndex
6666 /// </summary>
6767 public List < string > Samples { get ; set ; }
6868
69+ /// <summary>
70+ /// 公众评分 0-10之间。
71+ /// </summary>
72+ public float ? CommunityRating { get ; set ; }
73+
6974 /// <summary>
7075 /// %genre:中文字幕?中文:%
7176 /// </summary>
You can’t perform that action at this time.
0 commit comments