Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
757aab1943 | ||
|
|
23d8da9ae7 | ||
|
|
2631c93444 |
@@ -41,26 +41,25 @@ public static class PlaceholderImageGenerator
|
|||||||
Typeface = SKTypeface.FromFamilyName("Arial", SKFontStyle.Bold)
|
Typeface = SKTypeface.FromFamilyName("Arial", SKFontStyle.Bold)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Calculate font size to fit text (max 48, min 24)
|
// Calculate font size and wrap text if needed
|
||||||
float fontSize = 48;
|
float fontSize = 48;
|
||||||
textPaint.TextSize = fontSize;
|
textPaint.TextSize = fontSize;
|
||||||
var textWidth = textPaint.MeasureText(text);
|
|
||||||
var maxWidth = Width * 0.85f;
|
var maxWidth = Width * 0.85f;
|
||||||
|
var maxHeight = Height * 0.8f;
|
||||||
|
|
||||||
if (textWidth > maxWidth)
|
var lines = WrapText(text, textPaint, maxWidth, maxHeight, ref fontSize);
|
||||||
|
|
||||||
|
// Draw each line centered
|
||||||
|
var lineHeight = fontSize * 1.2f;
|
||||||
|
var totalHeight = lines.Count * lineHeight;
|
||||||
|
var startY = ((Height - totalHeight) / 2) + fontSize;
|
||||||
|
|
||||||
|
foreach (var line in lines)
|
||||||
{
|
{
|
||||||
fontSize = fontSize * maxWidth / textWidth;
|
canvas.DrawText(line, Width / 2, startY, textPaint);
|
||||||
fontSize = fontSize < 24 ? 24 : fontSize;
|
startY += lineHeight;
|
||||||
textPaint.TextSize = fontSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Center text vertically
|
|
||||||
SKRect textBounds = default;
|
|
||||||
textPaint.MeasureText(text, ref textBounds);
|
|
||||||
var yPos = (Height / 2) - textBounds.MidY;
|
|
||||||
|
|
||||||
canvas.DrawText(text, Width / 2, yPos, textPaint);
|
|
||||||
|
|
||||||
// Encode to PNG
|
// Encode to PNG
|
||||||
using var image = surface.Snapshot();
|
using var image = surface.Snapshot();
|
||||||
using var data = image.Encode(SKEncodedImageFormat.Png, 100);
|
using var data = image.Encode(SKEncodedImageFormat.Png, 100);
|
||||||
@@ -70,4 +69,73 @@ public static class PlaceholderImageGenerator
|
|||||||
stream.Position = 0;
|
stream.Position = 0;
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wraps text to fit within the specified width and height constraints.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The text to wrap.</param>
|
||||||
|
/// <param name="paint">The paint to use for measuring.</param>
|
||||||
|
/// <param name="maxWidth">Maximum width for each line.</param>
|
||||||
|
/// <param name="maxHeight">Maximum total height.</param>
|
||||||
|
/// <param name="fontSize">Font size (will be adjusted if needed).</param>
|
||||||
|
/// <returns>List of text lines.</returns>
|
||||||
|
private static System.Collections.Generic.List<string> WrapText(
|
||||||
|
string text,
|
||||||
|
SKPaint paint,
|
||||||
|
float maxWidth,
|
||||||
|
float maxHeight,
|
||||||
|
ref float fontSize)
|
||||||
|
{
|
||||||
|
const float minFontSize = 20;
|
||||||
|
var words = text.Split(' ');
|
||||||
|
var lines = new System.Collections.Generic.List<string>();
|
||||||
|
|
||||||
|
while (fontSize >= minFontSize)
|
||||||
|
{
|
||||||
|
paint.TextSize = fontSize;
|
||||||
|
lines.Clear();
|
||||||
|
|
||||||
|
var currentLine = string.Empty;
|
||||||
|
foreach (var word in words)
|
||||||
|
{
|
||||||
|
var testLine = string.IsNullOrEmpty(currentLine) ? word : $"{currentLine} {word}";
|
||||||
|
var testWidth = paint.MeasureText(testLine);
|
||||||
|
|
||||||
|
if (testWidth > maxWidth && !string.IsNullOrEmpty(currentLine))
|
||||||
|
{
|
||||||
|
lines.Add(currentLine);
|
||||||
|
currentLine = word;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentLine = testLine;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(currentLine))
|
||||||
|
{
|
||||||
|
lines.Add(currentLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if total height fits
|
||||||
|
var lineHeight = fontSize * 1.2f;
|
||||||
|
var totalHeight = lines.Count * lineHeight;
|
||||||
|
|
||||||
|
if (totalHeight <= maxHeight)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reduce font size and try again
|
||||||
|
fontSize -= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If still doesn't fit, just return what we have
|
||||||
|
if (lines.Count == 0)
|
||||||
|
{
|
||||||
|
lines.Add(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,16 @@ A Jellyfin plugin for accessing SRF Play (Swiss Radio and Television) video-on-d
|
|||||||
|
|
||||||
**Beta/Alpha** - This plugin has been tested on two Jellyfin instances and is working. Some clients may experience issues with hardware decoding, which appears to be client-specific behavior.
|
**Beta/Alpha** - This plugin has been tested on two Jellyfin instances and is working. Some clients may experience issues with hardware decoding, which appears to be client-specific behavior.
|
||||||
|
|
||||||
|
## Quick Install
|
||||||
|
|
||||||
|
Add this repository URL in Jellyfin (Dashboard → Plugins → Repositories):
|
||||||
|
|
||||||
|
```
|
||||||
|
https://gitea.tourolle.paris/dtourolle/jellyfin-srfPlay/raw/branch/master/manifest.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Then install "SRF Play" from the plugin catalog.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Access to SRF Play VOD content (video-on-demand, no DRM-protected content)
|
- Access to SRF Play VOD content (video-on-demand, no DRM-protected content)
|
||||||
@@ -102,16 +112,6 @@ dotnet build
|
|||||||
|
|
||||||
The compiled plugin will be in `bin/Debug/net8.0/`
|
The compiled plugin will be in `bin/Debug/net8.0/`
|
||||||
|
|
||||||
## Quick Install
|
|
||||||
|
|
||||||
Add this repository URL in Jellyfin (Dashboard → Plugins → Repositories):
|
|
||||||
|
|
||||||
```
|
|
||||||
https://gitea.tourolle.paris/dtourolle/jellyfin-srfPlay/raw/branch/master/manifest.json
|
|
||||||
```
|
|
||||||
|
|
||||||
Then install "SRF Play" from the plugin catalog.
|
|
||||||
|
|
||||||
## Manual Installation
|
## Manual Installation
|
||||||
|
|
||||||
1. Build the plugin (see above)
|
1. Build the plugin (see above)
|
||||||
|
|||||||
+10
-1
@@ -7,6 +7,15 @@
|
|||||||
"owner": "dtourolle",
|
"owner": "dtourolle",
|
||||||
"category": "Live TV",
|
"category": "Live TV",
|
||||||
"imageUrl": "https://gitea.tourolle.paris/dtourolle/jellyfin-srfPlay/raw/branch/master/assests/main%20logo.png",
|
"imageUrl": "https://gitea.tourolle.paris/dtourolle/jellyfin-srfPlay/raw/branch/master/assests/main%20logo.png",
|
||||||
"versions": []
|
"versions": [
|
||||||
|
{
|
||||||
|
"version": "1.0.12",
|
||||||
|
"changelog": "Release 1.0.12",
|
||||||
|
"targetAbi": "10.9.0.0",
|
||||||
|
"sourceUrl": "https://gitea.tourolle.paris/dtourolle/jellyfin-srfPlay/releases/download/v1.0.12/srfplay_1.0.12.0.zip",
|
||||||
|
"checksum": "47baa02ade413253db94fe3ba0763f69",
|
||||||
|
"timestamp": "2025-12-20T13:35:38Z"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user