feat: move storage path setting to configuration file

- change default storage path to /srv/libretime
- remove music dirs table
- use /tmp for testing storage
- storage dir should always have a trailing slash
This commit is contained in:
jo 2022-04-18 20:34:38 +02:00 committed by Kyle Robbertze
parent b3ff2defc4
commit f7bb6e7592
48 changed files with 464 additions and 4701 deletions

View File

@ -0,0 +1,41 @@
from django.db import migrations
from ._migrations import legacy_migration_factory
UP = """
ALTER TABLE "cc_files" DROP CONSTRAINT "cc_music_dirs_folder_fkey";
ALTER TABLE "cc_files" DROP COLUMN "directory";
DROP TABLE "cc_music_dirs";
"""
DOWN = """
CREATE TABLE "cc_music_dirs"
(
"id" serial NOT NULL,
"directory" TEXT,
"type" VARCHAR(255),
"exists" BOOLEAN DEFAULT 't',
"watched" BOOLEAN DEFAULT 't',
PRIMARY KEY ("id"),
CONSTRAINT "cc_music_dir_unique" UNIQUE ("directory")
);
ALTER TABLE "cc_files" ADD COLUMN "directory" INTEGER;
ALTER TABLE "cc_files" ADD CONSTRAINT "cc_music_dirs_folder_fkey"
FOREIGN KEY ("directory")
REFERENCES "cc_music_dirs" ("id");
"""
class Migration(migrations.Migration):
dependencies = [
("legacy", "0028_3_0_0_alpha_13_2"),
]
operations = [
migrations.RunPython(
code=legacy_migration_factory(
target="3.0.0-alpha.13.3",
sql=UP,
)
)
]

View File

@ -1 +1 @@
LEGACY_SCHEMA_VERSION = "3.0.0-alpha.13.2" LEGACY_SCHEMA_VERSION = "3.0.0-alpha.13.3"

View File

@ -1,21 +1,4 @@
-----------------------------------------------------------------------
-- cc_music_dirs
-----------------------------------------------------------------------
DROP TABLE IF EXISTS "cc_music_dirs" CASCADE;
CREATE TABLE "cc_music_dirs"
(
"id" serial NOT NULL,
"directory" TEXT,
"type" VARCHAR(255),
"exists" BOOLEAN DEFAULT 't',
"watched" BOOLEAN DEFAULT 't',
PRIMARY KEY ("id"),
CONSTRAINT "cc_music_dir_unique" UNIQUE ("directory")
);
----------------------------------------------------------------------- -----------------------------------------------------------------------
-- cc_files -- cc_files
----------------------------------------------------------------------- -----------------------------------------------------------------------
@ -28,7 +11,6 @@ CREATE TABLE "cc_files"
"name" VARCHAR(255) DEFAULT '' NOT NULL, "name" VARCHAR(255) DEFAULT '' NOT NULL,
"mime" VARCHAR(255) DEFAULT '' NOT NULL, "mime" VARCHAR(255) DEFAULT '' NOT NULL,
"ftype" VARCHAR(128) DEFAULT '' NOT NULL, "ftype" VARCHAR(128) DEFAULT '' NOT NULL,
"directory" INTEGER,
"filepath" TEXT DEFAULT '', "filepath" TEXT DEFAULT '',
"import_status" INTEGER DEFAULT 1 NOT NULL, "import_status" INTEGER DEFAULT 1 NOT NULL,
"currentlyaccessing" INTEGER DEFAULT 0 NOT NULL, "currentlyaccessing" INTEGER DEFAULT 0 NOT NULL,
@ -792,10 +774,6 @@ ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_editedby_fkey"
FOREIGN KEY ("editedby") FOREIGN KEY ("editedby")
REFERENCES "cc_subjs" ("id"); REFERENCES "cc_subjs" ("id");
ALTER TABLE "cc_files" ADD CONSTRAINT "cc_music_dirs_folder_fkey"
FOREIGN KEY ("directory")
REFERENCES "cc_music_dirs" ("id");
ALTER TABLE "cloud_file" ADD CONSTRAINT "cloud_file_FK_1" ALTER TABLE "cloud_file" ADD CONSTRAINT "cloud_file_FK_1"
FOREIGN KEY ("cc_file_id") FOREIGN KEY ("cc_file_id")
REFERENCES "cc_files" ("id") REFERENCES "cc_files" ("id")

View File

@ -5,7 +5,7 @@ from django.utils import dateparse
from model_bakery import baker from model_bakery import baker
from rest_framework.test import APITestCase from rest_framework.test import APITestCase
from ...._fixtures import AUDIO_FILENAME, fixture_path from ...._fixtures import AUDIO_FILENAME
class TestScheduleViewSet(APITestCase): class TestScheduleViewSet(APITestCase):
@ -15,13 +15,8 @@ class TestScheduleViewSet(APITestCase):
cls.token = settings.CONFIG.general.api_key cls.token = settings.CONFIG.general.api_key
def test_schedule_item_full_length(self): def test_schedule_item_full_length(self):
music_dir = baker.make(
"storage.MusicDir",
directory=str(fixture_path),
)
file = baker.make( file = baker.make(
"storage.File", "storage.File",
directory=music_dir,
mime="audio/mp3", mime="audio/mp3",
filepath=AUDIO_FILENAME, filepath=AUDIO_FILENAME,
length=timedelta(seconds=40.86), length=timedelta(seconds=40.86),
@ -51,13 +46,8 @@ class TestScheduleViewSet(APITestCase):
self.assertEqual(dateparse.parse_duration(result[0]["cue_out"]), file.cueout) self.assertEqual(dateparse.parse_duration(result[0]["cue_out"]), file.cueout)
def test_schedule_item_trunc(self): def test_schedule_item_trunc(self):
music_dir = baker.make(
"storage.MusicDir",
directory=str(fixture_path),
)
file = baker.make( file = baker.make(
"storage.File", "storage.File",
directory=music_dir,
mime="audio/mp3", mime="audio/mp3",
filepath=AUDIO_FILENAME, filepath=AUDIO_FILENAME,
length=timedelta(seconds=40.86), length=timedelta(seconds=40.86),
@ -88,13 +78,8 @@ class TestScheduleViewSet(APITestCase):
) )
def test_schedule_item_invalid(self): def test_schedule_item_invalid(self):
music_dir = baker.make(
"storage.MusicDir",
directory=str(fixture_path),
)
file = baker.make( file = baker.make(
"storage.File", "storage.File",
directory=music_dir,
mime="audio/mp3", mime="audio/mp3",
filepath=AUDIO_FILENAME, filepath=AUDIO_FILENAME,
length=timedelta(seconds=40.86), length=timedelta(seconds=40.86),
@ -134,13 +119,8 @@ class TestScheduleViewSet(APITestCase):
self.assertEqual(dateparse.parse_duration(result[0]["cue_out"]), file.cueout) self.assertEqual(dateparse.parse_duration(result[0]["cue_out"]), file.cueout)
def test_schedule_item_range(self): def test_schedule_item_range(self):
music_dir = baker.make(
"storage.MusicDir",
directory=str(fixture_path),
)
file = baker.make( file = baker.make(
"storage.File", "storage.File",
directory=music_dir,
mime="audio/mp3", mime="audio/mp3",
filepath=AUDIO_FILENAME, filepath=AUDIO_FILENAME,
length=timedelta(seconds=40.86), length=timedelta(seconds=40.86),

View File

@ -3,6 +3,7 @@ from libretime_shared.config import (
DatabaseConfig, DatabaseConfig,
GeneralConfig, GeneralConfig,
RabbitMQConfig, RabbitMQConfig,
StorageConfig,
) )
@ -10,3 +11,4 @@ class Config(BaseConfig):
general: GeneralConfig general: GeneralConfig
database: DatabaseConfig = DatabaseConfig() database: DatabaseConfig = DatabaseConfig()
rabbitmq: RabbitMQConfig = RabbitMQConfig() rabbitmq: RabbitMQConfig = RabbitMQConfig()
storage: StorageConfig = StorageConfig()

View File

@ -1,8 +1,11 @@
import os import os
from .._fixtures import fixture_path
os.environ.setdefault("LIBRETIME_DEBUG", "true") os.environ.setdefault("LIBRETIME_DEBUG", "true")
os.environ.setdefault("LIBRETIME_GENERAL_PUBLIC_URL", "http://localhost") os.environ.setdefault("LIBRETIME_GENERAL_PUBLIC_URL", "http://localhost")
os.environ.setdefault("LIBRETIME_GENERAL_API_KEY", "testing") os.environ.setdefault("LIBRETIME_GENERAL_API_KEY", "testing")
os.environ.setdefault("LIBRETIME_STORAGE_PATH", str(fixture_path))
# pylint: disable=wrong-import-position,unused-import # pylint: disable=wrong-import-position,unused-import
from .prod import ( from .prod import (

View File

@ -1,4 +1,3 @@
from .cloud_file import CloudFile from .cloud_file import CloudFile
from .file import File from .file import File
from .storage import MusicDir
from .track_type import TrackType from .track_type import TrackType

View File

@ -5,9 +5,6 @@ class File(models.Model):
name = models.CharField(max_length=255) name = models.CharField(max_length=255)
mime = models.CharField(max_length=255) mime = models.CharField(max_length=255)
ftype = models.CharField(max_length=128) ftype = models.CharField(max_length=128)
directory = models.ForeignKey(
"MusicDir", models.DO_NOTHING, db_column="directory", blank=True, null=True
)
filepath = models.TextField(blank=True, null=True) filepath = models.TextField(blank=True, null=True)
import_status = models.IntegerField() import_status = models.IntegerField()
currently_accessing = models.IntegerField(db_column="currentlyaccessing") currently_accessing = models.IntegerField(db_column="currentlyaccessing")

View File

@ -1,12 +0,0 @@
from django.db import models
class MusicDir(models.Model):
directory = models.TextField(unique=True, blank=True, null=True)
type = models.CharField(max_length=255, blank=True, null=True)
exists = models.BooleanField(blank=True, null=True)
watched = models.BooleanField(blank=True, null=True)
class Meta:
managed = False
db_table = "cc_music_dirs"

View File

@ -1,9 +1,8 @@
from rest_framework import routers from rest_framework import routers
from .views import CloudFileViewSet, FileViewSet, MusicDirViewSet, TrackTypeViewSet from .views import CloudFileViewSet, FileViewSet, TrackTypeViewSet
router = routers.DefaultRouter() router = routers.DefaultRouter()
router.register("files", FileViewSet) router.register("files", FileViewSet)
router.register("music-dirs", MusicDirViewSet)
router.register("cloud-files", CloudFileViewSet) router.register("cloud-files", CloudFileViewSet)
router.register("track-types", TrackTypeViewSet) router.register("track-types", TrackTypeViewSet)

View File

@ -1,4 +1,3 @@
from .cloud_file import CloudFileSerializer from .cloud_file import CloudFileSerializer
from .file import FileSerializer from .file import FileSerializer
from .storage import MusicDirSerializer
from .track_type import TrackTypeSerializer from .track_type import TrackTypeSerializer

View File

@ -1,9 +0,0 @@
from rest_framework import serializers
from ..models import MusicDir
class MusicDirSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = MusicDir
fields = "__all__"

View File

@ -24,13 +24,8 @@ class TestFileViewSet(APITestCase):
self.assertEqual(response.status_code, 404) self.assertEqual(response.status_code, 404)
def test_exists(self): def test_exists(self):
music_dir = baker.make(
"storage.MusicDir",
directory=str(fixture_path),
)
file = baker.make( file = baker.make(
"storage.File", "storage.File",
directory=music_dir,
mime="audio/mp3", mime="audio/mp3",
filepath=AUDIO_FILENAME, filepath=AUDIO_FILENAME,
) )

View File

@ -1,4 +1,3 @@
from .cloud_file import CloudFileViewSet from .cloud_file import CloudFileViewSet
from .file import FileViewSet from .file import FileViewSet
from .storage import MusicDirViewSet
from .track_type import TrackTypeViewSet from .track_type import TrackTypeViewSet

View File

@ -1,5 +1,6 @@
import os import os
from django.conf import settings
from django.http import FileResponse from django.http import FileResponse
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from rest_framework import viewsets from rest_framework import viewsets
@ -20,7 +21,5 @@ class FileViewSet(viewsets.ModelViewSet):
pk = IntegerField().to_internal_value(data=pk) pk = IntegerField().to_internal_value(data=pk)
file = get_object_or_404(File, pk=pk) file = get_object_or_404(File, pk=pk)
storage = file.directory path = os.path.join(settings.CONFIG.storage.path, file.filepath)
path = os.path.join(storage.directory, file.filepath)
return FileResponse(open(path, "rb"), content_type=file.mime) return FileResponse(open(path, "rb"), content_type=file.mime)

View File

@ -1,10 +0,0 @@
from rest_framework import viewsets
from ..models import MusicDir
from ..serializers import MusicDirSerializer
class MusicDirViewSet(viewsets.ModelViewSet):
queryset = MusicDir.objects.all()
serializer_class = MusicDirSerializer
model_permission_name = "musicdir"

View File

@ -396,7 +396,6 @@ info "creating project directories"
mkdir_and_chown "$LIBRETIME_USER" "$CONFIG_DIR" mkdir_and_chown "$LIBRETIME_USER" "$CONFIG_DIR"
mkdir_and_chown "$LIBRETIME_USER" "$WORKING_DIR" mkdir_and_chown "$LIBRETIME_USER" "$WORKING_DIR"
mkdir_and_chown "$LIBRETIME_USER" "$LOG_DIR" mkdir_and_chown "$LIBRETIME_USER" "$LOG_DIR"
mkdir_and_chown "$LIBRETIME_USER" "$STORAGE_DIR"
if $is_first_install; then if $is_first_install; then
[[ -f "$CONFIG_TMP_FILEPATH" ]] || cp "$CONFIG_EXAMPLE_FILEPATH" "$CONFIG_TMP_FILEPATH" [[ -f "$CONFIG_TMP_FILEPATH" ]] || cp "$CONFIG_EXAMPLE_FILEPATH" "$CONFIG_TMP_FILEPATH"
@ -406,6 +405,9 @@ if $is_first_install; then
set_config "$LIBRETIME_PUBLIC_URL" general public_url set_config "$LIBRETIME_PUBLIC_URL" general public_url
fi fi
set_config "$(generate_random_password)" general api_key set_config "$(generate_random_password)" general api_key
mkdir_and_chown "$LIBRETIME_USER" "$STORAGE_DIR"
set_config "$STORAGE_DIR" storage path
fi fi
# PostgreSQL # PostgreSQL

View File

@ -17,6 +17,10 @@ general:
# Specify a class like LibreTime_Auth_Adaptor_FreeIpa to replace the built-in adaptor # Specify a class like LibreTime_Auth_Adaptor_FreeIpa to replace the built-in adaptor
auth: local auth: local
storage:
# Path of the storage directory, default is /srv/libretime
path: /srv/libretime
database: database:
# The hostname of the PostgreSQL server, default is localhost # The hostname of the PostgreSQL server, default is localhost
host: localhost host: localhost

View File

@ -93,8 +93,7 @@ class FileDataHelper
$get_file_content = file_get_contents($path); $get_file_content = file_get_contents($path);
} }
} else { } else {
$storDir = Application_Model_MusicDir::getStorDir(); $path = Config::getStoragePath() . $file . '-' . $size;
$path = $storDir->getDirectory() . $file . '-' . $size;
if (!file_exists($path)) { if (!file_exists($path)) {
$get_file_content = $default; $get_file_content = $default;
} else { } else {
@ -132,8 +131,8 @@ class FileDataHelper
$Image = 'data:' . $mime . ';charset=utf-8;base64,' . base64_encode($getFileInfo['comments']['picture'][0]['data']); $Image = 'data:' . $mime . ';charset=utf-8;base64,' . base64_encode($getFileInfo['comments']['picture'][0]['data']);
$base64 = @$Image; $base64 = @$Image;
if (!file_exists($importDir . '/' . 'artwork/')) { if (!file_exists($importDir . 'artwork/')) {
if (!mkdir($importDir . '/' . 'artwork/', 0777, true)) { if (!mkdir($importDir . 'artwork/', 0777, true)) {
Logging::error('Failed to create artwork directory.'); Logging::error('Failed to create artwork directory.');
throw new Exception('Failed to create artwork directory.'); throw new Exception('Failed to create artwork directory.');
@ -179,8 +178,7 @@ class FileDataHelper
$file = Application_Model_StoredFile::RecallById($trackid); $file = Application_Model_StoredFile::RecallById($trackid);
$md = $file->getMetadata(); $md = $file->getMetadata();
$storDir = Application_Model_MusicDir::getStorDir(); $fp = Config::getStoragePath();
$fp = $storDir->getDirectory();
$dbAudioPath = $md['MDATA_KEY_FILEPATH']; $dbAudioPath = $md['MDATA_KEY_FILEPATH'];
$fullpath = $fp . $dbAudioPath; $fullpath = $fp . $dbAudioPath;
@ -243,8 +241,7 @@ class FileDataHelper
$file = Application_Model_StoredFile::RecallById($trackid); $file = Application_Model_StoredFile::RecallById($trackid);
$md = $file->getMetadata(); $md = $file->getMetadata();
$storDir = Application_Model_MusicDir::getStorDir(); $fp = Config::getStoragePath();
$fp = $storDir->getDirectory();
$dbAudioPath = $md['MDATA_KEY_FILEPATH']; $dbAudioPath = $md['MDATA_KEY_FILEPATH'];
$fullpath = $fp . $dbAudioPath; $fullpath = $fp . $dbAudioPath;
@ -295,8 +292,7 @@ class FileDataHelper
$file = Application_Model_StoredFile::RecallById($trackid); $file = Application_Model_StoredFile::RecallById($trackid);
$md = $file->getMetadata(); $md = $file->getMetadata();
$storDir = Application_Model_MusicDir::getStorDir(); $fp = Config::getStoragePath();
$fp = $storDir->getDirectory();
$dbAudioPath = $md['MDATA_KEY_ARTWORK']; $dbAudioPath = $md['MDATA_KEY_ARTWORK'];
$fullpath = $fp . $dbAudioPath; $fullpath = $fp . $dbAudioPath;

View File

@ -0,0 +1,15 @@
<?php
class Application_Common_Storage
{
public static function splitFilePath($p_filepath)
{
$storage_path = Config::getStoragePath();
if (strpos($p_filepath, $storage_path) !== 0) {
return null;
}
return [$storage_path, substr($p_filepath, strlen($storage_path))];
}
}

View File

@ -29,9 +29,6 @@ return [
'BaseCcMountName' => 'airtime/om/BaseCcMountName.php', 'BaseCcMountName' => 'airtime/om/BaseCcMountName.php',
'BaseCcMountNamePeer' => 'airtime/om/BaseCcMountNamePeer.php', 'BaseCcMountNamePeer' => 'airtime/om/BaseCcMountNamePeer.php',
'BaseCcMountNameQuery' => 'airtime/om/BaseCcMountNameQuery.php', 'BaseCcMountNameQuery' => 'airtime/om/BaseCcMountNameQuery.php',
'BaseCcMusicDirs' => 'airtime/om/BaseCcMusicDirs.php',
'BaseCcMusicDirsPeer' => 'airtime/om/BaseCcMusicDirsPeer.php',
'BaseCcMusicDirsQuery' => 'airtime/om/BaseCcMusicDirsQuery.php',
'BaseCcPerms' => 'airtime/om/BaseCcPerms.php', 'BaseCcPerms' => 'airtime/om/BaseCcPerms.php',
'BaseCcPermsPeer' => 'airtime/om/BaseCcPermsPeer.php', 'BaseCcPermsPeer' => 'airtime/om/BaseCcPermsPeer.php',
'BaseCcPermsQuery' => 'airtime/om/BaseCcPermsQuery.php', 'BaseCcPermsQuery' => 'airtime/om/BaseCcPermsQuery.php',
@ -158,10 +155,6 @@ return [
'CcMountNamePeer' => 'airtime/CcMountNamePeer.php', 'CcMountNamePeer' => 'airtime/CcMountNamePeer.php',
'CcMountNameQuery' => 'airtime/CcMountNameQuery.php', 'CcMountNameQuery' => 'airtime/CcMountNameQuery.php',
'CcMountNameTableMap' => 'airtime/map/CcMountNameTableMap.php', 'CcMountNameTableMap' => 'airtime/map/CcMountNameTableMap.php',
'CcMusicDirs' => 'airtime/CcMusicDirs.php',
'CcMusicDirsPeer' => 'airtime/CcMusicDirsPeer.php',
'CcMusicDirsQuery' => 'airtime/CcMusicDirsQuery.php',
'CcMusicDirsTableMap' => 'airtime/map/CcMusicDirsTableMap.php',
'CcPerms' => 'airtime/CcPerms.php', 'CcPerms' => 'airtime/CcPerms.php',
'CcPermsPeer' => 'airtime/CcPermsPeer.php', 'CcPermsPeer' => 'airtime/CcPermsPeer.php',
'CcPermsQuery' => 'airtime/CcPermsQuery.php', 'CcPermsQuery' => 'airtime/CcPermsQuery.php',

View File

@ -76,7 +76,17 @@ class Config
// Storage // Storage
// ////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////
$CC_CONFIG['current_backend'] = $values['current_backend']['storage_backend'] ?? 'file'; $CC_CONFIG['storagePath'] = $values['storage']['path'] ?? '/srv/libretime';
if (!is_dir($CC_CONFIG['storagePath'])) {
echo "the configured storage.path '{$CC_CONFIG['storagePath']}' does not exists!";
exit;
}
if (!is_writable($CC_CONFIG['storagePath'])) {
echo "the configured storage.path '{$CC_CONFIG['storagePath']}' is not writable!";
exit;
}
// Facebook (DEPRECATED) // Facebook (DEPRECATED)
// ////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////
@ -146,4 +156,9 @@ class Config
return in_array(strtolower($value), ['yes', 'true']); return in_array(strtolower($value), ['yes', 'true']);
} }
public static function getStoragePath()
{
return rtrim(self::getConfig()['storagePath'], '/') . '/';
}
} }

View File

@ -604,8 +604,7 @@ class ApiController extends Zend_Controller_Action
throw new ZendActionHttpException($this, 400, 'ERROR: No ID was given.'); throw new ZendActionHttpException($this, 400, 'ERROR: No ID was given.');
} }
$storDir = Application_Model_MusicDir::getStorDir(); $fp = Config::getStoragePath();
$fp = $storDir->getDirectory();
// $this->view->type = $type; // $this->view->type = $type;
$file = Application_Model_StoredFile::RecallById($trackid); $file = Application_Model_StoredFile::RecallById($trackid);
@ -876,13 +875,9 @@ class ApiController extends Zend_Controller_Action
public function mediaMonitorSetupAction() public function mediaMonitorSetupAction()
{ {
$this->view->stor = Application_Model_MusicDir::getStorDir()->getDirectory(); $this->view->stor = Config::getStoragePath();
$watchedDirs = Application_Model_MusicDir::getWatchedDirs();
$watchedDirsPath = []; $watchedDirsPath = [];
foreach ($watchedDirs as $wd) {
$watchedDirsPath[] = $wd->getDirectory();
}
$this->view->watched_dirs = $watchedDirsPath; $this->view->watched_dirs = $watchedDirsPath;
} }
@ -1051,46 +1046,6 @@ class ApiController extends Zend_Controller_Action
Application_Model_StoredFile::listAllFiles($dir_id, $all); Application_Model_StoredFile::listAllFiles($dir_id, $all);
} }
public function listAllWatchedDirsAction()
{
$result = [];
$arrWatchedDirs = Application_Model_MusicDir::getWatchedDirs();
$storDir = Application_Model_MusicDir::getStorDir();
$result[$storDir->getId()] = $storDir->getDirectory();
foreach ($arrWatchedDirs as $watchedDir) {
$result[$watchedDir->getId()] = $watchedDir->getDirectory();
}
$this->view->dirs = $result;
}
public function addWatchedDirAction()
{
$request = $this->getRequest();
$path = base64_decode($request->getParam('path'));
$this->view->msg = Application_Model_MusicDir::addWatchedDir($path);
}
public function removeWatchedDirAction()
{
$request = $this->getRequest();
$path = base64_decode($request->getParam('path'));
$this->view->msg = Application_Model_MusicDir::removeWatchedDir($path);
}
public function setStorageDirAction()
{
$request = $this->getRequest();
$path = base64_decode($request->getParam('path'));
$this->view->msg = Application_Model_MusicDir::setStorDir($path);
}
public function getStreamSettingAction() public function getStreamSettingAction()
{ {
$info = Application_Model_StreamSetting::getStreamSetting(); $info = Application_Model_StreamSetting::getStreamSetting();
@ -1171,84 +1126,6 @@ class ApiController extends Zend_Controller_Action
Application_Model_Preference::SetSourceStatus($sourcename, $status); Application_Model_Preference::SetSourceStatus($sourcename, $status);
} }
// handles addition/deletion of mount point which watched dirs reside
public function updateFileSystemMountAction()
{
$request = $this->getRequest();
$params = $request->getParams();
$added_list = empty($params['added_dir']) ? [] : explode(',', $params['added_dir']);
$removed_list = empty($params['removed_dir']) ? [] : explode(',', $params['removed_dir']);
// get all watched dirs
$watched_dirs = Application_Model_MusicDir::getWatchedDirs(null, null);
foreach ($added_list as $ad) {
$ad .= '/';
foreach ($watched_dirs as $dir) {
$dirPath = $dir->getDirectory();
// if mount path itself was watched
if ($dirPath == $ad) {
Application_Model_MusicDir::addWatchedDir($dirPath, false);
} elseif (substr($dirPath, 0, strlen($ad)) === $ad && $dir->getExistsFlag() == false) {
// if dir contains any dir in removed_list( if watched dir resides on new mounted path )
Application_Model_MusicDir::addWatchedDir($dirPath, false);
} elseif (substr($ad, 0, strlen($dirPath)) === $dirPath) {
// is new mount point within the watched dir?
// pyinotify doesn't notify anyhing in this case, so we add this mount point as
// watched dir
// bypass nested loop check
Application_Model_MusicDir::addWatchedDir($ad, false, true);
}
}
}
foreach ($removed_list as $rd) {
$rd .= '/';
foreach ($watched_dirs as $dir) {
$dirPath = $dir->getDirectory();
// if dir contains any dir in removed_list( if watched dir resides on new mounted path )
if (substr($dirPath, 0, strlen($rd)) === $rd && $dir->getExistsFlag() == true) {
Application_Model_MusicDir::removeWatchedDir($dirPath, false);
} elseif (substr($rd, 0, strlen($dirPath)) === $dirPath) {
// is new mount point within the watched dir?
// pyinotify doesn't notify anyhing in this case, so we walk through all files within
// this watched dir in DB and mark them deleted.
// In case of h) of use cases, due to pyinotify behaviour of noticing mounted dir, we need to
// compare agaisnt all files in cc_files table
$watchDir = Application_Model_MusicDir::getDirByPath($rd);
// get all the files that is under $dirPath
$files = Application_Model_StoredFile::listAllFiles(
$dir->getId(),
$all = false
);
foreach ($files as $f) {
// if the file is from this mount
$filePaths = $f->getFilePaths();
$filePath = $filePaths[0];
if (substr($filePath, 0, strlen($rd)) === $rd) {
$f->delete();
}
}
if ($watchDir) {
Application_Model_MusicDir::removeWatchedDir($rd, false);
}
}
}
}
}
// handles case where watched dir is missing
public function handleWatchedDirMissingAction()
{
$request = $this->getRequest();
$dir = base64_decode($request->getParam('dir'));
Application_Model_MusicDir::removeWatchedDir($dir, false);
}
/* This action is for use by our dev scripts, that make /* This action is for use by our dev scripts, that make
* a change to the database and we want rabbitmq to send * a change to the database and we want rabbitmq to send
* out a message to pypo that a potential change has been made. */ * out a message to pypo that a potential change has been made. */

View File

@ -417,11 +417,11 @@ class LibraryController extends Zend_Controller_Action
$file = Application_Model_StoredFile::RecallById($id); $file = Application_Model_StoredFile::RecallById($id);
$this->view->type = $type; $this->view->type = $type;
$md = $file->getMetadata(); $md = $file->getMetadata();
$storagePath = Config::getStoragePath();
foreach ($md as $key => $value) { foreach ($md as $key => $value) {
if ($key == 'MDATA_KEY_DIRECTORY' && !is_null($value)) { if ($key == 'MDATA_KEY_DIRECTORY' && !is_null($value)) {
$musicDir = Application_Model_MusicDir::getDirByPK($value); $md['MDATA_KEY_FILEPATH'] = Application_Common_OsPath::join($storagePath, $md['MDATA_KEY_FILEPATH']);
$md['MDATA_KEY_FILEPATH'] = Application_Common_OsPath::join($musicDir->getDirectory(), $md['MDATA_KEY_FILEPATH']);
} }
} }

View File

@ -380,58 +380,6 @@ class PreferenceController extends Zend_Controller_Action
$this->_helper->json->sendJson($result); $this->_helper->json->sendJson($result);
} }
public function changeStorDirectoryAction()
{
$chosen = $this->getRequest()->getParam('dir');
$element = $this->getRequest()->getParam('element');
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
$res = Application_Model_MusicDir::setStorDir($chosen);
if ($res['code'] != 0) {
$watched_dirs_form->populate(['storageFolder' => $chosen]);
$watched_dirs_form->getElement($element)->setErrors([$res['error']]);
}
$this->view->subform = $watched_dirs_form->render();
}
public function reloadWatchDirectoryAction()
{
$chosen = $this->getRequest()->getParam('dir');
$element = $this->getRequest()->getParam('element');
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
$res = Application_Model_MusicDir::addWatchedDir($chosen);
if ($res['code'] != 0) {
$watched_dirs_form->populate(['watchedFolder' => $chosen]);
$watched_dirs_form->getElement($element)->setErrors([$res['error']]);
}
$this->view->subform = $watched_dirs_form->render();
}
public function rescanWatchDirectoryAction()
{
$dir_path = $this->getRequest()->getParam('dir');
$dir = Application_Model_MusicDir::getDirByPath($dir_path);
$data = ['directory' => $dir->getDirectory(),
'id' => $dir->getId(), ];
Application_Model_RabbitMq::SendMessageToMediaMonitor('rescan_watch', $data);
Logging::info("Unhiding all files belonging to:: {$dir_path}");
$dir->unhideFiles();
$this->_helper->json->sendJson(null);
}
public function removeWatchDirectoryAction()
{
$chosen = $this->getRequest()->getParam('dir');
$dir = Application_Model_MusicDir::removeWatchedDir($chosen);
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
$this->view->subform = $watched_dirs_form->render();
}
public function isImportInProgressAction() public function isImportInProgressAction()
{ {
$now = time(); $now = time();

View File

@ -1,478 +0,0 @@
<?php
class NestedDirectoryException extends Exception
{
}
class Application_Model_MusicDir
{
/**
* @holds propel database object
*/
private $_dir;
public function __construct($dir)
{
$this->_dir = $dir;
}
public function getId()
{
return $this->_dir->getId();
}
public function getType()
{
return $this->_dir->getType();
}
public function setType($type)
{
$this->_dir->setType($type);
}
public function getDirectory()
{
return $this->_dir->getDirectory();
}
public function setDirectory($dir)
{
$this->_dir->setDirectory($dir);
$this->_dir->save();
}
public function setExistsFlag($flag)
{
$this->_dir->setExists($flag);
$this->_dir->save();
}
public function setWatchedFlag($flag)
{
$this->_dir->setWatched($flag);
$this->_dir->save();
}
public function getWatchedFlag()
{
return $this->_dir->getWatched();
}
public function getExistsFlag()
{
return $this->_dir->getExists();
}
/**
* There are 2 cases where this function can be called.
* 1. When watched dir was removed
* 2. When some dir was watched, but it was unmounted.
*
* In case of 1, $userAddedWatchedDir should be true
* In case of 2, $userAddedWatchedDir should be false
*
* When $userAddedWatchedDir is true, it will set "Watched" flag to false
* otherwise, it will set "Exists" flag to true
*
* @param mixed $userAddedWatchedDir
*/
public function remove($userAddedWatchedDir = true)
{
$music_dir_id = $this->getId();
$sql = <<<'SQL'
SELECT DISTINCT s.instance_id
FROM cc_music_dirs AS md
LEFT JOIN cc_files AS f ON f.directory = md.id
RIGHT JOIN cc_schedule AS s ON s.file_id = f.id
WHERE md.id = :musicDirId;
SQL;
$show_instances = Application_Common_Database::prepareAndExecute(
$sql,
[':musicDirId' => $music_dir_id],
'all'
);
// get all the files on this dir
$sql = <<<'SQL'
UPDATE cc_files
SET file_exists = 'f'
WHERE id IN
(SELECT f.id
FROM cc_music_dirs AS md
LEFT JOIN cc_files AS f ON f.directory = md.id
WHERE md.id = :musicDirId);
SQL;
$affected = Application_Common_Database::prepareAndExecute(
$sql,
[':musicDirId' => $music_dir_id],
'all'
);
// set RemovedFlag to true
if ($userAddedWatchedDir) {
self::setWatchedFlag(false);
} else {
self::setExistsFlag(false);
}
// $res = $this->_dir->delete();
foreach ($show_instances as $show_instance_row) {
$temp_show = new Application_Model_ShowInstance($show_instance_row['instance_id']);
$temp_show->updateScheduledTime();
}
Application_Model_RabbitMq::PushSchedule();
}
/**
* Checks if p_dir1 is the ancestor of p_dir2. Returns
* true if it is the ancestor, false otherwise. Note that
* /home/user is considered the ancestor of /home/user.
*
* @param string $p_dir1
* The potential ancestor directory
* @param string $p_dir2
* The potential descendent directory
*
* @return bool
* Returns true if it is the ancestor, false otherwise
*/
private static function isAncestorDir($p_dir1, $p_dir2)
{
if (strlen($p_dir1) > strlen($p_dir2)) {
return false;
}
return substr($p_dir2, 0, strlen($p_dir1)) == $p_dir1;
}
/**
* Checks whether the path provided is a valid path. A valid path
* is defined as not being nested within an existing watched directory,
* or vice-versa. Throws a NestedDirectoryException if invalid.
*
* @param string $p_path
* The path we want to validate
*/
public static function isPathValid($p_path)
{
$dirs = self::getWatchedDirs();
$dirs[] = self::getStorDir();
foreach ($dirs as $dirObj) {
$dir = $dirObj->getDirectory();
$diff = strlen($dir) - strlen($p_path);
if ($diff == 0) {
if ($dir == $p_path) {
throw new NestedDirectoryException(sprintf(_('%s is already watched.'), $p_path));
}
} elseif ($diff > 0) {
if (self::isAncestorDir($p_path, $dir)) {
throw new NestedDirectoryException(sprintf(_('%s contains nested watched directory: %s'), $p_path, $dir));
}
} else { // diff < 0
if (self::isAncestorDir($dir, $p_path)) {
throw new NestedDirectoryException(sprintf(_('%s is nested within existing watched directory: %s'), $p_path, $dir));
}
}
}
}
/** There are 2 cases where this function can be called.
* 1. When watched dir was added
* 2. When some dir was watched, but it was unmounted somehow, but gets mounted again.
*
* In case of 1, $userAddedWatchedDir should be true
* In case of 2, $userAddedWatchedDir should be false
*
* When $userAddedWatchedDir is true, it will set "Removed" flag to false
* otherwise, it will set "Exists" flag to true
*
* @param $nestedWatch - if true, bypass path check, and Watched to false
* @param mixed $p_path
* @param mixed $p_type
* @param mixed $userAddedWatchedDir
*/
public static function addDir($p_path, $p_type, $userAddedWatchedDir = true, $nestedWatch = false)
{
if (!is_dir($p_path)) {
return ['code' => 2, 'error' => sprintf(_('%s is not a valid directory.'), $p_path)];
}
$real_path = Application_Common_OsPath::normpath($p_path) . '/';
if ($real_path != '/') {
$p_path = $real_path;
}
$exist_dir = self::getDirByPath($p_path);
if (is_null($exist_dir)) {
$temp_dir = new CcMusicDirs();
$dir = new Application_Model_MusicDir($temp_dir);
} else {
$dir = $exist_dir;
}
$dir->setType($p_type);
$p_path = Application_Common_OsPath::normpath($p_path) . '/';
try {
/* isPathValid() checks if path is a substring or a superstring of an
* existing dir and if not, throws NestedDirectoryException */
if (!$nestedWatch) {
self::isPathValid($p_path);
}
if ($userAddedWatchedDir) {
$dir->setWatchedFlag(true);
} else {
if ($nestedWatch) {
$dir->setWatchedFlag(false);
}
$dir->setExistsFlag(true);
}
$dir->setDirectory($p_path);
return ['code' => 0];
} catch (NestedDirectoryException $nde) {
$msg = $nde->getMessage();
return ['code' => 1, 'error' => "{$msg}"];
} catch (Exception $e) {
return ['code' => 1,
'error' => sprintf(
_('%s is already set as the current storage dir or in the' .
' watched folders list'),
$p_path
),
];
}
}
/** There are 2 cases where this function can be called.
* 1. When watched dir was added
* 2. When some dir was watched, but it was unmounted somehow, but gets mounted again.
*
* In case of 1, $userAddedWatchedDir should be true
* In case of 2, $userAddedWatchedDir should be false
*
* When $userAddedWatchedDir is true, it will set "Watched" flag to true
* otherwise, it will set "Exists" flag to true
*
* @param mixed $p_path
* @param mixed $userAddedWatchedDir
* @param mixed $nestedWatch
*/
public static function addWatchedDir($p_path, $userAddedWatchedDir = true, $nestedWatch = false)
{
$res = self::addDir($p_path, 'watched', $userAddedWatchedDir, $nestedWatch);
if ($res['code'] != 0) {
return $res;
}
// convert "linked" files (Airtime <= 1.8.2) to watched files.
$propel_link_dir = CcMusicDirsQuery::create()
->filterByType('link')
->findOne();
// see if any linked files exist.
if (isset($propel_link_dir)) {
// newly added watched directory object
$propel_new_watch = CcMusicDirsQuery::create()
->filterByDirectory(Application_Common_OsPath::normpath($p_path) . '/')
->findOne();
// any files of the deprecated "link" type.
$link_files = CcFilesQuery::create()
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
->filterByDbDirectory($propel_link_dir->getId())
->find();
$newly_watched_dir = $propel_new_watch->getDirectory();
foreach ($link_files as $link_file) {
$link_filepath = $link_file->getDbFilepath();
// convert "link" file into a watched file.
if ((strlen($newly_watched_dir) < strlen($link_filepath)) && (substr($link_filepath, 0, strlen($newly_watched_dir)) === $newly_watched_dir)) {
// get the filepath path not including the watched directory.
$sub_link_filepath = substr($link_filepath, strlen($newly_watched_dir));
$link_file->setDbDirectory($propel_new_watch->getId());
$link_file->setDbFilepath($sub_link_filepath);
$link_file->save();
}
}
}
$data = [];
$data['directory'] = $p_path;
Application_Model_RabbitMq::SendMessageToMediaMonitor('new_watch', $data);
return $res;
}
public static function getDirByPK($pk)
{
$dir = CcMusicDirsQuery::create()->findPK($pk);
if (!$dir) {
return null;
}
return new Application_Model_MusicDir($dir);
}
public static function getDirByPath($p_path)
{
$dir = CcMusicDirsQuery::create()
->filterByDirectory($p_path)
->findOne();
if ($dir == null) {
return null;
}
return new Application_Model_MusicDir($dir);
}
/**
* Search and returns watched dirs.
*
* @param $exists search condition with exists flag
* @param $watched search condition with watched flag
*/
public static function getWatchedDirs($exists = true, $watched = true)
{
$result = [];
$dirs = CcMusicDirsQuery::create()
->filterByType('watched');
if ($exists !== null) {
$dirs = $dirs->filterByExists($exists);
}
if ($watched !== null) {
$dirs = $dirs->filterByWatched($watched);
}
$dirs = $dirs->find();
foreach ($dirs as $dir) {
$result[] = new Application_Model_MusicDir($dir);
}
return $result;
}
public static function getStorDir()
{
$dir = CcMusicDirsQuery::create()
->filterByType('stor')
->findOne();
return new Application_Model_MusicDir($dir);
}
public static function setStorDir($p_dir)
{
// we want to be consistent when storing dir path.
// path should always ends with trailing '/'
$p_dir = Application_Common_OsPath::normpath($p_dir) . '/';
if (!is_dir($p_dir)) {
return ['code' => 2, 'error' => sprintf(_('%s is not a valid directory.'), $p_dir)];
}
if (Application_Model_Preference::GetImportTimestamp() + 10 > time()) {
return ['code' => 3, 'error' => 'Airtime is currently importing files. Please wait until this is complete before changing the storage directory.'];
}
$dir = self::getStorDir();
// if $p_dir doesn't exist in DB
$exist = $dir->getDirByPath($p_dir);
if ($exist == null) {
$dir->setDirectory($p_dir);
$dirId = $dir->getId();
$data = [];
$data['directory'] = $p_dir;
$data['dir_id'] = $dirId;
Application_Model_RabbitMq::SendMessageToMediaMonitor('change_stor', $data);
return ['code' => 0];
}
return ['code' => 1,
'error' => sprintf(_('%s is already set as the current storage dir or in the watched folders list.'), $p_dir), ];
}
public static function getWatchedDirFromFilepath($p_filepath)
{
$dirs = CcMusicDirsQuery::create()
->filterByType(['watched', 'stor'])
->filterByExists(true)
->filterByWatched(true)
->find();
foreach ($dirs as $dir) {
$directory = $dir->getDirectory();
if (substr($p_filepath, 0, strlen($directory)) === $directory) {
return new Application_Model_MusicDir($dir);
}
}
return null;
}
/** There are 2 cases where this function can be called.
* 1. When watched dir was removed
* 2. When some dir was watched, but it was unmounted.
*
* In case of 1, $userAddedWatchedDir should be true
* In case of 2, $userAddedWatchedDir should be false
*
* When $userAddedWatchedDir is true, it will set "Watched" flag to false
* otherwise, it will set "Exists" flag to true
*
* @param mixed $p_dir
* @param mixed $userAddedWatchedDir
*/
public static function removeWatchedDir($p_dir, $userAddedWatchedDir = true)
{
// make sure that $p_dir has a trailing "/"
$real_path = Application_Common_OsPath::normpath($p_dir) . '/';
if ($real_path != '/') {
$p_dir = $real_path;
}
$dir = Application_Model_MusicDir::getDirByPath($p_dir);
if (is_null($dir)) {
return ['code' => 1, 'error' => sprintf(_("%s doesn't exist in the watched list."), $p_dir)];
}
$dir->remove($userAddedWatchedDir);
$data = [];
$data['directory'] = $p_dir;
Application_Model_RabbitMq::SendMessageToMediaMonitor('remove_watch', $data);
return ['code' => 0];
}
public static function splitFilePath($p_filepath)
{
$mus_dir = self::getWatchedDirFromFilepath($p_filepath);
if (is_null($mus_dir)) {
return null;
}
$length_dir = strlen($mus_dir->getDirectory());
$fp = substr($p_filepath, $length_dir);
return [$mus_dir->getDirectory(), trim($fp)];
}
public function unhideFiles()
{
$files = $this->_dir->getCcFiless();
$hid = 0;
foreach ($files as $file) {
++$hid;
$file->setDbHidden(false);
$file->save();
}
Logging::info("unhide '{$hid}' files");
}
}

View File

@ -498,14 +498,11 @@ SQL;
*/ */
public function setFilePath($p_filepath) public function setFilePath($p_filepath)
{ {
$path_info = Application_Model_MusicDir::splitFilePath($p_filepath); $path_info = Application_Common_Storage::splitFilePath($p_filepath);
if (is_null($path_info)) { if (is_null($path_info)) {
return -1; return -1;
} }
$musicDir = Application_Model_MusicDir::getDirByPath($path_info[0]);
$this->_file->setDbDirectory($musicDir->getId());
$this->_file->setDbFilepath($path_info[1]); $this->_file->setDbFilepath($path_info[1]);
$this->_file->save($this->_con); $this->_file->save($this->_con);
} }
@ -650,15 +647,13 @@ SQL;
*/ */
public static function RecallByFilepath($p_filepath, $con) public static function RecallByFilepath($p_filepath, $con)
{ {
$path_info = Application_Model_MusicDir::splitFilePath($p_filepath); $path_info = Application_Common_Storage::splitFilePath($p_filepath);
if (is_null($path_info)) { if (is_null($path_info)) {
return null; return null;
} }
$music_dir = Application_Model_MusicDir::getDirByPath($path_info[0]);
$file = CcFilesQuery::create() $file = CcFilesQuery::create()
->filterByDbDirectory($music_dir->getId())
->filterByDbFilepath($path_info[1]) ->filterByDbFilepath($path_info[1])
->findOne($con); ->findOne($con);
@ -667,15 +662,13 @@ SQL;
public static function RecallByPartialFilepath($partial_path, $con) public static function RecallByPartialFilepath($partial_path, $con)
{ {
$path_info = Application_Model_MusicDir::splitFilePath($partial_path); $path_info = Application_Common_Storage::splitFilePath($partial_path);
if (is_null($path_info)) { if (is_null($path_info)) {
return null; return null;
} }
$music_dir = Application_Model_MusicDir::getDirByPath($path_info[0]);
$files = CcFilesQuery::create() $files = CcFilesQuery::create()
->filterByDbDirectory($music_dir->getId())
->filterByDbFilepath("{$path_info[1]}%") ->filterByDbFilepath("{$path_info[1]}%")
->find($con); ->find($con);
$res = []; $res = [];
@ -848,8 +841,7 @@ SQL;
$displayTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone()); $displayTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
$utcTimezone = new DateTimeZone('UTC'); $utcTimezone = new DateTimeZone('UTC');
$storDir = Application_Model_MusicDir::getStorDir(); $fp = Config::getStoragePath();
$fp = $storDir->getDirectory();
foreach ($results['aaData'] as &$row) { foreach ($results['aaData'] as &$row) {
$row['id'] = intval($row['id']); $row['id'] = intval($row['id']);
@ -951,8 +943,7 @@ SQL;
{ {
$audio_file = $tempFilePath; $audio_file = $tempFilePath;
$storDir = Application_Model_MusicDir::getStorDir(); $stor = Config::getStoragePath();
$stor = $storDir->getDirectory();
// check if "organize" dir exists and if not create one // check if "organize" dir exists and if not create one
if (!file_exists($stor . '/organize')) { if (!file_exists($stor . '/organize')) {
if (!mkdir($stor . '/organize', 0777)) { if (!mkdir($stor . '/organize', 0777)) {

View File

@ -205,21 +205,15 @@ class Application_Model_Systemstatus
public static function GetDiskInfo() public static function GetDiskInfo()
{ {
$storagePath = Config::getStoragePath();
$totalSpace = disk_total_space($storagePath);
$partitions = []; $partitions = [];
/* First lets get all the watched directories. Then we can group them $partitions[$totalSpace] = new stdClass();
* into the same partitions by comparing the partition sizes. */ $partitions[$totalSpace]->totalSpace = $totalSpace;
$musicDirs = Application_Model_MusicDir::getWatchedDirs(); $partitions[$totalSpace]->totalFreeSpace = disk_free_space($storagePath);
$musicDirs[] = Application_Model_MusicDir::getStorDir(); $partitions[$totalSpace]->usedSpace = $totalSpace - $partitions[$totalSpace]->totalFreeSpace;
foreach ($musicDirs as $md) { $partitions[$totalSpace]->dirs[] = $storagePath;
$totalSpace = disk_total_space($md->getDirectory());
if (!isset($partitions[$totalSpace])) {
$partitions[$totalSpace] = new stdClass();
$partitions[$totalSpace]->totalSpace = $totalSpace;
$partitions[$totalSpace]->totalFreeSpace = disk_free_space($md->getDirectory());
$partitions[$totalSpace]->usedSpace = $totalSpace - $partitions[$totalSpace]->totalFreeSpace;
}
$partitions[$totalSpace]->dirs[] = $md->getDirectory();
}
return array_values($partitions); return array_values($partitions);
} }

View File

@ -147,8 +147,7 @@ class CcFiles extends BaseCcFiles
self::validateFileArray($fileArray); self::validateFileArray($fileArray);
$storDir = Application_Model_MusicDir::getStorDir(); $importedStorageDir = Config::getStoragePath() . 'imported/' . self::getOwnerId() . '/';
$importedStorageDir = $storDir->getDirectory() . 'imported/' . self::getOwnerId() . '/';
$importedDbPath = 'imported/' . self::getOwnerId() . '/'; $importedDbPath = 'imported/' . self::getOwnerId() . '/';
$artwork = FileDataHelper::saveArtworkData($filePath, $originalFilename, $importedStorageDir, $importedDbPath); $artwork = FileDataHelper::saveArtworkData($filePath, $originalFilename, $importedStorageDir, $importedDbPath);
$trackType = FileDataHelper::saveTrackType(); $trackType = FileDataHelper::saveTrackType();
@ -221,9 +220,6 @@ class CcFiles extends BaseCcFiles
Application_Model_Preference::updateDiskUsage($fileSizeBytes); Application_Model_Preference::updateDiskUsage($fileSizeBytes);
} elseif ($file) { } elseif ($file) {
// Since we check for this value when deleting files, set it first
$file->setDbDirectory(self::MUSIC_DIRS_STOR_PK);
$file->fromArray($fileArray, BasePeer::TYPE_FIELDNAME); $file->fromArray($fileArray, BasePeer::TYPE_FIELDNAME);
// Our RESTful API takes "full_path" as a field, which we then split and translate to match // Our RESTful API takes "full_path" as a field, which we then split and translate to match
@ -237,7 +233,7 @@ class CcFiles extends BaseCcFiles
Application_Model_Preference::updateDiskUsage($fileSizeBytes); Application_Model_Preference::updateDiskUsage($fileSizeBytes);
$fullPath = $fileArray['full_path']; $fullPath = $fileArray['full_path'];
$storDir = Application_Model_MusicDir::getStorDir()->getDirectory(); $storDir = Config::getStoragePath();
$pos = strpos($fullPath, $storDir); $pos = strpos($fullPath, $storDir);
if ($pos !== false) { if ($pos !== false) {
@ -409,11 +405,7 @@ class CcFiles extends BaseCcFiles
*/ */
public function getAbsoluteFilePath() public function getAbsoluteFilePath()
{ {
$music_dir = Application_Model_MusicDir::getDirByPK($this->getDbDirectory()); $directory = Config::getStoragePath();
if (!$music_dir) {
throw new Exception('Invalid music_dir for file ' . $this->getDbId() . ' in database.');
}
$directory = $music_dir->getDirectory();
$filepath = $this->getDbFilepath(); $filepath = $this->getDbFilepath();
return Application_Common_OsPath::join($directory, $filepath); return Application_Common_OsPath::join($directory, $filepath);
@ -424,11 +416,7 @@ class CcFiles extends BaseCcFiles
*/ */
public function getAbsoluteArtworkPath() public function getAbsoluteArtworkPath()
{ {
$music_dir = Application_Model_MusicDir::getDirByPK($this->getDbDirectory()); $directory = Config::getStoragePath();
if (!$music_dir) {
throw new Exception('Invalid music_dir for file ' . $this->getDbId() . ' in database.');
}
$directory = $music_dir->getDirectory();
$filepath = $this->getDbArtwork(); $filepath = $this->getDbArtwork();
return Application_Common_OsPath::join($directory, $filepath); return Application_Common_OsPath::join($directory, $filepath);

View File

@ -1,12 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_music_dirs' table.
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*/
class CcMusicDirs extends BaseCcMusicDirs
{
} // CcMusicDirs

View File

@ -1,12 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_music_dirs' table.
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*/
class CcMusicDirsPeer extends BaseCcMusicDirsPeer
{
} // CcMusicDirsPeer

View File

@ -1,12 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_music_dirs' table.
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*/
class CcMusicDirsQuery extends BaseCcMusicDirsQuery
{
} // CcMusicDirsQuery

View File

@ -43,7 +43,6 @@ class CcFilesTableMap extends TableMap
$this->addColumn('name', 'DbName', 'VARCHAR', true, 255, ''); $this->addColumn('name', 'DbName', 'VARCHAR', true, 255, '');
$this->addColumn('mime', 'DbMime', 'VARCHAR', true, 255, ''); $this->addColumn('mime', 'DbMime', 'VARCHAR', true, 255, '');
$this->addColumn('ftype', 'DbFtype', 'VARCHAR', true, 128, ''); $this->addColumn('ftype', 'DbFtype', 'VARCHAR', true, 128, '');
$this->addForeignKey('directory', 'DbDirectory', 'INTEGER', 'cc_music_dirs', 'id', false, null, null);
$this->addColumn('filepath', 'DbFilepath', 'LONGVARCHAR', false, null, ''); $this->addColumn('filepath', 'DbFilepath', 'LONGVARCHAR', false, null, '');
$this->addColumn('import_status', 'DbImportStatus', 'INTEGER', true, null, 1); $this->addColumn('import_status', 'DbImportStatus', 'INTEGER', true, null, 1);
$this->addColumn('currentlyaccessing', 'DbCurrentlyaccessing', 'INTEGER', true, null, 0); $this->addColumn('currentlyaccessing', 'DbCurrentlyaccessing', 'INTEGER', true, null, 0);
@ -118,7 +117,6 @@ class CcFilesTableMap extends TableMap
{ {
$this->addRelation('FkOwner', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner_id' => 'id', ), null, null); $this->addRelation('FkOwner', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner_id' => 'id', ), null, null);
$this->addRelation('CcSubjsRelatedByDbEditedby', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null); $this->addRelation('CcSubjsRelatedByDbEditedby', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null);
$this->addRelation('CcMusicDirs', 'CcMusicDirs', RelationMap::MANY_TO_ONE, array('directory' => 'id', ), null, null);
$this->addRelation('CloudFile', 'CloudFile', RelationMap::ONE_TO_MANY, array('id' => 'cc_file_id', ), 'CASCADE', null, 'CloudFiles'); $this->addRelation('CloudFile', 'CloudFile', RelationMap::ONE_TO_MANY, array('id' => 'cc_file_id', ), 'CASCADE', null, 'CloudFiles');
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcShowInstancess'); $this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcShowInstancess');
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcPlaylistcontentss'); $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcPlaylistcontentss');

View File

@ -1,58 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_music_dirs' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcMusicDirsTableMap extends TableMap
{
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcMusicDirsTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_music_dirs');
$this->setPhpName('CcMusicDirs');
$this->setClassname('CcMusicDirs');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_music_dirs_id_seq');
// columns
$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
$this->addColumn('directory', 'Directory', 'LONGVARCHAR', false, null, null);
$this->addColumn('type', 'Type', 'VARCHAR', false, 255, null);
$this->addColumn('exists', 'Exists', 'BOOLEAN', false, null, true);
$this->addColumn('watched', 'Watched', 'BOOLEAN', false, null, true);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcFiles', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'directory', ), null, null, 'CcFiless');
} // buildRelations()
} // CcMusicDirsTableMap

File diff suppressed because it is too large Load Diff

View File

@ -24,13 +24,13 @@ abstract class BaseCcFilesPeer
const TM_CLASS = 'CcFilesTableMap'; const TM_CLASS = 'CcFilesTableMap';
/** The total number of columns. */ /** The total number of columns. */
const NUM_COLUMNS = 69; const NUM_COLUMNS = 68;
/** The number of lazy-loaded columns. */ /** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0; const NUM_LAZY_LOAD_COLUMNS = 0;
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 69; const NUM_HYDRATE_COLUMNS = 68;
/** the column name for the id field */ /** the column name for the id field */
const ID = 'cc_files.id'; const ID = 'cc_files.id';
@ -44,9 +44,6 @@ abstract class BaseCcFilesPeer
/** the column name for the ftype field */ /** the column name for the ftype field */
const FTYPE = 'cc_files.ftype'; const FTYPE = 'cc_files.ftype';
/** the column name for the directory field */
const DIRECTORY = 'cc_files.directory';
/** the column name for the filepath field */ /** the column name for the filepath field */
const FILEPATH = 'cc_files.filepath'; const FILEPATH = 'cc_files.filepath';
@ -258,12 +255,12 @@ abstract class BaseCcFilesPeer
* e.g. CcFilesPeer::$fieldNames[CcFilesPeer::TYPE_PHPNAME][0] = 'Id' * e.g. CcFilesPeer::$fieldNames[CcFilesPeer::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMime', 'DbFtype', 'DbDirectory', 'DbFilepath', 'DbImportStatus', 'DbCurrentlyaccessing', 'DbEditedby', 'DbMtime', 'DbUtime', 'DbLPtime', 'DbMd5', 'DbTrackTitle', 'DbArtistName', 'DbBitRate', 'DbSampleRate', 'DbFormat', 'DbLength', 'DbAlbumTitle', 'DbGenre', 'DbComments', 'DbYear', 'DbTrackNumber', 'DbChannels', 'DbUrl', 'DbBpm', 'DbRating', 'DbEncodedBy', 'DbDiscNumber', 'DbMood', 'DbLabel', 'DbComposer', 'DbEncoder', 'DbChecksum', 'DbLyrics', 'DbOrchestra', 'DbConductor', 'DbLyricist', 'DbOriginalLyricist', 'DbRadioStationName', 'DbInfoUrl', 'DbArtistUrl', 'DbAudioSourceUrl', 'DbRadioStationUrl', 'DbBuyThisUrl', 'DbIsrcNumber', 'DbCatalogNumber', 'DbOriginalArtist', 'DbCopyright', 'DbReportDatetime', 'DbReportLocation', 'DbReportOrganization', 'DbSubject', 'DbContributor', 'DbLanguage', 'DbFileExists', 'DbReplayGain', 'DbOwnerId', 'DbCuein', 'DbCueout', 'DbSilanCheck', 'DbHidden', 'DbIsScheduled', 'DbIsPlaylist', 'DbFilesize', 'DbDescription', 'DbArtwork', 'DbTrackType', ), BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMime', 'DbFtype', 'DbFilepath', 'DbImportStatus', 'DbCurrentlyaccessing', 'DbEditedby', 'DbMtime', 'DbUtime', 'DbLPtime', 'DbMd5', 'DbTrackTitle', 'DbArtistName', 'DbBitRate', 'DbSampleRate', 'DbFormat', 'DbLength', 'DbAlbumTitle', 'DbGenre', 'DbComments', 'DbYear', 'DbTrackNumber', 'DbChannels', 'DbUrl', 'DbBpm', 'DbRating', 'DbEncodedBy', 'DbDiscNumber', 'DbMood', 'DbLabel', 'DbComposer', 'DbEncoder', 'DbChecksum', 'DbLyrics', 'DbOrchestra', 'DbConductor', 'DbLyricist', 'DbOriginalLyricist', 'DbRadioStationName', 'DbInfoUrl', 'DbArtistUrl', 'DbAudioSourceUrl', 'DbRadioStationUrl', 'DbBuyThisUrl', 'DbIsrcNumber', 'DbCatalogNumber', 'DbOriginalArtist', 'DbCopyright', 'DbReportDatetime', 'DbReportLocation', 'DbReportOrganization', 'DbSubject', 'DbContributor', 'DbLanguage', 'DbFileExists', 'DbReplayGain', 'DbOwnerId', 'DbCuein', 'DbCueout', 'DbSilanCheck', 'DbHidden', 'DbIsScheduled', 'DbIsPlaylist', 'DbFilesize', 'DbDescription', 'DbArtwork', 'DbTrackType', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMime', 'dbFtype', 'dbDirectory', 'dbFilepath', 'dbImportStatus', 'dbCurrentlyaccessing', 'dbEditedby', 'dbMtime', 'dbUtime', 'dbLPtime', 'dbMd5', 'dbTrackTitle', 'dbArtistName', 'dbBitRate', 'dbSampleRate', 'dbFormat', 'dbLength', 'dbAlbumTitle', 'dbGenre', 'dbComments', 'dbYear', 'dbTrackNumber', 'dbChannels', 'dbUrl', 'dbBpm', 'dbRating', 'dbEncodedBy', 'dbDiscNumber', 'dbMood', 'dbLabel', 'dbComposer', 'dbEncoder', 'dbChecksum', 'dbLyrics', 'dbOrchestra', 'dbConductor', 'dbLyricist', 'dbOriginalLyricist', 'dbRadioStationName', 'dbInfoUrl', 'dbArtistUrl', 'dbAudioSourceUrl', 'dbRadioStationUrl', 'dbBuyThisUrl', 'dbIsrcNumber', 'dbCatalogNumber', 'dbOriginalArtist', 'dbCopyright', 'dbReportDatetime', 'dbReportLocation', 'dbReportOrganization', 'dbSubject', 'dbContributor', 'dbLanguage', 'dbFileExists', 'dbReplayGain', 'dbOwnerId', 'dbCuein', 'dbCueout', 'dbSilanCheck', 'dbHidden', 'dbIsScheduled', 'dbIsPlaylist', 'dbFilesize', 'dbDescription', 'dbArtwork', 'dbTrackType', ), BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMime', 'dbFtype', 'dbFilepath', 'dbImportStatus', 'dbCurrentlyaccessing', 'dbEditedby', 'dbMtime', 'dbUtime', 'dbLPtime', 'dbMd5', 'dbTrackTitle', 'dbArtistName', 'dbBitRate', 'dbSampleRate', 'dbFormat', 'dbLength', 'dbAlbumTitle', 'dbGenre', 'dbComments', 'dbYear', 'dbTrackNumber', 'dbChannels', 'dbUrl', 'dbBpm', 'dbRating', 'dbEncodedBy', 'dbDiscNumber', 'dbMood', 'dbLabel', 'dbComposer', 'dbEncoder', 'dbChecksum', 'dbLyrics', 'dbOrchestra', 'dbConductor', 'dbLyricist', 'dbOriginalLyricist', 'dbRadioStationName', 'dbInfoUrl', 'dbArtistUrl', 'dbAudioSourceUrl', 'dbRadioStationUrl', 'dbBuyThisUrl', 'dbIsrcNumber', 'dbCatalogNumber', 'dbOriginalArtist', 'dbCopyright', 'dbReportDatetime', 'dbReportLocation', 'dbReportOrganization', 'dbSubject', 'dbContributor', 'dbLanguage', 'dbFileExists', 'dbReplayGain', 'dbOwnerId', 'dbCuein', 'dbCueout', 'dbSilanCheck', 'dbHidden', 'dbIsScheduled', 'dbIsPlaylist', 'dbFilesize', 'dbDescription', 'dbArtwork', 'dbTrackType', ),
BasePeer::TYPE_COLNAME => array (CcFilesPeer::ID, CcFilesPeer::NAME, CcFilesPeer::MIME, CcFilesPeer::FTYPE, CcFilesPeer::DIRECTORY, CcFilesPeer::FILEPATH, CcFilesPeer::IMPORT_STATUS, CcFilesPeer::CURRENTLYACCESSING, CcFilesPeer::EDITEDBY, CcFilesPeer::MTIME, CcFilesPeer::UTIME, CcFilesPeer::LPTIME, CcFilesPeer::MD5, CcFilesPeer::TRACK_TITLE, CcFilesPeer::ARTIST_NAME, CcFilesPeer::BIT_RATE, CcFilesPeer::SAMPLE_RATE, CcFilesPeer::FORMAT, CcFilesPeer::LENGTH, CcFilesPeer::ALBUM_TITLE, CcFilesPeer::GENRE, CcFilesPeer::COMMENTS, CcFilesPeer::YEAR, CcFilesPeer::TRACK_NUMBER, CcFilesPeer::CHANNELS, CcFilesPeer::URL, CcFilesPeer::BPM, CcFilesPeer::RATING, CcFilesPeer::ENCODED_BY, CcFilesPeer::DISC_NUMBER, CcFilesPeer::MOOD, CcFilesPeer::LABEL, CcFilesPeer::COMPOSER, CcFilesPeer::ENCODER, CcFilesPeer::CHECKSUM, CcFilesPeer::LYRICS, CcFilesPeer::ORCHESTRA, CcFilesPeer::CONDUCTOR, CcFilesPeer::LYRICIST, CcFilesPeer::ORIGINAL_LYRICIST, CcFilesPeer::RADIO_STATION_NAME, CcFilesPeer::INFO_URL, CcFilesPeer::ARTIST_URL, CcFilesPeer::AUDIO_SOURCE_URL, CcFilesPeer::RADIO_STATION_URL, CcFilesPeer::BUY_THIS_URL, CcFilesPeer::ISRC_NUMBER, CcFilesPeer::CATALOG_NUMBER, CcFilesPeer::ORIGINAL_ARTIST, CcFilesPeer::COPYRIGHT, CcFilesPeer::REPORT_DATETIME, CcFilesPeer::REPORT_LOCATION, CcFilesPeer::REPORT_ORGANIZATION, CcFilesPeer::SUBJECT, CcFilesPeer::CONTRIBUTOR, CcFilesPeer::LANGUAGE, CcFilesPeer::FILE_EXISTS, CcFilesPeer::REPLAY_GAIN, CcFilesPeer::OWNER_ID, CcFilesPeer::CUEIN, CcFilesPeer::CUEOUT, CcFilesPeer::SILAN_CHECK, CcFilesPeer::HIDDEN, CcFilesPeer::IS_SCHEDULED, CcFilesPeer::IS_PLAYLIST, CcFilesPeer::FILESIZE, CcFilesPeer::DESCRIPTION, CcFilesPeer::ARTWORK, CcFilesPeer::TRACK_TYPE, ), BasePeer::TYPE_COLNAME => array (CcFilesPeer::ID, CcFilesPeer::NAME, CcFilesPeer::MIME, CcFilesPeer::FTYPE, CcFilesPeer::FILEPATH, CcFilesPeer::IMPORT_STATUS, CcFilesPeer::CURRENTLYACCESSING, CcFilesPeer::EDITEDBY, CcFilesPeer::MTIME, CcFilesPeer::UTIME, CcFilesPeer::LPTIME, CcFilesPeer::MD5, CcFilesPeer::TRACK_TITLE, CcFilesPeer::ARTIST_NAME, CcFilesPeer::BIT_RATE, CcFilesPeer::SAMPLE_RATE, CcFilesPeer::FORMAT, CcFilesPeer::LENGTH, CcFilesPeer::ALBUM_TITLE, CcFilesPeer::GENRE, CcFilesPeer::COMMENTS, CcFilesPeer::YEAR, CcFilesPeer::TRACK_NUMBER, CcFilesPeer::CHANNELS, CcFilesPeer::URL, CcFilesPeer::BPM, CcFilesPeer::RATING, CcFilesPeer::ENCODED_BY, CcFilesPeer::DISC_NUMBER, CcFilesPeer::MOOD, CcFilesPeer::LABEL, CcFilesPeer::COMPOSER, CcFilesPeer::ENCODER, CcFilesPeer::CHECKSUM, CcFilesPeer::LYRICS, CcFilesPeer::ORCHESTRA, CcFilesPeer::CONDUCTOR, CcFilesPeer::LYRICIST, CcFilesPeer::ORIGINAL_LYRICIST, CcFilesPeer::RADIO_STATION_NAME, CcFilesPeer::INFO_URL, CcFilesPeer::ARTIST_URL, CcFilesPeer::AUDIO_SOURCE_URL, CcFilesPeer::RADIO_STATION_URL, CcFilesPeer::BUY_THIS_URL, CcFilesPeer::ISRC_NUMBER, CcFilesPeer::CATALOG_NUMBER, CcFilesPeer::ORIGINAL_ARTIST, CcFilesPeer::COPYRIGHT, CcFilesPeer::REPORT_DATETIME, CcFilesPeer::REPORT_LOCATION, CcFilesPeer::REPORT_ORGANIZATION, CcFilesPeer::SUBJECT, CcFilesPeer::CONTRIBUTOR, CcFilesPeer::LANGUAGE, CcFilesPeer::FILE_EXISTS, CcFilesPeer::REPLAY_GAIN, CcFilesPeer::OWNER_ID, CcFilesPeer::CUEIN, CcFilesPeer::CUEOUT, CcFilesPeer::SILAN_CHECK, CcFilesPeer::HIDDEN, CcFilesPeer::IS_SCHEDULED, CcFilesPeer::IS_PLAYLIST, CcFilesPeer::FILESIZE, CcFilesPeer::DESCRIPTION, CcFilesPeer::ARTWORK, CcFilesPeer::TRACK_TYPE, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MIME', 'FTYPE', 'DIRECTORY', 'FILEPATH', 'IMPORT_STATUS', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'UTIME', 'LPTIME', 'MD5', 'TRACK_TITLE', 'ARTIST_NAME', 'BIT_RATE', 'SAMPLE_RATE', 'FORMAT', 'LENGTH', 'ALBUM_TITLE', 'GENRE', 'COMMENTS', 'YEAR', 'TRACK_NUMBER', 'CHANNELS', 'URL', 'BPM', 'RATING', 'ENCODED_BY', 'DISC_NUMBER', 'MOOD', 'LABEL', 'COMPOSER', 'ENCODER', 'CHECKSUM', 'LYRICS', 'ORCHESTRA', 'CONDUCTOR', 'LYRICIST', 'ORIGINAL_LYRICIST', 'RADIO_STATION_NAME', 'INFO_URL', 'ARTIST_URL', 'AUDIO_SOURCE_URL', 'RADIO_STATION_URL', 'BUY_THIS_URL', 'ISRC_NUMBER', 'CATALOG_NUMBER', 'ORIGINAL_ARTIST', 'COPYRIGHT', 'REPORT_DATETIME', 'REPORT_LOCATION', 'REPORT_ORGANIZATION', 'SUBJECT', 'CONTRIBUTOR', 'LANGUAGE', 'FILE_EXISTS', 'REPLAY_GAIN', 'OWNER_ID', 'CUEIN', 'CUEOUT', 'SILAN_CHECK', 'HIDDEN', 'IS_SCHEDULED', 'IS_PLAYLIST', 'FILESIZE', 'DESCRIPTION', 'ARTWORK', 'TRACK_TYPE', ), BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MIME', 'FTYPE', 'FILEPATH', 'IMPORT_STATUS', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'UTIME', 'LPTIME', 'MD5', 'TRACK_TITLE', 'ARTIST_NAME', 'BIT_RATE', 'SAMPLE_RATE', 'FORMAT', 'LENGTH', 'ALBUM_TITLE', 'GENRE', 'COMMENTS', 'YEAR', 'TRACK_NUMBER', 'CHANNELS', 'URL', 'BPM', 'RATING', 'ENCODED_BY', 'DISC_NUMBER', 'MOOD', 'LABEL', 'COMPOSER', 'ENCODER', 'CHECKSUM', 'LYRICS', 'ORCHESTRA', 'CONDUCTOR', 'LYRICIST', 'ORIGINAL_LYRICIST', 'RADIO_STATION_NAME', 'INFO_URL', 'ARTIST_URL', 'AUDIO_SOURCE_URL', 'RADIO_STATION_URL', 'BUY_THIS_URL', 'ISRC_NUMBER', 'CATALOG_NUMBER', 'ORIGINAL_ARTIST', 'COPYRIGHT', 'REPORT_DATETIME', 'REPORT_LOCATION', 'REPORT_ORGANIZATION', 'SUBJECT', 'CONTRIBUTOR', 'LANGUAGE', 'FILE_EXISTS', 'REPLAY_GAIN', 'OWNER_ID', 'CUEIN', 'CUEOUT', 'SILAN_CHECK', 'HIDDEN', 'IS_SCHEDULED', 'IS_PLAYLIST', 'FILESIZE', 'DESCRIPTION', 'ARTWORK', 'TRACK_TYPE', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mime', 'ftype', 'directory', 'filepath', 'import_status', 'currentlyaccessing', 'editedby', 'mtime', 'utime', 'lptime', 'md5', 'track_title', 'artist_name', 'bit_rate', 'sample_rate', 'format', 'length', 'album_title', 'genre', 'comments', 'year', 'track_number', 'channels', 'url', 'bpm', 'rating', 'encoded_by', 'disc_number', 'mood', 'label', 'composer', 'encoder', 'checksum', 'lyrics', 'orchestra', 'conductor', 'lyricist', 'original_lyricist', 'radio_station_name', 'info_url', 'artist_url', 'audio_source_url', 'radio_station_url', 'buy_this_url', 'isrc_number', 'catalog_number', 'original_artist', 'copyright', 'report_datetime', 'report_location', 'report_organization', 'subject', 'contributor', 'language', 'file_exists', 'replay_gain', 'owner_id', 'cuein', 'cueout', 'silan_check', 'hidden', 'is_scheduled', 'is_playlist', 'filesize', 'description', 'artwork', 'track_type', ), BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mime', 'ftype', 'filepath', 'import_status', 'currentlyaccessing', 'editedby', 'mtime', 'utime', 'lptime', 'md5', 'track_title', 'artist_name', 'bit_rate', 'sample_rate', 'format', 'length', 'album_title', 'genre', 'comments', 'year', 'track_number', 'channels', 'url', 'bpm', 'rating', 'encoded_by', 'disc_number', 'mood', 'label', 'composer', 'encoder', 'checksum', 'lyrics', 'orchestra', 'conductor', 'lyricist', 'original_lyricist', 'radio_station_name', 'info_url', 'artist_url', 'audio_source_url', 'radio_station_url', 'buy_this_url', 'isrc_number', 'catalog_number', 'original_artist', 'copyright', 'report_datetime', 'report_location', 'report_organization', 'subject', 'contributor', 'language', 'file_exists', 'replay_gain', 'owner_id', 'cuein', 'cueout', 'silan_check', 'hidden', 'is_scheduled', 'is_playlist', 'filesize', 'description', 'artwork', 'track_type', ),
BasePeer::TYPE_NUM => array (0, 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, ) BasePeer::TYPE_NUM => array (0, 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, )
); );
/** /**
@ -273,12 +270,12 @@ abstract class BaseCcFilesPeer
* e.g. CcFilesPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 * e.g. CcFilesPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMime' => 2, 'DbFtype' => 3, 'DbDirectory' => 4, 'DbFilepath' => 5, 'DbImportStatus' => 6, 'DbCurrentlyaccessing' => 7, 'DbEditedby' => 8, 'DbMtime' => 9, 'DbUtime' => 10, 'DbLPtime' => 11, 'DbMd5' => 12, 'DbTrackTitle' => 13, 'DbArtistName' => 14, 'DbBitRate' => 15, 'DbSampleRate' => 16, 'DbFormat' => 17, 'DbLength' => 18, 'DbAlbumTitle' => 19, 'DbGenre' => 20, 'DbComments' => 21, 'DbYear' => 22, 'DbTrackNumber' => 23, 'DbChannels' => 24, 'DbUrl' => 25, 'DbBpm' => 26, 'DbRating' => 27, 'DbEncodedBy' => 28, 'DbDiscNumber' => 29, 'DbMood' => 30, 'DbLabel' => 31, 'DbComposer' => 32, 'DbEncoder' => 33, 'DbChecksum' => 34, 'DbLyrics' => 35, 'DbOrchestra' => 36, 'DbConductor' => 37, 'DbLyricist' => 38, 'DbOriginalLyricist' => 39, 'DbRadioStationName' => 40, 'DbInfoUrl' => 41, 'DbArtistUrl' => 42, 'DbAudioSourceUrl' => 43, 'DbRadioStationUrl' => 44, 'DbBuyThisUrl' => 45, 'DbIsrcNumber' => 46, 'DbCatalogNumber' => 47, 'DbOriginalArtist' => 48, 'DbCopyright' => 49, 'DbReportDatetime' => 50, 'DbReportLocation' => 51, 'DbReportOrganization' => 52, 'DbSubject' => 53, 'DbContributor' => 54, 'DbLanguage' => 55, 'DbFileExists' => 56, 'DbReplayGain' => 57, 'DbOwnerId' => 58, 'DbCuein' => 59, 'DbCueout' => 60, 'DbSilanCheck' => 61, 'DbHidden' => 62, 'DbIsScheduled' => 63, 'DbIsPlaylist' => 64, 'DbFilesize' => 65, 'DbDescription' => 66, 'DbArtwork' => 67, 'DbTrackType' => 68, ), BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMime' => 2, 'DbFtype' => 3, 'DbFilepath' => 4, 'DbImportStatus' => 5, 'DbCurrentlyaccessing' => 6, 'DbEditedby' => 7, 'DbMtime' => 8, 'DbUtime' => 9, 'DbLPtime' => 10, 'DbMd5' => 11, 'DbTrackTitle' => 12, 'DbArtistName' => 13, 'DbBitRate' => 14, 'DbSampleRate' => 15, 'DbFormat' => 16, 'DbLength' => 17, 'DbAlbumTitle' => 18, 'DbGenre' => 19, 'DbComments' => 20, 'DbYear' => 21, 'DbTrackNumber' => 22, 'DbChannels' => 23, 'DbUrl' => 24, 'DbBpm' => 25, 'DbRating' => 26, 'DbEncodedBy' => 27, 'DbDiscNumber' => 28, 'DbMood' => 29, 'DbLabel' => 30, 'DbComposer' => 31, 'DbEncoder' => 32, 'DbChecksum' => 33, 'DbLyrics' => 34, 'DbOrchestra' => 35, 'DbConductor' => 36, 'DbLyricist' => 37, 'DbOriginalLyricist' => 38, 'DbRadioStationName' => 39, 'DbInfoUrl' => 40, 'DbArtistUrl' => 41, 'DbAudioSourceUrl' => 42, 'DbRadioStationUrl' => 43, 'DbBuyThisUrl' => 44, 'DbIsrcNumber' => 45, 'DbCatalogNumber' => 46, 'DbOriginalArtist' => 47, 'DbCopyright' => 48, 'DbReportDatetime' => 49, 'DbReportLocation' => 50, 'DbReportOrganization' => 51, 'DbSubject' => 52, 'DbContributor' => 53, 'DbLanguage' => 54, 'DbFileExists' => 55, 'DbReplayGain' => 56, 'DbOwnerId' => 57, 'DbCuein' => 58, 'DbCueout' => 59, 'DbSilanCheck' => 60, 'DbHidden' => 61, 'DbIsScheduled' => 62, 'DbIsPlaylist' => 63, 'DbFilesize' => 64, 'DbDescription' => 65, 'DbArtwork' => 66, 'DbTrackType' => 67, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMime' => 2, 'dbFtype' => 3, 'dbDirectory' => 4, 'dbFilepath' => 5, 'dbImportStatus' => 6, 'dbCurrentlyaccessing' => 7, 'dbEditedby' => 8, 'dbMtime' => 9, 'dbUtime' => 10, 'dbLPtime' => 11, 'dbMd5' => 12, 'dbTrackTitle' => 13, 'dbArtistName' => 14, 'dbBitRate' => 15, 'dbSampleRate' => 16, 'dbFormat' => 17, 'dbLength' => 18, 'dbAlbumTitle' => 19, 'dbGenre' => 20, 'dbComments' => 21, 'dbYear' => 22, 'dbTrackNumber' => 23, 'dbChannels' => 24, 'dbUrl' => 25, 'dbBpm' => 26, 'dbRating' => 27, 'dbEncodedBy' => 28, 'dbDiscNumber' => 29, 'dbMood' => 30, 'dbLabel' => 31, 'dbComposer' => 32, 'dbEncoder' => 33, 'dbChecksum' => 34, 'dbLyrics' => 35, 'dbOrchestra' => 36, 'dbConductor' => 37, 'dbLyricist' => 38, 'dbOriginalLyricist' => 39, 'dbRadioStationName' => 40, 'dbInfoUrl' => 41, 'dbArtistUrl' => 42, 'dbAudioSourceUrl' => 43, 'dbRadioStationUrl' => 44, 'dbBuyThisUrl' => 45, 'dbIsrcNumber' => 46, 'dbCatalogNumber' => 47, 'dbOriginalArtist' => 48, 'dbCopyright' => 49, 'dbReportDatetime' => 50, 'dbReportLocation' => 51, 'dbReportOrganization' => 52, 'dbSubject' => 53, 'dbContributor' => 54, 'dbLanguage' => 55, 'dbFileExists' => 56, 'dbReplayGain' => 57, 'dbOwnerId' => 58, 'dbCuein' => 59, 'dbCueout' => 60, 'dbSilanCheck' => 61, 'dbHidden' => 62, 'dbIsScheduled' => 63, 'dbIsPlaylist' => 64, 'dbFilesize' => 65, 'dbDescription' => 66, 'dbArtwork' => 67, 'dbTrackType' => 68, ), BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMime' => 2, 'dbFtype' => 3, 'dbFilepath' => 4, 'dbImportStatus' => 5, 'dbCurrentlyaccessing' => 6, 'dbEditedby' => 7, 'dbMtime' => 8, 'dbUtime' => 9, 'dbLPtime' => 10, 'dbMd5' => 11, 'dbTrackTitle' => 12, 'dbArtistName' => 13, 'dbBitRate' => 14, 'dbSampleRate' => 15, 'dbFormat' => 16, 'dbLength' => 17, 'dbAlbumTitle' => 18, 'dbGenre' => 19, 'dbComments' => 20, 'dbYear' => 21, 'dbTrackNumber' => 22, 'dbChannels' => 23, 'dbUrl' => 24, 'dbBpm' => 25, 'dbRating' => 26, 'dbEncodedBy' => 27, 'dbDiscNumber' => 28, 'dbMood' => 29, 'dbLabel' => 30, 'dbComposer' => 31, 'dbEncoder' => 32, 'dbChecksum' => 33, 'dbLyrics' => 34, 'dbOrchestra' => 35, 'dbConductor' => 36, 'dbLyricist' => 37, 'dbOriginalLyricist' => 38, 'dbRadioStationName' => 39, 'dbInfoUrl' => 40, 'dbArtistUrl' => 41, 'dbAudioSourceUrl' => 42, 'dbRadioStationUrl' => 43, 'dbBuyThisUrl' => 44, 'dbIsrcNumber' => 45, 'dbCatalogNumber' => 46, 'dbOriginalArtist' => 47, 'dbCopyright' => 48, 'dbReportDatetime' => 49, 'dbReportLocation' => 50, 'dbReportOrganization' => 51, 'dbSubject' => 52, 'dbContributor' => 53, 'dbLanguage' => 54, 'dbFileExists' => 55, 'dbReplayGain' => 56, 'dbOwnerId' => 57, 'dbCuein' => 58, 'dbCueout' => 59, 'dbSilanCheck' => 60, 'dbHidden' => 61, 'dbIsScheduled' => 62, 'dbIsPlaylist' => 63, 'dbFilesize' => 64, 'dbDescription' => 65, 'dbArtwork' => 66, 'dbTrackType' => 67, ),
BasePeer::TYPE_COLNAME => array (CcFilesPeer::ID => 0, CcFilesPeer::NAME => 1, CcFilesPeer::MIME => 2, CcFilesPeer::FTYPE => 3, CcFilesPeer::DIRECTORY => 4, CcFilesPeer::FILEPATH => 5, CcFilesPeer::IMPORT_STATUS => 6, CcFilesPeer::CURRENTLYACCESSING => 7, CcFilesPeer::EDITEDBY => 8, CcFilesPeer::MTIME => 9, CcFilesPeer::UTIME => 10, CcFilesPeer::LPTIME => 11, CcFilesPeer::MD5 => 12, CcFilesPeer::TRACK_TITLE => 13, CcFilesPeer::ARTIST_NAME => 14, CcFilesPeer::BIT_RATE => 15, CcFilesPeer::SAMPLE_RATE => 16, CcFilesPeer::FORMAT => 17, CcFilesPeer::LENGTH => 18, CcFilesPeer::ALBUM_TITLE => 19, CcFilesPeer::GENRE => 20, CcFilesPeer::COMMENTS => 21, CcFilesPeer::YEAR => 22, CcFilesPeer::TRACK_NUMBER => 23, CcFilesPeer::CHANNELS => 24, CcFilesPeer::URL => 25, CcFilesPeer::BPM => 26, CcFilesPeer::RATING => 27, CcFilesPeer::ENCODED_BY => 28, CcFilesPeer::DISC_NUMBER => 29, CcFilesPeer::MOOD => 30, CcFilesPeer::LABEL => 31, CcFilesPeer::COMPOSER => 32, CcFilesPeer::ENCODER => 33, CcFilesPeer::CHECKSUM => 34, CcFilesPeer::LYRICS => 35, CcFilesPeer::ORCHESTRA => 36, CcFilesPeer::CONDUCTOR => 37, CcFilesPeer::LYRICIST => 38, CcFilesPeer::ORIGINAL_LYRICIST => 39, CcFilesPeer::RADIO_STATION_NAME => 40, CcFilesPeer::INFO_URL => 41, CcFilesPeer::ARTIST_URL => 42, CcFilesPeer::AUDIO_SOURCE_URL => 43, CcFilesPeer::RADIO_STATION_URL => 44, CcFilesPeer::BUY_THIS_URL => 45, CcFilesPeer::ISRC_NUMBER => 46, CcFilesPeer::CATALOG_NUMBER => 47, CcFilesPeer::ORIGINAL_ARTIST => 48, CcFilesPeer::COPYRIGHT => 49, CcFilesPeer::REPORT_DATETIME => 50, CcFilesPeer::REPORT_LOCATION => 51, CcFilesPeer::REPORT_ORGANIZATION => 52, CcFilesPeer::SUBJECT => 53, CcFilesPeer::CONTRIBUTOR => 54, CcFilesPeer::LANGUAGE => 55, CcFilesPeer::FILE_EXISTS => 56, CcFilesPeer::REPLAY_GAIN => 57, CcFilesPeer::OWNER_ID => 58, CcFilesPeer::CUEIN => 59, CcFilesPeer::CUEOUT => 60, CcFilesPeer::SILAN_CHECK => 61, CcFilesPeer::HIDDEN => 62, CcFilesPeer::IS_SCHEDULED => 63, CcFilesPeer::IS_PLAYLIST => 64, CcFilesPeer::FILESIZE => 65, CcFilesPeer::DESCRIPTION => 66, CcFilesPeer::ARTWORK => 67, CcFilesPeer::TRACK_TYPE => 68, ), BasePeer::TYPE_COLNAME => array (CcFilesPeer::ID => 0, CcFilesPeer::NAME => 1, CcFilesPeer::MIME => 2, CcFilesPeer::FTYPE => 3, CcFilesPeer::FILEPATH => 4, CcFilesPeer::IMPORT_STATUS => 5, CcFilesPeer::CURRENTLYACCESSING => 6, CcFilesPeer::EDITEDBY => 7, CcFilesPeer::MTIME => 8, CcFilesPeer::UTIME => 9, CcFilesPeer::LPTIME => 10, CcFilesPeer::MD5 => 11, CcFilesPeer::TRACK_TITLE => 12, CcFilesPeer::ARTIST_NAME => 13, CcFilesPeer::BIT_RATE => 14, CcFilesPeer::SAMPLE_RATE => 15, CcFilesPeer::FORMAT => 16, CcFilesPeer::LENGTH => 17, CcFilesPeer::ALBUM_TITLE => 18, CcFilesPeer::GENRE => 19, CcFilesPeer::COMMENTS => 20, CcFilesPeer::YEAR => 21, CcFilesPeer::TRACK_NUMBER => 22, CcFilesPeer::CHANNELS => 23, CcFilesPeer::URL => 24, CcFilesPeer::BPM => 25, CcFilesPeer::RATING => 26, CcFilesPeer::ENCODED_BY => 27, CcFilesPeer::DISC_NUMBER => 28, CcFilesPeer::MOOD => 29, CcFilesPeer::LABEL => 30, CcFilesPeer::COMPOSER => 31, CcFilesPeer::ENCODER => 32, CcFilesPeer::CHECKSUM => 33, CcFilesPeer::LYRICS => 34, CcFilesPeer::ORCHESTRA => 35, CcFilesPeer::CONDUCTOR => 36, CcFilesPeer::LYRICIST => 37, CcFilesPeer::ORIGINAL_LYRICIST => 38, CcFilesPeer::RADIO_STATION_NAME => 39, CcFilesPeer::INFO_URL => 40, CcFilesPeer::ARTIST_URL => 41, CcFilesPeer::AUDIO_SOURCE_URL => 42, CcFilesPeer::RADIO_STATION_URL => 43, CcFilesPeer::BUY_THIS_URL => 44, CcFilesPeer::ISRC_NUMBER => 45, CcFilesPeer::CATALOG_NUMBER => 46, CcFilesPeer::ORIGINAL_ARTIST => 47, CcFilesPeer::COPYRIGHT => 48, CcFilesPeer::REPORT_DATETIME => 49, CcFilesPeer::REPORT_LOCATION => 50, CcFilesPeer::REPORT_ORGANIZATION => 51, CcFilesPeer::SUBJECT => 52, CcFilesPeer::CONTRIBUTOR => 53, CcFilesPeer::LANGUAGE => 54, CcFilesPeer::FILE_EXISTS => 55, CcFilesPeer::REPLAY_GAIN => 56, CcFilesPeer::OWNER_ID => 57, CcFilesPeer::CUEIN => 58, CcFilesPeer::CUEOUT => 59, CcFilesPeer::SILAN_CHECK => 60, CcFilesPeer::HIDDEN => 61, CcFilesPeer::IS_SCHEDULED => 62, CcFilesPeer::IS_PLAYLIST => 63, CcFilesPeer::FILESIZE => 64, CcFilesPeer::DESCRIPTION => 65, CcFilesPeer::ARTWORK => 66, CcFilesPeer::TRACK_TYPE => 67, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MIME' => 2, 'FTYPE' => 3, 'DIRECTORY' => 4, 'FILEPATH' => 5, 'IMPORT_STATUS' => 6, 'CURRENTLYACCESSING' => 7, 'EDITEDBY' => 8, 'MTIME' => 9, 'UTIME' => 10, 'LPTIME' => 11, 'MD5' => 12, 'TRACK_TITLE' => 13, 'ARTIST_NAME' => 14, 'BIT_RATE' => 15, 'SAMPLE_RATE' => 16, 'FORMAT' => 17, 'LENGTH' => 18, 'ALBUM_TITLE' => 19, 'GENRE' => 20, 'COMMENTS' => 21, 'YEAR' => 22, 'TRACK_NUMBER' => 23, 'CHANNELS' => 24, 'URL' => 25, 'BPM' => 26, 'RATING' => 27, 'ENCODED_BY' => 28, 'DISC_NUMBER' => 29, 'MOOD' => 30, 'LABEL' => 31, 'COMPOSER' => 32, 'ENCODER' => 33, 'CHECKSUM' => 34, 'LYRICS' => 35, 'ORCHESTRA' => 36, 'CONDUCTOR' => 37, 'LYRICIST' => 38, 'ORIGINAL_LYRICIST' => 39, 'RADIO_STATION_NAME' => 40, 'INFO_URL' => 41, 'ARTIST_URL' => 42, 'AUDIO_SOURCE_URL' => 43, 'RADIO_STATION_URL' => 44, 'BUY_THIS_URL' => 45, 'ISRC_NUMBER' => 46, 'CATALOG_NUMBER' => 47, 'ORIGINAL_ARTIST' => 48, 'COPYRIGHT' => 49, 'REPORT_DATETIME' => 50, 'REPORT_LOCATION' => 51, 'REPORT_ORGANIZATION' => 52, 'SUBJECT' => 53, 'CONTRIBUTOR' => 54, 'LANGUAGE' => 55, 'FILE_EXISTS' => 56, 'REPLAY_GAIN' => 57, 'OWNER_ID' => 58, 'CUEIN' => 59, 'CUEOUT' => 60, 'SILAN_CHECK' => 61, 'HIDDEN' => 62, 'IS_SCHEDULED' => 63, 'IS_PLAYLIST' => 64, 'FILESIZE' => 65, 'DESCRIPTION' => 66, 'ARTWORK' => 67, 'TRACK_TYPE' => 68, ), BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MIME' => 2, 'FTYPE' => 3, 'FILEPATH' => 4, 'IMPORT_STATUS' => 5, 'CURRENTLYACCESSING' => 6, 'EDITEDBY' => 7, 'MTIME' => 8, 'UTIME' => 9, 'LPTIME' => 10, 'MD5' => 11, 'TRACK_TITLE' => 12, 'ARTIST_NAME' => 13, 'BIT_RATE' => 14, 'SAMPLE_RATE' => 15, 'FORMAT' => 16, 'LENGTH' => 17, 'ALBUM_TITLE' => 18, 'GENRE' => 19, 'COMMENTS' => 20, 'YEAR' => 21, 'TRACK_NUMBER' => 22, 'CHANNELS' => 23, 'URL' => 24, 'BPM' => 25, 'RATING' => 26, 'ENCODED_BY' => 27, 'DISC_NUMBER' => 28, 'MOOD' => 29, 'LABEL' => 30, 'COMPOSER' => 31, 'ENCODER' => 32, 'CHECKSUM' => 33, 'LYRICS' => 34, 'ORCHESTRA' => 35, 'CONDUCTOR' => 36, 'LYRICIST' => 37, 'ORIGINAL_LYRICIST' => 38, 'RADIO_STATION_NAME' => 39, 'INFO_URL' => 40, 'ARTIST_URL' => 41, 'AUDIO_SOURCE_URL' => 42, 'RADIO_STATION_URL' => 43, 'BUY_THIS_URL' => 44, 'ISRC_NUMBER' => 45, 'CATALOG_NUMBER' => 46, 'ORIGINAL_ARTIST' => 47, 'COPYRIGHT' => 48, 'REPORT_DATETIME' => 49, 'REPORT_LOCATION' => 50, 'REPORT_ORGANIZATION' => 51, 'SUBJECT' => 52, 'CONTRIBUTOR' => 53, 'LANGUAGE' => 54, 'FILE_EXISTS' => 55, 'REPLAY_GAIN' => 56, 'OWNER_ID' => 57, 'CUEIN' => 58, 'CUEOUT' => 59, 'SILAN_CHECK' => 60, 'HIDDEN' => 61, 'IS_SCHEDULED' => 62, 'IS_PLAYLIST' => 63, 'FILESIZE' => 64, 'DESCRIPTION' => 65, 'ARTWORK' => 66, 'TRACK_TYPE' => 67, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mime' => 2, 'ftype' => 3, 'directory' => 4, 'filepath' => 5, 'import_status' => 6, 'currentlyaccessing' => 7, 'editedby' => 8, 'mtime' => 9, 'utime' => 10, 'lptime' => 11, 'md5' => 12, 'track_title' => 13, 'artist_name' => 14, 'bit_rate' => 15, 'sample_rate' => 16, 'format' => 17, 'length' => 18, 'album_title' => 19, 'genre' => 20, 'comments' => 21, 'year' => 22, 'track_number' => 23, 'channels' => 24, 'url' => 25, 'bpm' => 26, 'rating' => 27, 'encoded_by' => 28, 'disc_number' => 29, 'mood' => 30, 'label' => 31, 'composer' => 32, 'encoder' => 33, 'checksum' => 34, 'lyrics' => 35, 'orchestra' => 36, 'conductor' => 37, 'lyricist' => 38, 'original_lyricist' => 39, 'radio_station_name' => 40, 'info_url' => 41, 'artist_url' => 42, 'audio_source_url' => 43, 'radio_station_url' => 44, 'buy_this_url' => 45, 'isrc_number' => 46, 'catalog_number' => 47, 'original_artist' => 48, 'copyright' => 49, 'report_datetime' => 50, 'report_location' => 51, 'report_organization' => 52, 'subject' => 53, 'contributor' => 54, 'language' => 55, 'file_exists' => 56, 'replay_gain' => 57, 'owner_id' => 58, 'cuein' => 59, 'cueout' => 60, 'silan_check' => 61, 'hidden' => 62, 'is_scheduled' => 63, 'is_playlist' => 64, 'filesize' => 65, 'description' => 66, 'artwork' => 67, 'track_type' => 68, ), BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mime' => 2, 'ftype' => 3, 'filepath' => 4, 'import_status' => 5, 'currentlyaccessing' => 6, 'editedby' => 7, 'mtime' => 8, 'utime' => 9, 'lptime' => 10, 'md5' => 11, 'track_title' => 12, 'artist_name' => 13, 'bit_rate' => 14, 'sample_rate' => 15, 'format' => 16, 'length' => 17, 'album_title' => 18, 'genre' => 19, 'comments' => 20, 'year' => 21, 'track_number' => 22, 'channels' => 23, 'url' => 24, 'bpm' => 25, 'rating' => 26, 'encoded_by' => 27, 'disc_number' => 28, 'mood' => 29, 'label' => 30, 'composer' => 31, 'encoder' => 32, 'checksum' => 33, 'lyrics' => 34, 'orchestra' => 35, 'conductor' => 36, 'lyricist' => 37, 'original_lyricist' => 38, 'radio_station_name' => 39, 'info_url' => 40, 'artist_url' => 41, 'audio_source_url' => 42, 'radio_station_url' => 43, 'buy_this_url' => 44, 'isrc_number' => 45, 'catalog_number' => 46, 'original_artist' => 47, 'copyright' => 48, 'report_datetime' => 49, 'report_location' => 50, 'report_organization' => 51, 'subject' => 52, 'contributor' => 53, 'language' => 54, 'file_exists' => 55, 'replay_gain' => 56, 'owner_id' => 57, 'cuein' => 58, 'cueout' => 59, 'silan_check' => 60, 'hidden' => 61, 'is_scheduled' => 62, 'is_playlist' => 63, 'filesize' => 64, 'description' => 65, 'artwork' => 66, 'track_type' => 67, ),
BasePeer::TYPE_NUM => array (0, 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, ) BasePeer::TYPE_NUM => array (0, 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, )
); );
/** /**
@ -356,7 +353,6 @@ abstract class BaseCcFilesPeer
$criteria->addSelectColumn(CcFilesPeer::NAME); $criteria->addSelectColumn(CcFilesPeer::NAME);
$criteria->addSelectColumn(CcFilesPeer::MIME); $criteria->addSelectColumn(CcFilesPeer::MIME);
$criteria->addSelectColumn(CcFilesPeer::FTYPE); $criteria->addSelectColumn(CcFilesPeer::FTYPE);
$criteria->addSelectColumn(CcFilesPeer::DIRECTORY);
$criteria->addSelectColumn(CcFilesPeer::FILEPATH); $criteria->addSelectColumn(CcFilesPeer::FILEPATH);
$criteria->addSelectColumn(CcFilesPeer::IMPORT_STATUS); $criteria->addSelectColumn(CcFilesPeer::IMPORT_STATUS);
$criteria->addSelectColumn(CcFilesPeer::CURRENTLYACCESSING); $criteria->addSelectColumn(CcFilesPeer::CURRENTLYACCESSING);
@ -426,7 +422,6 @@ abstract class BaseCcFilesPeer
$criteria->addSelectColumn($alias . '.name'); $criteria->addSelectColumn($alias . '.name');
$criteria->addSelectColumn($alias . '.mime'); $criteria->addSelectColumn($alias . '.mime');
$criteria->addSelectColumn($alias . '.ftype'); $criteria->addSelectColumn($alias . '.ftype');
$criteria->addSelectColumn($alias . '.directory');
$criteria->addSelectColumn($alias . '.filepath'); $criteria->addSelectColumn($alias . '.filepath');
$criteria->addSelectColumn($alias . '.import_status'); $criteria->addSelectColumn($alias . '.import_status');
$criteria->addSelectColumn($alias . '.currentlyaccessing'); $criteria->addSelectColumn($alias . '.currentlyaccessing');
@ -918,57 +913,6 @@ abstract class BaseCcFilesPeer
} }
/**
* Returns the number of rows matching criteria, joining the related CcMusicDirs table
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows.
*/
public static function doCountJoinCcMusicDirs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CcFilesPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcFilesPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(CcFilesPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/** /**
* Selects a collection of CcFiles objects pre-filled with their CcSubjs objects. * Selects a collection of CcFiles objects pre-filled with their CcSubjs objects.
* @param Criteria $criteria * @param Criteria $criteria
@ -1103,73 +1047,6 @@ abstract class BaseCcFilesPeer
} }
/**
* Selects a collection of CcFiles objects pre-filled with their CcMusicDirs objects.
* @param Criteria $criteria
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return array Array of CcFiles objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinCcMusicDirs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(CcFilesPeer::DATABASE_NAME);
}
CcFilesPeer::addSelectColumns($criteria);
$startcol = CcFilesPeer::NUM_HYDRATE_COLUMNS;
CcMusicDirsPeer::addSelectColumns($criteria);
$criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcFilesPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcFilesPeer::getInstanceFromPool($key1))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcFilesPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
CcFilesPeer::addInstanceToPool($obj1, $key1);
} // if $obj1 already loaded
$key2 = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol);
if ($key2 !== null) {
$obj2 = CcMusicDirsPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcMusicDirsPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
CcMusicDirsPeer::addInstanceToPool($obj2, $key2);
} // if obj2 already loaded
// Add the $obj1 (CcFiles) to $obj2 (CcMusicDirs)
$obj2->addCcFiles($obj1);
} // if joined row was not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
/** /**
* Returns the number of rows matching criteria, joining all related tables * Returns the number of rows matching criteria, joining all related tables
* *
@ -1210,8 +1087,6 @@ abstract class BaseCcFilesPeer
$criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior);
$criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con); $stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) { if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
@ -1252,15 +1127,10 @@ abstract class BaseCcFilesPeer
CcSubjsPeer::addSelectColumns($criteria); CcSubjsPeer::addSelectColumns($criteria);
$startcol4 = $startcol3 + CcSubjsPeer::NUM_HYDRATE_COLUMNS; $startcol4 = $startcol3 + CcSubjsPeer::NUM_HYDRATE_COLUMNS;
CcMusicDirsPeer::addSelectColumns($criteria);
$startcol5 = $startcol4 + CcMusicDirsPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcFilesPeer::OWNER_ID, CcSubjsPeer::ID, $join_behavior); $criteria->addJoin(CcFilesPeer::OWNER_ID, CcSubjsPeer::ID, $join_behavior);
$criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior);
$criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con); $stmt = BasePeer::doSelect($criteria, $con);
$results = array(); $results = array();
@ -1314,24 +1184,6 @@ abstract class BaseCcFilesPeer
$obj3->addCcFilesRelatedByDbEditedby($obj1); $obj3->addCcFilesRelatedByDbEditedby($obj1);
} // if joined row not null } // if joined row not null
// Add objects for joined CcMusicDirs rows
$key4 = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol4);
if ($key4 !== null) {
$obj4 = CcMusicDirsPeer::getInstanceFromPool($key4);
if (!$obj4) {
$cls = CcMusicDirsPeer::getOMClass();
$obj4 = new $cls();
$obj4->hydrate($row, $startcol4);
CcMusicDirsPeer::addInstanceToPool($obj4, $key4);
} // if obj4 loaded
// Add the $obj1 (CcFiles) to the collection in $obj4 (CcMusicDirs)
$obj4->addCcFiles($obj1);
} // if joined row not null
$results[] = $obj1; $results[] = $obj1;
} }
$stmt->closeCursor(); $stmt->closeCursor();
@ -1376,8 +1228,6 @@ abstract class BaseCcFilesPeer
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
} }
$criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con); $stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) { if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
@ -1427,61 +1277,6 @@ abstract class BaseCcFilesPeer
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
} }
$criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Returns the number of rows matching criteria, joining the related CcMusicDirs table
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows.
*/
public static function doCountJoinAllExceptCcMusicDirs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CcFilesPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcFilesPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
// Set the correct dbName
$criteria->setDbName(CcFilesPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcFilesPeer::OWNER_ID, CcSubjsPeer::ID, $join_behavior);
$criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con); $stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) { if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
@ -1519,11 +1314,6 @@ abstract class BaseCcFilesPeer
CcFilesPeer::addSelectColumns($criteria); CcFilesPeer::addSelectColumns($criteria);
$startcol2 = CcFilesPeer::NUM_HYDRATE_COLUMNS; $startcol2 = CcFilesPeer::NUM_HYDRATE_COLUMNS;
CcMusicDirsPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + CcMusicDirsPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con); $stmt = BasePeer::doSelect($criteria, $con);
$results = array(); $results = array();
@ -1542,25 +1332,6 @@ abstract class BaseCcFilesPeer
CcFilesPeer::addInstanceToPool($obj1, $key1); CcFilesPeer::addInstanceToPool($obj1, $key1);
} // if obj1 already loaded } // if obj1 already loaded
// Add objects for joined CcMusicDirs rows
$key2 = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = CcMusicDirsPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcMusicDirsPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
CcMusicDirsPeer::addInstanceToPool($obj2, $key2);
} // if $obj2 already loaded
// Add the $obj1 (CcFiles) to the collection in $obj2 (CcMusicDirs)
$obj2->addCcFiles($obj1);
} // if joined row is not null
$results[] = $obj1; $results[] = $obj1;
} }
$stmt->closeCursor(); $stmt->closeCursor();
@ -1593,11 +1364,6 @@ abstract class BaseCcFilesPeer
CcFilesPeer::addSelectColumns($criteria); CcFilesPeer::addSelectColumns($criteria);
$startcol2 = CcFilesPeer::NUM_HYDRATE_COLUMNS; $startcol2 = CcFilesPeer::NUM_HYDRATE_COLUMNS;
CcMusicDirsPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + CcMusicDirsPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con); $stmt = BasePeer::doSelect($criteria, $con);
$results = array(); $results = array();
@ -1616,123 +1382,6 @@ abstract class BaseCcFilesPeer
CcFilesPeer::addInstanceToPool($obj1, $key1); CcFilesPeer::addInstanceToPool($obj1, $key1);
} // if obj1 already loaded } // if obj1 already loaded
// Add objects for joined CcMusicDirs rows
$key2 = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = CcMusicDirsPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcMusicDirsPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
CcMusicDirsPeer::addInstanceToPool($obj2, $key2);
} // if $obj2 already loaded
// Add the $obj1 (CcFiles) to the collection in $obj2 (CcMusicDirs)
$obj2->addCcFiles($obj1);
} // if joined row is not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
/**
* Selects a collection of CcFiles objects pre-filled with all related objects except CcMusicDirs.
*
* @param Criteria $criteria
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return array Array of CcFiles objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinAllExceptCcMusicDirs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
// Set the correct dbName if it has not been overridden
// $criteria->getDbName() will return the same object if not set to another value
// so == check is okay and faster
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(CcFilesPeer::DATABASE_NAME);
}
CcFilesPeer::addSelectColumns($criteria);
$startcol2 = CcFilesPeer::NUM_HYDRATE_COLUMNS;
CcSubjsPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_COLUMNS;
CcSubjsPeer::addSelectColumns($criteria);
$startcol4 = $startcol3 + CcSubjsPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcFilesPeer::OWNER_ID, CcSubjsPeer::ID, $join_behavior);
$criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcFilesPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcFilesPeer::getInstanceFromPool($key1))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcFilesPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
CcFilesPeer::addInstanceToPool($obj1, $key1);
} // if obj1 already loaded
// Add objects for joined CcSubjs rows
$key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = CcSubjsPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcSubjsPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
CcSubjsPeer::addInstanceToPool($obj2, $key2);
} // if $obj2 already loaded
// Add the $obj1 (CcFiles) to the collection in $obj2 (CcSubjs)
$obj2->addCcFilesRelatedByDbOwnerId($obj1);
} // if joined row is not null
// Add objects for joined CcSubjs rows
$key3 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol3);
if ($key3 !== null) {
$obj3 = CcSubjsPeer::getInstanceFromPool($key3);
if (!$obj3) {
$cls = CcSubjsPeer::getOMClass();
$obj3 = new $cls();
$obj3->hydrate($row, $startcol3);
CcSubjsPeer::addInstanceToPool($obj3, $key3);
} // if $obj3 already loaded
// Add the $obj1 (CcFiles) to the collection in $obj3 (CcSubjs)
$obj3->addCcFilesRelatedByDbEditedby($obj1);
} // if joined row is not null
$results[] = $obj1; $results[] = $obj1;
} }
$stmt->closeCursor(); $stmt->closeCursor();

View File

@ -10,7 +10,6 @@
* @method CcFilesQuery orderByDbName($order = Criteria::ASC) Order by the name column * @method CcFilesQuery orderByDbName($order = Criteria::ASC) Order by the name column
* @method CcFilesQuery orderByDbMime($order = Criteria::ASC) Order by the mime column * @method CcFilesQuery orderByDbMime($order = Criteria::ASC) Order by the mime column
* @method CcFilesQuery orderByDbFtype($order = Criteria::ASC) Order by the ftype column * @method CcFilesQuery orderByDbFtype($order = Criteria::ASC) Order by the ftype column
* @method CcFilesQuery orderByDbDirectory($order = Criteria::ASC) Order by the directory column
* @method CcFilesQuery orderByDbFilepath($order = Criteria::ASC) Order by the filepath column * @method CcFilesQuery orderByDbFilepath($order = Criteria::ASC) Order by the filepath column
* @method CcFilesQuery orderByDbImportStatus($order = Criteria::ASC) Order by the import_status column * @method CcFilesQuery orderByDbImportStatus($order = Criteria::ASC) Order by the import_status column
* @method CcFilesQuery orderByDbCurrentlyaccessing($order = Criteria::ASC) Order by the currentlyaccessing column * @method CcFilesQuery orderByDbCurrentlyaccessing($order = Criteria::ASC) Order by the currentlyaccessing column
@ -80,7 +79,6 @@
* @method CcFilesQuery groupByDbName() Group by the name column * @method CcFilesQuery groupByDbName() Group by the name column
* @method CcFilesQuery groupByDbMime() Group by the mime column * @method CcFilesQuery groupByDbMime() Group by the mime column
* @method CcFilesQuery groupByDbFtype() Group by the ftype column * @method CcFilesQuery groupByDbFtype() Group by the ftype column
* @method CcFilesQuery groupByDbDirectory() Group by the directory column
* @method CcFilesQuery groupByDbFilepath() Group by the filepath column * @method CcFilesQuery groupByDbFilepath() Group by the filepath column
* @method CcFilesQuery groupByDbImportStatus() Group by the import_status column * @method CcFilesQuery groupByDbImportStatus() Group by the import_status column
* @method CcFilesQuery groupByDbCurrentlyaccessing() Group by the currentlyaccessing column * @method CcFilesQuery groupByDbCurrentlyaccessing() Group by the currentlyaccessing column
@ -158,10 +156,6 @@
* @method CcFilesQuery rightJoinCcSubjsRelatedByDbEditedby($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation * @method CcFilesQuery rightJoinCcSubjsRelatedByDbEditedby($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation
* @method CcFilesQuery innerJoinCcSubjsRelatedByDbEditedby($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation * @method CcFilesQuery innerJoinCcSubjsRelatedByDbEditedby($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation
* *
* @method CcFilesQuery leftJoinCcMusicDirs($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcMusicDirs relation
* @method CcFilesQuery rightJoinCcMusicDirs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcMusicDirs relation
* @method CcFilesQuery innerJoinCcMusicDirs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcMusicDirs relation
*
* @method CcFilesQuery leftJoinCloudFile($relationAlias = null) Adds a LEFT JOIN clause to the query using the CloudFile relation * @method CcFilesQuery leftJoinCloudFile($relationAlias = null) Adds a LEFT JOIN clause to the query using the CloudFile relation
* @method CcFilesQuery rightJoinCloudFile($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CloudFile relation * @method CcFilesQuery rightJoinCloudFile($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CloudFile relation
* @method CcFilesQuery innerJoinCloudFile($relationAlias = null) Adds a INNER JOIN clause to the query using the CloudFile relation * @method CcFilesQuery innerJoinCloudFile($relationAlias = null) Adds a INNER JOIN clause to the query using the CloudFile relation
@ -200,7 +194,6 @@
* @method CcFiles findOneByDbName(string $name) Return the first CcFiles filtered by the name column * @method CcFiles findOneByDbName(string $name) Return the first CcFiles filtered by the name column
* @method CcFiles findOneByDbMime(string $mime) Return the first CcFiles filtered by the mime column * @method CcFiles findOneByDbMime(string $mime) Return the first CcFiles filtered by the mime column
* @method CcFiles findOneByDbFtype(string $ftype) Return the first CcFiles filtered by the ftype column * @method CcFiles findOneByDbFtype(string $ftype) Return the first CcFiles filtered by the ftype column
* @method CcFiles findOneByDbDirectory(int $directory) Return the first CcFiles filtered by the directory column
* @method CcFiles findOneByDbFilepath(string $filepath) Return the first CcFiles filtered by the filepath column * @method CcFiles findOneByDbFilepath(string $filepath) Return the first CcFiles filtered by the filepath column
* @method CcFiles findOneByDbImportStatus(int $import_status) Return the first CcFiles filtered by the import_status column * @method CcFiles findOneByDbImportStatus(int $import_status) Return the first CcFiles filtered by the import_status column
* @method CcFiles findOneByDbCurrentlyaccessing(int $currentlyaccessing) Return the first CcFiles filtered by the currentlyaccessing column * @method CcFiles findOneByDbCurrentlyaccessing(int $currentlyaccessing) Return the first CcFiles filtered by the currentlyaccessing column
@ -270,7 +263,6 @@
* @method array findByDbName(string $name) Return CcFiles objects filtered by the name column * @method array findByDbName(string $name) Return CcFiles objects filtered by the name column
* @method array findByDbMime(string $mime) Return CcFiles objects filtered by the mime column * @method array findByDbMime(string $mime) Return CcFiles objects filtered by the mime column
* @method array findByDbFtype(string $ftype) Return CcFiles objects filtered by the ftype column * @method array findByDbFtype(string $ftype) Return CcFiles objects filtered by the ftype column
* @method array findByDbDirectory(int $directory) Return CcFiles objects filtered by the directory column
* @method array findByDbFilepath(string $filepath) Return CcFiles objects filtered by the filepath column * @method array findByDbFilepath(string $filepath) Return CcFiles objects filtered by the filepath column
* @method array findByDbImportStatus(int $import_status) Return CcFiles objects filtered by the import_status column * @method array findByDbImportStatus(int $import_status) Return CcFiles objects filtered by the import_status column
* @method array findByDbCurrentlyaccessing(int $currentlyaccessing) Return CcFiles objects filtered by the currentlyaccessing column * @method array findByDbCurrentlyaccessing(int $currentlyaccessing) Return CcFiles objects filtered by the currentlyaccessing column
@ -442,7 +434,7 @@ abstract class BaseCcFilesQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT "id", "name", "mime", "ftype", "directory", "filepath", "import_status", "currentlyaccessing", "editedby", "mtime", "utime", "lptime", "md5", "track_title", "artist_name", "bit_rate", "sample_rate", "format", "length", "album_title", "genre", "comments", "year", "track_number", "channels", "url", "bpm", "rating", "encoded_by", "disc_number", "mood", "label", "composer", "encoder", "checksum", "lyrics", "orchestra", "conductor", "lyricist", "original_lyricist", "radio_station_name", "info_url", "artist_url", "audio_source_url", "radio_station_url", "buy_this_url", "isrc_number", "catalog_number", "original_artist", "copyright", "report_datetime", "report_location", "report_organization", "subject", "contributor", "language", "file_exists", "replay_gain", "owner_id", "cuein", "cueout", "silan_check", "hidden", "is_scheduled", "is_playlist", "filesize", "description", "artwork", "track_type" FROM "cc_files" WHERE "id" = :p0'; $sql = 'SELECT "id", "name", "mime", "ftype", "filepath", "import_status", "currentlyaccessing", "editedby", "mtime", "utime", "lptime", "md5", "track_title", "artist_name", "bit_rate", "sample_rate", "format", "length", "album_title", "genre", "comments", "year", "track_number", "channels", "url", "bpm", "rating", "encoded_by", "disc_number", "mood", "label", "composer", "encoder", "checksum", "lyrics", "orchestra", "conductor", "lyricist", "original_lyricist", "radio_station_name", "info_url", "artist_url", "audio_source_url", "radio_station_url", "buy_this_url", "isrc_number", "catalog_number", "original_artist", "copyright", "report_datetime", "report_location", "report_organization", "subject", "contributor", "language", "file_exists", "replay_gain", "owner_id", "cuein", "cueout", "silan_check", "hidden", "is_scheduled", "is_playlist", "filesize", "description", "artwork", "track_type" FROM "cc_files" WHERE "id" = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@ -660,50 +652,6 @@ abstract class BaseCcFilesQuery extends ModelCriteria
return $this->addUsingAlias(CcFilesPeer::FTYPE, $dbFtype, $comparison); return $this->addUsingAlias(CcFilesPeer::FTYPE, $dbFtype, $comparison);
} }
/**
* Filter the query on the directory column
*
* Example usage:
* <code>
* $query->filterByDbDirectory(1234); // WHERE directory = 1234
* $query->filterByDbDirectory(array(12, 34)); // WHERE directory IN (12, 34)
* $query->filterByDbDirectory(array('min' => 12)); // WHERE directory >= 12
* $query->filterByDbDirectory(array('max' => 12)); // WHERE directory <= 12
* </code>
*
* @see filterByCcMusicDirs()
*
* @param mixed $dbDirectory The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcFilesQuery The current query, for fluid interface
*/
public function filterByDbDirectory($dbDirectory = null, $comparison = null)
{
if (is_array($dbDirectory)) {
$useMinMax = false;
if (isset($dbDirectory['min'])) {
$this->addUsingAlias(CcFilesPeer::DIRECTORY, $dbDirectory['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbDirectory['max'])) {
$this->addUsingAlias(CcFilesPeer::DIRECTORY, $dbDirectory['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcFilesPeer::DIRECTORY, $dbDirectory, $comparison);
}
/** /**
* Filter the query on the filepath column * Filter the query on the filepath column
* *
@ -2891,82 +2839,6 @@ abstract class BaseCcFilesQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'CcSubjsRelatedByDbEditedby', 'CcSubjsQuery'); ->useQuery($relationAlias ? $relationAlias : 'CcSubjsRelatedByDbEditedby', 'CcSubjsQuery');
} }
/**
* Filter the query by a related CcMusicDirs object
*
* @param CcMusicDirs|PropelObjectCollection $ccMusicDirs The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcFilesQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcMusicDirs($ccMusicDirs, $comparison = null)
{
if ($ccMusicDirs instanceof CcMusicDirs) {
return $this
->addUsingAlias(CcFilesPeer::DIRECTORY, $ccMusicDirs->getId(), $comparison);
} elseif ($ccMusicDirs instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CcFilesPeer::DIRECTORY, $ccMusicDirs->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCcMusicDirs() only accepts arguments of type CcMusicDirs or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the CcMusicDirs relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcFilesQuery The current query, for fluid interface
*/
public function joinCcMusicDirs($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcMusicDirs');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CcMusicDirs');
}
return $this;
}
/**
* Use the CcMusicDirs relation CcMusicDirs object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcMusicDirsQuery A secondary query class using the current class as primary query
*/
public function useCcMusicDirsQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcMusicDirs($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcMusicDirs', 'CcMusicDirsQuery');
}
/** /**
* Filter the query by a related CloudFile object * Filter the query by a related CloudFile object
* *

File diff suppressed because it is too large Load Diff

View File

@ -1,775 +0,0 @@
<?php
/**
* Base static class for performing query and update operations on the 'cc_music_dirs' table.
*
*
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcMusicDirsPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
/** the table name for this class */
const TABLE_NAME = 'cc_music_dirs';
/** the related Propel class for this table */
const OM_CLASS = 'CcMusicDirs';
/** the related TableMap class for this table */
const TM_CLASS = 'CcMusicDirsTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 5;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 5;
/** the column name for the id field */
const ID = 'cc_music_dirs.id';
/** the column name for the directory field */
const DIRECTORY = 'cc_music_dirs.directory';
/** the column name for the type field */
const TYPE = 'cc_music_dirs.type';
/** the column name for the exists field */
const EXISTS = 'cc_music_dirs.exists';
/** the column name for the watched field */
const WATCHED = 'cc_music_dirs.watched';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identity map to hold any loaded instances of CcMusicDirs objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcMusicDirs[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. CcMusicDirsPeer::$fieldNames[CcMusicDirsPeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'Directory', 'Type', 'Exists', 'Watched', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'directory', 'type', 'exists', 'watched', ),
BasePeer::TYPE_COLNAME => array (CcMusicDirsPeer::ID, CcMusicDirsPeer::DIRECTORY, CcMusicDirsPeer::TYPE, CcMusicDirsPeer::EXISTS, CcMusicDirsPeer::WATCHED, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'DIRECTORY', 'TYPE', 'EXISTS', 'WATCHED', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'directory', 'type', 'exists', 'watched', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. CcMusicDirsPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Directory' => 1, 'Type' => 2, 'Exists' => 3, 'Watched' => 4, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'directory' => 1, 'type' => 2, 'exists' => 3, 'watched' => 4, ),
BasePeer::TYPE_COLNAME => array (CcMusicDirsPeer::ID => 0, CcMusicDirsPeer::DIRECTORY => 1, CcMusicDirsPeer::TYPE => 2, CcMusicDirsPeer::EXISTS => 3, CcMusicDirsPeer::WATCHED => 4, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'DIRECTORY' => 1, 'TYPE' => 2, 'EXISTS' => 3, 'WATCHED' => 4, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'directory' => 1, 'type' => 2, 'exists' => 3, 'watched' => 4, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
* @throws PropelException - if the specified name could not be found in the fieldname mappings.
*/
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = CcMusicDirsPeer::getFieldNames($toType);
$key = isset(CcMusicDirsPeer::$fieldKeys[$fromType][$name]) ? CcMusicDirsPeer::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CcMusicDirsPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @return array A list of field names
* @throws PropelException - if the type is not valid.
*/
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, CcMusicDirsPeer::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
}
return CcMusicDirsPeer::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. CcMusicDirsPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(CcMusicDirsPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(CcMusicDirsPeer::ID);
$criteria->addSelectColumn(CcMusicDirsPeer::DIRECTORY);
$criteria->addSelectColumn(CcMusicDirsPeer::TYPE);
$criteria->addSelectColumn(CcMusicDirsPeer::EXISTS);
$criteria->addSelectColumn(CcMusicDirsPeer::WATCHED);
} else {
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.directory');
$criteria->addSelectColumn($alias . '.type');
$criteria->addSelectColumn($alias . '.exists');
$criteria->addSelectColumn($alias . '.watched');
}
}
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
{
// we may modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CcMusicDirsPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcMusicDirsPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(CcMusicDirsPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// BasePeer returns a PDOStatement
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
* @return CcMusicDirs
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = CcMusicDirsPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
return CcMusicDirsPeer::populateObjects(CcMusicDirsPeer::doSelectStmt($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
*
* Use this method directly if you want to work with an executed statement directly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con The connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return PDOStatement The executed PDOStatement object.
* @see BasePeer::doSelect()
*/
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
CcMusicDirsPeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(CcMusicDirsPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
}
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param CcMusicDirs $obj A CcMusicDirs object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
} // if key === null
CcMusicDirsPeer::$instances[$key] = $obj;
}
}
/**
* Removes an object from the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doDelete
* methods in your stub classes -- you may need to explicitly remove objects
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A CcMusicDirs object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof CcMusicDirs) {
$key = (string) $value->getId();
} elseif (is_scalar($value)) {
// assume we've been passed a primary key
$key = (string) $value;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcMusicDirs object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
throw $e;
}
unset(CcMusicDirsPeer::$instances[$key]);
}
} // removeInstanceFromPool()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return CcMusicDirs Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(CcMusicDirsPeer::$instances[$key])) {
return CcMusicDirsPeer::$instances[$key];
}
}
return null; // just to be explicit
}
/**
* Clear the instance pool.
*
* @return void
*/
public static function clearInstancePool($and_clear_all_references = false)
{
if ($and_clear_all_references) {
foreach (CcMusicDirsPeer::$instances as $instance) {
$instance->clearAllReferences(true);
}
}
CcMusicDirsPeer::$instances = array();
}
/**
* Method to invalidate the instance pool of all tables related to cc_music_dirs
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return string A string version of PK or null if the components of primary key in result array are all null.
*/
public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
{
// If the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(PDOStatement $stmt)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = CcMusicDirsPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = CcMusicDirsPeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, 0, true); // rehydrate
$results[] = $obj;
} else {
$obj = new $cls();
$obj->hydrate($row);
$results[] = $obj;
CcMusicDirsPeer::addInstanceToPool($obj, $key);
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (CcMusicDirs object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = CcMusicDirsPeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + CcMusicDirsPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CcMusicDirsPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcMusicDirsPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(CcMusicDirsPeer::DATABASE_NAME)->getTable(CcMusicDirsPeer::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this peer class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCcMusicDirsPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcMusicDirsPeer::TABLE_NAME)) {
$dbMap->addTableObject(new \CcMusicDirsTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
*
* @return string ClassName
*/
public static function getOMClass($row = 0, $colnum = 0)
{
return CcMusicDirsPeer::OM_CLASS;
}
/**
* Performs an INSERT on the database, given a CcMusicDirs or Criteria object.
*
* @param mixed $values Criteria or CcMusicDirs object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from CcMusicDirs object
}
if ($criteria->containsKey(CcMusicDirsPeer::ID) && $criteria->keyContainsValue(CcMusicDirsPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcMusicDirsPeer::ID.')');
}
// Set the correct dbName
$criteria->setDbName(CcMusicDirsPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
/**
* Performs an UPDATE on the database, given a CcMusicDirs or Criteria object.
*
* @param mixed $values Criteria or CcMusicDirs object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(CcMusicDirsPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(CcMusicDirsPeer::ID);
$value = $criteria->remove(CcMusicDirsPeer::ID);
if ($value) {
$selectCriteria->add(CcMusicDirsPeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(CcMusicDirsPeer::TABLE_NAME);
}
} else { // $values is CcMusicDirs object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(CcMusicDirsPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Deletes all rows from the cc_music_dirs table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDeleteAll(CcMusicDirsPeer::TABLE_NAME, $con, CcMusicDirsPeer::DATABASE_NAME);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
CcMusicDirsPeer::clearInstancePool();
CcMusicDirsPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Performs a DELETE on the database, given a CcMusicDirs or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcMusicDirs object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
// invalidate the cache for all objects of this type, since we have no
// way of knowing (without running a query) what objects should be invalidated
// from the cache based on this Criteria.
CcMusicDirsPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof CcMusicDirs) { // it's a model object
// invalidate the cache for this single object
CcMusicDirsPeer::removeInstanceFromPool($values);
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(CcMusicDirsPeer::DATABASE_NAME);
$criteria->add(CcMusicDirsPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
CcMusicDirsPeer::removeInstanceFromPool($singleval);
}
}
// Set the correct dbName
$criteria->setDbName(CcMusicDirsPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDelete($criteria, $con);
CcMusicDirsPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given CcMusicDirs object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param CcMusicDirs $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate($obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(CcMusicDirsPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(CcMusicDirsPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(CcMusicDirsPeer::DATABASE_NAME, CcMusicDirsPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return CcMusicDirs
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = CcMusicDirsPeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(CcMusicDirsPeer::DATABASE_NAME);
$criteria->add(CcMusicDirsPeer::ID, $pk);
$v = CcMusicDirsPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return CcMusicDirs[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(CcMusicDirsPeer::DATABASE_NAME);
$criteria->add(CcMusicDirsPeer::ID, $pks, Criteria::IN);
$objs = CcMusicDirsPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseCcMusicDirsPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseCcMusicDirsPeer::buildTableMap();

View File

@ -1,482 +0,0 @@
<?php
/**
* Base class that represents a query for the 'cc_music_dirs' table.
*
*
*
* @method CcMusicDirsQuery orderById($order = Criteria::ASC) Order by the id column
* @method CcMusicDirsQuery orderByDirectory($order = Criteria::ASC) Order by the directory column
* @method CcMusicDirsQuery orderByType($order = Criteria::ASC) Order by the type column
* @method CcMusicDirsQuery orderByExists($order = Criteria::ASC) Order by the exists column
* @method CcMusicDirsQuery orderByWatched($order = Criteria::ASC) Order by the watched column
*
* @method CcMusicDirsQuery groupById() Group by the id column
* @method CcMusicDirsQuery groupByDirectory() Group by the directory column
* @method CcMusicDirsQuery groupByType() Group by the type column
* @method CcMusicDirsQuery groupByExists() Group by the exists column
* @method CcMusicDirsQuery groupByWatched() Group by the watched column
*
* @method CcMusicDirsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcMusicDirsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcMusicDirsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcMusicDirsQuery leftJoinCcFiles($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcFiles relation
* @method CcMusicDirsQuery rightJoinCcFiles($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcFiles relation
* @method CcMusicDirsQuery innerJoinCcFiles($relationAlias = null) Adds a INNER JOIN clause to the query using the CcFiles relation
*
* @method CcMusicDirs findOne(PropelPDO $con = null) Return the first CcMusicDirs matching the query
* @method CcMusicDirs findOneOrCreate(PropelPDO $con = null) Return the first CcMusicDirs matching the query, or a new CcMusicDirs object populated from the query conditions when no match is found
*
* @method CcMusicDirs findOneByDirectory(string $directory) Return the first CcMusicDirs filtered by the directory column
* @method CcMusicDirs findOneByType(string $type) Return the first CcMusicDirs filtered by the type column
* @method CcMusicDirs findOneByExists(boolean $exists) Return the first CcMusicDirs filtered by the exists column
* @method CcMusicDirs findOneByWatched(boolean $watched) Return the first CcMusicDirs filtered by the watched column
*
* @method array findById(int $id) Return CcMusicDirs objects filtered by the id column
* @method array findByDirectory(string $directory) Return CcMusicDirs objects filtered by the directory column
* @method array findByType(string $type) Return CcMusicDirs objects filtered by the type column
* @method array findByExists(boolean $exists) Return CcMusicDirs objects filtered by the exists column
* @method array findByWatched(boolean $watched) Return CcMusicDirs objects filtered by the watched column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcMusicDirsQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcMusicDirsQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
{
if (null === $dbName) {
$dbName = 'airtime';
}
if (null === $modelName) {
$modelName = 'CcMusicDirs';
}
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CcMusicDirsQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param CcMusicDirsQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CcMusicDirsQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CcMusicDirsQuery) {
return $criteria;
}
$query = new CcMusicDirsQuery(null, null, $modelAlias);
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con an optional connection object
*
* @return CcMusicDirs|CcMusicDirs[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CcMusicDirsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Alias of findPk to use instance pooling
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcMusicDirs A model object, or null if the key is not found
* @throws PropelException
*/
public function findOneById($key, $con = null)
{
return $this->findPk($key, $con);
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcMusicDirs A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "id", "directory", "type", "exists", "watched" FROM "cc_music_dirs" WHERE "id" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CcMusicDirs();
$obj->hydrate($row);
CcMusicDirsPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcMusicDirs|CcMusicDirs[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|CcMusicDirs[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return CcMusicDirsQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcMusicDirsPeer::ID, $key, Criteria::EQUAL);
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return CcMusicDirsQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcMusicDirsPeer::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id >= 12
* $query->filterById(array('max' => 12)); // WHERE id <= 12
* </code>
*
* @param mixed $id The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcMusicDirsQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(CcMusicDirsPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(CcMusicDirsPeer::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcMusicDirsPeer::ID, $id, $comparison);
}
/**
* Filter the query on the directory column
*
* Example usage:
* <code>
* $query->filterByDirectory('fooValue'); // WHERE directory = 'fooValue'
* $query->filterByDirectory('%fooValue%'); // WHERE directory LIKE '%fooValue%'
* </code>
*
* @param string $directory The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcMusicDirsQuery The current query, for fluid interface
*/
public function filterByDirectory($directory = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($directory)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $directory)) {
$directory = str_replace('*', '%', $directory);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcMusicDirsPeer::DIRECTORY, $directory, $comparison);
}
/**
* Filter the query on the type column
*
* Example usage:
* <code>
* $query->filterByType('fooValue'); // WHERE type = 'fooValue'
* $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%'
* </code>
*
* @param string $type The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcMusicDirsQuery The current query, for fluid interface
*/
public function filterByType($type = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($type)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $type)) {
$type = str_replace('*', '%', $type);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcMusicDirsPeer::TYPE, $type, $comparison);
}
/**
* Filter the query on the exists column
*
* Example usage:
* <code>
* $query->filterByExists(true); // WHERE exists = true
* $query->filterByExists('yes'); // WHERE exists = true
* </code>
*
* @param boolean|string $exists The value to use as filter.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcMusicDirsQuery The current query, for fluid interface
*/
public function filterByExists($exists = null, $comparison = null)
{
if (is_string($exists)) {
$exists = in_array(strtolower($exists), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(CcMusicDirsPeer::EXISTS, $exists, $comparison);
}
/**
* Filter the query on the watched column
*
* Example usage:
* <code>
* $query->filterByWatched(true); // WHERE watched = true
* $query->filterByWatched('yes'); // WHERE watched = true
* </code>
*
* @param boolean|string $watched The value to use as filter.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcMusicDirsQuery The current query, for fluid interface
*/
public function filterByWatched($watched = null, $comparison = null)
{
if (is_string($watched)) {
$watched = in_array(strtolower($watched), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(CcMusicDirsPeer::WATCHED, $watched, $comparison);
}
/**
* Filter the query by a related CcFiles object
*
* @param CcFiles|PropelObjectCollection $ccFiles the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcMusicDirsQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcFiles($ccFiles, $comparison = null)
{
if ($ccFiles instanceof CcFiles) {
return $this
->addUsingAlias(CcMusicDirsPeer::ID, $ccFiles->getDbDirectory(), $comparison);
} elseif ($ccFiles instanceof PropelObjectCollection) {
return $this
->useCcFilesQuery()
->filterByPrimaryKeys($ccFiles->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCcFiles() only accepts arguments of type CcFiles or PropelCollection');
}
}
/**
* Adds a JOIN clause to the query using the CcFiles relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcMusicDirsQuery The current query, for fluid interface
*/
public function joinCcFiles($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcFiles');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CcFiles');
}
return $this;
}
/**
* Use the CcFiles relation CcFiles object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcFilesQuery A secondary query class using the current class as primary query
*/
public function useCcFilesQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcFiles($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
}
/**
* Exclude object from result
*
* @param CcMusicDirs $ccMusicDirs Object to remove from the list of results
*
* @return CcMusicDirsQuery The current query, for fluid interface
*/
public function prune($ccMusicDirs = null)
{
if ($ccMusicDirs) {
$this->addUsingAlias(CcMusicDirsPeer::ID, $ccMusicDirs->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
}

View File

@ -2248,31 +2248,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
return $this; return $this;
} }
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this CcSubjs is new, it will return
* an empty collection; or if this CcSubjs has previously
* been saved, it will retrieve related CcFilessRelatedByDbOwnerId from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in CcSubjs.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return PropelObjectCollection|CcFiles[] List of CcFiles objects
*/
public function getCcFilessRelatedByDbOwnerIdJoinCcMusicDirs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$query = CcFilesQuery::create(null, $criteria);
$query->joinWith('CcMusicDirs', $join_behavior);
return $this->getCcFilessRelatedByDbOwnerId($query, $con);
}
/** /**
* Clears out the collCcFilessRelatedByDbEditedby collection * Clears out the collCcFilessRelatedByDbEditedby collection
* *
@ -2498,31 +2473,6 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
return $this; return $this;
} }
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this CcSubjs is new, it will return
* an empty collection; or if this CcSubjs has previously
* been saved, it will retrieve related CcFilessRelatedByDbEditedby from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in CcSubjs.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return PropelObjectCollection|CcFiles[] List of CcFiles objects
*/
public function getCcFilessRelatedByDbEditedbyJoinCcMusicDirs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$query = CcFilesQuery::create(null, $criteria);
$query->joinWith('CcMusicDirs', $join_behavior);
return $this->getCcFilessRelatedByDbEditedby($query, $con);
}
/** /**
* Clears out the collCcPermss collection * Clears out the collCcPermss collection
* *

View File

@ -165,8 +165,7 @@ class Rest_ShowImageController extends Zend_Rest_Controller
throw new Exception('Bad file extension.'); throw new Exception('Bad file extension.');
} }
$storDir = Application_Model_MusicDir::getStorDir(); $importedStorageDirectory = Config::getStoragePath() . 'imported/' . $ownerId . '/show-images/' . $showId;
$importedStorageDirectory = $storDir->getDirectory() . 'imported/' . $ownerId . '/show-images/' . $showId;
try { try {
$importedStorageDirectory = $this->copyFileToStor($tempFilePath, $importedStorageDirectory, $fileExtension); $importedStorageDirectory = $this->copyFileToStor($tempFilePath, $importedStorageDirectory, $fileExtension);
@ -276,8 +275,7 @@ class Rest_ShowImageController extends Zend_Rest_Controller
{ {
$ownerId = RestAuth::getOwnerId(); $ownerId = RestAuth::getOwnerId();
$storDir = Application_Model_MusicDir::getStorDir(); $importedStorageDirectory = Config::getStoragePath() . 'imported/' . $ownerId . '/show-images/' . $showId;
$importedStorageDirectory = $storDir->getDirectory() . 'imported/' . $ownerId . '/show-images/' . $showId;
Logging::info('Deleting images from ' . $importedStorageDirectory); Logging::info('Deleting images from ' . $importedStorageDirectory);

View File

@ -28,11 +28,7 @@ class Application_Service_MediaService
$CC_CONFIG = Config::getConfig(); $CC_CONFIG = Config::getConfig();
$apiKey = $CC_CONFIG['apiKey'][0]; $apiKey = $CC_CONFIG['apiKey'][0];
$importedStorageDirectory = ''; $importedStorageDirectory = Config::getStoragePath() . '/imported/' . $ownerId;
if ($CC_CONFIG['current_backend'] == 'file') {
$storDir = Application_Model_MusicDir::getStorDir();
$importedStorageDirectory = $storDir->getDirectory() . '/imported/' . $ownerId;
}
// Copy the temporary file over to the "organize" folder so that it's off our webserver // Copy the temporary file over to the "organize" folder so that it's off our webserver
// and accessible by libretime-analyzer which could be running on a different machine. // and accessible by libretime-analyzer which could be running on a different machine.
@ -40,15 +36,14 @@ class Application_Service_MediaService
// Dispatch a message to libretime-analyzer through RabbitMQ, // Dispatch a message to libretime-analyzer through RabbitMQ,
// notifying it that there's a new upload to process! // notifying it that there's a new upload to process!
$storageBackend = new ProxyStorageBackend($CC_CONFIG['current_backend']);
Application_Model_RabbitMq::SendMessageToAnalyzer( Application_Model_RabbitMq::SendMessageToAnalyzer(
$newTempFilePath, $newTempFilePath,
$importedStorageDirectory, $importedStorageDirectory,
basename($originalFilename), basename($originalFilename),
$callbackUrl, $callbackUrl,
$apiKey, $apiKey,
$CC_CONFIG['current_backend'], '',
$storageBackend->getFilePrefix() '',
); );
return $newTempFilePath; return $newTempFilePath;

View File

@ -1,22 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--Autogenerated by PropelSchemaReverseTask class.--> <!--Autogenerated by PropelSchemaReverseTask class.-->
<database name="airtime" defaultIdMethod="native"> <database name="airtime" defaultIdMethod="native">
<table name="cc_music_dirs" phpName="CcMusicDirs">
<column name="id" phpName="Id" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
<column name="directory" phpName="Directory" type="LONGVARCHAR" required="false" />
<column name="type" phpName="Type" type="VARCHAR" size="255" required="false" />
<column name="exists" phpName="Exists" type="BOOLEAN" required="false" defaultValue="true" />
<column name="watched" phpName="Watched" type="BOOLEAN" required="false" defaultValue="true" />
<unique name="cc_music_dir_unique">
<unique-column name="directory" />
</unique>
</table>
<table name="cc_files" phpName="CcFiles"> <table name="cc_files" phpName="CcFiles">
<column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" /> <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
<column name="name" phpName="DbName" type="VARCHAR" size="255" required="true" defaultValue="" /> <column name="name" phpName="DbName" type="VARCHAR" size="255" required="true" defaultValue="" />
<column name="mime" phpName="DbMime" type="VARCHAR" size="255" required="true" defaultValue="" /> <column name="mime" phpName="DbMime" type="VARCHAR" size="255" required="true" defaultValue="" />
<column name="ftype" phpName="DbFtype" type="VARCHAR" size="128" required="true" defaultValue="" /> <column name="ftype" phpName="DbFtype" type="VARCHAR" size="128" required="true" defaultValue="" />
<column name="directory" phpName="DbDirectory" type="INTEGER" required="false" />
<column name="filepath" phpName="DbFilepath" type="LONGVARCHAR" required="false" defaultValue="" /> <column name="filepath" phpName="DbFilepath" type="LONGVARCHAR" required="false" defaultValue="" />
<column name="import_status" phpName="DbImportStatus" type="INTEGER" required="true" defaultValue="1" /> <column name="import_status" phpName="DbImportStatus" type="INTEGER" required="true" defaultValue="1" />
<column name="currentlyaccessing" phpName="DbCurrentlyaccessing" type="INTEGER" required="true" defaultValue="0" /> <column name="currentlyaccessing" phpName="DbCurrentlyaccessing" type="INTEGER" required="true" defaultValue="0" />
@ -87,9 +76,6 @@
<foreign-key foreignTable="cc_subjs" name="cc_files_editedby_fkey"> <foreign-key foreignTable="cc_subjs" name="cc_files_editedby_fkey">
<reference local="editedby" foreign="id" /> <reference local="editedby" foreign="id" />
</foreign-key> </foreign-key>
<foreign-key foreignTable="cc_music_dirs" name="cc_music_dirs_folder_fkey">
<reference local="directory" foreign="id" />
</foreign-key>
<index name="cc_files_md5_idx"> <index name="cc_files_md5_idx">
<index-column name="md5" /> <index-column name="md5" />
</index> </index>

View File

@ -49,84 +49,8 @@ class TestHelper
$dbuser = $CC_CONFIG['dsn']['username']; $dbuser = $CC_CONFIG['dsn']['username'];
$dbpasswd = $CC_CONFIG['dsn']['password']; $dbpasswd = $CC_CONFIG['dsn']['password'];
$databaseAlreadyExists = AirtimeInstall::createDatabase(); AirtimeInstall::createDatabase();
if ($databaseAlreadyExists) { AirtimeInstall::CreateDatabaseTables($dbuser, $dbpasswd, $dbname, $dbhost, $dbport);
// Truncate all the tables
$con = Propel::getConnection();
$sql = "select * from pg_tables where tableowner = '{$dbuser}'";
try {
$rows = $con->query($sql)->fetchAll();
} catch (Exception $e) {
$rows = [];
}
// Add any tables that shouldn't be cleared here.
// cc_subjs - Most of Airtime requires an admin account to work, which has id=1,
// so don't clear it.
// cc_music_dirs - Has foreign key constraints against cc_files, so we clear cc_files
// first and clear cc_music_dirs after
$tablesToNotClear = ['cc_subjs', 'cc_music_dirs'];
$con->beginTransaction();
foreach ($rows as $row) {
$tablename = $row['tablename'];
if (in_array($tablename, $tablesToNotClear)) {
continue;
}
// echo " * Clearing database table $tablename...";
// TRUNCATE is actually slower than DELETE in many cases:
// http://stackoverflow.com/questions/11419536/postgresql-truncation-speed
// $sql = "TRUNCATE TABLE $tablename CASCADE";
$sql = "DELETE FROM {$tablename}";
AirtimeInstall::InstallQuery($sql, false);
}
// Now that cc_files is empty, clearing cc_music_dirs should work
$sql = 'DELETE FROM cc_music_dirs';
AirtimeInstall::InstallQuery($sql, false);
// Because files are stored relative to their watch directory,
// we need to set the "stor" path before we can successfully
// create a fake file in the database.
// Copy paste from airtime-db-install.php:
$stor_dir = '/tmp';
$con = Propel::getConnection();
$sql = "INSERT INTO cc_music_dirs (directory, type) VALUES ('{$stor_dir}', 'stor')";
try {
$con->exec($sql);
} catch (Exception $e) {
echo " * Failed inserting {$stor_dir} in cc_music_dirs" . PHP_EOL;
echo " * Message {$e->getMessage()}" . PHP_EOL;
return false;
}
$con->commit();
// Because we're DELETEing all the rows instead of using TRUNCATE (for speed),
// we have to reset the sequences so the auto-increment columns (like primary keys)
// all start at 1 again. This is hacky but it still lets all of this execute fast.
$sql = "SELECT c.relname FROM pg_class c WHERE c.relkind = 'S'";
try {
$rows = $con->query($sql)->fetchAll();
} catch (Exception $e) {
$rows = [];
}
$con->beginTransaction();
foreach ($rows as $row) {
$seqrelname = $row['relname'];
$sql = "ALTER SEQUENCE {$seqrelname} RESTART WITH 1";
AirtimeInstall::InstallQuery($sql, false);
}
$con->commit();
} else {
// Create all the database tables
AirtimeInstall::CreateDatabaseTables($dbuser, $dbpasswd, $dbname, $dbhost, $dbport);
}
} }
public static function setupZendBootstrap() public static function setupZendBootstrap()

View File

@ -1,15 +1,7 @@
cc_music_dirs:
- id: "1"
directory: "/tmp/libretime-test"
type: "stor"
exists: "t"
watched: "t"
cc_files: cc_files:
- id: "1" - id: "1"
mime: "audio/mp3" mime: "audio/mp3"
ftype: "audioclip" ftype: "audioclip"
directory: "1"
filepath: "imported/1/oneminute.mp3" filepath: "imported/1/oneminute.mp3"
mtime: "2017-08-06 04:27:36" mtime: "2017-08-06 04:27:36"
utime: "2017-08-06 04:26:47" utime: "2017-08-06 04:26:47"
@ -31,7 +23,6 @@ cc_files:
- id: "2" - id: "2"
mime: "audio/mp3" mime: "audio/mp3"
ftype: "audioclip" ftype: "audioclip"
directory: "1"
filepath: "imported/1/fiveminute.mp3" filepath: "imported/1/fiveminute.mp3"
mtime: "2017-08-06 04:28:36" mtime: "2017-08-06 04:28:36"
utime: "2017-08-06 04:27:47" utime: "2017-08-06 04:27:47"
@ -53,7 +44,6 @@ cc_files:
- id: "3" - id: "3"
mime: "audio/mp3" mime: "audio/mp3"
ftype: "audioclip" ftype: "audioclip"
directory: "1"
filepath: "imported/1/track1.mp3" filepath: "imported/1/track1.mp3"
mtime: "2017-08-06 04:28:36" mtime: "2017-08-06 04:28:36"
utime: "2017-08-06 04:27:47" utime: "2017-08-06 04:27:47"
@ -76,7 +66,6 @@ cc_files:
- id: "4" - id: "4"
mime: "audio/mp3" mime: "audio/mp3"
ftype: "audioclip" ftype: "audioclip"
directory: "1"
filepath: "imported/1/track2.mp3" filepath: "imported/1/track2.mp3"
mtime: "2017-08-06 04:28:36" mtime: "2017-08-06 04:28:36"
utime: "2017-08-06 04:27:47" utime: "2017-08-06 04:27:47"
@ -99,7 +88,6 @@ cc_files:
- id: "5" - id: "5"
mime: "audio/mp3" mime: "audio/mp3"
ftype: "audioclip" ftype: "audioclip"
directory: "1"
filepath: "imported/1/track3.mp3" filepath: "imported/1/track3.mp3"
mtime: "2017-08-06 04:28:36" mtime: "2017-08-06 04:28:36"
utime: "2017-08-06 04:27:47" utime: "2017-08-06 04:27:47"
@ -122,7 +110,6 @@ cc_files:
- id: "6" - id: "6"
mime: "audio/mp3" mime: "audio/mp3"
ftype: "audioclip" ftype: "audioclip"
directory: "1"
filepath: "imported/1/track1-2.mp3" filepath: "imported/1/track1-2.mp3"
mtime: "2017-08-06 05:28:36" mtime: "2017-08-06 05:28:36"
utime: "2017-08-16 04:27:47" utime: "2017-08-16 04:27:47"
@ -145,7 +132,6 @@ cc_files:
- id: "7" - id: "7"
mime: "audio/mp3" mime: "audio/mp3"
ftype: "audioclip" ftype: "audioclip"
directory: "1"
filepath: "imported/1/track2-2.mp3" filepath: "imported/1/track2-2.mp3"
mtime: "2017-08-06 04:28:36" mtime: "2017-08-06 04:28:36"
utime: "2017-08-06 04:27:47" utime: "2017-08-06 04:27:47"

View File

@ -3,9 +3,5 @@ general:
public_url: http://localhost public_url: http://localhost
api_key: H2NRICX6CM8F50CU123C api_key: H2NRICX6CM8F50CU123C
database: storage:
host: localhost path: /tmp
port: 5432
name: libretime_test
user: libretime
password: libretime

View File

@ -109,6 +109,11 @@ class GeneralConfig(BaseModel):
api_key: str api_key: str
# pylint: disable=too-few-public-methods
class StorageConfig(BaseModel):
path: str = "/srv/libretime"
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods
class DatabaseConfig(BaseModel): class DatabaseConfig(BaseModel):
host: str = "localhost" host: str = "localhost"