summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Brachold <vdr07@deltab.de>2009-12-20 14:46:30 +0000
committerAndreas Brachold <vdr07@deltab.de>2009-12-20 14:46:30 +0000
commitd6b4a7ed30075deb159ebc3a5bf7aa6959058fba (patch)
tree781f3899ac6d9ffbfa3594bdb0e5d057f9af5119
parent088518042587c633b662d054375c9801bed844f4 (diff)
downloadxxv-d6b4a7ed30075deb159ebc3a5bf7aa6959058fba.tar.gz
xxv-d6b4a7ed30075deb159ebc3a5bf7aa6959058fba.tar.bz2
* Chronicle: store also epg description (change db layout version-32)
* Chronicle: ignore cutted recordings * jason: show description from recording stored by chronicle
-rwxr-xr-xcontrib/chronicle-remove-duplicate.pl2
-rwxr-xr-xcontrib/update-xxv2
-rw-r--r--contrib/upgrade-xxv-db.sql5
-rw-r--r--lib/XXV/MODULES/CHRONICLE.pm20
4 files changed, 17 insertions, 12 deletions
diff --git a/contrib/chronicle-remove-duplicate.pl b/contrib/chronicle-remove-duplicate.pl
index 2902107..fca29ef 100755
--- a/contrib/chronicle-remove-duplicate.pl
+++ b/contrib/chronicle-remove-duplicate.pl
@@ -56,7 +56,7 @@ sub dump_duplicates {
or die "Couldn't execute dump statement: " . $sth->errstr;
while (@data = $sth->fetchrow_array()) {
- print sprintf("%3d: %20s %s\n",$data[0],$data[2],$data[1]);
+ print sprintf("%3d: %20s %s\n",$data[0],$data[2] || '',$data[1]);
}
if ($sth->rows == 0) {
diff --git a/contrib/update-xxv b/contrib/update-xxv
index 8567cd4..f94facb 100755
--- a/contrib/update-xxv
+++ b/contrib/update-xxv
@@ -18,7 +18,7 @@
# Increment the version number each time the database changes!
#
-actualVersion=31
+actualVersion=32
# Specify tables to export before and import after update
#
diff --git a/contrib/upgrade-xxv-db.sql b/contrib/upgrade-xxv-db.sql
index 885a777..6b4a050 100644
--- a/contrib/upgrade-xxv-db.sql
+++ b/contrib/upgrade-xxv-db.sql
@@ -32,11 +32,12 @@ CREATE TABLE IF NOT EXISTS `AUTOTIMER` (
CREATE TABLE IF NOT EXISTS `CHRONICLE` (
`id` int(10) unsigned NOT NULL auto_increment,
- `hash` varchar(16) NOT NULL default '',
+ `hash` varchar(32) NOT NULL default '',
`title` text NOT NULL,
- `channel_id` varchar(100) NOT NULL default '',
+ `channel_id` varchar(32) default '',
`starttime` datetime NOT NULL default '0000-00-00 00:00:00',
`duration` int(11) NOT NULL default '0',
+ `description` text,
PRIMARY KEY (`id`),
UNIQUE KEY `hash` (`hash`)
);
diff --git a/lib/XXV/MODULES/CHRONICLE.pm b/lib/XXV/MODULES/CHRONICLE.pm
index d3aceed..74c94b2 100644
--- a/lib/XXV/MODULES/CHRONICLE.pm
+++ b/lib/XXV/MODULES/CHRONICLE.pm
@@ -115,12 +115,13 @@ sub _init {
$self->{dbh}->do(qq|
CREATE TABLE IF NOT EXISTS CHRONICLE (
id int unsigned auto_increment not NULL,
- hash varchar(16) NOT NULL default '',
+ hash varchar(32) NOT NULL default '',
title text NOT NULL default '',
- channel_id varchar(100) NOT NULL default '',
+ channel_id varchar(32) default '',
starttime datetime NOT NULL default '0000-00-00 00:00:00',
duration int NOT NULL default '0',
- PRIMARY KEY (id),
+ description text,
+ PRIMARY KEY (id),
UNIQUE KEY (hash)
) COMMENT = '$version'
|);
@@ -148,11 +149,12 @@ sub _insertData {
my $sql = qq|
INSERT IGNORE INTO CHRONICLE
SELECT SQL_CACHE
- 0, PASSWORD(CONCAT(e.channel_id,e.starttime,title)),
- REPLACE(IF(Length(e.subtitle)<=0, IF(left(e.title,1) = '%',right(e.title,length(e.title)-1),e.title), CONCAT_WS('~',e.title,e.subtitle)),'~%','~') as title,
+ 0, MD5(CONCAT(e.channel_id,FLOOR(UNIX_TIMESTAMP(e.starttime) / 900),REPLACE(IF(ISNULL(e.subtitle) OR Length(e.subtitle)<=0, IF(left(e.title,1) = "%",SUBSTR(e.title FROM 2),e.title), CONCAT_WS("~",e.title,e.subtitle)),"~%","~"))),
+ REPLACE(IF(ISNULL(e.subtitle) OR Length(e.subtitle)<=0, IF(left(e.title,1) = "%",SUBSTR(e.title FROM 2),e.title), CONCAT_WS("~",e.title,e.subtitle)),"~%","~") as title,
IF(e.channel_id <> "<undef>",e.channel_id , NULL),
e.starttime,
- e.duration
+ e.duration,
+ e.description
FROM OLDEPG as e,RECORDS as r
WHERE r.eventid = e.eventid
|;
@@ -190,7 +192,8 @@ SELECT SQL_CACHE
UNIX_TIMESTAMP(starttime) as \'$f{'day'}\',
DATE_FORMAT(starttime, '%H:%i') as \'$f{'start'}\',
DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP(starttime) + duration), '%H:%i') as \'$f{'stop'}\'
-FROM CHRONICLE WHERE id > 0
+ ,description as _description
+FROM CHRONICLE
ORDER BY starttime
|;
@@ -249,7 +252,7 @@ sub search {
my $text = shift || return $console->err(gettext("No 'string' to search defined! Please use chrsearch 'text'."));
my $params = shift;
- my $query = buildsearch("title",$text);
+ my $query = buildsearch("title,description",$text);
my %f = (
'id' => gettext('Service'),
@@ -271,6 +274,7 @@ SELECT SQL_CACHE
UNIX_TIMESTAMP(starttime) as \'$f{'day'}\',
DATE_FORMAT(starttime, '%H:%i') as \'$f{'start'}\',
DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP(starttime) + duration), '%H:%i') as \'$f{'stop'}\'
+ ,description as _description
FROM CHRONICLE
|;
$sql .= sprintf("WHERE %s ORDER BY starttime",$query->{query});