Example #1
0
 public function __construct(User $user)
 {
     $this->user = $user;
     $torrentDB = new TorrentDB();
     $fileDB = new FileDB();
     foreach ($this->user->torrentHashes as $hash) {
         $torrent = $torrentDB->get($hash);
         $files = $fileDB->getTorrentFiles($torrent);
         foreach ($files as $file) {
             // If file is a "music" file
             if ($file->type == File::MUSIC_TYPE) {
                 $this->process($file);
             }
         }
     }
 }