|
1 | 1 | Winamp Now Playing to File |
2 | 2 | === |
3 | 3 |
|
4 | | -This is a plugin for [Winamp](http://www.winamp.com/) that saves information about the currently playing song to a file on your computer. |
| 4 | +This is a plugin for [Winamp](http://www.winamp.com/) that saves text information and album art for the currently playing song to files on your computer. |
5 | 5 |
|
6 | | -You can customize where the file is saved, as well as the format of the information. When Winamp is not playing, the file will be empty. |
| 6 | +You can customize where the files are saved, as well as the format of the text. When Winamp is not playing, the text file will be empty, and the album art image file will be deleted. When a song is playing but it does not contain any album art in its metadata, the image file will be a 1px × 1px opaque black PNG. |
7 | 7 |
|
8 | 8 | ## Problem |
9 | 9 |
|
10 | | -I was broadcasting video game streams on [my Twitch.tv channel](https://twitch.tv/aldaviva), in which I also play music in the background. I wanted viewers to be able to tell which song I was playing at any given time, in case they liked it and wanted to find it for themselves. I started using the [Advanced mIRC Integration Plug-In (AIMP)](http://amip.tools-for.net/wiki/), which is generally used for showing your Now Playing status in IRC using [mIRC](https://www.mirc.com/). It also lets you save the status to a text file, which I added as a Text Source in [OBS](https://obsproject.com/). Unfortunately, AIMP only supports encoding the text using ANSI, OEM (DOS), FIDO, or KOI8 character encodings, none of which are UTF-8, which OBS requires. For example, `Jävla Sladdar` by [Etnoscope](https://www.discogs.com/Etnoscope-Way-Over-Deadline/master/284523) was being shown in the video stream as `J�vla Sladdar`, because even though AMIP was saving `ä` using ANSI, OBS was decoding the file with UTF-8, so the character was not properly decoded. |
| 10 | +I was broadcasting video game streams on [my Twitch.tv channel](https://twitch.tv/aldaviva), in which I also play music in the background. I wanted viewers to be able to tell which song I was playing at any given time in case they liked it and wanted to find it for themselves. I started using the [Advanced mIRC Integration Plug-In (AIMP)](http://amip.tools-for.net/wiki/), which is generally used for showing your Now Playing status in IRC using [mIRC](https://www.mirc.com/). It also lets you save the status to a text file, which I added as a Text Source in [OBS](https://obsproject.com/). Unfortunately, AIMP only supports encoding the text using ANSI, OEM (DOS), FIDO, or KOI8 character encodings, none of which are UTF-8, which OBS requires. For example, `Jävla Sladdar` by [Etnoscope](https://www.discogs.com/Etnoscope-Way-Over-Deadline/master/284523) was being shown in the video stream as `J�vla Sladdar`, because even though AMIP was saving `ä` using ANSI (`0xe4`), OBS was decoding the file with UTF-8, so the character was not properly decoded. |
11 | 11 |
|
12 | 12 | ## Solution |
13 | 13 |
|
14 | | -I wrote my own Winamp plugin to save information about the currently playing song to a text file, encoded with UTF-8. |
| 14 | +I wrote my own Winamp plugin to save information about the currently playing song to a text file, encoded with UTF-8, and an image file, encoded however the album art was encoded in the audio file metadata (JPEG, PNG, etc). |
15 | 15 |
|
16 | 16 | ## Installation |
17 | 17 |
|
18 | | -1. Download the [latest release](https://github.com/Aldaviva/WinampNowPlayingToFile/releases) ZIP file (not the source code file) |
19 | | -2. Extract the archive to your Winamp installation directory |
| 18 | +1. Download the [latest release](https://github.com/Aldaviva/WinampNowPlayingToFile/releases) ZIP file (not the source code file). |
| 19 | +2. Extract the archive to your Winamp installation directory. |
20 | 20 | ``` |
21 | 21 | C:\Program Files (x86)\Winamp |
22 | 22 | ├── plugins |
23 | 23 | │ └── gen_WinampNowPlayingToFile.dll |
24 | 24 | ├── WinampNowPlayingToFile.dll |
25 | 25 | ├── Daniel15.Sharpamp.dll |
26 | 26 | └── mustache-sharp.dll |
| 27 | + └── taglib-sharp.dll |
27 | 28 | ``` |
28 | 29 |
|
29 | | -3. Restart Winamp if it's already running |
| 30 | +3. Restart Winamp if it's already running. |
30 | 31 |
|
31 | 32 | ## Configuration |
32 | 33 |
|
33 | | -By default, this plugin saves information about the currently playing song to `winamp-now-playing.txt` in your temporary directory (`%TEMP%`), and the file contains the track Artist, Title, and Album (if applicable), for example |
| 34 | +### Text |
| 35 | +
|
| 36 | +By default, this plugin saves textual information about the currently playing song to `winamp-now-playing.txt` in your temporary directory (`%TEMP%`), and the file contains the track Artist, Title, and Album (if applicable), for example |
34 | 37 | ```text |
35 | 38 | U2 - Exit - The Joshua Tree |
36 | 39 | ``` |
37 | 40 |
|
38 | | -To customize the file location and contents, |
| 41 | +To customize the text file location and contents, |
39 | 42 |
|
40 | | -1. Start Winamp |
41 | | -2. In Winamp's Preferences, go to Plug-ins › General Purpose |
42 | | -3. Configure Now Playing to File |
43 | | -4. You can change the file contents by editing the template and inserting template placeholders for the following track information |
| 43 | +1. Start Winamp. |
| 44 | +1. In Winamp's Preferences, go to Plug-ins › General Purpose. |
| 45 | +1. Configure the Now Playing to File plugin. |
| 46 | +1. You can change the file contents by editing the **Text template** and inserting placeholders for the following song information. |
44 | 47 | - `{{Album}}` |
45 | 48 | - `{{Artist}}` |
46 | 49 | - `{{Filename}}` |
47 | 50 | - `{{Title}}` |
48 | 51 | - `{{Year}}` |
49 | | -5. Advanced template logic can be added using [Handlebars expressions](https://handlebarsjs.com/), including the [built-in helpers](https://handlebarsjs.com/builtin_helpers.html) like `{{#if}}` and `{{#unless}}` |
50 | | -6. You can change where the file is written on your drive |
51 | | -7. Click Save to write your settings to the registry (`HKCU\Software\WinampNowPlayingToFile`) |
| 52 | +1. As you fill in the template, the **Text preview** will be updated to show how the currently-playing song would be rendered, or if no song is playing, an example song. |
| 53 | +1. Advanced template logic can be added using [Handlebars expressions](https://handlebarsjs.com/), including the [built-in helpers](https://handlebarsjs.com/guide/builtin-helpers.html) like `{{#if}}`, `{{#else}}`, `{{/if}}`, and `{{#unless}}`. To insert a line break (CRLF), use `{{#newline}}`. |
| 54 | +1. You can change where the file is written on your drive by selecting a different path for **Save text as**. |
| 55 | +1. Click OK to write your settings to the registry (`HKCU\Software\WinampNowPlayingToFile`). |
| 56 | + |
| 57 | +### Album art image |
| 58 | + |
| 59 | +This plugin also saves the currently playing song's album art to `winamp-now-playing.png` in the same directory at the original format and resolution as it is saved in the song metadata tags. |
| 60 | + |
| 61 | +Note that the file extension is not changed, even if the album art has a file type different from PNG, to make it easier to refer to this file from other programs like OBS without having to deal with multiple possible file extensions. This means that this file may be a JPEG with a `.png` file extension. Most programs, including OBS, can handle this case just fine, but it is a little silly looking. |
| 62 | + |
| 63 | +You can customize the album art filename and path using **Save album art as** in the same configuration dialog as the text file above. |
52 | 64 |
|
53 | 65 | ## Usage |
54 | 66 |
|
55 | 67 | ### OBS |
56 | 68 |
|
57 | | -1. Start playing a song in Winamp |
58 | | -2. Create a new Text (GDI+) source in your OBS scene |
59 | | -3. In the Properties for your source, enable Read From File |
60 | | -4. Select the text file created by this plugin (by default, `%TEMP%\winamp-now-playing.txt`) |
| 69 | +1. Start playing a song in Winamp. |
| 70 | +1. Create a new Text (GDI+) source in your OBS scene. |
| 71 | +1. In the Properties for your text source, enable Read From File. |
| 72 | +1. Select the text file created by this plugin (by default, `%TEMP%\winamp-now-playing.txt`). |
| 73 | +1. Create a new Image source in your scene. |
| 74 | +1. In the Properties for your image source, select the image file created by this plugin (by default, `%TEMP%\winamp-now-playing.png`). |
| 75 | + |
| 76 | +## Uninstallation |
| 77 | + |
| 78 | +1. In Winamp's Preferences, go to Plug-ins › General Purpose. |
| 79 | +1. Select the Now Playing to File plugin, then click the Uninstall Selected Plug-In button. |
| 80 | +1. Delete all the files you had extracted to the Winamp installation directory when installing this plugin. |
| 81 | + ``` |
| 82 | + C:\Program Files (x86)\Winamp |
| 83 | + ├── plugins |
| 84 | + │ └── gen_WinampNowPlayingToFile.dll |
| 85 | + ├── WinampNowPlayingToFile.dll |
| 86 | + ├── Daniel15.Sharpamp.dll |
| 87 | + ├── mustache-sharp.dll |
| 88 | + └── taglib-sharp.dll |
| 89 | + ``` |
| 90 | +1. Delete the song information files (by default, `winamp-now-playing.txt` and `winamp-now-playing.png` in `%TEMP%`). |
0 commit comments