Release
This commit is contained in:
16
RadioDJViewer/Main.Designer.cs
generated
16
RadioDJViewer/Main.Designer.cs
generated
@@ -122,13 +122,13 @@
|
|||||||
//
|
//
|
||||||
this.restAPISettingToolStripMenuItem.Name = "restAPISettingToolStripMenuItem";
|
this.restAPISettingToolStripMenuItem.Name = "restAPISettingToolStripMenuItem";
|
||||||
this.restAPISettingToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
this.restAPISettingToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
this.restAPISettingToolStripMenuItem.Text = "Rest API Setting";
|
this.restAPISettingToolStripMenuItem.Text = "Setting";
|
||||||
this.restAPISettingToolStripMenuItem.Click += new System.EventHandler(this.restAPISettingToolStripMenuItem_Click);
|
this.restAPISettingToolStripMenuItem.Click += new System.EventHandler(this.restAPISettingToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// exitToolStripMenuItem
|
// exitToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
this.exitToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
|
||||||
this.exitToolStripMenuItem.Text = "Exit";
|
this.exitToolStripMenuItem.Text = "Exit";
|
||||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
@@ -166,7 +166,7 @@
|
|||||||
// label6
|
// label6
|
||||||
//
|
//
|
||||||
this.label6.AutoSize = true;
|
this.label6.AutoSize = true;
|
||||||
this.label6.Location = new System.Drawing.Point(205, 130);
|
this.label6.Location = new System.Drawing.Point(170, 130);
|
||||||
this.label6.Name = "label6";
|
this.label6.Name = "label6";
|
||||||
this.label6.Size = new System.Drawing.Size(65, 16);
|
this.label6.Size = new System.Drawing.Size(65, 16);
|
||||||
this.label6.TabIndex = 5;
|
this.label6.TabIndex = 5;
|
||||||
@@ -175,7 +175,7 @@
|
|||||||
// label5
|
// label5
|
||||||
//
|
//
|
||||||
this.label5.AutoSize = true;
|
this.label5.AutoSize = true;
|
||||||
this.label5.Location = new System.Drawing.Point(205, 84);
|
this.label5.Location = new System.Drawing.Point(170, 83);
|
||||||
this.label5.Name = "label5";
|
this.label5.Name = "label5";
|
||||||
this.label5.Size = new System.Drawing.Size(56, 16);
|
this.label5.Size = new System.Drawing.Size(56, 16);
|
||||||
this.label5.TabIndex = 4;
|
this.label5.TabIndex = 4;
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
// label4
|
// label4
|
||||||
//
|
//
|
||||||
this.label4.AutoSize = true;
|
this.label4.AutoSize = true;
|
||||||
this.label4.Location = new System.Drawing.Point(205, 41);
|
this.label4.Location = new System.Drawing.Point(170, 39);
|
||||||
this.label4.Name = "label4";
|
this.label4.Name = "label4";
|
||||||
this.label4.Size = new System.Drawing.Size(48, 16);
|
this.label4.Size = new System.Drawing.Size(48, 16);
|
||||||
this.label4.TabIndex = 3;
|
this.label4.TabIndex = 3;
|
||||||
@@ -270,6 +270,7 @@
|
|||||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
|
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
|
||||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;
|
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;
|
||||||
|
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel4;
|
||||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3;
|
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3;
|
||||||
private System.Windows.Forms.MenuStrip menuStrip2;
|
private System.Windows.Forms.MenuStrip menuStrip2;
|
||||||
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
||||||
@@ -278,15 +279,14 @@
|
|||||||
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
|
||||||
private System.Windows.Forms.PictureBox pictureBox1;
|
private System.Windows.Forms.PictureBox pictureBox1;
|
||||||
private System.Windows.Forms.GroupBox groupBox1;
|
private System.Windows.Forms.GroupBox groupBox1;
|
||||||
private System.Windows.Forms.Label label2;
|
|
||||||
private System.Windows.Forms.Label label1;
|
|
||||||
private System.Windows.Forms.Label label6;
|
private System.Windows.Forms.Label label6;
|
||||||
private System.Windows.Forms.Label label5;
|
private System.Windows.Forms.Label label5;
|
||||||
private System.Windows.Forms.Label label4;
|
private System.Windows.Forms.Label label4;
|
||||||
private System.Windows.Forms.Label label3;
|
private System.Windows.Forms.Label label3;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
private System.Windows.Forms.Button button1;
|
private System.Windows.Forms.Button button1;
|
||||||
private System.Windows.Forms.Button button2;
|
private System.Windows.Forms.Button button2;
|
||||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel4;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Resources;
|
||||||
|
|
||||||
namespace RadioDJViewer
|
namespace RadioDJViewer
|
||||||
{
|
{
|
||||||
@@ -30,6 +31,7 @@ namespace RadioDJViewer
|
|||||||
public Main()
|
public Main()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
EnsureDefaultImageExists();
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
// Auto-load profiles if profiles.json exists
|
// Auto-load profiles if profiles.json exists
|
||||||
AutoLoadProfiles();
|
AutoLoadProfiles();
|
||||||
@@ -37,6 +39,45 @@ namespace RadioDJViewer
|
|||||||
apiTimer = new System.Windows.Forms.Timer();
|
apiTimer = new System.Windows.Forms.Timer();
|
||||||
apiTimer.Interval = 3000; // 3 seconds
|
apiTimer.Interval = 3000; // 3 seconds
|
||||||
apiTimer.Tick += ApiTimer_Tick;
|
apiTimer.Tick += ApiTimer_Tick;
|
||||||
|
// Set up marquee timer for title
|
||||||
|
marqueeTimer = new System.Windows.Forms.Timer();
|
||||||
|
marqueeTimer.Interval = 100; // Adjust speed as needed
|
||||||
|
marqueeTimer.Tick += MarqueeTimer_Tick;
|
||||||
|
}
|
||||||
|
|
||||||
|
private System.Windows.Forms.Timer marqueeTimer;
|
||||||
|
private int marqueeOffset = 0;
|
||||||
|
private string marqueeText = "";
|
||||||
|
|
||||||
|
private void EnsureDefaultImageExists()
|
||||||
|
{
|
||||||
|
if (!File.Exists(defaultImagePath))
|
||||||
|
{
|
||||||
|
// Try to extract from resources
|
||||||
|
var fallbackImg = Properties.Resources.fallback;
|
||||||
|
if (fallbackImg != null)
|
||||||
|
{
|
||||||
|
fallbackImg.Save(defaultImagePath, System.Drawing.Imaging.ImageFormat.Jpeg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MarqueeTimer_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (marqueeText.Length > 0)
|
||||||
|
{
|
||||||
|
int visibleChars = 30; // Adjust for label width
|
||||||
|
if (marqueeText.Length > visibleChars)
|
||||||
|
{
|
||||||
|
marqueeOffset = (marqueeOffset + 1) % marqueeText.Length;
|
||||||
|
string display = marqueeText.Substring(marqueeOffset) + " " + marqueeText.Substring(0, marqueeOffset);
|
||||||
|
label4.Text = display.Substring(0, Math.Min(visibleChars, display.Length));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label4.Text = marqueeText;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApiTimer_Tick(object sender, EventArgs e)
|
private void ApiTimer_Tick(object sender, EventArgs e)
|
||||||
@@ -170,18 +211,32 @@ namespace RadioDJViewer
|
|||||||
{
|
{
|
||||||
string imagePath = string.Empty;
|
string imagePath = string.Empty;
|
||||||
string outputImageName = loadedProfile?.OutputImageName;
|
string outputImageName = loadedProfile?.OutputImageName;
|
||||||
|
bool useFallback = false;
|
||||||
if (!string.IsNullOrEmpty(mainImagesFolderPath) && !string.IsNullOrEmpty(imageName))
|
if (!string.IsNullOrEmpty(mainImagesFolderPath) && !string.IsNullOrEmpty(imageName))
|
||||||
{
|
{
|
||||||
imagePath = Path.Combine(mainImagesFolderPath, imageName);
|
imagePath = Path.Combine(mainImagesFolderPath, imageName);
|
||||||
}
|
if (!File.Exists(imagePath))
|
||||||
if (string.IsNullOrEmpty(imagePath) || !File.Exists(imagePath))
|
|
||||||
{
|
|
||||||
// Show default image if not found
|
|
||||||
if (File.Exists(defaultImagePath))
|
|
||||||
{
|
{
|
||||||
using (var img = Image.FromFile(defaultImagePath))
|
useFallback = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
useFallback = true;
|
||||||
|
}
|
||||||
|
if (useFallback)
|
||||||
|
{
|
||||||
|
// Use fallback PNG from resources
|
||||||
|
var fallbackImg = Properties.Resources.fallback;
|
||||||
|
if (fallbackImg != null)
|
||||||
|
{
|
||||||
|
var resized = new Bitmap(fallbackImg, pictureBox1.Size);
|
||||||
|
pictureBox1.Image = resized;
|
||||||
|
// Save fallback image to output folder as PNG
|
||||||
|
if (!string.IsNullOrEmpty(outputFolderPath) && !string.IsNullOrEmpty(outputImageName))
|
||||||
{
|
{
|
||||||
pictureBox1.Image = new Bitmap(img);
|
string destPath = Path.Combine(outputFolderPath, Path.ChangeExtension(outputImageName, ".png"));
|
||||||
|
resized.Save(destPath, System.Drawing.Imaging.ImageFormat.Png);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -192,19 +247,37 @@ namespace RadioDJViewer
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Display in pictureBox1
|
|
||||||
using (var img = Image.FromFile(imagePath))
|
using (var img = Image.FromFile(imagePath))
|
||||||
{
|
{
|
||||||
pictureBox1.Image = new Bitmap(img);
|
var resized = new Bitmap(img, pictureBox1.Size);
|
||||||
// Copy and convert to PNG in output folder if set and output image name is set
|
pictureBox1.Image = resized;
|
||||||
|
// Save to output folder as PNG
|
||||||
if (!string.IsNullOrEmpty(outputFolderPath) && !string.IsNullOrEmpty(outputImageName))
|
if (!string.IsNullOrEmpty(outputFolderPath) && !string.IsNullOrEmpty(outputImageName))
|
||||||
{
|
{
|
||||||
string destPath = Path.Combine(outputFolderPath, Path.ChangeExtension(outputImageName, ".png"));
|
string destPath = Path.Combine(outputFolderPath, Path.ChangeExtension(outputImageName, ".png"));
|
||||||
img.Save(destPath, System.Drawing.Imaging.ImageFormat.Png);
|
resized.Save(destPath, System.Drawing.Imaging.ImageFormat.Png);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { /* Handle errors if needed */ }
|
catch
|
||||||
|
{
|
||||||
|
// If loading image fails, fallback
|
||||||
|
var fallbackImg = Properties.Resources.fallback;
|
||||||
|
if (fallbackImg != null)
|
||||||
|
{
|
||||||
|
var resized = new Bitmap(fallbackImg, pictureBox1.Size);
|
||||||
|
pictureBox1.Image = resized;
|
||||||
|
if (!string.IsNullOrEmpty(outputFolderPath) && !string.IsNullOrEmpty(outputImageName))
|
||||||
|
{
|
||||||
|
string destPath = Path.Combine(outputFolderPath, Path.ChangeExtension(outputImageName, ".png"));
|
||||||
|
resized.Save(destPath, System.Drawing.Imaging.ImageFormat.Png);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pictureBox1.Image = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ParseAndDisplaySongInfo(string xml)
|
private void ParseAndDisplaySongInfo(string xml)
|
||||||
@@ -219,14 +292,16 @@ namespace RadioDJViewer
|
|||||||
string album = doc.SelectSingleNode("//*[translate(local-name(), 'ALBUM', 'album')='album']")?.InnerText;
|
string album = doc.SelectSingleNode("//*[translate(local-name(), 'ALBUM', 'album')='album']")?.InnerText;
|
||||||
string albumArt = doc.SelectSingleNode("//*[translate(local-name(), 'ALBUMART', 'albumart')='albumart']")?.InnerText;
|
string albumArt = doc.SelectSingleNode("//*[translate(local-name(), 'ALBUMART', 'albumart')='albumart']")?.InnerText;
|
||||||
|
|
||||||
label4.Text = !string.IsNullOrWhiteSpace(title) ? title : "No title";
|
marqueeText = !string.IsNullOrWhiteSpace(title) ? title : "No title";
|
||||||
|
marqueeOffset = 0;
|
||||||
|
marqueeTimer.Start();
|
||||||
label5.Text = !string.IsNullOrWhiteSpace(artist) ? artist : "No artist";
|
label5.Text = !string.IsNullOrWhiteSpace(artist) ? artist : "No artist";
|
||||||
label6.Text = !string.IsNullOrWhiteSpace(album) ? album : "No album";
|
label6.Text = !string.IsNullOrWhiteSpace(album) ? album : "No album";
|
||||||
|
|
||||||
// Write to output files
|
// Write to output files
|
||||||
if (!string.IsNullOrEmpty(outputFolderPath))
|
if (!string.IsNullOrEmpty(outputFolderPath))
|
||||||
{
|
{
|
||||||
File.WriteAllText(Path.Combine(outputFolderPath, "title.txt"), label4.Text);
|
File.WriteAllText(Path.Combine(outputFolderPath, "title.txt"), marqueeText);
|
||||||
File.WriteAllText(Path.Combine(outputFolderPath, "artist.txt"), label5.Text);
|
File.WriteAllText(Path.Combine(outputFolderPath, "artist.txt"), label5.Text);
|
||||||
File.WriteAllText(Path.Combine(outputFolderPath, "album.txt"), label6.Text);
|
File.WriteAllText(Path.Combine(outputFolderPath, "album.txt"), label6.Text);
|
||||||
}
|
}
|
||||||
@@ -243,7 +318,9 @@ namespace RadioDJViewer
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
label4.Text = "No title";
|
marqueeText = "No title";
|
||||||
|
marqueeOffset = 0;
|
||||||
|
marqueeTimer.Start();
|
||||||
label5.Text = "No artist";
|
label5.Text = "No artist";
|
||||||
label6.Text = "No album";
|
label6.Text = "No album";
|
||||||
pictureBox1.Image = null;
|
pictureBox1.Image = null;
|
||||||
@@ -270,7 +347,7 @@ namespace RadioDJViewer
|
|||||||
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
|
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||||
string message = $"RadioDJViewer\nVersion: {version}\nGitHub: https://github.com/yourusername/RadioDJViewer";
|
string message = $"RadioDJViewer\nVersion: {version}\nGitHub: https://git.smartcraft.me/minster586/RadioDJViewer";
|
||||||
MessageBox.Show(message, "About RadioDJViewer", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show(message, "About RadioDJViewer", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -124,7 +124,7 @@
|
|||||||
<data name="toolStripStatusLabel2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="toolStripStatusLabel2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
||||||
iVBORw0KGgoAAAANSUhEUgAAAIAAAACABAMAAAAxEHz4AAAABGdBTUEAALGPC/xhBQAAAANQTFRFJn8A
|
iVBORw0KGgoAAAANSUhEUgAAAIAAAACABAMAAAAxEHz4AAAABGdBTUEAALGPC/xhBQAAAANQTFRFJn8A
|
||||||
Mx1isQAAAAlwSFlzAAAOvgAADr4B6kKxwAAAAB9JREFUaN7twTEBAAAAwqD1T20IX6AAAAAAAAAAAD4D
|
Mx1isQAAAAlwSFlzAAAOvAAADrwBlbxySQAAAB9JREFUaN7twTEBAAAAwqD1T20IX6AAAAAAAAAAAD4D
|
||||||
IIAAAT2Y3yoAAAAASUVORK5CYII=
|
IIAAAT2Y3yoAAAAASUVORK5CYII=
|
||||||
</value>
|
</value>
|
||||||
</data>
|
</data>
|
||||||
|
10
RadioDJViewer/Properties/Resources.Designer.cs
generated
10
RadioDJViewer/Properties/Resources.Designer.cs
generated
@@ -60,6 +60,16 @@ namespace RadioDJViewer.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap fallback {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("fallback", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -118,6 +118,9 @@
|
|||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="fallback" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\fallback.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
<data name="green" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="green" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
@@ -100,5 +100,8 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Resources\red.png" />
|
<None Include="Resources\red.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\fallback.png" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
BIN
RadioDJViewer/Resources/fallback.png
Normal file
BIN
RadioDJViewer/Resources/fallback.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Reference in New Issue
Block a user