June 21, 2011, 19:47:15 Last Edit: July 28, 2011, 15:26:48 by laite
'Albumrandom' is a plugin for gmusicbrowser that uses weighted random for playing albums.

You can download plugin and see README (please check it out) at https://github.com/laite/gmusicbrowser-plugins/tree/master/albumrandom

-
Thanks,
laite

That's great! Let's hope squentin adds this to gmb by default

All right! Version 0.2 is here, and it's MUCH better than the original.

I've updated the opening post, with new picture from preferences :)

Well. I was actually going to upgrade this sometime later with more options, but since I ran out of my ToDo items I decided to release it as it is now. If you got any ideas for this, please let me know :)

It might take a little while to get the hang of the behaviour, but feel free to ask if something doesn't seem right - I have made this plugin mainly to suit my own taste, but tried to include many options so everybody could get their own preferences out of this.

hey, just downloaded it and tried it but i get "Bareword "CalculateDB" not allowed while "strict subs" in use at ~/.config/gmusicbrowser/plugins/albumrandom.pm line 336."
i don't have time to really look into the code myself atm, hope you got time to look at that.

#5 July 05, 2011, 06:39:34 Last Edit: July 13, 2011, 06:56:09 by laite
Quote from: ochosi on July 04, 2011, 07:19:28
hey, just downloaded it and tried it but i get "Bareword "CalculateDB" not allowed while "strict subs" in use at ~/.config/gmusicbrowser/plugins/albumrandom.pm line 336."
i don't have time to really look into the code myself atm, hope you got time to look at that.

This should be now fixed. I believe it was due to calling function CalculateDB before it was introduced. Did this prevent plugin from working at all?

hi
i tried but can' t install the plugin
copied both the files where it said, but they don't show up in the list of plugins
of course my version is 1.1.7, latest from the repository
one more thing , i dont know how to add item to a layout
i also tried the other plugin to get the playcount from lastfm
but even that doesn't show in the plugins list
i copied them to both usr/share/gmusicbrowser/plugins
as well as home/.config/gmusicbrowser/plugins
pls suggest
Dr subodh

Quote from: cardiacanesthesia on July 25, 2011, 08:40:40
hi
i tried but can' t install the plugin
copied both the files where it said, but they don't show up in the list of plugins

You remembered to restart gmusicbrowser, right? I'm afraid I have no idea why they won't show, I've never had similar problems. Perhaps you could see if there is some error messages on startup (run gmusicbrowser from terminal so you can see output in that screen).

Quote from: cardiacanesthesia on July 25, 2011, 08:40:40
one more thing , i dont know how to add item to a layout

It's kinda tricky at the start, but there are nice documents to help:
http://gmusicbrowser.org/layout_doc.html
http://wiki.gmusicbrowser.org/dokuwiki/doku.php?id=customization:songtree

Basic lines are these:
*find out what layout you are using and find it's settings in /usr/share/gmusicbrowser/layouts (or /usr/share/gmusicbrowser/layout (main.layout?), I'm sorry I don't remember how it's done in original version) - see layout document on how to recognise this if you have problems
*compare document to your players layout until you have somekind of clue which element goes where
*I'd suggest you to add word 'Albumrandom' (without quotations) next to buttons somewhere (they look something like "ExtraButtons 5-VolumeIcon -Pref" etc.)
*save layout, restart gmb and apply layout from preferences.

But of course, this doesn't work if you can't get plugin installed first :/

I hope Quentin sees this, for I really don't know what's wrong with that.

Quote from: cardiacanesthesia on July 25, 2011, 08:40:40
i tried but can' t install the plugin
[...]
i copied them to both usr/share/gmusicbrowser/plugins
as well as home/.config/gmusicbrowser/plugins
I don't know what could have gone wrong, but launch gmusicbrowser from the command line with the "-debug" option (=> "gmusicbrowser -debug"), it will print each plugin file it reads, and if it found a plugin inside.

Laite: about adding a button to a layout, plugins can do that, check the rip plugin for an example (or ask me on irc). Though the button will only appear if the layout specified a space for extra buttons, by adding "ExtraButtons" in the layout.

gmusicbrowser -debug says

"Reading plugin /usr/bin/../share/gmusicbrowser/plugins/albumrandom.pm
No plugin found in /usr/bin/../share/gmusicbrowser/plugins/albumrandom.pm, maybe it uses an old format"

Quote from: cardiacanesthesia on July 25, 2011, 15:16:02
gmusicbrowser -debug says

"Reading plugin /usr/bin/../share/gmusicbrowser/plugins/albumrandom.pm
No plugin found in /usr/bin/../share/gmusicbrowser/plugins/albumrandom.pm, maybe it uses an old format"
I think it means you didn't save it correctly, you have to click on the "raw" link on the github site : https://raw.github.com/laite/gmusicbrowser-plugins/master/albumrandom/albumrandom.pm

clicking the "choose an album for me" context-menu entry crashes gmb with the following output:

Use of uninitialized value $Options{"PLUGIN_ALBUMRANDOM_update_automa"...} in numeric eq (==) at /home/ochosi/.config/gmusicbrowser/plugins/albumrandom.pm line 168.
Illegal division by zero at /home/ochosi/.config/gmusicbrowser/plugins/albumrandom.pm line 372.

(the first is only a warning that pops up when activating the plugin.)

if i try "generate multiple albums" gmb crashes with this error:
Can't call method "CalcScore" on an undefined value at /home/ochosi/.config/gmusicbrowser/plugins/albumrandom.pm line 600.


i'm using gmb 1.1.7 from shimmer-git and your plugin from your git.

Quote from: ochosi on July 25, 2011, 19:37:04

Use of uninitialized value $Options{"PLUGIN_ALBUMRANDOM_update_automa"...} in numeric eq (==) at /home/ochosi/.config/gmusicbrowser/plugins/albumrandom.pm line 168.

This should now be fixed.

Quote from: ochosi on July 25, 2011, 19:37:04
Illegal division by zero at /home/ochosi/.config/gmusicbrowser/plugins/albumrandom.pm line 372.

Hmm, this seems to imply that 'generator' couldn't find any albums. Are your tags properly set (artist, album, year and tracknumbers on all songs you have selected as source)? I might have a hunch why this might also be, but I'll need to do some testing with the code before I can tell for sure.

Quote from: ochosi on July 25, 2011, 19:37:04if i try "generate multiple albums" gmb crashes with this error:

Can't call method "CalcScore" on an undefined value at /home/ochosi/.config/gmusicbrowser/plugins/albumrandom.pm line 600.

I believe this is also due to 'generator' returning zero albums. I'll look into that.

dunno , there was some problem with my copying the file
i just copied the contents into a new gedit document and saved it directly in the abovementioned folder.
it started working spontaneously
thanks

Due to many problems in this plugin I've rewritten it almost completely. I strongly suggest to get the latest version from the git (see link at opening post), because I have no intention in developing that old version any more. I dropped some options (see README) for the new version, mainly of caching, so if you'd rather use the old version it's still available at https://github.com/laite/gmusicbrowser-plugins/tree/master/old_versions/albumrandom - just don't expect it to get any better.