mirror of
https://github.com/lampame/lampac-ukraine.git
synced 2026-04-16 17:32:20 +00:00
feat(starlight): add episode image support and improve image selection
- Add Image property to Episode model - Update episode template call to include image parameter - Implement SelectImage helper method for flexible image source selection - Enhance image selection logic for both main content and episodes
This commit is contained in:
parent
60d7b15dc1
commit
58bb8d194c
@ -89,7 +89,7 @@ namespace StarLight.Controllers
|
|||||||
|
|
||||||
string episodeName = string.IsNullOrEmpty(ep.Title) ? $"Епізод {index}" : ep.Title;
|
string episodeName = string.IsNullOrEmpty(ep.Title) ? $"Епізод {index}" : ep.Title;
|
||||||
string callUrl = $"{host}/starlight/play?hash={HttpUtility.UrlEncode(ep.Hash)}&title={HttpUtility.UrlEncode(title ?? original_title)}";
|
string callUrl = $"{host}/starlight/play?hash={HttpUtility.UrlEncode(ep.Hash)}&title={HttpUtility.UrlEncode(title ?? original_title)}";
|
||||||
episode_tpl.Append(episodeName, title ?? original_title, (s + 1).ToString(), index.ToString("D2"), accsArgs(callUrl), "call");
|
episode_tpl.Append(episodeName, title ?? original_title, (s + 1).ToString(), index.ToString("D2"), accsArgs(callUrl), "call", img: ep.Image);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@ namespace StarLight.Models
|
|||||||
public string VideoSlug { get; set; }
|
public string VideoSlug { get; set; }
|
||||||
public string Date { get; set; }
|
public string Date { get; set; }
|
||||||
public string SeasonSlug { get; set; }
|
public string SeasonSlug { get; set; }
|
||||||
|
public string Image { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ProjectInfo
|
public class ProjectInfo
|
||||||
|
|||||||
@ -119,7 +119,7 @@ namespace StarLight
|
|||||||
{
|
{
|
||||||
Title = root.TryGetProperty("title", out var titleProp) ? titleProp.GetString() : null,
|
Title = root.TryGetProperty("title", out var titleProp) ? titleProp.GetString() : null,
|
||||||
Description = root.TryGetProperty("description", out var descProp) ? descProp.GetString() : null,
|
Description = root.TryGetProperty("description", out var descProp) ? descProp.GetString() : null,
|
||||||
Poster = NormalizeImage(root.TryGetProperty("image", out var imageProp) ? imageProp.GetString() : null),
|
Poster = NormalizeImage(SelectImage(root, "imageMob", "imageTab", "image", "logoImage")),
|
||||||
Hash = root.TryGetProperty("hash", out var hashProp) ? hashProp.GetString() : null,
|
Hash = root.TryGetProperty("hash", out var hashProp) ? hashProp.GetString() : null,
|
||||||
Type = root.TryGetProperty("typeSlug", out var typeProp) ? typeProp.GetString() : null,
|
Type = root.TryGetProperty("typeSlug", out var typeProp) ? typeProp.GetString() : null,
|
||||||
Channel = root.TryGetProperty("channelTitle", out var channelProp) ? channelProp.GetString() : null
|
Channel = root.TryGetProperty("channelTitle", out var channelProp) ? channelProp.GetString() : null
|
||||||
@ -143,7 +143,8 @@ namespace StarLight
|
|||||||
Hash = item.TryGetProperty("hash", out var eHash) ? eHash.GetString() : null,
|
Hash = item.TryGetProperty("hash", out var eHash) ? eHash.GetString() : null,
|
||||||
VideoSlug = item.TryGetProperty("videoSlug", out var eSlug) ? eSlug.GetString() : null,
|
VideoSlug = item.TryGetProperty("videoSlug", out var eSlug) ? eSlug.GetString() : null,
|
||||||
Date = item.TryGetProperty("dateOfBroadcast", out var eDate) ? eDate.GetString() : (item.TryGetProperty("timeUploadVideo", out var eDate2) ? eDate2.GetString() : null),
|
Date = item.TryGetProperty("dateOfBroadcast", out var eDate) ? eDate.GetString() : (item.TryGetProperty("timeUploadVideo", out var eDate2) ? eDate2.GetString() : null),
|
||||||
SeasonSlug = seasonSlug
|
SeasonSlug = seasonSlug,
|
||||||
|
Image = NormalizeImage(SelectImage(item, "imageMob", "image"))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,6 +241,21 @@ namespace StarLight
|
|||||||
return $"{_init.host}{path}";
|
return $"{_init.host}{path}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string SelectImage(JsonElement element, params string[] keys)
|
||||||
|
{
|
||||||
|
foreach (var key in keys)
|
||||||
|
{
|
||||||
|
if (element.TryGetProperty(key, out var prop))
|
||||||
|
{
|
||||||
|
var value = prop.GetString();
|
||||||
|
if (!string.IsNullOrEmpty(value))
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static TimeSpan cacheTime(int multiaccess, int home = 5, int mikrotik = 2, OnlinesSettings init = null, int rhub = -1)
|
public static TimeSpan cacheTime(int multiaccess, int home = 5, int mikrotik = 2, OnlinesSettings init = null, int rhub = -1)
|
||||||
{
|
{
|
||||||
if (init != null && init.rhub && rhub != -1)
|
if (init != null && init.rhub && rhub != -1)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user