Skip to content

Instantly share code, notes, and snippets.

@squentin
squentin / 0001-tag-writing-for-DeusIX.patch
Created October 19, 2020 15:55
rating/lastplay/playcount tag writing patch for DeusIX
---
gmusicbrowser_songs.pm | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/gmusicbrowser_songs.pm b/gmusicbrowser_songs.pm
index 67d331b..2d98ba0 100644
--- a/gmusicbrowser_songs.pm
+++ b/gmusicbrowser_songs.pm
@@ -1091,13 +1091,15 @@ our %timespan_menu=
@squentin
squentin / gst1-play.pl
Created August 25, 2015 21:24
Sample program to play one or more file with gstreamer-1.x
#!/usr/bin/perl
use warnings;
use strict;
use Glib;
use Glib::Object::Introspection;
Glib::Object::Introspection->setup(basename => 'Gst', version => '1.0', package => 'GStreamer1');
GStreamer1::init_check([ $0, @ARGV ]) or die "Can't initialize gstreamer-1.x\n";
my $reg= GStreamer1::Registry::get();
$reg->lookup_feature('playbin') or die "gstreamer-1.x plugin 'playbin' not found.\n";
@squentin
squentin / setfield.pl
Created July 28, 2014 16:36
Small script to set field to a given value for a given file
#!/bin/perl
use warnings;
use strict;
use Net::DBus;
my $bus = Net::DBus->session;
my $service = $bus->get_service('org.gmusicbrowser');
my $object = $service->get_object('/org/gmusicbrowser', 'org.gmusicbrowser');
die "Usage : $0 file(with full path) field value\n" unless @ARGV==3;
@squentin
squentin / setplaycount.pl
Created April 19, 2012 17:34
small script to set playcount for a song
#!/usr/bin/perl
use warnings;
use strict;
use Net::DBus;
my $bus = Net::DBus->session;
my $service = $bus->get_service('org.gmusicbrowser');
my $object = $service->get_object('/org/gmusicbrowser', 'org.gmusicbrowser');
die "Usage : $0 file(with full path) value\n" unless @ARGV==2;
@squentin
squentin / currentsong.pl
Created April 18, 2012 16:28
example for querying current song via DBus
#!/bin/perl
use warnings;
use strict;
use Net::DBus;
my $bus = Net::DBus->session;
my $service = $bus->get_service('org.gmusicbrowser');
my $object = $service->get_object('/org/gmusicbrowser', 'org.gmusicbrowser');
my $info= $object->CurrentSong;
#returns a function, that function takes a listref of IDs as argument, and returns a hashref of groupid=>score
#returns nothing on error
sub Random::MakeGroupScoreFunction
{ my ($self,$field)=@_;
my ($keycode,$multi)= Songs::LookupCode($field, 'hash','hashm', [ID => '$_']);
unless ($keycode || $multi) { warn "MakeGroupScoreFunction error : can't find code for field $field\n"; return } #return dummy sub ?
($keycode,my $keyafter)= split / +---- +/,$keycode||$multi,2;
if ($keyafter) { warn "MakeGroupScoreFunction with field $field is not supported yet\n"; return } #return dummy sub ?
my ($before,$score)=$self->make;
my $calcIDscore= $multi ? 'my $IDscore='.$score.'; for my $key ('.$keycode.') {$score{$key}+=$IDscore}' : "\$score\{$keycode}+=$score;";
@squentin
squentin / mpris2.pm
Created January 16, 2012 14:42
mpris2 plugin with patch for Net::DBus v1.0.0
# Copyright (C) 2011 Quentin Sculo <squentin@free.fr>
#
# This file is part of Gmusicbrowser.
# Gmusicbrowser is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by the Free Software Foundation
=for gmbplugin MPRIS2
name MPRIS v2
title MPRIS v2 support
@squentin
squentin / desktopwidget.pm
Created January 11, 2012 18:44
patched desktopwidget.pm
# Copyright (C) 2010 Quentin Sculo <squentin@free.fr>
#
# This file is part of Gmusicbrowser.
# Gmusicbrowser is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by the Free Software Foundation
=gmbplugin DesktopWidgets
name Desktop widgets
title Desktop widgets plugin
@squentin
squentin / keypress_bypass.diff
Created September 9, 2011 21:11
bypass default shortcut keys except for entries and spinbuttons
diff --git a/gmusicbrowser_layout.pm b/gmusicbrowser_layout.pm
index ee3a576..d0dc82b 100644
--- a/gmusicbrowser_layout.pm
+++ b/gmusicbrowser_layout.pm
@@ -981,7 +981,7 @@ sub CreateWidgets
{ $widgets->{$_}->signal_connect(scroll_event => \&::ChangeVol)
for grep $widgets->{$_}, split /\s+/,$l;
}
- $self->signal_connect_after(key_press_event => \&KeyPressed);
+ $self->signal_connect(key_press_event => \&KeyPressed);
@squentin
squentin / setplaycount.pl
Created March 17, 2011 15:43
example to set playcount for a song via DBus api
#!/bin/perl
use warnings;
use strict;
use Net::DBus;
my $bus = Net::DBus->session;
my $service = $bus->get_service('org.gmusicbrowser');
my $object = $service->get_object('/org/gmusicbrowser', 'org.gmusicbrowser');
die "Usage : $0 file(with full path) value\n" unless @ARGV==2;