This provides a collection of music related functions -
1) track rating
2) automatically detect track changes and update played times/counts/run user command.
3) a smart playlist shuffle (reorder the playlist, based on rating\last played time).
4) add extra tags to help go from tracks to albums (and vice versa).
6) import extra tags form a tab separated text file.
5) extra milkdrop functionality.
6) cd player style playback controls (play-pause, previous-restart buttons).
Some of the milkdrop/cd player controls require you that you are using Winamp, Someone could extend it to use foobar if needed.
This plug-in needs a dummy screen (xMusic.dummy.xml) which is included with the download, you need add this to you skin for the plug-in to work (it simply defines a few categories used when auto updating)
As usual, the source code is included, its written in C# and you can use the free edition of C# to edit/compile it.
Download link (including source code) -
Updates
20 Mar 2007 - Added album.added\sort and track.added\sort tags.
20 Mar 2007 - Fixed a bug while loading invalid tag files.
20 Mar 2007 - Improved tag importing instructions.
20 Mar 2007 - Very basic multizone support (works on the active zone).
?????????????? - Play status is now correctly picked up from WinAmp.
2 Apr 2008 - Updated to "my" version.
3 Apr 2008 - Added more data to xmusic.dummy.xml.
2 Apr 2008 - tags renamed to match xDatabase
2 Apr 2008 - Settings moved to an ini file
2 Apr 2008 - removed current.track.on track change command and current.track.auto update play times.
3 Apr 2008 - added ini file option to use the the file creation date - Get Date Added From File = true/false.
3 Apr 2008 - added ini file option to add item specific xdb.date.added - Add Date Added For "type" = true/false
4 Apr 2008 - fixed bug which reset play counter
4 Apr 2008 - fixed bug in use file creation date
4 Apr 2008 - sort info correctly added to albums/tracks and movies
6 Apr 2008 - added "find.audio.player.now"
6 Apr 2008 - added "find.audio.player.next"
Please note...
I only use this plugin to control milkdrop and automatiaclly add play times... for everything else i use xDatabase.
I have left the duplicated routines in, so hopefully it wont break anyone's install, but i am less likely to update this because I dont use it...
I would suggest moving over to xDatabase for most of the PLAYLIST/DATABASE routines.
I now use a ini file to store plugin settings, there is a new section about it in this post.
Some of the tag names have changed (i made them more neutral, and share them with xDatabase), here are the new tag names
"played" = "xdb.played"
"last.played" = "xdb.last.played.sort"
"last.played.str" = "xdb.last.played"
"played.count" = "xdb.played.count"
"album.added" = "xdb.date.added"
"track.added" = "xdb.date.added"
"album.added.sort" = "xdb.date.added.sort"
"track.added.sort" = "xdb.date.added.sort"
"shuffle.pos" = "xdb.random"
"stars" = "xdb.rating"
Functions are -
*** PLUGIN **********************************
xmusic.plugin.stop
This will stop the plugin from looking for track changes and play state changes.
xmusic.plugin.start
This will make the plugin look for track changes and play state changes. This can be called automatically by setting AutoStart = true in the ini file.
*** CURRENT TRACK **********************************
current.track.set track rating:dec/inc/toggle/*/**/***/****/*****
This writes/updates a tag called "stars" in the current track.
"dec" decrements the rating
"inc" increments the rating
"toggle" increments the rating, if it equals ***** it wraps round to *
"*" to "*****" sets stars to that value.
current.track.set track played time:value
This will update the current songs "played", "played.count", "last.played" and "last.played.str".
"" use the current time
"blank" reset the played times
"date/time" set the played times to be this value.
if the value is blank, the tags will be removed, if not they are set to
"played" to true
"played.count" is incremented
"last.played" to be the number of mins since my birthday (good for sorting)
"last.played.str" to be "last played at %datetime>f"
current.track.set album rating:blank/dec/inc/*/**/***/****/*****
This does the same thing as "current.track.set track rating", but it is applied to every track on the current songs album.
current.track.set album played time:value
This does the same thing as "track.set track played time", but it is applied to every track on the current songs album.
*** PLAYLIST/DATABASE ******************************
find.audio.player.now:category name>category field>audio.player.field>is sorted (true/false)
This will find the current song in a category.
find.audio.player.next:category name>category field>audio.player.field>is sorted (true/false)
This will find the next song in a category.
database.m3uplaylists.load.current
Jump to the current playlist in the m3uplaylists category - useful to ensure that you are deleing/renaming the current playlist.
database.m3uplaylists.find:playlistname
Jump to the playlist "playlistname" in the m3uplaylists category.
database.set rating:category>dec/inc/*****
This does the same thing as "set track rating", but it updates the selected entry in "category".
database.set played time:category>value
This does the same thing as "track.set track played time", but it updates the selected entry in "category".
database.playlist shuffle:MaxSongsToResuffle
This will add a field ("shuffle.pos") to every item in the current playlist, the playlist can then be sorted on the new field to randomize it. This means you can see what order the tracks will be played in (unlike when using the shuffle command).
If MaxSongsToResuffle is set it will only update that number of the entries in the playlist (useful if you playlist is very large).
database.add shuffle
Updates the "shuffle.pos" of every song in the music database.
database.add extra fields
This add the following fields to each album -
"artist.sort" (i.e. artist=the beatles, artist.sort=beatles, the)
"albumname.sort" (i.e. albumname=the big album, albumname.sort=big album, the)
It will also add the following fields to each track -
"artist.sort" (i.e. artist=the beatles, artist.sort=beatles, the)
"album.artist"\"album.artist.sort" a copy of the alum artist name (allows for simple mapping of various artist tracks)
If the following are NOT present they are added and set to
"played" = "false"
"played.count" = "0"
"last.played" = "0000000000"
"stars" = "***"
"track.search" = "TrackName (TrackArtist, AlbumName)"
"shuffle.pos" = random position based on the rating/played time.
database.import tags:tab_separated_file_path
This parses a tab separated list and adds/updates any music entries found in the text file.
*** PLAYBACK CONTROLS ******************************
playback.set pause string:str
When the music player is paused, %variable>xmusic.play.pause.button% will contain this string.
playback.set play string:str
When the music player is playing, %variable>xmusic.play.pause.button% will contain this string.
playback.toggle playback
Toggle the music player, combine with %variable>xmusic.play.pause.button% and you have a simple play/pause combo button.
playback.stop
Stop the music player (and updates %variable>xmusic.play.pause.button%).
playback.restart and previous track
Call this once and it will restart the current track, call it twice and it will jump to the previous track (this is how all of my cd players have worked). In use this feels like double clicking the button...
playback.auto.hide.controls:TRUE/FALSE/BLANK
If this is set to true it will automatically hide the progress bar and any controls with an id of "id.music.controls".
I use this to hide a music now plying display on my main menu.
*** MILKDROP ***************************************
milkdrop.auto.reposition:TRUE/FALSE
If enabled, this does the same kind of thing as xmovewindow - whenever a screen is entered or milkdrop is started it will strip the border/title from milkdrop and automatically position miilkdrop at the control with an id of "xmusic.milkdrop.screen_name", where screen_name is the name of the screen the control is on.
If you want it to look for milkdrop starting and position the control as needed you need a textbox with a value of "plugin>xmusic>milkdrop.auto.position".
milkdrop.position
This does the same kind of thing as xmovewindow - it will strip the border/title from milkdrop and automatically position miilkdrop at the control with an id of "xmusic.milkdrop.screen_name", where screen_name is the name of the screen the control is on.
milkdrop.stop
Stop milkdrop.
milkdrop.start
Start milkdrop.
milkdrop.toggle
Stop/start milkdrop.
milkdrop.fullscreen stop
Not yet implemented.
milkdrop.fullscreen start
Not yet implemented.
milkdrop.fullscreen toggle
Not yet implemented.
milkdrop.rating -
Decrement the rating for the current visualization currently running.
milkdrop.rating +
Increment the rating for the current visualization currently running.
milkdrop.vis +
Move to the next visualization.
milkdrop.vis -
Move to the previous visualization.
milkdrop.vis random
Pick a random visualization.
milkdrop.show title
Show the current songs title in milkdrop.
milkdrop.show fps
Show the current songs title (animated) in milkdrop.
*** INI FILE SETTINGS *********************************
Format Rating Char = char
Whenever a user rating is changed this charecter is used.
AutoStart = true/false
On start-up, kick off the plugin
Auto Update Last Played Time = true/false
Automatically update the last played time whenever the current track changes.
Add Date Added For "type" = true/false
If this is set, i will create a xdb.date.added."type" and xdb.date.added.sort"type" entries, where "type" is track or album.
Get Date Added From File = true/false
If this is set, i will try and get the date added from the file creation time, if the value stored in the database is older i will still use that...
Auto Position Milkdrop window = true/false
Automatically remove the frame from mildrop and position it to the control "xmusic.milkdrop.***current screen name***.
Auto Hide Music Controls = true/false
If a track is playing show progressbar and any controls with an id of id.music.controls, if no track is playing hide them.
Pause Button Text = string
If a track IS playing the value of "xmusic.play.pause.button" will be this string.
Play Button Text = string
If a track is NOT playing the value of "xmusic.play.pause.button" will be this string.
Check For Track Changes every (ms) = int
Every XXX ms i will see if the current track has changed.
Milkdrop Class Name = string
This is the class name of the milkdrop window, it is Milkdrop for version 1 and Milkdrop2 for the new milkdrop.
Check Playback State Via Winamp = true/false
IF you are using WinAmp, i can tell if a track is playing or paused and update the state acordingly.
Check For Play State Changes every (ms) = int
If Check Playback State Via Winamp is set, Every XXX ms i will see if the you have pressed the play/pause/stop buttons.
[On Track Change]
Whenever the current track changes, i will run the commands in the [On Track Change]. It will run all of the commands in the order 1, 2, 3 etc.
Example -
[On Track Change]
1 = command¦xlobby¦goto screen¦menu
2 = command¦plugin¦command¦xMusic¦milkdrop.stop
[On Track Change]
Whenever the play status changes, i will run the commands in the [On Play State Change]. It will run all of the commands in the order 1, 2, 3 etc.
Example -
[On Track Change]
1 = command¦xlobby¦goto screen¦menu
2 = command¦plugin¦command¦xMusic¦milkdrop.stop
Notes:
xml file backups
Anything that directly modifies a database.xml file will save the old file as xxx.bup, if anything goes wrong you can restore the last copy.
CD Playback controls
The value of %variable>xmusic.play.pause.button% is automatically updated to reflect the play status of Winamp.
Smart Playlist/shuffle.pos
shuffle.pos is "smart", it will factor in the rating of the track and its last played time - it tries to place ***** songs near the start of the playlist and * songs at the end. it will also try and place unplayed songs at the start of they playlist. Personally, i tent to listen to all of my tracks in a random playlist (i load up 14000 tracks when Xlobby starts) calling database.playlist shuffle takes ages to run on such a large playlist, instead i call "database.add shuffle" every time i exit Xlobby, this means i can simply sort my initial playlist on "shuffle.pos".
Mp3 Tag Importing
I use a simple export file, the output file name should be *.txt and i use the following mte file -
- Code: Select all
parameter length length.seconds genre year bitrate codec
$loop(%album%)$loop(%album%)%_folderpath%%_filename_ext% %_length% %_length_seconds% %genre% %year% %_bitrate% %_codec%
$loopend()$loopend()
PLEASE NOTE THAT THE ABOVE IS USING TABS NOT SPACES
%_folderpath%%_filename_ext% HAS to be the FISRT entry!
%_length%, %_length_seconds% can be replaced with any of the tags supported in Mp3Tag.
This will generate a file that looks like this
C:\tag.txt
-----------------------------------------------
C:\oasis\stop the clocks [disc 1 of 2]\06-wonderwall.flac 04:17 257 Rock 2006 1040 Free Lossless Audio Codec
C:\oasis\stop the clocks [disc 1 of 2]\01-rock 'n' roll star.flac 05:19 319 Rock 2006 1061 Free Lossless Audio Codec
-----------------------------------------------
You then need to add an header to the the file so the importer knows what field names to use -
-----------------------------------------------
parameter length length.seconds genre year bitrate codec
C:\Documents and Settings\sean.pittaway\My Data\Music\New\oasis\stop the clocks [disc 1 of 2]\06-wonderwall.flac 04:17 257 Rock 2006 1040 Free Lossless Audio Codec
C:\Documents and Settings\sean.pittaway\My Data\Music\New\oasis\stop the clocks [disc 1 of 2]\01-rock 'n' roll star.flac 05:19 319 Rock 2006 1061 Free Lossless Audio Codec
-----------------------------------------------
Again parameter MUST BE THE FIRST ENTRY.
PLEASE NOTE THAT THE ABOVE IS USING TABS NOT SPACES
You can now import these tags using this plugin.
Sean.