summaryrefslogtreecommitdiff
path: root/p2pvr/daemon/sql/storage
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-08-02 19:52:03 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2017-08-02 19:54:59 +0100
commit575f818b0bce3a6dc571e970c546ae4d02660e02 (patch)
tree3193e2dd302874c61411ca3a5752a3256fe4a469 /p2pvr/daemon/sql/storage
parentTidy and shuffle some bits (diff)
downloadp2pvr-575f818b0bce3a6dc571e970c546ae4d02660e02.tar.bz2
p2pvr-575f818b0bce3a6dc571e970c546ae4d02660e02.tar.xz
p2pvr-575f818b0bce3a6dc571e970c546ae4d02660e02.zip
Provide more comprehensive video stats, not just size
Diffstat (limited to 'p2pvr/daemon/sql/storage')
-rw-r--r--p2pvr/daemon/sql/storage/getSize.sql3
-rw-r--r--p2pvr/daemon/sql/storage/getVideoStats.sql6
2 files changed, 6 insertions, 3 deletions
diff --git a/p2pvr/daemon/sql/storage/getSize.sql b/p2pvr/daemon/sql/storage/getSize.sql
deleted file mode 100644
index 1427d02..0000000
--- a/p2pvr/daemon/sql/storage/getSize.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-SELECT SUM(LENGTH(videodata))
-FROM recordedvideo
-WHERE recordingid = ?
diff --git a/p2pvr/daemon/sql/storage/getVideoStats.sql b/p2pvr/daemon/sql/storage/getVideoStats.sql
new file mode 100644
index 0000000..e00cc0c
--- /dev/null
+++ b/p2pvr/daemon/sql/storage/getVideoStats.sql
@@ -0,0 +1,6 @@
+SELECT r.recordingId, SUM(LENGTH(rv.videodata)) totalSize, COUNT(rv.recordingid) fragments
+FROM recordings r
+ LEFT OUTER JOIN recordedvideo rv
+ ON r.recordingId = rv.recordingId
+WHERE r.recordingid = ?
+GROUP BY r.recordingId