App-DrivePlayer
view release on metacpan or search on metacpan
lib/App/DrivePlayer/GUI.pm view on Meta::CPAN
}
sub run {
my ($self) = @_;
my $db_is_new = !-f $self->config->db_path();
$self->_build_ui();
$self->_auto_sync_from_sheet_on_new_db() if $db_is_new;
$self->_prune_removed_folders();
$self->_load_library();
Glib::Timeout->add($POLL_INTERVAL_MS, sub {
$self->_player_poll();
return TRUE;
});
Gtk3->main();
$self->player->quit() if $self->player;
}
# ---- Initialisation ----
lib/App/DrivePlayer/GUI.pm view on Meta::CPAN
$fp_status->set_markup('<span foreground="#cc0000">Fork failed</span>');
$install_btn->set_sensitive(TRUE);
return;
}
if ($pid == 0) {
exec('pkexec', 'apt-get', 'install', '-y', 'libchromaprint-tools')
or POSIX::_exit(1);
}
# Poll every 500 ms until the child exits
Glib::Timeout->add(500, sub {
my $res = waitpid($pid, WNOHANG());
if ($res == $pid) {
$refresh_fp_status->();
$install_btn->set_sensitive(TRUE);
return FALSE; # remove timer
}
return TRUE; # keep polling
});
});
( run in 0.868 second using v1.01-cache-2.11-cpan-39bf76dae61 )