Added support for uploading to web server, among other smaller updates~ ^-^
<?php
/* ############################################################# */
// Simply put your user name and desired font here and you are set!
$user = "givenameplz";
$txtFont = 'calibri.ttf'; // File has to be in the same folder as this file!
/* ############################################################# */
// If you want to change the output messages, please do it here.
$output_is = "is";
$outputHappy = "(*^v^)/";
$outputSad = "(Q^Q)~";
$output_nowplaying = "Now Playing:";
/* ############################################################# */
// If you have no idea whats going on, don't touch anything below~
// Adding spaces~
$output_is = " ".$output_is." ";
$outputHappy = " ".$outputHappy;
$outputSad = " ".$outputSad;
$output_nowplaying = " ".$output_nowplaying." ";
header('content-type: image/png');
$image = imagecreatetruecolor(620, 10);
imagealphablending($image, false);
$bgCol = imagecolorallocatealpha($image, 0, 0, 0, 127);
imagefill($image, 0, 0, $bgCol);
imagesavealpha($image, true);
$txtCol = imagecolorallocate($image, 128, 64, 128);
$txtNPCol = imagecolorallocate($image, 218, 54, 108);
$txtMapCol = imagecolorallocate($image, 188, 54, 98);
$txtSize = 8;
$txtAngle = 0;
$txtX = 1;
$txtY = 8;
$offset = calcMyFontPlz($user.$output_is,$txtFont,$txtSize,$txtAngle); // Offset for USERNAME is...
$np = file_get_contents('np.txt', NULL, NULL, 0, filesize('np.txt'));
$status = file_get_contents('status.txt', NULL, NULL, 0, filesize('status.txt'));
if(strpos($status,"Online") !== false && strpos($np,"Nothing Q^Q") !== false){
//Output if we're online but not playing anything
$txtStatus = "[Online]";
$txtStatusCol = imagecolorallocate($image, 0, 180, 0);
$offset2 = calcMyFontPlz($txtStatus,$txtFont,$txtSize,$txtAngle);
imagettftext($image, $txtSize, $txtAngle, $txtX + $offset + $offset2, $txtY, $txtCol, $txtFont, $outputHappy);
} elseif(strpos($status,"Offline") !== false){
//Output if we're offline
$txtStatus = "[Offline]";
$txtStatusCol = imagecolorallocate($image, 180, 0, 0);
$offset2 = calcMyFontPlz($txtStatus,$txtFont,$txtSize,$txtAngle);
imagettftext($image, $txtSize, $txtAngle, $txtX + $offset + $offset2, $txtY, $txtCol, $txtFont, $outputSad);
} else {
//Output if we're online playing a map!
$txtStatus = "[Online]";
$txtStatusCol = imagecolorallocate($image, 0, 172, 0);
$offset2 = calcMyFontPlz($txtStatus,$txtFont,$txtSize,$txtAngle);
imagettftext($image, $txtSize, $txtAngle, $txtX + $offset + $offset2, $txtY, $txtCol, $txtFont, $outputHappy);
if(strlen($np) > 2){
$offset2 += calcMyFontPlz($outputHappy,$txtFont,$txtSize,$txtAngle);
imagettftext($image, $txtSize, $txtAngle, $txtX + $offset + $offset2, $txtY, $txtNPCol, $txtFont, $output_nowplaying);
$offset2 += calcMyFontPlz($output_nowplaying,$txtFont,$txtSize,$txtAngle);
imagettftext($image, $txtSize, $txtAngle, $txtX + $offset + $offset2, $txtY, $txtMapCol, $txtFont, $np);
}
}
//Output Online/Offline message.
imagettftext($image, $txtSize, $txtAngle, $txtX, $txtY, $txtCol, $txtFont, $user.$output_is);
imagettftext($image, $txtSize, $txtAngle, $txtX + $offset, $txtY, $txtStatusCol, $txtFont, $txtStatus);
imagepng($image);
imagedestroy($image);
function calcMyFontPlz($string, $font, $size, $angle)
{
$result = imagettfbbox($size,$angle,$font,$string);
return $result[2];
}
?>
Italobrothers - Stamp On The Ground [Insane] [--|------------------]EDIT: If you remove all of the suffixes, then the difficulty appears at the 5% mark.
Yeah, I recently only just realized what that bar is for lol.YayMii wrote:
I'm liking this program (planning to use it as a song display whenever I livestream), but I think I found a bug. When playing through a song, osu!np records the progress bar in the text once you play through 5% of the song (or when the progress bar in the window title updates), replacing the suffix tags:Italobrothers - Stamp On The Ground [Insane] [--|------------------]EDIT: If you remove all of the suffixes, then the difficulty appears at the 5% mark.
The picture of the map thing was just something that came to mind as an example, looking forward to your ideas for more features!Primula wrote:
[...]
Think of other fun things to include, as querying the picture of the song playing.
I have a few ideas, not too sure how to get the picture of a map (is there a different ID for a mapset maybe? I guess that'd be why >-<)
[...]
Just another thought aswell, I myself can't think of useful things to output.Primula wrote:
[...]
Maybe more placeholders like [Diff] and [DL] for the user to input.
I'm not sure what else there is to output, (otherthan the many possibilities of map data).
[...]
Looking perfect! Thanks, I like the compact design, its just that I don't want to put on my reading glasses. (As I would need to buy some in the first place!)Primula wrote:
[...]
As for your suggestions, givenameplz.
Increase size of the texts, they appear really small for me.
I increased it a little, hope it's okay o.o I'd like to keep it compact considering it's an application which should just run in the background most of the time.
[...]
Updated to v0.8 with the newline feature you recommended. ^-^YayMii wrote:
Woah, you update fast. Just hours after my post, and you already fixed the issues I found!
As for the suffix data, the only thing I can think of that might be useful is having the mapper's name. Another feature that could potentially be useful would be the ability to export the data in multiple lines. Anyways, keep up the good work!
1. The middle field was individual to be used as feedback so you know whether the current song is being outputted and also was used to set the idle message, but I'll make the following changes for that:YayMii wrote:
Just tried the newest version, and I have a few suggestions:
1. Since you already added the commands for songtitle and artist, why not just use one big text field instead of 3 smaller ones?
2. How about 2 different lines for when you're playing a song and when you're not? I have mine saying "Mapped by: [c]" and the "Mapped by:" part shows up even when I'm not playing a song.
3. Maybe save the configuration to a file? My settings seem to be resetting every update.
Thanks for another quick update, but this time it looks like the directories aren't saving properly and is causing problemsPrimula wrote:
Okis, all your suggestions are now implemented in v1.1, YayMii. :3
I was going to make it possible to do commands like: [Creator: c] so 'Creator:' would only show if 'c' existed, but it's a bit fiddly (very much dependant on what text is enclosed) and not very necessary because I've split the idle and output messages now. Only time something like that is needed is when the information really doesn't exist (some maps don't have creators listed or something? >-<)
I think I could do something like [Creator: <c>] quite easily, I'll get around to it when I have time.
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.ArgumentException: Empty path name is not legal.
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.IO.File.Create(String path)
at OsuNP.frmOsuNP.resetNP()
at OsuNP.frmOsuNP.cmdToggle_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18033 built by: FX45RTMGDR
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
osu!np
Assembly Version: 1.1.0.0
Win32 Version: 1.1.0.0
CodeBase: file:///C:/Users/BlooMassacre/Documents/osu!np/osu!np.exe
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 10.0.0.0
Win32 Version: 11.0.50709.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18033 built by: FX45RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18037 built by: FX45RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18022 built by: FX45RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18033 built by: FX45RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
I found the issue... hitting the X button on the config window at any time causes the whole config to clear itself.Primula wrote:
I'm not sure how to troubleshoot your error, what exactly do you do to cause it?
Directories are saving fine for me, and it only crashes if the directories are left blank.
Try deleting your old settings file (remove folder: C:\Users\..\AppData\Local\Primpri)
Ensure output directory contains the file to output like: C:\Users\..\Desktop\np.txt
Ensure Osu! directory is correct like: C:\Program Files\Osu (no trailing slash)
On the 'Upload' tab, only check 'Playing' and 'Online Status' if you're uploading through ftp.
and ensure the ftp field is an existing web directory like: ftp://host.com/www/np/ (this path varies so you might require something else)
Ensure you're clicking 'Save' when exiting the Config after updating the directories, not 'Close' (might seem obvious >-<)
peppy wrote:
You'll probably have a lot easier time using the new last.fm scrobbling plus the last.fm api to get currently playing tracks from osu!, if you feel like switching over.
Just go to your profile, and on the left bar you should see a "connect to last.fm" link. Once you connect your profile, osu! should automatically scrobble your songs as you play the game.Dexus wrote:
Ooo? So that's why last.fm was integrated; How do you set it up exactly? I've not really looked into it.
For your first request, that's already possible.YayMii wrote:
Two more feature requests: is there a way you could give an option to display the beatmap link as osu.ppy.sh/b/# (difficulty specific) instead of osu.ppy.sh/s/# (song specific)? And is there a way you could display the difficulty mods in use? Thanks!
Oh, BTW, I'm not using this for the !np command in chat, I'm actually using it with OBS to display the song title/link on-screen when streamingSome of my viewers were asking how I did it, and I directed them here. Maybe you could include instructions on how to set that up in the OP? I could help, if needed.
Also, thanks for making this tool. I seem to be having a problem with my ftp connection now thoughThe PHP side of things wasn't intended to output much song data at first but it's on the TODO list.it just keeps uploading blank np.txt files
UPDATE: After a while it'll upload non-blank np.txt files however they refuse to be customized xD They just output the Artist and Title
- An option to add a 2nd output file.Okidoki
I have an idea to go with xformi's idea: How about an option to keep the last-played song in another file? Just in case I begin playing another song and someone asks for the song I already finished.Okidoki x2
are these working?(not that it matters for me- I have my prog for it ;w; )☆★ Map Difficulty Commands
- ☆ [t] - Song Title.
☆ [tu] - Song Title in unicode.
☆ [a] - Song Artist.
☆ [au] - Song Artist in unicode.
☆ [c] - Map Creator.
☆ [tag] - Map Tags.
☆ [mid] - Map ID.
☆ [msid] - Mapset ID.
- ☆ [diff] - Map Difficulty.
☆ [hpd] - HP Drain Rate.
☆ [cs] - Circle Size.
☆ [od] - Overall Difficulty.
☆ [ar] - Approach Rate.
☆ [sm] - Slider Multiplier.
☆ [st] - Slider Tick Rate.
As far as I'm aware, you need to properly set your osu! directory in the config for the map info and IDs to function.Piotrekol wrote:
/snip
are these working?(not that it matters for me- I have my prog for it ;w; )
because I tried using map/mapset ID's and it didn't work (v1.5)
Exception while connecting to FTPEasy fix.
Primary output is overwrittenSomething I overlooked.
Add an "Start osu!" buttonNice idea, will do an 'Osu' icon styled button~
POST requestsPretty simple to do >-<
Upload to FTP does not correctly "go offline"I thought I fixed this >-< Will check it.
It has been send as it is right now, only the key is removed as I havn't entered the FTP in the new Version yet.Primula wrote:
The 'osu!np stopped working' thing is related to the other problem.
I didn't do much testing with the post thing because I was too tired. >-<
..But it worked fine for me in the few tests I did do.. ;---;
And it worked just fine again now.. odd.
Could you send me a copy of your exported config? (with your ftp details removed ofc)
Gah! °,..,°Primula wrote:
[...]
I just realized I forgot to do the unicode thing ;---;!
17:51:42|NP: Retrieving MapData of Map(Oranges & Lemons - Soramimi Cake (TV size);[Hard]).& to &.
[...]
17:51:42|POST: Encoded(key=xxx&primary=Oranges & Lemons - Soramimi Cake (TV size) [Hard]&secondary= - [Hard]&)
18:00:34|NP: Retrieving MapData of Map(Amane - Eternal Fullmoon;[Al's Insane]).' to '.
[...]
18:00:35|POST: Encoded(key=xxx&primary=Amane - Eternal Fullmoon [Al's Insane]&secondary= - [Al's Insane]&)
pls update for bigger window, i use 1920x1080 monitor so i find the window to be 2small4me.B..but.. If you open the Beatmaps window, it doubles in size! ;--;
21:33:17|POST: Compare~
Raw(key=abc321&primary=np: SYNC.ART'S - Sins -Kokoro no Tsumi- [Nightmare]&)
Encoded(key=abc321&primary=np%3a+SYNC.ART%27S+-+Sins+-Kokoro+no+Tsumi-+%5bNightmare%5d&)
21:33:17|POST: Setting header..
21:33:17|POST: Writing request stream..
21:33:18|POST: Reading response stream..
21:33:18|POST: Response(np: SYNC.ART'S - Sins -Kokoro no Tsumi- [Nightmare])
Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: osu!np.exe
Problem Signature 02: 2.0.0.0
Problem Signature 03: 5211ce71
Problem Signature 04: System.Windows.Forms
Problem Signature 05: 4.0.30319.18046
Problem Signature 06: 51552cda
Problem Signature 07: c2b
Problem Signature 08: 36
Problem Signature 09: System.InvalidOperationException
OS Version: 6.2.9200.2.0.0.256.48
Locale ID: 1033
Additional Information 1: 5861
Additional Information 2: 5861822e1919d7c014bbb064c64908b2
Additional Information 3: f3d5
Additional Information 4: f3d5be0cad2787556264647dc02181c3
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=190175
If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt
When are you receiving that error, at startup?Yes, right after the start
And is there any additional information provided by it?Logs from Event Viewer
Only thing I can recommend at the moment is install .Net Framework 4 if you don't already have it, or repair if you do.I'm using Windows 8 Pro 64-bit, so .Net Framework 4 is already installed.
Will check on it today. >-<YayMii wrote:
Sorry about the late response, but it seems osu!np still doesn't work with osu!test. If there's nothing left that you can do currently to fix the issue, do you think you'd be able to find out why it isn't working if I gifted you supporter?
I get this error as well and I'm on windows 7 64-bit. I repaired my .NET framework and re-installed it. I can not run osu!np at all.hit0ri wrote:
After update to v2.0 I get this errorView problem detailsProblem signature:
Problem Event Name: CLR20r3
Problem Signature 01: osu!np.exe
Problem Signature 02: 2.0.0.0
Problem Signature 03: 5211ce71
Problem Signature 04: System.Windows.Forms
Problem Signature 05: 4.0.30319.18046
Problem Signature 06: 51552cda
Problem Signature 07: c2b
Problem Signature 08: 36
Problem Signature 09: System.InvalidOperationException
OS Version: 6.2.9200.2.0.0.256.48
Locale ID: 1033
Additional Information 1: 5861
Additional Information 2: 5861822e1919d7c014bbb064c64908b2
Additional Information 3: f3d5
Additional Information 4: f3d5be0cad2787556264647dc02181c3
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=190175
If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt
Did you try thisPiotrekol wrote:
last version that worked for me was v1.9
Windows 7 x64 SP1 + .NET 4.5
★ Problem: osu!np will throw a System.InvalidOperation Exception and will not startup.
☆ Solution: Ensure that you have WMP installed. (It's installed by default on Windows operating systems but you may have uninstalled it.)
Control Panel > Programs & Features > Turn Windows features on/off > Media > Enable 'Windows Media Player' > Restart if necessary
Known issue with v2.1 & 2.2, it's fixed in 2.3 (for when updating to future versions)YayMii wrote:
Thanks for the update, but I'm now getting this error when updating:
It works fine when redownloading manually though :/
Something I forgot to do, will get settings sorted in 2.4YayMii wrote:
EDIT: And it seems to not save my "previous secondary" setting.
Thank you ^-^YayMii wrote:
Wow, you're amazing! Adding features that I'd use even though I didn't know I wanted them. Keep up the good work.
I have a few suggestions:
1. For the standalone player, it should probably have a separate output if it doesn't already (seeing as you don't really need information like the difficulty).
2. Maybe a toggle for osu!test in the database reader? osu!test has its own set of .db files, and that was the original reason why I asked for o!test support in the first place.
This appears to be a problem with the position saving of the application.Kurimu wrote:
Not sure why this happened but my config file and my np file both just disappeared and now when I open the program it opens to the task bar but has no window.
Edit: It seems that whenever I load it, my config file disappears.. so I have to export every time I have it opened if I want my settings to retain.
<setting name="setPosition" serializeAs="String">Sometimes gets set to a really odd, seemingly overflow value.
<value>162, 171</value>