App-DrivePlayer
view release on metacpan or search on metacpan
lib/App/DrivePlayer/GUI.pm view on Meta::CPAN
my ($s) = @_;
return '' unless defined $s && length $s;
$s =~ s{ \A (?: 19 | 20 ) \d{2} - }{}x;
$s =~ tr/_/ /;
return $s;
}
# Title-specific: strip a leading track-number prefix like "01 ",
# "01 - ", "01. ", "01-" before applying the underscore transform.
# Accepts 1-3 digit numbers so compilation tracks up to 999 still
# get cleaned.
sub _display_title {
my ($s) = @_;
return '' unless defined $s && length $s;
# Swap underscores to spaces first so "01_Attention" becomes "01 Attention"
# and the track-number prefix below can match it.
$s =~ tr/_/ /;
$s =~ s{
\A
\s* # optional leading whitespace
\d{1,3} # 1-3 digit track number
[\s.\-]+ # separator: space, dot, hyphen
}{}x;
return $s;
}
1;
__END__
=head1 NAME
App::DrivePlayer::GUI - GTK3 application window for DrivePlayer
=head1 SYNOPSIS
use App::DrivePlayer::GUI;
App::DrivePlayer::GUI->new->run;
=head1 DESCRIPTION
The top-level L<Moo> class that constructs and drives the GTK3 user
interface. Responsibilities include:
=over 4
=item *
Building the main window with a sidebar (artists / albums / folders), a
track list, and playback controls (play/pause, stop, seek, volume).
=item *
Lazily initialising the Google REST API connection and
L<App::DrivePlayer::Player> on first use, so start-up is fast even when network
access is unavailable.
=item *
Running folder scans (via L<App::DrivePlayer::Scanner>) in a background thread
with live progress reporting.
=item *
Persisting configuration changes (music folder list, OAuth2 credentials)
through L<App::DrivePlayer::Config>.
=back
Requires the GTK3 system libraries and the L<Gtk3> and L<Glib> Perl
modules. Not covered by the unit test suite.
=head1 METHODS
=head2 new
my $gui = App::DrivePlayer::GUI->new;
Constructs the application object. The window is not shown until L</run>
is called.
=head2 run
$gui->run;
Build and display the main window, then enter the GTK3 main loop. Does not
return until the window is closed.
=cut
( run in 1.282 second using v1.01-cache-2.11-cpan-d8267643d1d )