Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-02-01 Thread Phil Meyer
I can now say, I'm still getting a lot of repeated and duplicated
tracks in the playlist with your modified version of the plugin.
Check the sugarcube prefs file to see what you have in the stored list of 
previous played tracks.  You may need to manually remove them and set the 
tracknum to 0.

i.e. for each player, it stores info such as:
  track1: file reference
  track2: file reference
  track3: file reference
  track4: file reference
  track5: file reference
  tracknumber: 5

If tracknumber is greater than sugarcube_remembertracks preference, then it 
will keep storing new tracks to this list, but only look for duplicates in the 
first n tracks.

If you delete all referenced tracks and set tracknumber to 0, it should be okay.

I also noticed some oddities when I had recipe set to avoid duplicates.  Try it 
with no recipe?
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-24 Thread Phil Meyer
Nevertheless, i gues, that now also the Dynamicplaylist integration of
sugarcube won't work anymore, but that could be improved

I was contemplating making a new plugin to do MusicIP mixes in DynamicPlaylist. 
 i.e. ask cparker if he wouldn't mind me taking a copy of parts of his code 
into a new plugin, and then extending it.

There are some enhancements I'd like to make to the DynamicPlaylist 
functionality, but don't want to inadvertently break SugarCube functionality, 
which I don't use much.

I'd like to define what to use as a seed, from some simple options/priorities, 
such as use currently selected item (when using the mixer context menu on a 
player, either an artist, album, song or genre), use currently playing track, 
or use last played track, or use random song from playlist name.

Be able to configure different dynamic playlists, eg. pass filter params into 
it.  So I could quickly play Not rated tracks filter, or favorite tracks.
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-21 Thread Phil Meyer
This is happening to me a lot now. I get the same song queued right
after itself quite often. I usually start my playlists with 10-20 songs,
or an album. I guess you have to always keep your playlist under 20 to
avoid it?

I think you'll find that if you have set the prefs to avoid dups in the last 20 
songs, that this will only work for the first 20 songs you play.  I think at 
some point it clears the songs that it has remembered (perhaps when SugarCube 
is stopped/disabled and then playback restarted), at which point it will work 
for the next 20 songs.

You could try applying my modified version of the plugin to see if it fixes the 
issue for you.
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-20 Thread Phil Meyer
maybe i got something wrong, but i have no problems with repeated
tracks.

Assuming you select one track and now Sugargucbe selects the next
tracks you can avoid this problem by the use of filters in musicip.

Probably.

I generally play with a filter not rated.  My MusicIP headless web server has 
a mix option Always include seed songs in mix, and the seed song appears as 
the first track in the mix.

I guess that even if I played a filter not played in last 5 days, the seed 
song (the one just played) would still be returned as the first song in the mix.

Thus if the plugin code doesn't ignore recently played tracks when selecting a 
song from the returned mix, it would choose the same song.

But like I said, this is using the potentially out of date unmaintained 
DynamicPlaylist integration mode in SugarCube.  SugarCube itself may be using 
different code (I haven't checked).
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-19 Thread Phil Meyer
I did some more testing with the different settings in the server
settings (Player tab). With the option 'Remember This Many Played
Tracks' set to 20 (the default is 1?) the mentioned problem with
repeating the same songs seems to be gone...
Until you've played 20 songs, then it might be a problem again (because it 
stores the 21st played song, and only looks at the first 20).
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-18 Thread Phil Meyer
I'm on 7.4.2 with only the plugin CustomBrowse installed
(DynamicPlaylist is not installed) and i'm having similar issues. When i
pick a song SugarCube nicely adds the next one. But when i skip the song
SugarCube keeps adding the same songs over and over again. Also when i
use fast foward SugarCube adds the same songs (in my opinion no song
should be added). If i generate a playlist with MusicIP, SugarCube adds
the next one to the end of the playlist, but when i go to that song and
hit the playbutton, again the same songs are added.

I believe that is because MusicIP is returning the seed song as the first hit 
in the mix.  I think the intention is that SugarCube will ignore this song 
because it is in the recent played songs history.  However, I think it only 
looks at the first n historic songs, whereas recent songs can be added after 
this number (and thus not filtered out of the mix).

However, I only looked at Dynamic Playlist integration - SugarCube running in 
it's normal way may be totally different.

I recommend Dynamic Playlist to run SugarCube - this doesn't queue up new 
tracks when you seek new positions (FWD/REW) in the currently playing song.
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-17 Thread Phil Meyer
Can you release your revised code for review and explain your comments
regarding unsafe.  I assume you refering to the unique array?  Which is
used temporarily during the selection and then wiped once the track is
selected.  I think it would be pretty impressive if this caused an issue
in use but happy to be proved wrong.

Thanks for releasing your update to this plugin - it is most appreciated.  
Sorry if I sounded ungrateful - I was just trying to help, and I seem to be one 
of minority that use it with DynamicPlaylists.  I realise that this part of 
your plugin was not really being maintained; I didn't want to make it sound 
like I thought it wasn't very good.

@unique is used within commandCallback when processing a newsong event, and 
also getNextDynamicPlayListTracks.  The code writes to the array, processes it, 
and then clears it.  I was thinking that there could be some time between 
writing the array and clearing it, that some other player that is also 
processing a newsong/DynamicPlaylist event would be in contention with that 
data.  However, if the server is all single-threaded (another player event not 
being processed until the first command callback has finished being processed), 
then I guess it's safe.  In other cases, data from functions is returned and 
then passed them into other functions, rather than using a global variable, so 
I just thought at first glance that it looked like a problem.

I've seen a few unexplained occurances in the past where it's stopped queuing 
up songs for no reason (pressing play on the same track then causes a new track 
to start), but that was with a previous version of the plugin.  This is the 
first time I've looked at the code though (because I wanted to get 
DynamicPlaylist processing working again).  I wasn't really looking for other 
issues, but it was just a passing thought when I was trying to understand how 
it worked, that it looked unsafe (could return the unique array instead of 
diditwork indicator - empty array=not worked).

I haven't done a diff to see what changes I actually made in the end.  I played 
around quite a bit with debug statement changes to understand how it worked 
(moved some code around, then moved it back!); I think the changes to get it to 
work were actually minimal.

I've tried SugarCube in it's usual playback mode since making the changes, and 
it still seems to work, but haven't done extensive testing (eg. haven't looked 
to see if remembered tracks is working to remove played tracks from future 
choices).  I cleared my prefs file down to start afresh - not sure what would 
happen with existing prefs file.
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-16 Thread Phil Meyer
Another thing I've noticed is that if I am playing a song with one song queued 
up, if I don't like the next song and delete it from the dynamic playlist, it 
tries to add a new one to play next, but most of the time it picks the same 
song.

I think this is because it is building the MIP mix from the last track that was 
selected, which is the one I'm deleting, and it always includes this seed track 
at the top of the mix, which is the one that gets selected.

So, I may tweak the code to make it mix from the currently playing track, or 
have some fallback logic to choose a different song if it matches the last 
selected song, or tell musicIP to not include seed song in the mix.

However, I can't find the MusicIP http api help pages anymore - I thought there 
was a query string param to include/exclude the seed track, but can't find it.

Maybe I just avoid using the first song returned in the mix?
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-16 Thread Phil Meyer
Another thing I've noticed is that if I am playing a song with one song queued 
up, if I don't like the next song and delete it from the dynamic playlist, it 
tries to add a new one to play next, but most of the time it picks the same 
song.

I found the bugs that were causing this too.

It doesn't keep track of previously played tracks correctly - i.e. mine is 
configured to remember the last 5 songs to avoid repeating them.  It is storing 
tracks into the prefs file, but doesn't honour the limit correctly.  i.e. I had 
over 100 songs stored, and it was only ignoring the first 5 that had been 
stored.  Therefore when it fetches a mix based on the last chosen song, that 
song is top of the list, is not ignored, and thus just selects that song again.

I changed the code to record the last n tracks, shuffling the historic tracks, 
such that the oldest song is dropped, and the newest song gets added.

Looking further through the code, there is at least one global variable (list 
of songs returned from MIP for the seed, with historic songs removed), which 
means the plugin is unsafe when more than one player has SugarCube enabled.  
This needs to either be passed around through function calls, or hold a list of 
songs per-client.

My modified SugarCube code is now working well as a Dynamic Playlist, if anyone 
has an interest in it.  Only one small issue - sometimes Dynamic Playlist 
queues up 2 future tracks instead of just one (only when starting the dynamic 
playlist with a song in the current playlist to be used as the starting seed 
track).  Still, I find this much better than SugarCube, which can cause many 
future tracks to get added through various events (such as fast-forward, etc).  
DynamicPlaylist seems to handle this side of things much better.

I need to test normal SugarCube operating mode now, in case any of my changes 
have affected that.
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-15 Thread Phil Meyer
Anyone using Dynamic Playlist, do you use any feature in SugarCube
besides the default settings ? which ?
Not really.

I would choose a particular filter, and would perhaps select different recipies 
from time to time.
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-15 Thread Phil Meyer
Dynamic Playlist uses two functions in its integration:
- getDynamicPlayLists
- getNextDynamicPlayListTracks

So these are probably a good place to start. I think the wiki
documentation of what they are supposed to do should be fairly correct:
http://wiki.slimdevices.com/index.php/Dynamic_Playlist_plugin

Thanks.  If I can find some spare time, I'll have a look at it.

I assume that DynamicPlaylist itself is correct, as that is working on its own 
and with the older version of SugarCube, so it's where these methods are 
implemented in the new version of SugarCube that I need to look.  However, the 
error message referred to isRemote within DynamicPlaylist::ProtocolHandler.

Phil
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-15 Thread Phil Meyer
The reason I ask is that it has felt like the Dynamic Playlist
integration is pretty different from the other SugarCube usage so it
might even be easier to maintain it if it was a separate plugin. It
won't work if you use all the SugarCube features, as that would mean
duplicating a lot of code. 

However, if you are just looking for a way to select which recipe or
filter to use, a separate plugin might not be a bad idea.

My main reason for using DynamicPlaylist is to wrap SugarCube such that it can 
be played as an alarm clock music source.  I configure SugarCube to use a 
certain filter.  It picks a random starting track, and then wanders off from 
that in the morning.

I would like a way to configure the initial seed (I think once upon a time I 
could select and queue a single song in the evening, so it used that as the 
starting song, but I think it hasn't used that for a long time and uses a new 
arbitrary starting track when the alarm fires).  I was playing with ideas like 
starting an alarm initially to play a single random song from a defined 
playlist of good wake-up songs, and then a second alarm fire a few seconds 
later to play SugarCube, using the current playing song as a seed.


I think I'm making a bit of progress.  Updating to 7.5/trunk tonight and using 
SugarCube 2.03, I'm not getting as many errors.  I figured that there was an 
issue with the dynamic SQL that sugarcube was building up - it has in it a 
hard-coded database name when identifying tables, eg. slimserver.albums.  My 
own MySQL instance has a different database name (as I have various versions 
running in parallel - various beta ones), so I just removed the database name.

I can see that within getNextDynamicPlayListTracks, it is selecting a track to 
play, and returns a valid track:

[23:34:46.4357] Plugins::SugarCube::Plugin::getNextDynamicPlayListTracks (1357) 
returning to Dynamic Playlist 
file:///M:/Music/Phil%27s%20Music/Rock/Badly%20Drawn%20Boy/About%20a%20Boy/16%20-%20Donna%20and%20Blitzen.mp3

However, nothing actually plays, so maybe the format that this is being 
returned in is wrong.
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-15 Thread Phil Meyer
I think it would therefore be safe to assume that Dynamic Playlist
functionality doesnt work ;)

I've had a quick look through the code patched it up, so it seems to be working 
for me.

I think my changes are limited to the getNextDynamicPlayListTracks method that 
Erland pointed me at.

I've added some debug logging.

I changed the line that searches for a random song so that when there's no seed 
track it only finds a mixable song from the database (via 
'musicmagic_mixable'=1).  I guess you don't want this, as your SugarCube 
plugin doesn't rely on the MusicIP plugin having retrieved mixable status?  
However, I think this means that it could end up selecting a track that is not 
mixable in MIP, and therefore would stop after one song (or does it then select 
another random song?  Not sure how this works regarding the chosen 
filter/recipe settings, i.e. a totally random song may not be a song for the 
desired SugarCube settings (filter set to Rated 5* for example, and random 
song could be anything).

I changed the logic so that it doesn't try to select a similar song for the 
random chosen song, as selecttrack only works based on the currently playing 
song, but the random song isn't playing yet.


sub getNextDynamicPlayListTracks {
my ($client,$dynamicplaylist,$limit,$offset,$parameters) = @_;
my $song = undef;
my $currentSongTrack = undef;
my $track;

$log-debug(getNextDynamicPlayListTracks);

# If this isn't the first time
if($offset) {
# Base mix of last returned song for this player
$song = $lastDynamicPlaylistTrack{$client};
}

# If this is the first time or no suitable song has been selected yet
if(!defined($song)) {
# Base mix of currently playing song
$currentSongTrack = Slim::Player::Playlist::song($client);
if(defined($currentSongTrack)  
Slim::Music::Info::isFileURL($currentSongTrack-url)) {
$song = $currentSongTrack-url;
}else {
$currentSongTrack = undef;
}
}
# If no suitable start track was found, base start of mix of a random 
track
if(!defined($song)) {
$log-info(no current song, so find a random song);
# Only search for local songs that we know are mixable
$track = 
Slim::Schema-rs('Track')-search({'audio'=1,'remote'=0,'musicmagic_mixable'=1},{
 'order_by' = \'RAND()'})-first;
$song = $track-url;
$log-info(selected random song is $song);
}
else
{
my $mytitle = SaveMyCurrentTrack($client,$song);
#  Strip and Store played track Latin1 format
my $mypageurl = buildMIPReq($client, $mytitle); 
# Routine to get MIP settings and build MIP request

my $diditwork = SendtoMIPSync($client,$mypageurl);  
if ($diditwork eq 1)
{
$log-debug(SendtoMIPSync worked);
$track = selecttrack($client, \...@unique); 
# Randomly select track
$#unique = -1;  # 
Finished with our Unique Tracks Array, wipe it for reuse
}
else
{
$log-debug(SendtoMIPSync didn't work);
}
}

my @result = ();

if($track) {
$log-debug(returning to Dynamic Playlist $track);
$lastDynamicPlaylistTrack{$client} = $track-url;

# If we started on currently playing song we need to return 
that song first
if(defined($currentSongTrack)) {
push @result,$currentSongTrack,
}
# Add new song retreived from MusicIP
push @result,$track;

} else {
$log-error(Couldn't find track for: $track);
}
return \...@result; 
}

If you're interested, I can send you my modified Sugarcube 2.03 Plugin.pm file 
(or try to make a diff).
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-15 Thread Phil Meyer
I've had a quick look through the code patched it up, so it seems to be 
working for me.

I also notice errors trying to read sugarcube prefs:

[00:50:08.9656] Slim::Control::Request::notify (2132) Error: Failed notify: 
Can't call method get on an undefined value at 
P:/Music/SlimServer/trunk/server/Plugins/SugarCube/Plugin.pm line 670.
[00:50:08.9707] Slim::Control::Request::notify (2132) Error: Failed notify: 
Can't call method get on an undefined value at 
P:/Music/SlimServer/trunk/server/Plugins/SugarCube/Plugin.pm line 670.

Seems to work though.
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-15 Thread Phil Meyer
Another adjustment needed - after calling selecttrack to choose the next track 
from MIP matches, it needs to get a track object from the url:

my $seltrack = selecttrack($client, \...@unique);
$track = 
Slim::Schema-rs('Track')-objectForUrl($seltrack);
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-14 Thread Phil Meyer
Great!  I'll give it a go.

Some questions though:

Does it still provide support for playing as a Dynamic Playlist?
Is it possible to totally disable Now and Next (as Dynamic Playlist will add 
the next song in advance to the playlist, I can see it there).
Is there a way to set a filter to be used all the time, or is it necessary to 
configure this for every hour of the day?
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-14 Thread Phil Meyer
 Does it still provide support for playing as a Dynamic Playlist?
Probably... but I dont guarantee it, nobody has reported it doesnt work
but then I dont know how many people use this functionality.

I can't seem to get SugarCube  2.03 to work at all.

I restarted the server, went into player settings and configured it.
Then I turned it on for my Boom.
Played a song; no sign of random songs following the seed song.

I looked in the log, and there's loads of stuff.  Stopped server, cleaned log, 
and restarted, so I could find the first error:

[20:50:11.2754] Slim::Control::Request::execute (1942) Error: While trying to 
run function coderef [Slim::Control::Queries::statusQuery]: [Can't locate 
object method isRemote via package 
Plugins::DynamicPlayList::ProtocolHandler at 
P:/Music/SlimServer/trunk/server/Slim/Player/Song.pm line 698.

(I don't think I was getting any error before loading the latest SugarCube, but 
I'll check this by reverting back to previous version)


[20:50:34.1072] Slim::Control::Request::notify (2132) Error: Failed notify: 
Can't call method get on an undefined value at 
P:/Music/SlimServer/trunk/server/Plugins/SugarCube/Plugin.pm line 670.
[20:50:34.1502] Slim::Control::Request::notify (2132) Error: Failed notify: 
Can't call method get on an undefined value at 
P:/Music/SlimServer/trunk/server/Plugins/SugarCube/Plugin.pm line 670.
[20:50:34.1790] Slim::Control::Request::execute (1942) Error: While trying to 
run function coderef [Slim::Control::Queries::statusQuery]: [Can't locate 
object method isRemote via package 
Plugins::DynamicPlayList::ProtocolHandler at 
P:/Music/SlimServer/trunk/server/Slim/Player/Song.pm line 698.
]
[20:50:34.1796] Slim::Web::JSONRPC::requestMethod (358) Request failed with 
error: Bad dispatch!
[20:50:34.2167] Slim::Utils::Misc::msg (1165) Warning: [20:50:34.2160] Use of 
uninitialized value $contextType in hash element at D:\Squeezebox 
Server\trunk\Cache\InstalledPlugins/Plugins/DynamicPlayList/Plugin.pm line 2039.
[20:50:34.3359] Slim::Control::Request::execute (1942) Error: While trying to 
run function coderef [Slim::Control::Queries::statusQuery]: [Can't locate 
object method isRemote via package 
Plugins::DynamicPlayList::ProtocolHandler at 
P:/Music/SlimServer/trunk/server/Slim/Player/Song.pm line 698.


 Is it possible to totally disable Now and Next (as Dynamic Playlist will
 add the next song in advance to the playlist, I can see it there).
Yes it can be disabled per player

 Is there a way to set a filter to be used all the time, or is it
 necessary to configure this for every hour of the day?

Yes, the filters have been restructure for 3x timezones day, evening
and night

Change in settings look good.  Look forward to getting it working.
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-14 Thread Phil Meyer
[20:50:11.2754] Slim::Control::Request::execute (1942) Error: While trying to 
run function coderef [Slim::Control::Queries::statusQuery]: [Can't locate 
object method isRemote via package 
Plugins::DynamicPlayList::ProtocolHandler at 
P:/Music/SlimServer/trunk/server/Slim/Player/Song.pm line 698.

(I don't think I was getting any error before loading the latest SugarCube, 
but I'll check this by reverting back to previous version)

Reverting to SugarCube 1.8.4 fixed the errors, so I guess it's not compatible 
:-(

Phil
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Announce: Spicefly SugarC ube Version 2.03 – (Automatic MusicIP DJ) for 7. x

2010-01-14 Thread Phil Meyer
I think it would therefore be safe to assume that Dynamic Playlist
functionality doesnt work ;)

Dynamic Playlist is working fine on its own, and with SugarCube 1.8.4.

I could take a look at Dynamic Playlist and SugarCube 2.03 code in combination 
to see where the issue lies, but don't know where to start.  Any pointers?
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins