Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a script to copy the disc images and image files. Also add in jsb…
…eeb.
- Loading branch information
Showing
3 changed files
with
109 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
web/includes/config.php | ||
web/gameimg/discs | ||
web/gameimg/screenshots | ||
web/jsbeeb | ||
*.log | ||
.vagrant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
require dirname(__FILE__) . '/../web/includes/config.php'; | ||
require dirname(__FILE__) . '/../web/includes/db_connect.php'; | ||
require dirname(__FILE__) . '/../web/includes/playlink.php'; | ||
|
||
define('WEBBASE','/vagrant/web'); | ||
define('UNZIPBASE','/home/vagrant'); | ||
|
||
$sql = "select * from screenshots"; | ||
$sth = $db->prepare($sql,array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY)); | ||
$sth->bindParam(1, $id, PDO::PARAM_INT); | ||
if ($sth->execute()) { | ||
$shots = $sth->fetchAll(); | ||
} else { | ||
echo "Error:"; | ||
echo "\n"; | ||
$sth->debugDumpParams (); | ||
$shots=array(); | ||
} | ||
|
||
foreach ($shots as $shot) { | ||
//$imagefile = WEBBASE . '/' . get_scrshot($shot['filename'],$shot['subdir']); | ||
$subdir = $shot['subdir']; | ||
$file = $shot['filename']; | ||
if ($subdir === NULL or $subdir === '') { | ||
$imagefile = WEBBASE . '/gameimg/screenshots/' . $file; | ||
} else { | ||
$imagefile = WEBBASE . '/gameimg/screenshots/' . $subdir . '/' . $file; | ||
} | ||
$dir = dirname($imagefile); | ||
if ( ! is_dir($dir)) { | ||
mkdir($dir , 0777,True); | ||
} | ||
$files=glob(UNZIPBASE . '/screens/?/*-' . $shot['gameid'] . '.???'); | ||
if (sizeof($files) > 1) { | ||
print("Too many images match"); | ||
print_r($shot); | ||
} | ||
if (sizeof($files)!=0) { | ||
copy($files[0], $imagefile); | ||
} else { | ||
print("Screnshot missing for:"); | ||
print_r($shot); | ||
} | ||
} | ||
|
||
$sql = "select * from images"; | ||
$sth = $db->prepare($sql,array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY)); | ||
$sth->bindParam(1, $id, PDO::PARAM_INT); | ||
if ($sth->execute()) { | ||
$shots = $sth->fetchAll(); | ||
} else { | ||
echo "Error:"; | ||
echo "\n"; | ||
$sth->debugDumpParams (); | ||
$shots=array(); | ||
} | ||
|
||
foreach ($shots as $shot) { | ||
$subdir=$shot['subdir']; | ||
$file=$shot['filename']; | ||
if ($subdir === NULL or $subdir === '') { | ||
$imagefile = WEBBASE . '/gameimg/discs/' . $file; | ||
} else { | ||
$imagefile = WEBBASE . '/gameimg/discs/' . $subdir . '/' . $file; | ||
} | ||
$dir = dirname($imagefile); | ||
if ( ! is_dir($dir)) { | ||
mkdir($dir , 0777,True); | ||
} | ||
$files=glob(UNZIPBASE . '/files/?/*-' . $shot['gameid'] . '.???'); | ||
if (sizeof($files) > 1) { | ||
print("Too many images match"); | ||
print_r($shot); | ||
} | ||
if (sizeof($files)!=0) { | ||
copy($files[0], $imagefile); | ||
} else { | ||
print("Screnshot missing for:"); | ||
print_r($shot); | ||
} | ||
} | ||
?> |