Author Topic: [PLUGIN] Weighted albumrandom  (Read 10309 times)

laite

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Gmusicbrowser-plugins by laite
[PLUGIN] Weighted albumrandom
« on: June 22, 2011, 00:47:15 »
'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
« Last Edit: July 28, 2011, 20:26:48 by laite »

Satoshi

  • Jr. Member
  • **
  • Posts: 44
    • View Profile
Re: [PLUGIN] Weighted albumrandom
« Reply #1 on: June 22, 2011, 04:51:23 »
That's great! Let's hope squentin adds this to gmb by default

laite

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Gmusicbrowser-plugins by laite
Re: [PLUGIN] Weighted albumrandom
« Reply #2 on: June 23, 2011, 15:39:43 »
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 :)

laite

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Gmusicbrowser-plugins by laite
Re: [PLUGIN] Weighted albumrandom
« Reply #3 on: June 23, 2011, 22:47:47 »
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.

ochosi

  • Full Member
  • ***
  • Posts: 187
    • View Profile
Re: [PLUGIN] Weighted albumrandom
« Reply #4 on: July 04, 2011, 12: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.

laite

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Gmusicbrowser-plugins by laite
Re: [PLUGIN] Weighted albumrandom
« Reply #5 on: July 05, 2011, 11:39:34 »
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?
« Last Edit: July 13, 2011, 11:56:09 by laite »

cardiacanesthesia

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: [PLUGIN] Weighted albumrandom
« Reply #6 on: July 25, 2011, 13: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
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

laite

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Gmusicbrowser-plugins by laite
Re: [PLUGIN] Weighted albumrandom
« Reply #7 on: July 25, 2011, 14:06:38 »
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).

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.

Quentin Sculo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1082
    • View Profile
Re: [PLUGIN] Weighted albumrandom
« Reply #8 on: July 25, 2011, 19:51:12 »
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.

cardiacanesthesia

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: [PLUGIN] Weighted albumrandom
« Reply #9 on: July 25, 2011, 20: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"

Quentin Sculo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1082
    • View Profile
Re: [PLUGIN] Weighted albumrandom
« Reply #10 on: July 25, 2011, 20:37:16 »
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

ochosi

  • Full Member
  • ***
  • Posts: 187
    • View Profile
Re: [PLUGIN] Weighted albumrandom
« Reply #11 on: July 26, 2011, 00:37:04 »
clicking the "choose an album for me" context-menu entry crashes gmb with the following output:
Code: [Select]
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:
Code: [Select]
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.

laite

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Gmusicbrowser-plugins by laite
Re: [PLUGIN] Weighted albumrandom
« Reply #12 on: July 26, 2011, 09:56:17 »
Code: [Select]
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.

Code: [Select]
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.

if i try "generate multiple albums" gmb crashes with this error:
Code: [Select]
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.

cardiacanesthesia

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re:Weighted albumrandom
« Reply #13 on: July 26, 2011, 16:49:17 »
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

laite

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Gmusicbrowser-plugins by laite
Re: [PLUGIN] Weighted albumrandom
« Reply #14 on: July 28, 2011, 20:24:52 »
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.