submitted by /u/davorg [link] [comments] |
A link site of your very own - Perl Hacks
When I first wrote about my pointless personal side projects a few months ago, I used the software I had written to generate my own link site (like a LinkTree clone) as an example. I’m happy to report that I’ve continued to work on this software.Dave Cross (Perl Hacks)
My wife and have a hobby-level online radio station and we use Logitech Media Server as the backend. As part of what we use we're running a plug-in called Spicefly Sugarcube, which interacts with a "brain" called MusicIP. MusicIP allows music suggestions to be called using an API, which is basically what Sugarcube is doing, and it builds a URL with the very last element being "recipe," which is a filter built into MusicIP that helps shape the direction the songs go.
The issue is I'd like to replace the recipe section of this plug in with a fixed array that cycles through to emulate a radio format clock. I realize that by doing this under the hood I lose the functionality of changing the recipes on the fly, but that's okay.
The program is driven by the
plugin.pm
file located here:
https://bitbucket.org/spicefly/sugarcube/src/master/SugarCube/Plugin.pm
I know nothing about Perl so tried to have ChatGPT alter this to replace the recipe section with a fixed array, It returned the upper part of the file this way, with no other changes, and the plug in won't load like this:
#v6.01 - December 2023
#+===================+
#Licencing Requirements Removed
#Released as Open Source under the GNU General Public License v3.0
#
#In Short Summary
#Complete source code must be made available that includes all changes
#Copyright and license notices must be preserved.
#Contributors provide an express grant of patent rights.
package Plugins::SugarCube::Plugin;
# Define the recipe sequence array
my
u/recipe_sequence = ('5s', '4s', '5s', '5s', '4s', '5s', '4s', '5s', '5s', '4s', '5s', '4s', '5s', '5s', '4s', '5s', '5s', '4s');
my $recipe_index = 0;
# Function to get the next recipe in sequence
sub get_next_recipe {
my $recipe = $recipe_sequence[$recipe_index];
$recipe_index = ($recipe_index + 1) %
u/recipe_sequence; # Loop back to the start
return $recipe;
}
use base qw(Slim::Plugin::Base);
use strict;
use Slim::Utils::Misc;
use Slim::Utils::Prefs;
use Slim::Utils::Log;
my $log = Slim::Utils::Log->addLogCategory(
{
'category' => 'plugin.sugarcube',
# 'defaultLevel' => 'WARN',
'defaultLevel' => 'DEBUG',
'description' => getDisplayName(),
}
);
So my question is, is this possible, and is the kernel of how to make it work here, or is there a better way to do it? If you look at the original plugin.pm file you'll see how the URL is built, and I really just want the very end of the URL to be &recipe=5s or %recipe=4s depending on the sequence I enter. Any help it appreciated!
submitted by /u/typecrazy789
[link] [comments]
submitted by /u/briandfoy [link] [comments] |
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.www.youtube.com
[link] [comments]
(dxxii) 8 great CPAN modules released last week
Updates for great CPAN modules released last week. A module is considered great if its favorites count is greater or equal than 12. App...niceperl.blogspot.com