Permalink
Browse files

this is the first beta of using a real database (currently limited to…

… sqlite) instead of the in memory object for the ContentLibrary. There is a lot of work to do, till this can be released - general functinality is implemented
  • Loading branch information...
geuma committed Dec 9, 2012
1 parent 2eb3204 commit 83f8cf3fcb96a28575c1d1147901607306a92765
Showing with 1,808 additions and 513 deletions.
  1. +5 −0 CHANGELOG
  2. +9 −5 PDLNA/Config.pm
  3. +30 −25 PDLNA/ContentDirectory.pm
  4. +114 −110 PDLNA/ContentItem.pm
  5. +419 −153 PDLNA/ContentLibrary.pm
  6. +846 −0 PDLNA/Database.pm
  7. +185 −128 PDLNA/HTTPServer.pm
  8. +90 −68 PDLNA/HTTPXML.pm
  9. +64 −0 PDLNA/Media.pm
  10. +43 −23 PDLNA/WebUI.pm
  11. +1 −1 VERSION
  12. +2 −0 install.pl
@@ -7,6 +7,11 @@ Licened under GPLv3 (see LICENSE file)

-----------------------------------------

Version 0.60.0
xx-xx-201x

- using a database instead of the whole huge in memory object for the ContentLibrary

Version 0.53.0
15-08-2012

@@ -47,6 +47,10 @@ our %CONFIG = (
'CACHE_CONTROL' => 1800,
'PIDFILE' => '/var/run/pdlna.pid',
'ALLOWED_CLIENTS' => [],

'DB_TYPE' => 'SQLITE3',
'DB_NAME' => '/tmp/pdlna-content.db',

'LOG_FILE_MAX_SIZE' => 1048576, # 10 MB
'LOG_FILE' => 'STDERR',
'LOG_CATEGORY' => [],
@@ -68,9 +72,9 @@ our %CONFIG = (
'TRANSCODING_PROFILES' => [],
# values which can be modified manually :P
'PROGRAM_NAME' => 'pDLNA',
'PROGRAM_VERSION' => '0.53.0',
'PROGRAM_DATE' => '2012-08-15',
'PROGRAM_BETA' => 0,
'PROGRAM_VERSION' => '0.60.0',
'PROGRAM_DATE' => '2012-12-09',
'PROGRAM_BETA' => 1,
'PROGRAM_WEBSITE' => 'http://www.pdlna.com',
'PROGRAM_AUTHOR' => 'Stefan Heumader',
'PROGRAM_DESC' => 'Perl DLNA MediaServer',
@@ -263,9 +267,9 @@ sub parse_config
@{$CONFIG{'LOG_CATEGORY'}} = split(',', $cfg->get('LogCategory'));
foreach my $category (@{$CONFIG{'LOG_CATEGORY'}})
{
unless ($category =~ /^(discovery|httpdir|httpstream|library|httpgeneric)$/)
unless ($category =~ /^(discovery|httpdir|httpstream|library|httpgeneric|database)$/)
{
push(@{$errormsg}, 'Invalid LogCategory: Available options [discovery|httpdir|httpstream|library|httpgeneric]');
push(@{$errormsg}, 'Invalid LogCategory: Available options [discovery|httpdir|httpstream|library|httpgeneric|database]');
}
}
push(@{$CONFIG{'LOG_CATEGORY'}}, 'default');
@@ -20,6 +20,9 @@ package PDLNA::ContentDirectory;
use strict;
use warnings;

use threads;
use threads::shared;

use Date::Format;
use Digest::SHA1;
use Fcntl;
@@ -39,31 +42,33 @@ sub new
my $class = shift;
my $params = shift;

my $self = ();
$self->{ID} = $$params{'parent_id'}.$$params{'id'};
$self->{PATH} = $$params{'path'} || '';
$self->{NAME} = $$params{'name'} || basename($self->{PATH});
$self->{TYPE} = $$params{'type'};
$self->{SUBTYPE} = $$params{'subtype'} || 'directory';
$self->{RECURSION} = $$params{'recursion'};
$self->{EXCLUDE_DIRS} = $$params{'exclude_dirs'};
$self->{EXCLUDE_ITEMS} = $$params{'exclude_items'};
$self->{ALLOW_PLAYLISTS} = $$params{'allow_playlists'} || 0;
$self->{PARENT_ID} = $$params{'parent_id'};
$self->{ITEMS} = {};
$self->{DIRECTORIES} = {};
$self->{AMOUNT} = 0;
$self->{SHA1} = '';
$self->{SIZE} = 0;

bless($self, $class);

unless ($self->{TYPE} eq 'meta')
{
$self->initialize();
}

return $self;
my %self : shared = ();
$self{ID} = $$params{'parent_id'}.$$params{'id'};
$self{PATH} = $$params{'path'} || '';
$self{NAME} = $$params{'name'} || basename($self{PATH});
$self{TYPE} = $$params{'type'};
$self{SUBTYPE} = $$params{'subtype'} || 'directory';
$self{RECURSION} = $$params{'recursion'};
$self{EXCLUDE_DIRS} = $$params{'exclude_dirs'};
$self{EXCLUDE_ITEMS} = $$params{'exclude_items'};
$self{ALLOW_PLAYLISTS} = $$params{'allow_playlists'} || 0;
$self{PARENT_ID} = $$params{'parent_id'};
my %items : shared = ();
$self{ITEMS} = \%items;
my %directories : shared = ();
$self{DIRECTORIES} = \%directories;
$self{AMOUNT} = 0;
$self{SHA1} = '';
$self{SIZE} = 0;

bless(\%self, $class);

## unless ($self{TYPE} eq 'meta')
# {
# $self->initialize();
# }

return \%self;
}

sub is_directory
Oops, something went wrong.

0 comments on commit 83f8cf3

Please sign in to comment.