Skip to content

Commit

Permalink
Folder can be specified from commandline. Cleaned up todo-list.
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzy76 committed Aug 23, 2015
1 parent b70b0d5 commit 243d17d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions medials
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,29 @@ Håvard Pedersen (fuzzy76)
TODO
- Filetype filtering (skip unknown files?)
- Filesize reporting
- Sort files (for now, pipe into sort)
- Intelligent tabulation
- Subtitle languages(?)
- Do not regard png as video
- Ignore folders
- Do not regard png as video streams
*/

$mf = new MediaFolder('.');
$folder = isset($argv[1]) ? $argv[1] : '.';
$mf = new MediaFolder($folder);
$mf->process();

class MediaFolder {
public $found = array();
function __construct($name) {
if ($handle = opendir($name)) {
while (false !== ($entry = readdir($handle))) {
if (substr($entry,0,1) != '.' && (is_file($entry))) { // Only process visible files
$this->found[] = $name . DIRECTORY_SEPARATOR . $entry;
$fullname = $name . DIRECTORY_SEPARATOR . $entry;
if (substr($entry,0,1) != '.' && (is_file($fullname))) { // Only process visible files
$this->found[] = $fullname;
}
}
closedir($handle);
sort($this->found);
} else {
echo "ERROR: Could not open directory!\n";
}
}

Expand Down

0 comments on commit 243d17d

Please sign in to comment.