├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── README.md ├── app ├── Console │ ├── Commands │ │ └── Inspire.php │ └── Kernel.php ├── Events │ └── Event.php ├── Exceptions │ └── Handler.php ├── Helpers │ ├── AudfprintFingerprinter.php │ ├── BasicLoader.php │ ├── Contracts │ │ ├── FingerprinterContract.php │ │ ├── HttpContract.php │ │ └── LoaderContract.php │ └── CurlHttp.php ├── Http │ ├── Controllers │ │ ├── Controller.php │ │ ├── MediaController.php │ │ ├── MediaTaskController.php │ │ ├── ProjectController.php │ │ └── ProjectTaskController.php │ ├── Kernel.php │ ├── Middleware │ │ └── EncryptCookies.php │ ├── Requests │ │ └── Request.php │ └── routes.php ├── Jobs │ ├── Job.php │ ├── PerformMediaTask.php │ └── PerformProjectTask.php ├── Listeners │ └── .gitkeep ├── Match.php ├── Media.php ├── MediaTask.php ├── Policies │ └── .gitkeep ├── Project.php ├── ProjectTask.php └── Providers │ ├── AppServiceProvider.php │ ├── EventServiceProvider.php │ ├── FingerprinterServiceProvider.php │ ├── LoaderServiceProvider.php │ └── RouteServiceProvider.php ├── artisan ├── bootstrap ├── app.php ├── autoload.php └── cache │ └── .gitignore ├── certs └── .gitkeep ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── compile.php ├── database.php ├── filesystems.php ├── mail.php ├── queue.php ├── services.php ├── session.php └── view.php ├── database ├── .gitignore ├── factories │ └── ModelFactory.php ├── migrations │ ├── .gitkeep │ ├── 2015_09_13_185000_create_projects_table.php │ ├── 2015_09_13_185400_create_media_table.php │ ├── 2015_09_13_185724_create_tasks_table.php │ ├── 2015_09_20_215721_create_jobs_table.php │ ├── 2015_10_12_121235_create_matches_table.php │ ├── 2015_12_02_003713_create_failed_jobs_table.php │ ├── 2016_02_29_00216_rename_tasks_table.php │ ├── 2016_02_29_00248_create_project_tasks_table.php │ └── 2016_11_22_120103_update_media_tasks_table.php └── seeds │ ├── .gitkeep │ └── DatabaseSeeder.php ├── docs ├── api.md └── workflow.pdf ├── fingerprinting-worker.conf.example ├── gulpfile.js ├── package.json ├── phpspec.yml ├── phpunit.xml ├── public ├── .htaccess ├── favicon.ico ├── index.php └── robots.txt ├── reset.sh ├── resources ├── assets │ └── sass │ │ └── app.scss ├── lang │ └── en │ │ ├── auth.php │ │ ├── pagination.php │ │ ├── passwords.php │ │ └── validation.php └── views │ ├── errors │ └── 503.blade.php │ ├── vendor │ └── .gitkeep │ └── welcome.blade.php ├── server.php ├── storage ├── app │ └── .gitignore ├── audfprint │ ├── .gitkeep │ ├── afpt_cache │ │ └── .gitkeep │ ├── flocks │ │ └── .gitkeep │ ├── media_cache │ │ └── .gitkeep │ └── pklz_cache │ │ └── .gitkeep ├── framework │ ├── .gitignore │ ├── cache │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore └── tests ├── ExampleTest.php └── TestCase.php /.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs 2 | # editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | # Spaces in coffee 13 | [**.coffee] 14 | indent_style = space 15 | indent_size = 2 16 | 17 | [**.js] 18 | indent_style = space 19 | indent_size = 2 20 | 21 | # Tabs in less 22 | [**.less] 23 | indent_style = tab 24 | indent_size = 2 25 | 26 | [**.css] 27 | indent_style = tab 28 | indent_size = 2 29 | 30 | [**.php] 31 | indent_style = space 32 | indent_size = 4 33 | 34 | [**.html] 35 | indent_style = tab 36 | indent_size = 2 37 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_ENV=local 2 | APP_DEBUG=true 3 | APP_KEY=SomeRandomString 4 | 5 | DB_HOST=localhost 6 | DB_DATABASE=homestead 7 | DB_USERNAME=homestead 8 | DB_PASSWORD=secret 9 | 10 | CACHE_DRIVER=file 11 | SESSION_DRIVER=file 12 | QUEUE_DRIVER=database 13 | 14 | MAIL_DRIVER=smtp 15 | MAIL_HOST=mailtrap.io 16 | MAIL_PORT=2525 17 | MAIL_USERNAME=null 18 | MAIL_PASSWORD=null 19 | MAIL_ENCRYPTION=null 20 | 21 | AUDFPRINT_PATH= 22 | 23 | DOCKER_HOST=unix:///var/run/docker.sock 24 | DOCKER_TLS_VERIFY=0 25 | DOCKER_CERT_PATH=/path/to/docker/certs 26 | 27 | DOCKER_FPRINT_IMAGE=slifty/audfprint:latest 28 | 29 | FPRINT_STORE=/var/audfprint/ 30 | FPRINT_CHUNK_LENGTH=3600 31 | 32 | RSYNC_IDENTITY_FILE=/path/to/cert/file 33 | ARCHIVE_USER=EMAILADDRESSYOUGETFROMTHEARCHIVE.ORGCOOKIE 34 | ARCHIVE_SIG=LONGTHINGYOUGETFROMTHEARCHIVE.ORGCOOKIE 35 | 36 | FFMPEG_BINARY_PATH=/usr/local/Cellar/ffmpeg/2.8.1/bin/ffmpeg 37 | FFPROBE_BINARY_PATH=/usr/local/Cellar/ffmpeg/2.8.1/bin/ffprobe 38 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.less linguist-vendored 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | /node_modules 3 | Homestead.yaml 4 | Homestead.json 5 | .env 6 | 7 | /certs/* 8 | *.pem 9 | 10 | /storage/audfprint/* 11 | !/storage/audfprint/afpt_cache 12 | /storage/audfprint/afpt_cache/* 13 | !/storage/audfprint/media_cache 14 | /storage/audfprint/media_cache/* 15 | !/storage/audfprint/pklz_cache 16 | /storage/audfprint/pklz_cache/* 17 | !/storage/audfprint/flocks 18 | /storage/audfprint/flocks/* 19 | !*.gitkeep 20 | 21 | *.DS_Store 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # The Duplitron 5000 2 | 3 | This repository contains the Duplitron, a RESTful API that makes it possible to discover and manage repeated audio from a larger corpus. It was originally created to support the Internet Archive's [Political Ad Archive](https://politicaladarchive.org/). 4 | 5 | The Duplitron takes in media (audio or video), compares it with existing media, and categorizes sections of the media based on the result of that comparison. It uses [ffmpeg](https://ffmpeg.org/) to manipulate the media files and then uses [audfprint](https://github.com/dpwe/audfprint) (via a docker image) to process the media files and identify segments of repeated content. 6 | 7 | The [API itself](docs/api.md) is powered by [Laravel](http://laravel.com). 8 | 9 | The code is written to support [PSR-2](http://www.php-fig.org/psr/psr-2/index.html) 10 | 11 | ## Dependencies 12 | 13 | To run this code you need: 14 | 15 | * PHP >= 5.5.9 16 | * OpenSSL PHP Extension 17 | * PDO PHP Extension 18 | * Mbstring PHP Extension 19 | * Tokenizer PHP Extension 20 | * [Composer](https://getcomposer.org/) for dependency management 21 | * [Docker](https://www.docker.com/) for running audfprint 22 | * [ffmpeg](https://ffmpeg.org/) 23 | * [PSQL](http://www.postgresql.org/) 24 | 25 | ## Installing 26 | 27 | 1. Install [ffmpeg](https://ffmpeg.org/) 28 | 29 | 2. Install [Docker](https://www.docker.com/) for running audfprint 30 | 31 | 3. Make it possible for your web provider to talk to docker. You can either create a docker group and add your web user to that group (easier), or set up [TLS verification](https://docs.docker.com/engine/articles/https/) for docker (harder). 32 | 33 | 4. Install [Composer](https://getcomposer.org/) 34 | 35 | 5. Clone the audfprint docker image and make sure it runs 36 | 37 | ```shell 38 | docker pull slifty/audfprint 39 | docker run slifty/audfprint 40 | ``` 41 | 42 | 6. Clone this repository into a living breathing live php enabled directory mod rewrite should be enabled 43 | 44 | 7. Install composer dependencies 45 | 46 | ```shell 47 | cd /path/to/your/clone/here 48 | composer install 49 | ``` 50 | 51 | 8. Copy .env.example to .env in the root directory, then edit it 52 | 53 | ```shell 54 | cd /path/to/your/clone/here 55 | cp .env.example .env 56 | vi .env 57 | ``` 58 | 59 | * RSYNC_IDENTITY_FILE: a path to a private key that web root has 500 access to, with any media files you plan on importing 60 | * FPRINT_STORE: a path to the /storage/audfprint director inside of the repository 61 | * DOCKER_HOST: the location and port of the docker you set up for audfprint 62 | 63 | 9. Install supervisor and [enable the job queue](http://laravel.com/docs/5.1/queues#running-the-queue-listener). 64 | 65 | ```shell 66 | cp duplitron-worker.conf.example /etc/supervisor/conf.d/fingerprinting-worker.conf 67 | vi /etc/supervisor/conf.d/fingerprinting-worker.conf 68 | sudo supervisorctl reread 69 | sudo supervisorctl update 70 | sudo supervisorctl start fingerprinting-worker:* 71 | ``` 72 | 73 | 74 | // Run ssh -fN -o"ControlPath none" -L 9999:tv-se.archive.org:8983 vm-home1.archive.org 75 | // so that requests are proxied through 76 | 77 | 78 | 79 | 80 | 81 | ## Installing on a fresh copy of ubuntu 14.04... 82 | 83 | ```shell 84 | sudo apt-get update 85 | sudo apt-get -y install git apache2 postgresql php5-common libapache2-mod-php5 php5-cli curl php5-pgsql 86 | sudo apt-get -y --force-yes install autoconf automake build-essential libass-dev libfreetype6-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev 87 | sudo apt-get install yasm libx264-dev cmake mercurial libmp3lame-dev libopus-dev 88 | mkdir ~/ffmpeg_sources 89 | cd ~/ffmpeg_sources ; hg clone https://bitbucket.org/multicoreware/x265 ; cd ~/ffmpeg_sources/x265/build/linux ; PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source ; make ; make install ; make distclean 90 | cd ~/ffmpeg_sources ; wget -O fdk-aac.tar.gz https://github.com/mstorsjo/fdk-aac/tarball/master ; tar xzvf fdk-aac.tar.gz ; cd mstorsjo-fdk-aac* ; autoreconf -fiv ; ./configure --prefix="$HOME/ffmpeg_build" --disable-shared ; make ; make install ; make distclean 91 | cd ~/ffmpeg_sources ; wget http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.5.0.tar.bz2 ; tar xjvf libvpx-1.5.0.tar.bz2 ; cd libvpx-1.5.0 ; PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests ; PATH="$HOME/bin:$PATH" make ; make install ; make clean 92 | cd ~/ffmpeg_sources ; wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 ; tar xjvf ffmpeg-snapshot.tar.bz2 ; cd ffmpeg ; PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --pkg-config-flags="--static" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir="$HOME/bin" --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree ; PATH="$HOME/bin:$PATH" make ; make install ; make distclean ; hash -r 93 | sudo cp ~/bin/ffmpeg /usr/local/bin 94 | sudo cp ~/bin/ffprobe /usr/local/bin 95 | sudo apt-get install -y frei0r-plugins git python python-scipy python-pip python-matplotlib software-properties-common wget libfreetype6-dev libpng-dev pkg-config python-dev 96 | sudo pip install -U distribute 97 | sudo pip install docopt git+git://github.com/bmcfee/librosa.git joblib 98 | cd /usr/local/src ; sudo wget --no-check-certificate http://www.mega-nerd.com/SRC/libsamplerate-0.1.8.tar.gz ; sudo tar xvfz libsamplerate-0.1.8.tar.gz ; cd libsamplerate-0.1.8 && sudo ./configure && sudo make && sudo make install 99 | sudo pip install scikits.samplerate 100 | cd /usr/local/src ; sudo git clone https://github.com/dpwe/audfprint.git 101 | curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer 102 | cd /var/www ; sudo git clone https://github.com/slifty/tvarchive-fingerprinting.git 103 | sudo chown -R $(whoami):www-data /var/www/tvarchive-fingerprinting/ 104 | cd /var/www/tvarchive-fingerprinting ; composer install 105 | printf "\n\tDocumentRoot /var/www/tvarchive-fingerprinting/public\n\tErrorLog \${APACHE_LOG_DIR}/error.log\n\tCustomLog \${APACHE_LOG_DIR}/access.log combined\n" | sudo tee /etc/apache2/sites-available/tvarchive-fingerprinting.conf 106 | sudo chown -R $(whoami):www-data /var/www/tvarchive-fingerprinting/ 107 | sudo apt-get install supervisor 108 | sudo cp /var/www/tvarchive-fingerprinting/fingerprinting-worker.conf.example /etc/supervisor/conf.d 109 | sudo a2dissite 000-default 110 | sudo a2ensite tvarchive-fingerprinting 111 | sudo a2enmod rewrite 112 | sudo apachectl restart 113 | sudo -upostgres createdb tvarchive_fingerprinting 114 | sudo -upostgres createuser tvarchive_fingerprinting -P 115 | sudo -upostgres psql -c "GRANT ALL PRIVILEGES ON DATABASE tvarchive_fingerprinting to tvarchive_fingerprinting" 116 | sudo chmod 777 -R /var/www/tvarchive-fingerprinting/storage 117 | 118 | ``` 119 | 120 | Next you have to update your apache config to `AllowOverride all` in the `/var/www` directory. 121 | 122 | ```shell 123 | sudo vi /etc/apache2/apache2.conf 124 | ``` 125 | 126 | Next you have to set up your .env as appropriate. 127 | 128 | ```shell 129 | cp /var/www/tvarchive-fingerprinting/.env.example /var/www/tvarchive-fingerprinting/.env 130 | php /var/www/tvarchive-fingerprinting/artisan key:generate 131 | vi /var/www/tvarchive-fingerprinting/.env 132 | ``` 133 | 134 | Some key values: 135 | 136 | ``` 137 | AUDFPRINT_PATH=/usr/local/src/audfprint/audfprint.py 138 | DB_DATABASE=tvarchive_fingerprinting 139 | DB_USERNAME=tvarchive_fingerprinting 140 | FFMPEG_BINARY_PATH=/usr/local/bin/ffmpeg 141 | FFMPEG_BINARY_PATH=/usr/local/bin/ffprobe 142 | FPRINT_STORE=/var/www/tvarchive-fingerprinting/storage/audfprint/ 143 | ``` 144 | 145 | Now migrate... 146 | 147 | ```shell 148 | php /var/www/tvarchive-fingerprinting/artisan migrate:refresh 149 | ``` 150 | 151 | Finally, set up your supervisor processes 152 | 153 | ```shell 154 | cp duplitron-worker.conf.example /etc/supervisor/conf.d/fingerprinting-worker.conf 155 | vi /etc/supervisor/conf.d/fingerprinting-worker.conf 156 | sudo supervisorctl reread 157 | sudo supervisorctl update 158 | sudo supervisorctl start fingerprinting-worker:* 159 | ``` 160 | -------------------------------------------------------------------------------- /app/Console/Commands/Inspire.php: -------------------------------------------------------------------------------- 1 | comment(PHP_EOL.Inspiring::quote().PHP_EOL); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire') 28 | ->hourly(); 29 | 30 | $schedule->call('Duplitron\Http\Controllers\ProjectTaskController@cleanEverything') 31 | ->dailyAt('5:00') 32 | ->name("runCleaningJob") 33 | ->withoutOverlapping(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/Events/Event.php: -------------------------------------------------------------------------------- 1 | getMessage(), $e); 47 | } 48 | 49 | return parent::render($request, $e); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/Helpers/BasicLoader.php: -------------------------------------------------------------------------------- 1 | afpt_path) 19 | return null; 20 | 21 | // Set up the basics 22 | $return_files = array( 23 | 'full' => '', 24 | 'chunks' => array() 25 | ); 26 | $source_afpt_path = $media->afpt_path; 27 | 28 | // Extract relevant pieces of the specified media path 29 | $parsed_url = parse_url($source_afpt_path); 30 | $afpt_scheme = $parsed_url['scheme']; 31 | 32 | $afpt_host = $parsed_url['host']; 33 | $afpt_user = (array_key_exists('user', $parsed_url))?$parsed_url['user']:""; 34 | $afpt_path = $parsed_url['path']; 35 | 36 | $parsed_path = pathinfo($afpt_path); 37 | $file_type = (array_key_exists('extension', $parsed_path))?$parsed_path['extension']:"zip"; 38 | 39 | // TODO: possibly support non-zip... maybe. 40 | if($file_type != "zip") 41 | return null; 42 | 43 | // Download the zip file 44 | $destination_file_base = $this->getFileBase($media); 45 | $destination_directory = env('FPRINT_STORE').'afpt_cache/'; 46 | $temp_afpt_archive_file = $this->loadFile($source_afpt_path, $destination_directory, $destination_file_base, $file_type); 47 | 48 | // Were we able to copy the archive file? 49 | if($temp_afpt_archive_file == "") 50 | return null; 51 | 52 | $detination_afpt_archive_path = $destination_directory.$temp_afpt_archive_file; 53 | $detination_afpt_extraction_path = $destination_directory.$destination_file_base.'/'; 54 | 55 | // TODO: Extract the zip file, route parts to the right place, populate return array 56 | $zip = new \ZipArchive(); 57 | if ($zip->open($detination_afpt_archive_path) === true) { 58 | $zip->extractTo($detination_afpt_extraction_path); 59 | $zip->close(); 60 | 61 | // Get a list of files in the new archive 62 | $archive_files = scandir($detination_afpt_extraction_path); 63 | 64 | // TODO: relying on file name structure feels bad. 65 | 66 | // Separate the files 67 | // 1) One file will not start with an underscore, that's the main file 68 | // 2) Some files will start with an underscore, those are the parts 69 | 70 | foreach($archive_files as $archive_file) 71 | { 72 | // Skip over '.' and '..' 73 | // And also skip over files that aren't density 20 74 | // TODO: we may want a safer way to pick apart the 20 density from 100 density 75 | // TODO: in general we want to handle both 20 and 100 76 | 77 | 78 | if(substr($archive_file, -11) != '_tva20.afpt') 79 | continue; 80 | 81 | if($archive_file[0] == '_') 82 | { 83 | // This is a chunk file, figure out the index 84 | $chunk_index = (int)substr($archive_file, 6, 2); 85 | $chunk_file = $destination_file_base."_".$chunk_index.".afpt"; 86 | $chunk_file_path = $destination_directory.$chunk_file; 87 | $archive_file_path = $detination_afpt_extraction_path.$archive_file; 88 | 89 | // Move the file 90 | copy($archive_file_path, $chunk_file_path); 91 | 92 | // Delete the file 93 | unlink($archive_file_path); 94 | 95 | // Register it 96 | $return_files['chunks'][] = $chunk_file; 97 | } 98 | else 99 | { 100 | // This is the core afpt file 101 | $fingerprint_file = $destination_file_base.'.afpt'; 102 | $fingerprint_file_path = $destination_directory.$fingerprint_file; 103 | $archive_file_path = $detination_afpt_extraction_path.$archive_file; 104 | 105 | // Move the file 106 | copy($archive_file_path, $fingerprint_file_path); 107 | 108 | // Delete the file 109 | unlink($archive_file_path); 110 | 111 | // Register it 112 | $return_files['full'] = $fingerprint_file; 113 | } 114 | } 115 | 116 | // Were there any sliced parts? 117 | if(sizeof($return_files['chunks']) == 0) 118 | { 119 | $chunk_file = $destination_file_base."_0.afpt"; 120 | $chunk_file_path = $destination_directory.$chunk_file; 121 | copy($destination_directory.$return_files['full'], $chunk_file_path); 122 | $return_files['chunks'][] = $chunk_file; 123 | } 124 | 125 | 126 | // Delete the zip file and the empty unzipped folder 127 | unlink($detination_afpt_archive_path); 128 | 129 | // Delete the empty unzipped folder 130 | rmdir($detination_afpt_extraction_path); 131 | 132 | } else { 133 | // Failed to open the zip file 134 | throw new \Exception("Unable to extract the fingerprint archive."); 135 | } 136 | 137 | return $return_files; 138 | } 139 | 140 | /** 141 | * See contract for documentation 142 | */ 143 | public function loadMedia($media) 144 | { 145 | // Set up the basics 146 | $return_files = array( 147 | 'full' => '', 148 | 'chunks' => array() 149 | ); 150 | $source_media_path = $media->media_path; 151 | 152 | // Extract relevant pieces of the specified media path 153 | $parsed_url = parse_url($source_media_path); 154 | $media_scheme = $parsed_url['scheme']; 155 | 156 | $media_host = $parsed_url['host']; 157 | $media_user = (array_key_exists('user', $parsed_url))?$parsed_url['user']:""; 158 | $media_path = $parsed_url['path']; 159 | 160 | $parsed_path = pathinfo($media_path); 161 | $file_type = (array_key_exists('extension', $parsed_path))?$parsed_path['extension']:"mp3"; 162 | 163 | // Set up the pieces of the destination file names 164 | $destination_file_base = $this->getFileBase($media); 165 | $destination_directory = env('FPRINT_STORE').'media_cache/'; 166 | $temp_media_file = $destination_file_base.".".$file_type; 167 | $temp_media_path = $destination_directory.$temp_media_file; 168 | 169 | // If the file doesn't exist, download it 170 | if(file_exists($temp_media_path)) 171 | { 172 | $return_files['full'] = $temp_media_file; 173 | } 174 | else 175 | { 176 | $temp_media_file = $this->loadFile($source_media_path, $destination_directory, $destination_file_base, $file_type); 177 | 178 | if($temp_media_file == "") 179 | throw new \Exception("Could not download the media: ".$source_media_path); 180 | 181 | // Save the media path 182 | $return_files['full'] = $temp_media_file; 183 | 184 | // Set up PHPVideoToolkit (for use in the next steps) 185 | $config = new \PHPVideoToolkit\Config(array( 186 | 'temp_directory' => '/tmp', 187 | 'ffmpeg' => env('FFMPEG_BINARY_PATH'), 188 | 'ffprobe' => env('FFPROBE_BINARY_PATH'), 189 | 'yamdi' => '', 190 | 'qtfaststart' => '', 191 | ), true); 192 | 193 | // Slice down the new media file if it has a listed start / duration 194 | if($media->duration > 0) 195 | { 196 | // Extract the section we care about 197 | $start = new \PHPVideoToolkit\Timecode($media->start); 198 | $end = new \PHPVideoToolkit\Timecode($media->start + $media->duration); 199 | 200 | // Process differently based on the file type 201 | switch($file_type) 202 | { 203 | case 'mp3': 204 | case 'wav': 205 | $audio = new \PHPVideoToolkit\Audio($temp_media_path, null, null, false); 206 | $command = $audio->extractSegment($start, $end); 207 | break; 208 | case 'mp4': 209 | $video = new \PHPVideoToolkit\Video($temp_media_path, null, null, false); 210 | $command = $video->extractSegment($start, $end); 211 | break; 212 | } 213 | // We need to save as a separate file then overwrite 214 | $trimmed_media_path = $temp_media_path."trimmed.".$file_type; 215 | $process = $command->save($trimmed_media_path, null, true); 216 | rename($trimmed_media_path, $temp_media_path); 217 | } 218 | } 219 | 220 | // Check if the file parts already exist 221 | $chunk_glob_path = $destination_directory.$destination_file_base."_*.".$file_type; 222 | $chunk_paths = glob($chunk_glob_path); 223 | 224 | // If the chunks already exist use them, otherwise make them. 225 | if(sizeof($chunk_paths) > 0) 226 | { 227 | foreach($chunk_paths as $chunk_path) 228 | $return_files['chunks'][] = basename($chunk_path); 229 | } 230 | else 231 | { 232 | 233 | // Calculate the number of chunks needed 234 | $parser = new \PHPVideoToolkit\MediaParser(); 235 | $media_data = $parser->getFileInformation($temp_media_path); 236 | $slice_duration = env('FPRINT_CHUNK_LENGTH'); 237 | $duration = $media_data['duration']->total_seconds; 238 | 239 | // Perform the actual slicing 240 | // TODO: there is an issue where slices that are too small might cause errors. 241 | // We will need to add logic to detect those and merge them into the previous slice 242 | if($duration > env('FPRINT_CHUNK_LENGTH') + 60) // The + 60 is to try to prevent slices less than 1 minute... 243 | { 244 | switch($file_type) 245 | { 246 | case 'mp3': 247 | case 'wav': 248 | $audio = new \PHPVideoToolkit\Audio($temp_media_path, null, null, false); 249 | $slices = $audio->split(env('FPRINT_CHUNK_LENGTH')); 250 | break; 251 | case 'mp4': 252 | $video = new \PHPVideoToolkit\Video($temp_media_path, null, null, false); 253 | $slices = $video->split(env('FPRINT_CHUNK_LENGTH')); 254 | break; 255 | } 256 | $process = $slices->save($destination_directory.$destination_file_base."_%index.".$file_type); 257 | $output = $process->getOutput(); 258 | 259 | // Get the filenames 260 | foreach($output as $chunk) 261 | { 262 | $return_files['chunks'][] = basename($chunk->getMediaPath()); 263 | } 264 | } 265 | else 266 | { 267 | $copy_path = str_replace(".".$file_type, "_0.".$file_type, $temp_media_path); 268 | copy($temp_media_path, $copy_path); 269 | $return_files['chunks'][] = basename($copy_path); 270 | } 271 | } 272 | return $return_files; 273 | } 274 | 275 | /** 276 | * See contract for documentation 277 | */ 278 | // TODO: make this thread safe, as well as all the other loader methods. 279 | public function removeCachedFiles($media) { 280 | 281 | // Set up the cache directories 282 | $media_cache = env('FPRINT_STORE').'media_cache/'; 283 | $afpt_cache = env('FPRINT_STORE').'afpt_cache/'; 284 | $file_base = $this->getFileBase($media); 285 | $remove_paths = []; 286 | 287 | // Find media files 288 | $media_glob_path = $media_cache.$file_base.".*"; 289 | $remove_paths = array_merge($remove_paths, glob($media_glob_path)); 290 | $media_chunks_glob_path = $media_cache.$file_base."_*.*"; 291 | $remove_paths = array_merge($remove_paths, glob($media_chunks_glob_path)); 292 | 293 | // Find fingerprint files 294 | $media_glob_path = $afpt_cache.$file_base.".afpt"; 295 | $remove_paths = array_merge($remove_paths, glob($media_glob_path)); 296 | $media_chunks_glob_path = $afpt_cache.$file_base."_*.afpt"; 297 | $remove_paths = array_merge($remove_paths, glob($media_chunks_glob_path)); 298 | 299 | // Go through the paths and remove them 300 | foreach($remove_paths as $remove_path) 301 | { 302 | unlink($remove_path); 303 | } 304 | return $remove_paths; 305 | } 306 | 307 | /** 308 | * Given a media file, returns the basename of the file being used for it's various cached pieces 309 | * @param Object $media the media being saved 310 | * @return String the base filename to be used 311 | */ 312 | private function getFileBase($media) { 313 | return "media-".$media->id; 314 | } 315 | 316 | /** 317 | * Loads a file into a specified directory, returns the file name that was created 318 | * @param string $source_path The full path to the file being loaded 319 | * @param string $destination_directory The directory the file should be stored in 320 | * @param string $destination_file_base The base name (not including extension) of the destination 321 | * @return string The name of the final file 322 | */ 323 | private function loadFile($source_url, $destination_directory, $destination_file_base, $file_type) 324 | { 325 | // Extract relevant pieces of the specified file path 326 | $parsed_url = parse_url($source_url); 327 | $source_scheme = $parsed_url['scheme']; 328 | 329 | $source_host = $parsed_url['host']; 330 | $source_user = (array_key_exists('user', $parsed_url))?$parsed_url['user']:""; 331 | $source_path = $parsed_url['path']; 332 | 333 | // Set up the pieces of the destination file names 334 | $temp_file = $destination_file_base.".".$file_type; 335 | $temp_file_path = $destination_directory.$temp_file; 336 | 337 | // Do we have a copy of this file already? 338 | if(file_exists($temp_file_path)) 339 | { 340 | // Good job! You loaded the file! PARTY! 341 | return $temp_file; 342 | } 343 | 344 | // Load the file (based on the scheme) 345 | switch($source_scheme) 346 | { 347 | case 'ssh': 348 | // Run an rsync to get a local copy 349 | // NOTE: This feels dirty, but so it goes. 350 | $ssh_command = 'ssh -i '.env('RSYNC_IDENTITY_FILE'); 351 | shell_exec('/usr/bin/rsync -az -e \''.$ssh_command.'\' '.$source_user.'@'.$source_host.':'.$source_path.' '.$temp_file_path); 352 | break; 353 | 354 | case 'http': 355 | case 'https': 356 | 357 | // If this is the archive, use their credentials 358 | // TODO: this should be made somehow more elegant or generalized 359 | if($source_host == "archive.org") 360 | { 361 | $user = env("ARCHIVE_USER"); 362 | $sig = env("ARCHIVE_SIG"); 363 | 364 | // Set the cookie and load the file 365 | $opts = array( 366 | 'http'=>array( 367 | 'header'=>"Cookie: logged-in-user=".$user.";logged-in-sig=".$sig 368 | ) 369 | ); 370 | $context = stream_context_create($opts); 371 | 372 | try 373 | { 374 | copy($source_url, $temp_file_path, $context); 375 | } 376 | catch (\Exception $e) 377 | { 378 | // Something went wrong with the copy 379 | return ""; 380 | } 381 | } 382 | else 383 | { 384 | copy($source_url, $temp_file_path); 385 | } 386 | break; 387 | } 388 | 389 | // Done 390 | return $temp_file; 391 | 392 | } 393 | } 394 | ?> 395 | -------------------------------------------------------------------------------- /app/Helpers/Contracts/FingerprinterContract.php: -------------------------------------------------------------------------------- 1 | 63 | 64 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | has('project_id')) 23 | { 24 | $results = Media::where('project_id', $request->input('project_id')); 25 | } 26 | else 27 | { 28 | // TODO: Real errors. 29 | return ['ERR: Project ID Required']; 30 | } 31 | 32 | if($request->has('matchType')) 33 | { 34 | switch($request->input('matchType')) 35 | { 36 | case 'corpus': 37 | $results = $results->where('is_corpus', 1); 38 | break; 39 | case 'distractor': 40 | $results = $results->where('is_distractor', 1); 41 | break; 42 | case 'potential_target': 43 | $results = $results->where('is_potential_target', 1); 44 | break; 45 | case 'target': 46 | $results = $results->where('is_target', 1); 47 | break; 48 | } 49 | } 50 | return $results->get(); 51 | } 52 | 53 | /** 54 | * Show the form for creating a new resource. 55 | * 56 | * @return Response 57 | */ 58 | public function create() 59 | { 60 | // 61 | } 62 | 63 | /** 64 | * Store a newly created resource in storage. 65 | * 66 | * @param Request $request 67 | * @return Response 68 | */ 69 | public function store(Request $request) 70 | { 71 | // 72 | $media = new Media(); 73 | 74 | $media->project_id = $request->input('project_id'); 75 | 76 | // Media can be created in two ways: 77 | // 1) A media path or an audf path (TODO: implement this) 78 | // 2) As a subsection of an existing media file 79 | if($request->has('base_media_id')) 80 | { 81 | $base_media = Media::find($request->input('base_media_id')); 82 | $media->base_media_id = $base_media->id; 83 | 84 | // We copy the base media from the parent, but NOT the fingerprints 85 | $media->media_path = $base_media->media_path; 86 | $media->afpt_path = ''; 87 | $media->external_id = $base_media->external_id; 88 | } 89 | else 90 | { 91 | $media->media_path = $request->input('media_path'); 92 | $media->afpt_path = $request->input('afpt_path'); 93 | 94 | // Store the external ID if it exists 95 | if($request->has('external_id')) 96 | { 97 | $media->external_id = $request->input('external_id'); 98 | } 99 | } 100 | 101 | 102 | // Sometimes the media we want to track is a subset of the full media 103 | $media->start = $request->has('start')?$request->start:0; 104 | $media->duration = $request->has('duration')?$request->duration:MEDIA::DURATION_UNKNOWN; 105 | 106 | // Make sure this media hasn't already been saved for this project 107 | $query = Media::where('project_id', $media->project_id) 108 | ->where('start', $media->start) 109 | ->where('duration', $media->duration); 110 | 111 | if($media->external_id) 112 | { 113 | // If an external ID is set, use that as the differentiating factor 114 | $query = $query->where('external_id', $media->external_id); 115 | } 116 | else 117 | { 118 | // Otherwise, use the media path 119 | $query = $query->where('media_path', $media->media_path); 120 | } 121 | 122 | $existing_media = $query->first(); 123 | if($existing_media) 124 | { 125 | return $existing_media; 126 | } 127 | 128 | $media->save(); 129 | return $media; 130 | } 131 | 132 | /** 133 | * Display the specified resource. 134 | * 135 | * @param int $id 136 | * @return Response 137 | */ 138 | public function show($id) 139 | { 140 | $media = Media::find($id); 141 | return $media; 142 | } 143 | 144 | /** 145 | * Show the form for editing the specified resource. 146 | * 147 | * @param int $id 148 | * @return Response 149 | */ 150 | public function edit($id) 151 | { 152 | // 153 | } 154 | 155 | /** 156 | * Update the specified resource in storage. 157 | * 158 | * @param Request $request 159 | * @param int $id 160 | * @return Response 161 | */ 162 | public function update(Request $request, $id) 163 | { 164 | // 165 | } 166 | 167 | /** 168 | * Remove the specified resource from storage. 169 | * 170 | * @param int $id 171 | * @return Response 172 | */ 173 | public function destroy($id) 174 | { 175 | // 176 | } 177 | 178 | 179 | public function getMediaMatches($id) 180 | { 181 | $media = Media::find($id); 182 | if(!$media) 183 | return []; 184 | 185 | return array_merge(json_decode($media->destinationMatches()->get()), json_decode($media->sourceMatches()->get())); 186 | } 187 | } 188 | -------------------------------------------------------------------------------- /app/Http/Controllers/MediaTaskController.php: -------------------------------------------------------------------------------- 1 | has('project_id')) 24 | { 25 | $results = \DB::table('media') 26 | ->join('media_tasks', 'media.id', '=', 'media_tasks.media_id') 27 | ->where('project_id', $request->input('project_id')); 28 | } 29 | else 30 | { 31 | // TODO: Real errors. 32 | return ['ERR: Project ID Required']; 33 | } 34 | 35 | if($request->has('status')) 36 | { 37 | switch($request->input('status')) 38 | { 39 | case MediaTask::STATUS_NEW: 40 | $results = $results->where('status_code', MediaTask::STATUS_NEW); 41 | break; 42 | case MediaTask::STATUS_STARTING: 43 | $results = $results->where('status_code', MediaTask::STATUS_STARTING); 44 | break; 45 | case MediaTask::STATUS_PROCESSING: 46 | $results = $results->where('status_code', MediaTask::STATUS_PROCESSING); 47 | break; 48 | case MediaTask::STATUS_FINISHED: 49 | $results = $results->where('status_code', MediaTask::STATUS_FINISHED); 50 | break; 51 | case MediaTask::STATUS_FAILED: 52 | $results = $results->where('status_code', MediaTask::STATUS_FAILED); 53 | break; 54 | } 55 | } 56 | 57 | return $results->get(); 58 | } 59 | 60 | /** 61 | * Show the form for creating a new resource. 62 | * 63 | * @return Response 64 | */ 65 | public function create() 66 | { 67 | } 68 | 69 | /** 70 | * Store a newly created resource in storage. 71 | * 72 | * @param Request $request 73 | * @return Response 74 | */ 75 | public function store(Request $request) 76 | { 77 | // Create a new task object 78 | $task = new MediaTask(); 79 | $task->status_code = MediaTask::STATUS_NEW; 80 | $task->attempts = 0; 81 | $task->media_id = $request->input('media_id'); 82 | $task->type = $request->input('type'); 83 | 84 | if($request->input('start_date') 85 | || $request->input('end_date')) { 86 | $task->parameters = array( 87 | 'start_date' => $request->input('start_date'), 88 | 'end_date' => $request->input('end_date'), 89 | ); 90 | } 91 | $task->save(); 92 | 93 | // Dispatch a job for this task 94 | $this->dispatch(new PerformMediaTask($task)); 95 | 96 | return $task; 97 | } 98 | 99 | /** 100 | * Display the specified resource. 101 | * 102 | * @param int $id 103 | * @return Response 104 | */ 105 | public function show($id) 106 | { 107 | $task = MediaTask::find($id); 108 | return $task; 109 | } 110 | 111 | /** 112 | * Show the form for editing the specified resource. 113 | * 114 | * @param int $id 115 | * @return Response 116 | */ 117 | public function edit($id) 118 | { 119 | // 120 | } 121 | 122 | /** 123 | * Update the specified resource in storage. 124 | * 125 | * @param Request $request 126 | * @param int $id 127 | * @return Response 128 | */ 129 | public function update(Request $request, $id) 130 | { 131 | // 132 | } 133 | 134 | /** 135 | * Remove the specified resource from storage. 136 | * 137 | * @param int $id 138 | * @return Response 139 | */ 140 | public function destroy($id) 141 | { 142 | // 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /app/Http/Controllers/ProjectController.php: -------------------------------------------------------------------------------- 1 | name = $request->input('name'); 45 | $project->save(); 46 | 47 | return $project; 48 | } 49 | 50 | /** 51 | * Display the specified resource. 52 | * 53 | * @param int $id 54 | * @return Response 55 | */ 56 | public function show($id) 57 | { 58 | $project = Project::find($id); 59 | return $project; 60 | } 61 | 62 | /** 63 | * Show the form for editing the specified resource. 64 | * 65 | * @param int $id 66 | * @return Response 67 | */ 68 | public function edit($id) 69 | { 70 | // 71 | } 72 | 73 | /** 74 | * Update the specified resource in storage. 75 | * 76 | * @param Request $request 77 | * @param int $id 78 | * @return Response 79 | */ 80 | public function update(Request $request, $id) 81 | { 82 | // 83 | } 84 | 85 | /** 86 | * Remove the specified resource from storage. 87 | * 88 | * @param int $id 89 | * @return Response 90 | */ 91 | public function destroy($id) 92 | { 93 | // 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /app/Http/Controllers/ProjectTaskController.php: -------------------------------------------------------------------------------- 1 | has('project_id')) 25 | { 26 | // TODO: Real errors. 27 | return ['ERR: Project ID Required']; 28 | } else { 29 | $results = \DB::table('project_tasks') 30 | ->where('project_id', $request->input('project_id')); 31 | } 32 | return $results->get(); 33 | } 34 | 35 | /** 36 | * Show the form for creating a new resource. 37 | * 38 | * @return Response 39 | */ 40 | public function create() 41 | { 42 | } 43 | 44 | /** 45 | * Store a newly created resource in storage. 46 | * 47 | * @param Request $request 48 | * @return Response 49 | */ 50 | public function store(Request $request) 51 | { 52 | // Create a new task object 53 | $task = new ProjectTask(); 54 | $task->status_code = ProjectTask::STATUS_NEW; 55 | $task->attempts = 0; 56 | $task->project_id = $request->input('project_id'); 57 | $task->type = $request->input('type'); 58 | $task->save(); 59 | 60 | // Dispatch a job for this task 61 | $this->dispatch(new PerformProjectTask($task)); 62 | 63 | return $task; 64 | } 65 | 66 | /** 67 | * Display the specified resource. 68 | * 69 | * @param int $id 70 | * @return Response 71 | */ 72 | public function show($id) 73 | { 74 | $task = ProjectTask::find($id); 75 | return $task; 76 | } 77 | 78 | /** 79 | * Show the form for editing the specified resource. 80 | * 81 | * @param int $id 82 | * @return Response 83 | */ 84 | public function edit($id) 85 | { 86 | // 87 | } 88 | 89 | /** 90 | * Update the specified resource in storage. 91 | * 92 | * @param Request $request 93 | * @param int $id 94 | * @return Response 95 | */ 96 | public function update(Request $request, $id) 97 | { 98 | // 99 | } 100 | 101 | /** 102 | * Remove the specified resource from storage. 103 | * 104 | * @param int $id 105 | * @return Response 106 | */ 107 | public function destroy($id) 108 | { 109 | // 110 | } 111 | 112 | /** 113 | * Store a newly created resource in storage. 114 | * 115 | * @param Request $request 116 | * @return Response 117 | */ 118 | public function cleanEverything() { 119 | 120 | $projects = Project::all(); 121 | 122 | $tasks = array(); 123 | 124 | foreach($projects as $project) { 125 | // Create a new task object 126 | $task = new ProjectTask(); 127 | $task->status_code = ProjectTask::STATUS_NEW; 128 | $task->attempts = 0; 129 | $task->project_id = $project->id; 130 | $task->type = ProjectTask::TYPE_CLEAN; 131 | $task->save(); 132 | 133 | $tasks[] = $task; 134 | 135 | // Dispatch a job for this task 136 | $this->dispatch(new PerformProjectTask($task)); 137 | } 138 | return $tasks; 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | task = $task; 31 | } 32 | 33 | /** 34 | * Execute the job. 35 | * 36 | * @return void 37 | */ 38 | public function handle(FingerprinterContract $fingerprinter) 39 | { 40 | if($this->attempts() > 1) 41 | return; 42 | 43 | // Load the media file locally 44 | // Mark this as processing 45 | $this->task->status_code = MediaTask::STATUS_PROCESSING; 46 | $this->task->save(); 47 | 48 | // TODO: Errors should be caught in a better way 49 | try 50 | { 51 | // Run the Docker commands based on the task type 52 | switch($this->task->type) 53 | { 54 | case MediaTask::TYPE_MATCH: 55 | $results = $fingerprinter->runMatch($this->task->media, true); 56 | $this->task->result_data = json_encode($results['results']); 57 | $this->task->result_output = json_encode($results['output']); 58 | $this->task->save(); 59 | break; 60 | 61 | case MediaTask::TYPE_MATCH_TARGETS: 62 | $results = $fingerprinter->runMatch($this->task->media, true, FingerprinterContract::MATCH_TARGET); 63 | $this->task->result_data = json_encode($results['results']); 64 | $this->task->result_output = json_encode($results['output']); 65 | $this->task->save(); 66 | break; 67 | 68 | case MediaTask::TYPE_FULL_MATCH: // All files, not just recent ones 69 | 70 | // Set date limits if specified 71 | if(array_key_exists('start_date', $this->task->parameters)) 72 | $fingerprinter->start_date = $this->task->parameters['start_date']; 73 | if(array_key_exists('end_date', $this->task->parameters)) 74 | $fingerprinter->end_date = $this->task->parameters['end_date']; 75 | 76 | $results = $fingerprinter->runMatch($this->task->media, false); 77 | $this->task->result_data = json_encode($results['results']); 78 | $this->task->result_output = json_encode($results['output']); 79 | $this->task->save(); 80 | break; 81 | 82 | case MediaTask::TYPE_CORPUS_ADD: 83 | $results = $fingerprinter->addCorpusItem($this->task->media); 84 | $this->task->result_data = json_encode($results['results']); 85 | $this->task->result_output = json_encode($results['output']); 86 | $this->task->save(); 87 | break; 88 | 89 | case MediaTask::TYPE_POTENTIAL_TARGET_ADD: 90 | $results = $fingerprinter->addPotentialTargetsItem($this->task->media); 91 | $this->task->result_data = json_encode($results['results']); 92 | $this->task->result_output = json_encode($results['output']); 93 | $this->task->save(); 94 | break; 95 | 96 | case MediaTask::TYPE_DISTRACTOR_ADD: 97 | $results = $fingerprinter->addDistractorsItem($this->task->media); 98 | $this->task->result_data = json_encode($results['results']); 99 | $this->task->result_output = json_encode($results['output']); 100 | $this->task->save(); 101 | break; 102 | 103 | case MediaTask::TYPE_TARGET_ADD: 104 | $results = $fingerprinter->addTargetsItem($this->task->media); 105 | $this->task->result_data = json_encode($results['results']); 106 | $this->task->result_output = json_encode($results['output']); 107 | $this->task->save(); 108 | break; 109 | 110 | case MediaTask::TYPE_CORPUS_REMOVE: 111 | $results = $fingerprinter->removeCorpusItem($this->task->media); 112 | $this->task->result_data = json_encode($results['results']); 113 | $this->task->result_output = json_encode($results['output']); 114 | $this->task->save(); 115 | break; 116 | 117 | case MediaTask::TYPE_POTENTIAL_TARGET_REMOVE: 118 | $results = $fingerprinter->removePotentialTargetsItem($this->task->media); 119 | $this->task->result_data = json_encode($results['results']); 120 | $this->task->result_output = json_encode($results['output']); 121 | $this->task->save(); 122 | break; 123 | 124 | case MediaTask::TYPE_TARGET_REMOVE: 125 | $results = $fingerprinter->removeTargetsItem($this->task->media); 126 | $this->task->result_data = json_encode($results['results']); 127 | $this->task->result_output = json_encode($results['output']); 128 | $this->task->save(); 129 | break; 130 | 131 | case MediaTask::TYPE_DISTRACTOR_REMOVE: 132 | $results = $fingerprinter->removeDistractorsItem($this->task->media); 133 | $this->task->result_data = json_encode($results['results']); 134 | $this->task->result_output = json_encode($results['output']); 135 | $this->task->save(); 136 | break; 137 | 138 | case MediaTask::TYPE_CLEAN: 139 | $results = $fingerprinter->cleanUp($this->task->media); 140 | $this->task->result_data = json_encode($results['results']); 141 | $this->task->result_output = json_encode($results['output']); 142 | $this->task->save(); 143 | break; 144 | } 145 | } 146 | catch (\Exception $e) 147 | { 148 | $result = array( 149 | "type" => "error", 150 | "message" => $e->getMessage() 151 | ); 152 | 153 | $output = array( 154 | "message" => $e->getMessage(), 155 | "trace" => $e->getTrace(), 156 | "line" => $e->getLine() 157 | ); 158 | $this->task->result_data = json_encode($result); 159 | $this->task->result_output = json_encode($output); 160 | $this->task->status_code = MediaTask::STATUS_FAILED; 161 | $this->task->save(); 162 | return; 163 | } 164 | 165 | // TODO: this is honestly the worst thing ever. 166 | if($this->hasErrors($this->task->result_output)) 167 | $this->task->status_code = MediaTask::STATUS_FAILED; 168 | else 169 | $this->task->status_code = MediaTask::STATUS_FINISHED; 170 | 171 | // Mark this as finished 172 | $this->task->save(); 173 | } 174 | 175 | // TODO: lol 176 | private function hasErrors($line) 177 | { 178 | // Did we find a log line that talks about a Traceback? 179 | if(strpos($line, 'Traceback') === false) 180 | return false; 181 | 182 | return true; 183 | } 184 | 185 | /** 186 | * Handle a job failure. 187 | * 188 | * @return void 189 | */ 190 | public function failed() 191 | { 192 | // Called when the job is failing... 193 | $this->task->status_code = MediaTask::STATUS_FAILED; 194 | $this->task->save(); 195 | } 196 | 197 | } 198 | -------------------------------------------------------------------------------- /app/Jobs/PerformProjectTask.php: -------------------------------------------------------------------------------- 1 | task = $task; 32 | } 33 | 34 | /** 35 | * Execute the job. 36 | * 37 | * @return void 38 | */ 39 | public function handle(FingerprinterContract $fingerprinter) 40 | { 41 | if($this->attempts() > 1) 42 | return; 43 | 44 | // Mark this as processing 45 | $this->task->status_code = ProjectTask::STATUS_PROCESSING; 46 | $this->task->save(); 47 | 48 | // TODO: switch on task type 49 | $results = $fingerprinter->cleanProject($this->task->project); 50 | $this->task->result_data = json_encode($results['results']); 51 | $this->task->result_output = json_encode($results['output']); 52 | 53 | 54 | $this->task->status_code = ProjectTask::STATUS_FINISHED; 55 | $this->task->save(); 56 | 57 | return; 58 | } 59 | 60 | /** 61 | * Handle a job failure. 62 | * 63 | * @return void 64 | */ 65 | public function failed() 66 | { 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /app/Listeners/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slifty/tvarchive-duplitron/71573fb84c497275dade888324bdc94b31df4db7/app/Listeners/.gitkeep -------------------------------------------------------------------------------- /app/Match.php: -------------------------------------------------------------------------------- 1 | belongsTo('Duplitron\Media', 'destination_id'); 41 | } 42 | 43 | /** 44 | * Specify relationship with Media (Source) 45 | * The source is the input file that we searched for matches within. 46 | */ 47 | public function source() { 48 | return $this->belongsTo('Duplitron\Media', 'source_id'); 49 | } 50 | 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /app/Media.php: -------------------------------------------------------------------------------- 1 | hasMany('Duplitron\MediaTask'); 64 | } 65 | 66 | /** 67 | * Specify relationship with Project 68 | */ 69 | public function project() { 70 | return $this->belongsTo('Duplitron\Project'); 71 | } 72 | 73 | /** 74 | * Specify relationship with Project 75 | */ 76 | public function baseMedia() { 77 | return $this->belongsTo('Duplitron\Media', 'base_media_id'); 78 | } 79 | 80 | /** 81 | * Specify relationship with Project 82 | */ 83 | public function childMedia() { 84 | return $this->belongsTo('Duplitron\Media', 'base_media_id'); 85 | } 86 | 87 | /** 88 | * Specify relationship with Matches 89 | */ 90 | public function sourceMatches() { 91 | return $this->hasMany('Duplitron\Match', 'source_id'); 92 | } 93 | 94 | /** 95 | * Specify relationship with Matches 96 | */ 97 | public function destinationMatches() { 98 | return $this->hasMany('Duplitron\Match', 'destination_id'); 99 | } 100 | 101 | /** 102 | * Create the match categorization information block 103 | */ 104 | public function getMatchCategorizationAttribute() { 105 | return $this->attributes['match_categorization'] = [ 106 | 'is_potential_target' => $this->is_potential_target, 107 | 'is_corpus' => $this->is_corpus, 108 | 'is_distractor' => $this->is_distractor, 109 | 'is_target' => $this->is_target 110 | ]; 111 | } 112 | 113 | 114 | } 115 | -------------------------------------------------------------------------------- /app/MediaTask.php: -------------------------------------------------------------------------------- 1 | belongsTo('Duplitron\Media'); 69 | } 70 | 71 | public function getStatusAttribute() { 72 | return $this->attributes['status'] = [ 73 | "code" => $this->attributes['status_code'], 74 | "description" => "" 75 | ]; 76 | } 77 | 78 | public function getResultAttribute() { 79 | return $this->attributes['result'] = [ 80 | "code" => $this->result_code, 81 | "data" => json_decode($this->result_data), 82 | "output" => json_decode($this->result_output) 83 | ]; 84 | } 85 | 86 | public function getParametersAttribute() { 87 | parse_str($this->attributes['parameters'], $parameters); 88 | return $parameters; 89 | } 90 | 91 | public function setParametersAttribute($parameters) { 92 | // Passed in as an associative array, but stored as a query string 93 | $collapsed_parameters = http_build_query($parameters); 94 | $this->attributes['parameters'] = $collapsed_parameters; 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /app/Policies/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slifty/tvarchive-duplitron/71573fb84c497275dade888324bdc94b31df4db7/app/Policies/.gitkeep -------------------------------------------------------------------------------- /app/Project.php: -------------------------------------------------------------------------------- 1 | hasMany('Duplitron\Media'); 40 | } 41 | 42 | /** 43 | * Specify relationship with Project Tasks 44 | */ 45 | public function tasks() { 46 | return $this->hasMany('Duplitron\ProjectTask'); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /app/ProjectTask.php: -------------------------------------------------------------------------------- 1 | belongsTo('Duplitron\Project'); 57 | } 58 | 59 | public function getStatusAttribute() { 60 | return $this->attributes['status'] = [ 61 | "code" => $this->attributes['status_code'], 62 | "description" => "" 63 | ]; 64 | } 65 | 66 | public function getResultAttribute() { 67 | return $this->attributes['result'] = [ 68 | "code" => $this->result_code, 69 | "data" => json_decode($this->result_data), 70 | "output" => json_decode($this->result_output) 71 | ]; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'Duplitron\Listeners\EventListener', 18 | ], 19 | ]; 20 | 21 | /** 22 | * Register any other events for your application. 23 | * 24 | * @param \Illuminate\Contracts\Events\Dispatcher $events 25 | * @return void 26 | */ 27 | public function boot(DispatcherContract $events) 28 | { 29 | parent::boot($events); 30 | 31 | // 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/Providers/FingerprinterServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->bind('Duplitron\Helpers\Contracts\FingerprinterContract', function(){ 31 | return new AudfprintFingerprinter($this->app['Duplitron\Helpers\Contracts\LoaderContract']); 32 | }); 33 | } 34 | 35 | /** 36 | * Get the services provided by the provider. 37 | * 38 | * @return array 39 | */ 40 | public function provides() 41 | { 42 | return ['Duplitron\Helpers\Contracts\FingerprinterContract']; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/Providers/LoaderServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->bind('Duplitron\Helpers\Contracts\LoaderContract', function(){ 32 | return new BasicLoader(); 33 | }); 34 | } 35 | 36 | /** 37 | * Get the services provided by the provider. 38 | * 39 | * @return array 40 | */ 41 | public function provides() 42 | { 43 | return ['Duplitron\Helpers\Contracts\LoaderContract']; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | group(['namespace' => $this->namespace], function ($router) { 41 | require app_path('Http/routes.php'); 42 | }); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 32 | 33 | $status = $kernel->handle( 34 | $input = new Symfony\Component\Console\Input\ArgvInput, 35 | new Symfony\Component\Console\Output\ConsoleOutput 36 | ); 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Shutdown The Application 41 | |-------------------------------------------------------------------------- 42 | | 43 | | Once Artisan has finished running. We will fire off the shutdown events 44 | | so that any final work may be done by the application before we shut 45 | | down the process. This is the last thing to happen to the request. 46 | | 47 | */ 48 | 49 | $kernel->terminate($input, $status); 50 | 51 | exit($status); 52 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | Duplitron\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | Duplitron\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | Duplitron\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /bootstrap/autoload.php: -------------------------------------------------------------------------------- 1 | =5.5.9", 9 | "laravel/framework": "5.1.*", 10 | "stage1/docker-php": "^0.4.3", 11 | "buggedcom/phpvideotoolkit": "^2.2" 12 | }, 13 | "require-dev": { 14 | "fzaninotto/faker": "~1.4", 15 | "mockery/mockery": "0.9.*", 16 | "phpunit/phpunit": "~4.0", 17 | "phpspec/phpspec": "~2.1" 18 | }, 19 | "autoload": { 20 | "classmap": [ 21 | "database" 22 | ], 23 | "psr-4": { 24 | "Duplitron\\": "app/" 25 | } 26 | }, 27 | "autoload-dev": { 28 | "classmap": [ 29 | "tests/TestCase.php" 30 | ] 31 | }, 32 | "scripts": { 33 | "post-install-cmd": [ 34 | "php artisan clear-compiled", 35 | "php artisan optimize" 36 | ], 37 | "pre-update-cmd": [ 38 | "php artisan clear-compiled" 39 | ], 40 | "post-update-cmd": [ 41 | "php artisan optimize" 42 | ], 43 | "post-root-package-install": [ 44 | "php -r \"copy('.env.example', '.env');\"" 45 | ], 46 | "post-create-project-cmd": [ 47 | "php artisan key:generate" 48 | ] 49 | }, 50 | "config": { 51 | "preferred-install": "dist" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /config/app.php: -------------------------------------------------------------------------------- 1 | env('APP_DEBUG', false), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Application URL 21 | |-------------------------------------------------------------------------- 22 | | 23 | | This URL is used by the console to properly generate URLs when using 24 | | the Artisan command line tool. You should set this to the root of 25 | | your application so that it is used when running Artisan tasks. 26 | | 27 | */ 28 | 29 | 'url' => 'http://localhost/tvarchive-fingerprinting/public', 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Application Timezone 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here you may specify the default timezone for your application, which 37 | | will be used by the PHP date and date-time functions. We have gone 38 | | ahead and set this to a sensible default for you out of the box. 39 | | 40 | */ 41 | 42 | 'timezone' => 'EST', 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Application Locale Configuration 47 | |-------------------------------------------------------------------------- 48 | | 49 | | The application locale determines the default locale that will be used 50 | | by the translation service provider. You are free to set this value 51 | | to any of the locales which will be supported by the application. 52 | | 53 | */ 54 | 55 | 'locale' => 'en', 56 | 57 | /* 58 | |-------------------------------------------------------------------------- 59 | | Application Fallback Locale 60 | |-------------------------------------------------------------------------- 61 | | 62 | | The fallback locale determines the locale to use when the current one 63 | | is not available. You may change the value to correspond to any of 64 | | the language folders that are provided through your application. 65 | | 66 | */ 67 | 68 | 'fallback_locale' => 'en', 69 | 70 | /* 71 | |-------------------------------------------------------------------------- 72 | | Encryption Key 73 | |-------------------------------------------------------------------------- 74 | | 75 | | This key is used by the Illuminate encrypter service and should be set 76 | | to a random, 32 character string, otherwise these encrypted strings 77 | | will not be safe. Please do this before deploying an application! 78 | | 79 | */ 80 | 81 | 'key' => env('APP_KEY', 'SomeRandomString'), 82 | 83 | 'cipher' => 'AES-256-CBC', 84 | 85 | /* 86 | |-------------------------------------------------------------------------- 87 | | Logging Configuration 88 | |-------------------------------------------------------------------------- 89 | | 90 | | Here you may configure the log settings for your application. Out of 91 | | the box, Laravel uses the Monolog PHP logging library. This gives 92 | | you a variety of powerful log handlers / formatters to utilize. 93 | | 94 | | Available Settings: "single", "daily", "syslog", "errorlog" 95 | | 96 | */ 97 | 98 | 'log' => 'single', 99 | 100 | /* 101 | |-------------------------------------------------------------------------- 102 | | Autoloaded Service Providers 103 | |-------------------------------------------------------------------------- 104 | | 105 | | The service providers listed here will be automatically loaded on the 106 | | request to your application. Feel free to add your own services to 107 | | this array to grant expanded functionality to your applications. 108 | | 109 | */ 110 | 111 | 'providers' => [ 112 | 113 | /* 114 | * Laravel Framework Service Providers... 115 | */ 116 | Illuminate\Foundation\Providers\ArtisanServiceProvider::class, 117 | Illuminate\Broadcasting\BroadcastServiceProvider::class, 118 | Illuminate\Bus\BusServiceProvider::class, 119 | Illuminate\Cache\CacheServiceProvider::class, 120 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, 121 | Illuminate\Routing\ControllerServiceProvider::class, 122 | Illuminate\Cookie\CookieServiceProvider::class, 123 | Illuminate\Database\DatabaseServiceProvider::class, 124 | Illuminate\Encryption\EncryptionServiceProvider::class, 125 | Illuminate\Filesystem\FilesystemServiceProvider::class, 126 | Illuminate\Foundation\Providers\FoundationServiceProvider::class, 127 | Illuminate\Hashing\HashServiceProvider::class, 128 | Illuminate\Mail\MailServiceProvider::class, 129 | Illuminate\Pagination\PaginationServiceProvider::class, 130 | Illuminate\Pipeline\PipelineServiceProvider::class, 131 | Illuminate\Queue\QueueServiceProvider::class, 132 | Illuminate\Redis\RedisServiceProvider::class, 133 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, 134 | Illuminate\Session\SessionServiceProvider::class, 135 | Illuminate\Translation\TranslationServiceProvider::class, 136 | Illuminate\Validation\ValidationServiceProvider::class, 137 | Illuminate\View\ViewServiceProvider::class, 138 | 139 | /* 140 | * Application Service Providers... 141 | */ 142 | Duplitron\Providers\AppServiceProvider::class, 143 | Duplitron\Providers\EventServiceProvider::class, 144 | Duplitron\Providers\RouteServiceProvider::class, 145 | Duplitron\Providers\LoaderServiceProvider::class, 146 | Duplitron\Providers\FingerprinterServiceProvider::class, 147 | 148 | ], 149 | 150 | /* 151 | |-------------------------------------------------------------------------- 152 | | Class Aliases 153 | |-------------------------------------------------------------------------- 154 | | 155 | | This array of class aliases will be registered when this application 156 | | is started. However, feel free to register as many as you wish as 157 | | the aliases are "lazy" loaded so they don't hinder performance. 158 | | 159 | */ 160 | 161 | 'aliases' => [ 162 | 163 | 'App' => Illuminate\Support\Facades\App::class, 164 | 'Artisan' => Illuminate\Support\Facades\Artisan::class, 165 | 'Auth' => Illuminate\Support\Facades\Auth::class, 166 | 'Blade' => Illuminate\Support\Facades\Blade::class, 167 | 'Bus' => Illuminate\Support\Facades\Bus::class, 168 | 'Cache' => Illuminate\Support\Facades\Cache::class, 169 | 'Config' => Illuminate\Support\Facades\Config::class, 170 | 'Cookie' => Illuminate\Support\Facades\Cookie::class, 171 | 'Crypt' => Illuminate\Support\Facades\Crypt::class, 172 | 'DB' => Illuminate\Support\Facades\DB::class, 173 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class, 174 | 'Event' => Illuminate\Support\Facades\Event::class, 175 | 'File' => Illuminate\Support\Facades\File::class, 176 | 'Gate' => Illuminate\Support\Facades\Gate::class, 177 | 'Hash' => Illuminate\Support\Facades\Hash::class, 178 | 'Input' => Illuminate\Support\Facades\Input::class, 179 | 'Inspiring' => Illuminate\Foundation\Inspiring::class, 180 | 'Lang' => Illuminate\Support\Facades\Lang::class, 181 | 'Log' => Illuminate\Support\Facades\Log::class, 182 | 'Mail' => Illuminate\Support\Facades\Mail::class, 183 | 'Password' => Illuminate\Support\Facades\Password::class, 184 | 'Queue' => Illuminate\Support\Facades\Queue::class, 185 | 'Redirect' => Illuminate\Support\Facades\Redirect::class, 186 | 'Redis' => Illuminate\Support\Facades\Redis::class, 187 | 'Request' => Illuminate\Support\Facades\Request::class, 188 | 'Response' => Illuminate\Support\Facades\Response::class, 189 | 'Route' => Illuminate\Support\Facades\Route::class, 190 | 'Schema' => Illuminate\Support\Facades\Schema::class, 191 | 'Session' => Illuminate\Support\Facades\Session::class, 192 | 'Storage' => Illuminate\Support\Facades\Storage::class, 193 | 'URL' => Illuminate\Support\Facades\URL::class, 194 | 'Validator' => Illuminate\Support\Facades\Validator::class, 195 | 'View' => Illuminate\Support\Facades\View::class, 196 | 197 | ], 198 | 199 | ]; 200 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | 'eloquent', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Authentication Model 23 | |-------------------------------------------------------------------------- 24 | | 25 | | When using the "Eloquent" authentication driver, we need to know which 26 | | Eloquent model should be used to retrieve your users. Of course, it 27 | | is often just the "User" model but you may use whatever you like. 28 | | 29 | */ 30 | 31 | 'model' => Duplitron\User::class, 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Authentication Table 36 | |-------------------------------------------------------------------------- 37 | | 38 | | When using the "Database" authentication driver, we need to know which 39 | | table should be used to retrieve your users. We have chosen a basic 40 | | default value but you may easily change it to any table you like. 41 | | 42 | */ 43 | 44 | 'table' => 'users', 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Password Reset Settings 49 | |-------------------------------------------------------------------------- 50 | | 51 | | Here you may set the options for resetting passwords including the view 52 | | that is your password reset e-mail. You can also set the name of the 53 | | table that maintains all of the reset tokens for your application. 54 | | 55 | | The expire time is the number of minutes that the reset token should be 56 | | considered valid. This security feature keeps tokens short-lived so 57 | | they have less time to be guessed. You may change this as needed. 58 | | 59 | */ 60 | 61 | 'password' => [ 62 | 'email' => 'emails.password', 63 | 'table' => 'password_resets', 64 | 'expire' => 60, 65 | ], 66 | 67 | ]; 68 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'pusher'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Broadcast Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may define all of the broadcast connections that will be used 24 | | to broadcast events to other systems or over websockets. Samples of 25 | | each available type of connection are provided inside this array. 26 | | 27 | */ 28 | 29 | 'connections' => [ 30 | 31 | 'pusher' => [ 32 | 'driver' => 'pusher', 33 | 'key' => env('PUSHER_KEY'), 34 | 'secret' => env('PUSHER_SECRET'), 35 | 'app_id' => env('PUSHER_APP_ID'), 36 | ], 37 | 38 | 'redis' => [ 39 | 'driver' => 'redis', 40 | 'connection' => 'default', 41 | ], 42 | 43 | 'log' => [ 44 | 'driver' => 'log', 45 | ], 46 | 47 | ], 48 | 49 | ]; 50 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Cache Stores 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may define all of the cache "stores" for your application as 24 | | well as their drivers. You may even define multiple stores for the 25 | | same cache driver to group types of items stored in your caches. 26 | | 27 | */ 28 | 29 | 'stores' => [ 30 | 31 | 'apc' => [ 32 | 'driver' => 'apc', 33 | ], 34 | 35 | 'array' => [ 36 | 'driver' => 'array', 37 | ], 38 | 39 | 'database' => [ 40 | 'driver' => 'database', 41 | 'table' => 'cache', 42 | 'connection' => null, 43 | ], 44 | 45 | 'file' => [ 46 | 'driver' => 'file', 47 | 'path' => storage_path('framework/cache'), 48 | ], 49 | 50 | 'memcached' => [ 51 | 'driver' => 'memcached', 52 | 'servers' => [ 53 | [ 54 | 'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100, 55 | ], 56 | ], 57 | ], 58 | 59 | 'redis' => [ 60 | 'driver' => 'redis', 61 | 'connection' => 'default', 62 | ], 63 | 64 | ], 65 | 66 | /* 67 | |-------------------------------------------------------------------------- 68 | | Cache Key Prefix 69 | |-------------------------------------------------------------------------- 70 | | 71 | | When utilizing a RAM based store such as APC or Memcached, there might 72 | | be other applications utilizing the same cache. So, we'll specify a 73 | | value to get prefixed to all our keys so we can avoid collisions. 74 | | 75 | */ 76 | 77 | 'prefix' => 'laravel', 78 | 79 | ]; 80 | -------------------------------------------------------------------------------- /config/compile.php: -------------------------------------------------------------------------------- 1 | [ 17 | // 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled File Providers 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may list service providers which define a "compiles" function 26 | | that returns additional files that should be compiled, providing an 27 | | easy way to get common files from any packages you are utilizing. 28 | | 29 | */ 30 | 31 | 'providers' => [ 32 | // 33 | ], 34 | 35 | ]; 36 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | PDO::FETCH_CLASS, 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Default Database Connection Name 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may specify which of the database connections below you wish 24 | | to use as your default connection for all database work. Of course 25 | | you may use many connections at once using the Database library. 26 | | 27 | */ 28 | 29 | 'default' => env('DB_CONNECTION', 'pgsql'), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Database Connections 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here are each of the database connections setup for your application. 37 | | Of course, examples of configuring each database platform that is 38 | | supported by Laravel is shown below to make development simple. 39 | | 40 | | 41 | | All database work in Laravel is done through the PHP PDO facilities 42 | | so make sure you have the driver for your particular database of 43 | | choice installed on your machine before you begin development. 44 | | 45 | */ 46 | 47 | 'connections' => [ 48 | 49 | 'sqlite' => [ 50 | 'driver' => 'sqlite', 51 | 'database' => storage_path('database.sqlite'), 52 | 'prefix' => '', 53 | ], 54 | 55 | 'mysql' => [ 56 | 'driver' => 'mysql', 57 | 'host' => env('DB_HOST', 'localhost'), 58 | 'database' => env('DB_DATABASE', 'forge'), 59 | 'username' => env('DB_USERNAME', 'forge'), 60 | 'password' => env('DB_PASSWORD', ''), 61 | 'charset' => 'utf8', 62 | 'collation' => 'utf8_unicode_ci', 63 | 'prefix' => '', 64 | 'strict' => false, 65 | ], 66 | 67 | 'pgsql' => [ 68 | 'driver' => 'pgsql', 69 | 'host' => env('DB_HOST', 'localhost'), 70 | 'database' => env('DB_DATABASE', 'forge'), 71 | 'username' => env('DB_USERNAME', 'forge'), 72 | 'password' => env('DB_PASSWORD', ''), 73 | 'charset' => 'utf8', 74 | 'prefix' => '', 75 | 'schema' => 'public', 76 | ], 77 | 78 | 'sqlsrv' => [ 79 | 'driver' => 'sqlsrv', 80 | 'host' => env('DB_HOST', 'localhost'), 81 | 'database' => env('DB_DATABASE', 'forge'), 82 | 'username' => env('DB_USERNAME', 'forge'), 83 | 'password' => env('DB_PASSWORD', ''), 84 | 'charset' => 'utf8', 85 | 'prefix' => '', 86 | ], 87 | 88 | ], 89 | 90 | /* 91 | |-------------------------------------------------------------------------- 92 | | Migration Repository Table 93 | |-------------------------------------------------------------------------- 94 | | 95 | | This table keeps track of all the migrations that have already run for 96 | | your application. Using this information, we can determine which of 97 | | the migrations on disk haven't actually been run in the database. 98 | | 99 | */ 100 | 101 | 'migrations' => 'migrations', 102 | 103 | /* 104 | |-------------------------------------------------------------------------- 105 | | Redis Databases 106 | |-------------------------------------------------------------------------- 107 | | 108 | | Redis is an open source, fast, and advanced key-value store that also 109 | | provides a richer set of commands than a typical key-value systems 110 | | such as APC or Memcached. Laravel makes it easy to dig right in. 111 | | 112 | */ 113 | 114 | 'redis' => [ 115 | 116 | 'cluster' => false, 117 | 118 | 'default' => [ 119 | 'host' => '127.0.0.1', 120 | 'port' => 6379, 121 | 'database' => 0, 122 | ], 123 | 124 | ], 125 | 126 | ]; 127 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | 'local', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Default Cloud Filesystem Disk 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Many applications store files both locally and in the cloud. For this 26 | | reason, you may specify a default "cloud" driver here. This driver 27 | | will be bound as the Cloud disk implementation in the container. 28 | | 29 | */ 30 | 31 | 'cloud' => 's3', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Filesystem Disks 36 | |-------------------------------------------------------------------------- 37 | | 38 | | Here you may configure as many filesystem "disks" as you wish, and you 39 | | may even configure multiple disks of the same driver. Defaults have 40 | | been setup for each driver as an example of the required options. 41 | | 42 | */ 43 | 44 | 'disks' => [ 45 | 46 | 'local' => [ 47 | 'driver' => 'local', 48 | 'root' => storage_path('app'), 49 | ], 50 | 51 | 'ftp' => [ 52 | 'driver' => 'ftp', 53 | 'host' => 'ftp.example.com', 54 | 'username' => 'your-username', 55 | 'password' => 'your-password', 56 | 57 | // Optional FTP Settings... 58 | // 'port' => 21, 59 | // 'root' => '', 60 | // 'passive' => true, 61 | // 'ssl' => true, 62 | // 'timeout' => 30, 63 | ], 64 | 65 | 's3' => [ 66 | 'driver' => 's3', 67 | 'key' => 'your-key', 68 | 'secret' => 'your-secret', 69 | 'region' => 'your-region', 70 | 'bucket' => 'your-bucket', 71 | ], 72 | 73 | 'rackspace' => [ 74 | 'driver' => 'rackspace', 75 | 'username' => 'your-username', 76 | 'key' => 'your-key', 77 | 'container' => 'your-container', 78 | 'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/', 79 | 'region' => 'IAD', 80 | 'url_type' => 'publicURL', 81 | ], 82 | 83 | ], 84 | 85 | ]; 86 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_DRIVER', 'smtp'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | SMTP Host Address 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may provide the host address of the SMTP server used by your 26 | | applications. A default option is provided that is compatible with 27 | | the Mailgun mail service which will provide reliable deliveries. 28 | | 29 | */ 30 | 31 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | SMTP Host Port 36 | |-------------------------------------------------------------------------- 37 | | 38 | | This is the SMTP port used by your application to deliver e-mails to 39 | | users of the application. Like the host we have set this value to 40 | | stay compatible with the Mailgun e-mail application by default. 41 | | 42 | */ 43 | 44 | 'port' => env('MAIL_PORT', 587), 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Global "From" Address 49 | |-------------------------------------------------------------------------- 50 | | 51 | | You may wish for all e-mails sent by your application to be sent from 52 | | the same address. Here, you may specify a name and address that is 53 | | used globally for all e-mails that are sent by your application. 54 | | 55 | */ 56 | 57 | 'from' => ['address' => null, 'name' => null], 58 | 59 | /* 60 | |-------------------------------------------------------------------------- 61 | | E-Mail Encryption Protocol 62 | |-------------------------------------------------------------------------- 63 | | 64 | | Here you may specify the encryption protocol that should be used when 65 | | the application send e-mail messages. A sensible default using the 66 | | transport layer security protocol should provide great security. 67 | | 68 | */ 69 | 70 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 71 | 72 | /* 73 | |-------------------------------------------------------------------------- 74 | | SMTP Server Username 75 | |-------------------------------------------------------------------------- 76 | | 77 | | If your SMTP server requires a username for authentication, you should 78 | | set it here. This will get used to authenticate with your server on 79 | | connection. You may also set the "password" value below this one. 80 | | 81 | */ 82 | 83 | 'username' => env('MAIL_USERNAME'), 84 | 85 | /* 86 | |-------------------------------------------------------------------------- 87 | | SMTP Server Password 88 | |-------------------------------------------------------------------------- 89 | | 90 | | Here you may set the password required by your SMTP server to send out 91 | | messages from your application. This will be given to the server on 92 | | connection so that the application will be able to send messages. 93 | | 94 | */ 95 | 96 | 'password' => env('MAIL_PASSWORD'), 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Sendmail System Path 101 | |-------------------------------------------------------------------------- 102 | | 103 | | When using the "sendmail" driver to send e-mails, we will need to know 104 | | the path to where Sendmail lives on this server. A default path has 105 | | been provided here, which will work well on most of your systems. 106 | | 107 | */ 108 | 109 | 'sendmail' => '/usr/sbin/sendmail -bs', 110 | 111 | /* 112 | |-------------------------------------------------------------------------- 113 | | Mail "Pretend" 114 | |-------------------------------------------------------------------------- 115 | | 116 | | When this option is enabled, e-mail will not actually be sent over the 117 | | web and will instead be written to your application's logs files so 118 | | you may inspect the message. This is great for local development. 119 | | 120 | */ 121 | 122 | 'pretend' => false, 123 | 124 | ]; 125 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_DRIVER', 'database'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Queue Connections 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may configure the connection information for each server that 27 | | is used by your application. A default configuration has been added 28 | | for each back-end shipped with Laravel. You are free to add more. 29 | | 30 | */ 31 | 32 | 'connections' => [ 33 | 34 | 'sync' => [ 35 | 'driver' => 'sync', 36 | ], 37 | 38 | 'database' => [ 39 | 'driver' => 'database', 40 | 'table' => 'jobs', 41 | 'queue' => 'default', 42 | 'expire' => 36000, 43 | ], 44 | 45 | 'beanstalkd' => [ 46 | 'driver' => 'beanstalkd', 47 | 'host' => 'localhost', 48 | 'queue' => 'default', 49 | 'ttr' => 36000, 50 | ], 51 | 52 | 'sqs' => [ 53 | 'driver' => 'sqs', 54 | 'key' => 'your-public-key', 55 | 'secret' => 'your-secret-key', 56 | 'queue' => 'your-queue-url', 57 | 'region' => 'us-east-1', 58 | ], 59 | 60 | 'iron' => [ 61 | 'driver' => 'iron', 62 | 'host' => 'mq-aws-us-east-1.iron.io', 63 | 'token' => 'your-token', 64 | 'project' => 'your-project-id', 65 | 'queue' => 'your-queue-name', 66 | 'encrypt' => true, 67 | ], 68 | 69 | 'redis' => [ 70 | 'driver' => 'redis', 71 | 'connection' => 'default', 72 | 'queue' => 'default', 73 | 'expire' => 3600, 74 | ], 75 | 76 | ], 77 | 78 | /* 79 | |-------------------------------------------------------------------------- 80 | | Failed Queue Jobs 81 | |-------------------------------------------------------------------------- 82 | | 83 | | These options configure the behavior of failed queue job logging so you 84 | | can control which database and table are used to store the jobs that 85 | | have failed. You may change them to any database / table you wish. 86 | | 87 | */ 88 | 89 | 'failed' => [ 90 | 'database' => 'pgsql', 'table' => 'failed_jobs', 91 | ], 92 | 93 | ]; 94 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | ], 21 | 22 | 'mandrill' => [ 23 | 'secret' => env('MANDRILL_SECRET'), 24 | ], 25 | 26 | 'ses' => [ 27 | 'key' => env('SES_KEY'), 28 | 'secret' => env('SES_SECRET'), 29 | 'region' => 'us-east-1', 30 | ], 31 | 32 | 'stripe' => [ 33 | 'model' => Duplitron\User::class, 34 | 'key' => env('STRIPE_KEY'), 35 | 'secret' => env('STRIPE_SECRET'), 36 | ], 37 | 38 | ]; 39 | -------------------------------------------------------------------------------- /config/session.php: -------------------------------------------------------------------------------- 1 | env('SESSION_DRIVER', 'file'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Session Lifetime 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may specify the number of minutes that you wish the session 27 | | to be allowed to remain idle before it expires. If you want them 28 | | to immediately expire on the browser closing, set that option. 29 | | 30 | */ 31 | 32 | 'lifetime' => 120, 33 | 34 | 'expire_on_close' => false, 35 | 36 | /* 37 | |-------------------------------------------------------------------------- 38 | | Session Encryption 39 | |-------------------------------------------------------------------------- 40 | | 41 | | This option allows you to easily specify that all of your session data 42 | | should be encrypted before it is stored. All encryption will be run 43 | | automatically by Laravel and you can use the Session like normal. 44 | | 45 | */ 46 | 47 | 'encrypt' => false, 48 | 49 | /* 50 | |-------------------------------------------------------------------------- 51 | | Session File Location 52 | |-------------------------------------------------------------------------- 53 | | 54 | | When using the native session driver, we need a location where session 55 | | files may be stored. A default has been set for you but a different 56 | | location may be specified. This is only needed for file sessions. 57 | | 58 | */ 59 | 60 | 'files' => storage_path('framework/sessions'), 61 | 62 | /* 63 | |-------------------------------------------------------------------------- 64 | | Session Database Connection 65 | |-------------------------------------------------------------------------- 66 | | 67 | | When using the "database" or "redis" session drivers, you may specify a 68 | | connection that should be used to manage these sessions. This should 69 | | correspond to a connection in your database configuration options. 70 | | 71 | */ 72 | 73 | 'connection' => null, 74 | 75 | /* 76 | |-------------------------------------------------------------------------- 77 | | Session Database Table 78 | |-------------------------------------------------------------------------- 79 | | 80 | | When using the "database" session driver, you may specify the table we 81 | | should use to manage the sessions. Of course, a sensible default is 82 | | provided for you; however, you are free to change this as needed. 83 | | 84 | */ 85 | 86 | 'table' => 'sessions', 87 | 88 | /* 89 | |-------------------------------------------------------------------------- 90 | | Session Sweeping Lottery 91 | |-------------------------------------------------------------------------- 92 | | 93 | | Some session drivers must manually sweep their storage location to get 94 | | rid of old sessions from storage. Here are the chances that it will 95 | | happen on a given request. By default, the odds are 2 out of 100. 96 | | 97 | */ 98 | 99 | 'lottery' => [2, 100], 100 | 101 | /* 102 | |-------------------------------------------------------------------------- 103 | | Session Cookie Name 104 | |-------------------------------------------------------------------------- 105 | | 106 | | Here you may change the name of the cookie used to identify a session 107 | | instance by ID. The name specified here will get used every time a 108 | | new session cookie is created by the framework for every driver. 109 | | 110 | */ 111 | 112 | 'cookie' => 'laravel_session', 113 | 114 | /* 115 | |-------------------------------------------------------------------------- 116 | | Session Cookie Path 117 | |-------------------------------------------------------------------------- 118 | | 119 | | The session cookie path determines the path for which the cookie will 120 | | be regarded as available. Typically, this will be the root path of 121 | | your application but you are free to change this when necessary. 122 | | 123 | */ 124 | 125 | 'path' => '/', 126 | 127 | /* 128 | |-------------------------------------------------------------------------- 129 | | Session Cookie Domain 130 | |-------------------------------------------------------------------------- 131 | | 132 | | Here you may change the domain of the cookie used to identify a session 133 | | in your application. This will determine which domains the cookie is 134 | | available to in your application. A sensible default has been set. 135 | | 136 | */ 137 | 138 | 'domain' => null, 139 | 140 | /* 141 | |-------------------------------------------------------------------------- 142 | | HTTPS Only Cookies 143 | |-------------------------------------------------------------------------- 144 | | 145 | | By setting this option to true, session cookies will only be sent back 146 | | to the server if the browser has a HTTPS connection. This will keep 147 | | the cookie from being sent to you if it can not be done securely. 148 | | 149 | */ 150 | 151 | 'secure' => false, 152 | 153 | ]; 154 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | realpath(base_path('resources/views')), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => realpath(storage_path('framework/views')), 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /database/factories/ModelFactory.php: -------------------------------------------------------------------------------- 1 | define(Duplitron\User::class, function (Faker\Generator $faker) { 15 | return [ 16 | 'name' => $faker->name, 17 | 'email' => $faker->email, 18 | 'password' => bcrypt(str_random(10)), 19 | 'remember_token' => str_random(10), 20 | ]; 21 | }); 22 | -------------------------------------------------------------------------------- /database/migrations/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slifty/tvarchive-duplitron/71573fb84c497275dade888324bdc94b31df4db7/database/migrations/.gitkeep -------------------------------------------------------------------------------- /database/migrations/2015_09_13_185000_create_projects_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 19 | $table->text('name'); 20 | $table->timestamps(); 21 | 22 | // Create indexes 23 | $table->unique('name'); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::drop('projects'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/migrations/2015_09_13_185400_create_media_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 19 | $table->integer('project_id'); 20 | $table->integer('base_media_id')->nullable(); 21 | $table->text('media_path'); 22 | $table->text('afpt_path')->nullable(); 23 | $table->text('external_id')->nullable(); 24 | $table->text('start'); 25 | $table->text('duration'); 26 | $table->boolean('is_potential_target')->default(false); 27 | $table->boolean('is_corpus')->default(false); 28 | $table->boolean('is_distractor')->default(false); 29 | $table->boolean('is_target')->default(false); 30 | $table->text('potential_target_database')->nullable(); 31 | $table->text('corpus_database')->nullable(); 32 | $table->text('distractor_database')->nullable(); 33 | $table->text('target_database')->nullable(); 34 | $table->timestamps(); 35 | 36 | // Create indexes 37 | $table->foreign('project_id')->references('id')->on('projects') 38 | ->onDelete('cascade'); 39 | $table->foreign('base_media_id')->references('id')->on('media') 40 | ->onDelete('cascade'); 41 | }); 42 | } 43 | 44 | /** 45 | * Reverse the migrations. 46 | * 47 | * @return void 48 | */ 49 | public function down() 50 | { 51 | Schema::drop('media'); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /database/migrations/2015_09_13_185724_create_tasks_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 19 | $table->integer('media_id'); 20 | $table->integer('attempts')->nullable(); 21 | $table->string('type'); 22 | $table->string('status_code')->nullable(); 23 | $table->string('result_code')->nullable(); 24 | $table->json('result_data')->nullable(); 25 | $table->json('result_output')->nullable(); 26 | $table->timestamps(); 27 | 28 | // Create indexes 29 | $table->foreign('media_id')->references('id')->on('media') 30 | ->onDelete('cascade'); 31 | }); 32 | } 33 | 34 | /** 35 | * Reverse the migrations. 36 | * 37 | * @return void 38 | */ 39 | public function down() 40 | { 41 | Schema::drop('tasks'); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /database/migrations/2015_09_20_215721_create_jobs_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 17 | $table->string('queue'); 18 | $table->longText('payload'); 19 | $table->tinyInteger('attempts')->unsigned(); 20 | $table->tinyInteger('reserved')->unsigned(); 21 | $table->unsignedInteger('reserved_at')->nullable(); 22 | $table->unsignedInteger('available_at'); 23 | $table->unsignedInteger('created_at'); 24 | $table->index(['queue', 'reserved', 'reserved_at']); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::drop('jobs'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /database/migrations/2015_10_12_121235_create_matches_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 17 | $table->integer('destination_id'); 18 | $table->integer('source_id'); 19 | 20 | $table->decimal('duration'); 21 | $table->decimal('destination_start'); 22 | $table->decimal('source_start'); 23 | $table->timestamps(); 24 | 25 | // Create indexes 26 | $table->foreign('destination_id')->references('id')->on('media') 27 | ->onDelete('cascade'); 28 | $table->foreign('source_id')->references('id')->on('media') 29 | ->onDelete('cascade'); 30 | 31 | $table->unique(array('destination_id', 'source_id', 'destination_start', 'source_start')); 32 | }); 33 | } 34 | 35 | /** 36 | * Reverse the migrations. 37 | * 38 | * @return void 39 | */ 40 | public function down() 41 | { 42 | Schema::drop('matches'); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /database/migrations/2015_12_02_003713_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->text('connection'); 18 | $table->text('queue'); 19 | $table->longText('payload'); 20 | $table->timestamp('failed_at'); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::drop('failed_jobs'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /database/migrations/2016_02_29_00216_rename_tasks_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 19 | $table->integer('project_id'); 20 | $table->integer('attempts')->nullable(); 21 | $table->string('type'); 22 | $table->string('status_code')->nullable(); 23 | $table->string('result_code')->nullable(); 24 | $table->json('result_data')->nullable(); 25 | $table->json('result_output')->nullable(); 26 | $table->timestamps(); 27 | 28 | // Create indexes 29 | $table->foreign('project_id')->references('id')->on('projects') 30 | ->onDelete('cascade'); 31 | }); 32 | } 33 | 34 | /** 35 | * Reverse the migrations. 36 | * 37 | * @return void 38 | */ 39 | public function down() 40 | { 41 | Schema::drop('project_tasks'); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /database/migrations/2016_11_22_120103_update_media_tasks_table.php: -------------------------------------------------------------------------------- 1 | string('parameters')->nullable(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::table('media_tasks', function (Blueprint $table) { 30 | 31 | // Remove fields 32 | $table->removeColumn('parameters'); 33 | }); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/seeds/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slifty/tvarchive-duplitron/71573fb84c497275dade888324bdc94b31df4db7/database/seeds/.gitkeep -------------------------------------------------------------------------------- /database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(UserTableSeeder::class); 18 | 19 | Model::reguard(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /docs/api.md: -------------------------------------------------------------------------------- 1 | ## Projects 2 | 3 | ###### Project Object JSON 4 | 5 | ```json 6 | { 7 | "id": 12, 8 | "name": "Political Ads" 9 | } 10 | ``` 11 | 12 | ### Create Project 13 | 14 | Creates and returns json data about a single new matching project. 15 | 16 | ##### URL 17 | 18 | `/projects` 19 | 20 | ##### Method 21 | 22 | `POST` 23 | 24 | ##### URL Params 25 | 26 | `None` 27 | 28 | ##### Data Params 29 | 30 | ###### Required 31 | 32 | * `name`: A unique name for the project. 33 | 34 | ###### Example 35 | 36 | ```json 37 | { 38 | "name" : "Political Ads" 39 | } 40 | ``` 41 | 42 | ##### Success Response 43 | 44 | Code | Content 45 | --- |:--- 46 | 200 | Project Object JSON 47 | 48 | ##### Error Response 49 | 50 | Code | Content 51 | --- |:--- 52 | 400 | `{ error : "Project name already exists" }` 53 | 54 | 55 | ##### Sample Call 56 | 57 | ```javascript 58 | $.ajax({ 59 | url: "/projects", 60 | dataType: "json", 61 | data: [ 62 | "name": "Political Ads" 63 | ] 64 | type : "POST", 65 | success : function(r) { 66 | console.log(r); 67 | } 68 | }); 69 | ``` 70 | 71 | ---------- 72 | 73 | ### Get Project 74 | 75 | Returns json data about a single project. 76 | 77 | ##### URL 78 | 79 | `/projects/:id` 80 | 81 | ##### Method 82 | 83 | `GET` 84 | 85 | ##### URL Params 86 | 87 | ###### Required 88 | 89 | * `id`: The ID of the project being retrieved. 90 | 91 | ##### Data Params 92 | 93 | `None` 94 | 95 | ##### Success Response 96 | 97 | Code | Content 98 | --- |:--- 99 | 200 | Project Object JSON 100 | 101 | 102 | ##### Error Response 103 | 104 | Code | Content 105 | --- |:--- 106 | 404 | `{ error : "The requested object could not be found" }` 107 | 108 | ##### Sample Call 109 | 110 | ```javascript 111 | $.ajax({ 112 | url: "/projects/1", 113 | dataType: "json", 114 | type : "GET", 115 | success : function(r) { 116 | console.log(r); 117 | } 118 | }); 119 | ``` 120 | 121 | ---------- 122 | 123 | ## Media 124 | 125 | ###### Media Object JSON 126 | 127 | ```json 128 | { 129 | "id": 12, 130 | "match_categorization": { 131 | "is_potential_target": true, 132 | "is_corpus": false, 133 | "is_distractor": false, 134 | "is_target": false 135 | }, 136 | "tasks": [], 137 | "project_id": 12, 138 | "media_path": "", 139 | "afpt_path": "" 140 | } 141 | ``` 142 | 143 | 144 | ### Create Media 145 | 146 | Creates and returns json data about a single new media project. 147 | 148 | ##### URL 149 | 150 | `/media` 151 | 152 | ##### Method 153 | 154 | `POST` 155 | 156 | ##### URL Params 157 | 158 | `None` 159 | 160 | ##### Data Params 161 | 162 | ###### Required 163 | 164 | * `project_id`: The ID of the project that the media file will be compared with 165 | * `media_path`: A path to the media file itself. This path can be in the following format: 166 | * **Network path**: `ssh://user@example.domain/path/to/file/from/root` which will result in an rsync to retrieve the file. 167 | 168 | ###### Optional 169 | 170 | * `afpt_path`: A path to the pre-processed audio fingerprint file. See the `media_path` documentation for format details. 171 | 172 | ###### Example 173 | 174 | ```json 175 | { 176 | "project_id": 12, 177 | "media_path": "ssh://jdoe@example.com/home/jdoe/media/rickroll.mp3", 178 | "afpt_path": "ssh://jdoe@example.com/home/jdoe/media/rickroll.afpt" 179 | } 180 | ``` 181 | 182 | ##### Success Response 183 | 184 | Code | Content 185 | --- |:--- 186 | 200 | Media Object JSON 187 | 188 | ##### Error Response 189 | 190 | Code | Content 191 | --- |:--- 192 | 400 | `{ error : "You did not include all required fields" }` 193 | 194 | 195 | ##### Sample Call 196 | 197 | ```javascript 198 | $.ajax({ 199 | url: "/media", 200 | dataType: "json", 201 | data: [ 202 | "name": "Political Ads" 203 | ] 204 | type : "POST", 205 | success : function(r) { 206 | console.log(r); 207 | } 208 | }); 209 | ``` 210 | 211 | ---------- 212 | 213 | ### Get Media 214 | 215 | ##### URL 216 | 217 | `/media/:id` 218 | 219 | ##### Method 220 | 221 | `GET` 222 | 223 | ##### URL Params 224 | 225 | ###### Required: 226 | 227 | * `id`: the identifier for a media record. 228 | 229 | ##### Data Params 230 | 231 | `None` 232 | 233 | ##### Success Response 234 | 235 | Code | Content 236 | --- |:--- 237 | 200 | Media Object JSON 238 | 239 | ##### Error Response 240 | 241 | Code | Content 242 | --- |:--- 243 | 404 | `{ error : "The requested object could not be found" }` 244 | 245 | ##### Sample Call 246 | 247 | ```javascript 248 | $.ajax({ 249 | url: "/media/12", 250 | dataType: "json", 251 | type : "GET", 252 | success : function(r) { 253 | console.log(r); 254 | } 255 | }); 256 | ``` 257 | 258 | 259 | ---------- 260 | 261 | ## MediaTasks 262 | 263 | ###### MediaTask Object JSON 264 | 265 | ```json 266 | { 267 | "id": 12, 268 | "media_id": 12, 269 | "type": "match", 270 | "status": { 271 | "code": 0, 272 | "description": "New task." 273 | }, 274 | "result": { 275 | "code": 1, 276 | "data": {}, 277 | "output": [ 278 | "Lines of output", 279 | "from the process" 280 | ] 281 | } 282 | } 283 | ``` 284 | 285 | ###### MediaTask Statuses 286 | 287 | Code | Description 288 | --- |:--- 289 | 0 | New task 290 | 1 | Starting 291 | 2 | In Progress 292 | 3 | Finished 293 | -1 | Failed 294 | 295 | ###### Result Codes 296 | 297 | Code | Description 298 | --- |:--- 299 | 1 | Success 300 | 0 | Fail 301 | 302 | 303 | 304 | ###### MediaTask Types 305 | 306 | * `match`: compare the media with the project fingerprints. 307 | 308 | ```json 309 | "data": { 310 | "matches": [{ 311 | "media_id": 13, 312 | "start_time": 15.32, 313 | "duration": 30, 314 | }], 315 | "segments": [{ 316 | "segment_type": "potential_target", 317 | "start_time": "", 318 | "duration": "" 319 | }] 320 | } 321 | ``` 322 | 323 | * `corpus_add`: save the media as a corpus item. 324 | * `potential_target_add`: add the media as a potential target item. 325 | * `distractor_add`: add the media as a distractor item. 326 | * `target_add`: add the media as a target item. 327 | 328 | ####### Match results 329 | 330 | 331 | ### Create MediaTask 332 | 333 | Once media is registered in the system it can be processed using fingerprinting and matching algorithms. These activities can be intense, so they are handled by a task queue (instead of being synchronous). 334 | 335 | ##### URL 336 | 337 | `/tasks` 338 | 339 | ##### Method 340 | 341 | `POST` 342 | 343 | ##### URL Params 344 | 345 | `None` 346 | 347 | ##### Data Params 348 | 349 | ###### Required 350 | 351 | * `media_id`: The ID of the media file that this task will be invoked on. 352 | * `type`: The type of task to be performed (see "MediaTask Types") 353 | 354 | ###### Optional 355 | 356 | `None` 357 | 358 | ###### Example 359 | 360 | ```json 361 | { 362 | "media_id": 12, 363 | "type": "match" 364 | } 365 | ``` 366 | 367 | ##### Success Response 368 | 369 | Code | Content 370 | --- |:--- 371 | 200 | MediaTask Object JSON 372 | 373 | ##### Error Response 374 | 375 | Code | Content 376 | --- |:--- 377 | 400 | `{ error : "You did not include all required fields" }` 378 | 379 | 380 | ##### Sample Call 381 | 382 | ```javascript 383 | $.ajax({ 384 | url: "/tasks", 385 | dataType: "json", 386 | data: [ 387 | "media_id": 12, 388 | "type": "match" 389 | ] 390 | type : "POST", 391 | success : function(r) { 392 | console.log(r); 393 | } 394 | }); 395 | ``` 396 | 397 | ---------- 398 | 399 | ### Get MediaTask 400 | 401 | ##### URL 402 | 403 | `/tasks/:id` 404 | 405 | ##### Method 406 | 407 | `GET` 408 | 409 | 410 | ##### URL Params 411 | 412 | ###### Required 413 | 414 | * `id`: The ID of the task being retrieved. 415 | 416 | ##### Data Params 417 | 418 | `None` 419 | 420 | ##### Success Response 421 | 422 | Code | Content 423 | --- |:--- 424 | 200 | Project Object JSON 425 | 426 | 427 | ##### Error Response 428 | 429 | Code | Content 430 | --- |:--- 431 | 404 | `{ error : "The requested object could not be found" }` 432 | 433 | 434 | ##### Sample Call 435 | 436 | ```javascript 437 | $.ajax({ 438 | url: "/tasks/12", 439 | dataType: "json", 440 | type : "GET", 441 | success : function(r) { 442 | console.log(r); 443 | } 444 | }); 445 | ``` 446 | -------------------------------------------------------------------------------- /docs/workflow.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slifty/tvarchive-duplitron/71573fb84c497275dade888324bdc94b31df4db7/docs/workflow.pdf -------------------------------------------------------------------------------- /fingerprinting-worker.conf.example: -------------------------------------------------------------------------------- 1 | [program:fingerprinting-worker] 2 | process_name=%(program_name)s_%(process_num)02d 3 | command=php /var/www/tvarchive-fingerprinting/artisan queue:listen database --timeout=0 --memory=500 --tries=1 4 | autostart=true 5 | autorestart=true 6 | user=$(whoami) 7 | numprocs=20 8 | stdout_logfile=/var/www/tvarchive-fingerprinting/storage/logs/fingerprinting-worker.log 9 | stderr_logfile=/var/www/tvarchive-fingerprinting/storage/logs/fingerprinting-worker-errors.log 10 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var elixir = require('laravel-elixir'); 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Elixir Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Elixir provides a clean, fluent API for defining some basic Gulp tasks 9 | | for your Laravel application. By default, we are compiling the Sass 10 | | file for our application, as well as publishing vendor resources. 11 | | 12 | */ 13 | 14 | elixir(function(mix) { 15 | mix.sass('app.scss'); 16 | }); 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "devDependencies": { 4 | "gulp": "^3.8.8" 5 | }, 6 | "dependencies": { 7 | "laravel-elixir": "^3.0.0", 8 | "bootstrap-sass": "^3.0.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /phpspec.yml: -------------------------------------------------------------------------------- 1 | suites: 2 | main: 3 | namespace: Duplitron 4 | psr4_prefix: Duplitron 5 | src_path: app -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | ./tests/ 15 | 16 | 17 | 18 | 19 | app/ 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Redirect Trailing Slashes If Not A Folder... 9 | RewriteCond %{REQUEST_FILENAME} !-d 10 | RewriteRule ^(.*)/$ /$1 [L,R=301] 11 | 12 | # Handle Front Controller... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_FILENAME} !-f 15 | RewriteRule ^ index.php [L] 16 | 17 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slifty/tvarchive-duplitron/71573fb84c497275dade888324bdc94b31df4db7/public/favicon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | /* 11 | |-------------------------------------------------------------------------- 12 | | Register The Auto Loader 13 | |-------------------------------------------------------------------------- 14 | | 15 | | Composer provides a convenient, automatically generated class loader for 16 | | our application. We just need to utilize it! We'll simply require it 17 | | into the script here so that we don't have to worry about manual 18 | | loading any of our classes later on. It feels nice to relax. 19 | | 20 | */ 21 | 22 | require __DIR__.'/../bootstrap/autoload.php'; 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Turn On The Lights 27 | |-------------------------------------------------------------------------- 28 | | 29 | | We need to illuminate PHP development, so let us turn on the lights. 30 | | This bootstraps the framework and gets it ready for use, then it 31 | | will load up this application so that we can run it and send 32 | | the responses back to the browser and delight our users. 33 | | 34 | */ 35 | 36 | $app = require_once __DIR__.'/../bootstrap/app.php'; 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Run The Application 41 | |-------------------------------------------------------------------------- 42 | | 43 | | Once we have the application, we can handle the incoming request 44 | | through the kernel, and send the associated response back to 45 | | the client's browser allowing them to enjoy the creative 46 | | and wonderful application we have prepared for them. 47 | | 48 | */ 49 | 50 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); 51 | 52 | $response = $kernel->handle( 53 | $request = Illuminate\Http\Request::capture() 54 | ); 55 | 56 | $response->send(); 57 | 58 | $kernel->terminate($request, $response); 59 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /reset.sh: -------------------------------------------------------------------------------- 1 | docker ps -a | awk '{print $1}' | xargs docker rm 2 | sudo find storage/audfprint/media_cache/ -not -name ".gitkeep" -print0 | xargs -0 rm 3 | sudo rm -fr storage/audfprint/pklz_cache/* 4 | sudo find storage/audfprint/afpt_cache/ -not -name ".gitkeep" -print0 | xargs -0 rm 5 | sudo rm storage/audfprint/flocks/* 6 | php artisan migrate:refresh 7 | -------------------------------------------------------------------------------- /resources/assets/sass/app.scss: -------------------------------------------------------------------------------- 1 | // @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap"; 2 | 3 | -------------------------------------------------------------------------------- /resources/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Passwords must be at least six characters and match the confirmation.', 17 | 'reset' => 'Your password has been reset!', 18 | 'sent' => 'We have e-mailed your password reset link!', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that e-mail address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /resources/lang/en/validation.php: -------------------------------------------------------------------------------- 1 | 'The :attribute must be accepted.', 17 | 'active_url' => 'The :attribute is not a valid URL.', 18 | 'after' => 'The :attribute must be a date after :date.', 19 | 'alpha' => 'The :attribute may only contain letters.', 20 | 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', 21 | 'alpha_num' => 'The :attribute may only contain letters and numbers.', 22 | 'array' => 'The :attribute must be an array.', 23 | 'before' => 'The :attribute must be a date before :date.', 24 | 'between' => [ 25 | 'numeric' => 'The :attribute must be between :min and :max.', 26 | 'file' => 'The :attribute must be between :min and :max kilobytes.', 27 | 'string' => 'The :attribute must be between :min and :max characters.', 28 | 'array' => 'The :attribute must have between :min and :max items.', 29 | ], 30 | 'boolean' => 'The :attribute field must be true or false.', 31 | 'confirmed' => 'The :attribute confirmation does not match.', 32 | 'date' => 'The :attribute is not a valid date.', 33 | 'date_format' => 'The :attribute does not match the format :format.', 34 | 'different' => 'The :attribute and :other must be different.', 35 | 'digits' => 'The :attribute must be :digits digits.', 36 | 'digits_between' => 'The :attribute must be between :min and :max digits.', 37 | 'email' => 'The :attribute must be a valid email address.', 38 | 'exists' => 'The selected :attribute is invalid.', 39 | 'filled' => 'The :attribute field is required.', 40 | 'image' => 'The :attribute must be an image.', 41 | 'in' => 'The selected :attribute is invalid.', 42 | 'integer' => 'The :attribute must be an integer.', 43 | 'ip' => 'The :attribute must be a valid IP address.', 44 | 'json' => 'The :attribute must be a valid JSON string.', 45 | 'max' => [ 46 | 'numeric' => 'The :attribute may not be greater than :max.', 47 | 'file' => 'The :attribute may not be greater than :max kilobytes.', 48 | 'string' => 'The :attribute may not be greater than :max characters.', 49 | 'array' => 'The :attribute may not have more than :max items.', 50 | ], 51 | 'mimes' => 'The :attribute must be a file of type: :values.', 52 | 'min' => [ 53 | 'numeric' => 'The :attribute must be at least :min.', 54 | 'file' => 'The :attribute must be at least :min kilobytes.', 55 | 'string' => 'The :attribute must be at least :min characters.', 56 | 'array' => 'The :attribute must have at least :min items.', 57 | ], 58 | 'not_in' => 'The selected :attribute is invalid.', 59 | 'numeric' => 'The :attribute must be a number.', 60 | 'regex' => 'The :attribute format is invalid.', 61 | 'required' => 'The :attribute field is required.', 62 | 'required_if' => 'The :attribute field is required when :other is :value.', 63 | 'required_with' => 'The :attribute field is required when :values is present.', 64 | 'required_with_all' => 'The :attribute field is required when :values is present.', 65 | 'required_without' => 'The :attribute field is required when :values is not present.', 66 | 'required_without_all' => 'The :attribute field is required when none of :values are present.', 67 | 'same' => 'The :attribute and :other must match.', 68 | 'size' => [ 69 | 'numeric' => 'The :attribute must be :size.', 70 | 'file' => 'The :attribute must be :size kilobytes.', 71 | 'string' => 'The :attribute must be :size characters.', 72 | 'array' => 'The :attribute must contain :size items.', 73 | ], 74 | 'string' => 'The :attribute must be a string.', 75 | 'timezone' => 'The :attribute must be a valid zone.', 76 | 'unique' => 'The :attribute has already been taken.', 77 | 'url' => 'The :attribute format is invalid.', 78 | 79 | /* 80 | |-------------------------------------------------------------------------- 81 | | Custom Validation Language Lines 82 | |-------------------------------------------------------------------------- 83 | | 84 | | Here you may specify custom validation messages for attributes using the 85 | | convention "attribute.rule" to name the lines. This makes it quick to 86 | | specify a specific custom language line for a given attribute rule. 87 | | 88 | */ 89 | 90 | 'custom' => [ 91 | 'attribute-name' => [ 92 | 'rule-name' => 'custom-message', 93 | ], 94 | ], 95 | 96 | /* 97 | |-------------------------------------------------------------------------- 98 | | Custom Validation Attributes 99 | |-------------------------------------------------------------------------- 100 | | 101 | | The following language lines are used to swap attribute place-holders 102 | | with something more reader friendly such as E-Mail Address instead 103 | | of "email". This simply helps us make messages a little cleaner. 104 | | 105 | */ 106 | 107 | 'attributes' => [], 108 | 109 | ]; 110 | -------------------------------------------------------------------------------- /resources/views/errors/503.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Be right back. 5 | 6 | 7 | 8 | 39 | 40 | 41 |
42 |
43 |
Be right back.
44 |
45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /resources/views/vendor/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slifty/tvarchive-duplitron/71573fb84c497275dade888324bdc94b31df4db7/resources/views/vendor/.gitkeep -------------------------------------------------------------------------------- /resources/views/welcome.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Laravel 5 | 6 | 7 | 8 | 37 | 38 | 39 |
40 |
41 |
Laravel 5
42 |
43 |
44 | 45 | 46 | -------------------------------------------------------------------------------- /server.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | $uri = urldecode( 11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 12 | ); 13 | 14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 15 | // built-in PHP web server. This provides a convenient way to test a Laravel 16 | // application without having installed a "real" web server software here. 17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /storage/audfprint/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slifty/tvarchive-duplitron/71573fb84c497275dade888324bdc94b31df4db7/storage/audfprint/.gitkeep -------------------------------------------------------------------------------- /storage/audfprint/afpt_cache/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slifty/tvarchive-duplitron/71573fb84c497275dade888324bdc94b31df4db7/storage/audfprint/afpt_cache/.gitkeep -------------------------------------------------------------------------------- /storage/audfprint/flocks/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slifty/tvarchive-duplitron/71573fb84c497275dade888324bdc94b31df4db7/storage/audfprint/flocks/.gitkeep -------------------------------------------------------------------------------- /storage/audfprint/media_cache/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slifty/tvarchive-duplitron/71573fb84c497275dade888324bdc94b31df4db7/storage/audfprint/media_cache/.gitkeep -------------------------------------------------------------------------------- /storage/audfprint/pklz_cache/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slifty/tvarchive-duplitron/71573fb84c497275dade888324bdc94b31df4db7/storage/audfprint/pklz_cache/.gitkeep -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | compiled.php 4 | services.json 5 | events.scanned.php 6 | routes.scanned.php 7 | down 8 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /tests/ExampleTest.php: -------------------------------------------------------------------------------- 1 | visit('/') 17 | ->see('Laravel 5'); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); 22 | 23 | return $app; 24 | } 25 | } 26 | --------------------------------------------------------------------------------