Zachary Kotlarek 12 лет назад
Родитель
Сommit
5b25055288
3 измененных файлов с 23 добавлено и 1 удалено
  1. 19 0
      backup/priority.php
  2. 3 0
      backup/scanAll.sh
  3. 1 1
      backup/upload.php

+ 19 - 0
backup/priority.php

@@ -0,0 +1,19 @@
+#!/usr/local/bin/php
+<?php
+
+# Includes
+require_once 'opendrive.php';
+
+# Open the DB connection
+$dbh = dbOpen();
+
+# Prepare statements
+$update = $dbh->prepare('UPDATE files SET priority = :priority WHERE path LIKE :path');
+
+# Set several groups
+$update->execute(array(':priority' => 100,	':path' => 'Movies/%'));
+$update->execute(array(':priority' => 50,	':path' => 'iTunes/%'));
+$update->execute(array(':priority' => -50,	':path' => 'Backups/%'));
+$update->execute(array(':priority' => -100,	':path' => 'TV/%'));
+
+?>

+ 3 - 0
backup/scanAll.sh

@@ -33,6 +33,9 @@ fi
 "${VIDEO_DIR}/backup/scanLocal.php" TV
 "${VIDEO_DIR}/backup/scanLocal.php" YouTube
 
+# Set priorities
+"${VIDEO_DIR}/backup/priority.php"
+
 # Always exit cleanly
 rm -f "${PID_FILE}"
 exit 0

+ 1 - 1
backup/upload.php

@@ -51,7 +51,7 @@ $folders = $dbh->prepare('SELECT base, path FROM files WHERE ' .
 $files = $dbh->prepare('SELECT base, path FROM files WHERE ' .
 	"(type != 'ignored' AND type != 'folder') AND " .
 	'(remote_mtime IS NULL OR remote_mtime < mtime) ' .
-	'ORDER BY base, path'
+	'ORDER BY priority, path'
 );
 $update = $dbh->prepare('UPDATE files SET remote_mtime = now() WHERE base = :base AND path = :path');