summaryrefslogtreecommitdiff
blob: eb239e2935764514e9675db2421ae8763513a505 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header$

# This file contains a custom OS package to provide information on the
# installation structure on Gentoo.

package Slim::Utils::OS::Custom;

use strict;

use base qw(Slim::Utils::OS::Linux);

sub initDetails {
	my $class = shift;

	$class->{osDetails} = $class->SUPER::initDetails();

	$class->{osDetails}->{isGentoo} = 1 ;

	# Ensure we find manually installed plugin files.
	push @INC, '/var/lib/logitechmediaserver';
	push @INC, '/var/lib/logitechmediaserver/Plugins';

	return $class->{osDetails};
}

=head2 dirsFor( $dir )

Return OS Specific directories.

Argument $dir is a string to indicate which of the Logitech Media Server
directories we need information for.

=cut

sub dirsFor {
	my ($class, $dir) = @_;

	my @dirs = ();

	# Overrides for specific directories.
	if ($dir eq 'Plugins') {

		# Look in the normal places.
		push @dirs, $class->SUPER::dirsFor($dir);

		# User-installed plugins are in a different place, so add it.
		push @dirs, '/var/lib/logitechmediaserver/Plugins';

	} elsif ($dir eq 'ClientPlaylists') {

		# LMS would normally try to put client playlists in the prefs
		# directory, but they aren't really prefs since they're dynamic
		# state of the clients. Effectively, they're the same as the
		# database cache, so we move these under /var/lib.
		push @dirs, '/var/lib/logitechmediaserver/ClientPlaylists';

	} elsif ($dir =~ /^(?:prefs)$/) {

		# Server and plugin preferences are in a different place.
		push @dirs, $::prefsdir || '/etc/logitechmediaserver';

	} else {

		# Use the default behaviour to locate the directory.
		push @dirs, $class->SUPER::dirsFor($dir);

	}

	return wantarray() ? @dirs : $dirs[0];
}

1;

__END__