Skip to content

Commit

Permalink
prepping for release
Browse files Browse the repository at this point in the history
  • Loading branch information
shenanigans committed Oct 1, 2015
1 parent f20b780 commit 8f9a8bf
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 36 deletions.
101 changes: 94 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,109 @@
# PornViewer
An image viewer for mission-critical applications.
An image viewer for mission-critical applications. Designed to provide a pleasurable viewing
experience. Theoretically cross-platform, currently available on Windows.


## Installation
PornViewer currently does not come pre-built. You can currently build your own for Windows and OSX.
First, clone this repository, download the correct prebuild of [node-webkit 0.12.x]
(https://github.com/nwjs/nw.js#user-content-downloads) for your environment, rename its directory to
`nw` and put it in the PornViewer directory.
Use one of these installer links below. If you like it, please [help me not be so broke](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=PN6C2AZTS2FP8&lc=US&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted).

### Windows Installers
#### 64 bits

#### 32 bits


### Linux Binaries
I've been having a problem with the `lwip` module, it's supposed to statically bind its own libpng
but it still somehow gets confused by the older version dynamically bound by node-webkit. Probably I
need to build my own node-webkit with libpng bound statically. If anybody has some thoughts on this
I'd love to hear them.

### OSX
Somebody with one of those dumbass apple computers is welcome to figure out a build for them. Mine
bricked out when its stupid battery died. And hey seriously isn't that `.dmg` thing weird as an
install process? Drag this shit into here. Random scripts go off unexpectedly. That's the sleak,
intuitive way to install things. See the [build instructions](#building-pornviewer) near the bottom
if you're thinking of helping out, you communist filth.


## FAQ
Actually that's a lie. Nobody has ever asked me any questions about PornViewer.

#### Is there a safe-for-work version of this?
No. You're welcome to fork this repo and make one. If you want my opinion I think you should call it
`lolphotos`.

#### What's next for PornViewer?
So glad I asked.
* drag-n-drop file and folder management
* fake directories called Collections
* view images from multiple directories or Collections
* "cascade view"
* video files


## Building PornViewer
You're going to need [nodejs](https://nodejs.org) and the npm thingy it comes with. Linux users are
advised to **always** install Node.js from source. If you're on Windows, you will need MinGW. I
recommend just using the lovely [command-line git installer](https://git-scm.com/downloads).

Clone this repository and download the most recent stable version of [node-webkit](https://github.com/nwjs/nw.js#downloads).
Unzip it, put it in the repository directory and rename it `nw`. If you're building a windows msi,
copy the contents of the `nw` directory into `resources\x64\` or `resources\x86\`.

Then do this stuff:
```shell
cd PornViewer
npm install
cd src
npm install
npm install -g nw-gyp
cd node_modules/lwip
nw-gyp rebuild
nw-gyp clean
nw-gyp configure --msvs_version=2013 --target=0.12.3
# nw-gyp configure --msvs_version=2013 --target=0.12.3 --arch=ia32
nw-gyp build
# nw-gyp build --arch=ia32
cd ../../
gulp once
```

Finally, use either `launch.sh` or `launch.vbs` to start the application.
Finally, use either `launch.sh` or `launch.vbs` to start the application. There is a shitton of
unnecessary content left in the `lwip` build and some of the other npm modules as well. Tracking
down and eliminating everything you don't need will drastically improve application launch time.
Remember to `gulp once` after making changes, or simply `gulp` to start a watch-and-rebuild process.

#### Building an MSI
I can't get `copy \b` to work right, maybe it's win10? So I use mingw's `cat` to make the prepacked
executable. Substitute `x86` if you need it.
```shell
cat resources/x64/nw.exe package.zip > build/x64/nw.exe
```

You'll need [WiX](http://wixtoolset.org/). Use a DOS shell to run `winbuild.bat`. This will build
one or two `.msi` files in `build\` depending on which architecture(s) have been prepared
completely.


## LICENSE
The MIT License (MIT)

Copyright (c) 2015 Kevin "Schmidty" Smith

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"dependencies": {
"gulp": "^3.9.0",
"gulp-watch": "^4.3.5",
"gulp-zip": "^3.0.2",
"sync-request": "^2.0.1"
"gulp-zip": "^3.0.2"
}
}
16 changes: 13 additions & 3 deletions src/Visualizer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,24 @@ function Visualizer (winnder, console) {
maxElem.dropClass ('restore');
});
function resize (stayMax){
self.canvas.width = self.canvas.clientWidth;
self.canvas.height = self.canvas.clientHeight;
self.redraw();
if (self.canvas.width != self.canvas.clientWidth
|| self.canvas.height != self.canvas.clientHeight
) {
self.canvas.width = self.canvas.clientWidth;
self.canvas.height = self.canvas.clientHeight;
self.redraw();
if (initialInterval) {
clearInterval (initialInterval);
delete initialInterval;
}
}
if (!stayMax) {
self.isMaximized = false;
maxElem.dropClass ('restore');
}
}
// when the window first resizes at startup, the resize event isn't sent. We have to poll.
var initialInterval = setInterval (resize, 100);
this.window.on ('resize', resize);
this.resize = resize;
this.context = this.canvas.getContext('2d');
Expand Down
19 changes: 4 additions & 15 deletions src/controller/ThumbWarrior.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var getType = require ('image-type');

var gui = global.window.nwDispatcher.requireNwGui();


/** @module PornViewer:ThumbWarrior
*/
Expand All @@ -29,26 +30,17 @@ db.changeVersion (db.version, "1.2", function (tx) {
delete dbQueue;
});

/** @property/Function getThumb
*/
var ZOOM_INTO_MIN = 3 / 4;
var ZOOM_INTO_MAX = 4 / 3;
var MAX_CLIP = 0.20;
var THUMB_SIZE = 150;
var CWD = process.cwd();
var THUMBS_DIR = path.join (gui.App.dataPath, 'thumbs');
// var THUMBS_DIR = path.join (
// process.env.LOCALAPPDATA || (
// process.platform == 'darwin' ?
// process.env.HOME + 'Library/Preference'
// : '/var/local'
// ),
// 'PornViewer',
// 'thumbs'
// );
mkdirp.sync (THUMBS_DIR);

/** @property/Function getThumb
*/
module.exports.getThumb = function (dirpath, filename, callback) {
if (!dbReady) {
dbQueue.push (function(){ module.exports.getThumb (dirpath, filename, callback); });
Expand Down Expand Up @@ -133,7 +125,6 @@ module.exports.getThumb = function (dirpath, filename, callback) {

if (width == height)
return srcImage.resize (150, 150, function (err, image) {
// console.log ('basic resize', err, image);
if (err)
return callback (err);
finalImage = image;
Expand All @@ -156,12 +147,10 @@ module.exports.getThumb = function (dirpath, filename, callback) {

// finalize the transform
var batch = srcImage.batch()
// .crop (left, top, right, bottom)
.crop (newWidth, newHeight)
.scale (scale)
;
batch.exec (function (err, image) {
// console.log ('batch resize', err, image);
if (err)
return callback (err);
finalImage = image;
Expand Down
13 changes: 5 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ visualizerWindow = gui.Window.open ('./Visualizer/index.html', {

// launch the Controller Window
controllerWindow = gui.Window.open ('./Controller/index.html', {
// toolbar: false,
// frame: false,
// transparent: true,
toolbar: false,
frame: false,
transparent: true,
title: 'PornController',
icon: 'icon.png'
});
Expand Down Expand Up @@ -117,8 +117,8 @@ if (!winState) {
}

// uncomment to show devtools at startup
var Window = gui.Window.get();
Window.on ('loaded', function(){ Window.showDevTools(); });
// var Window = gui.Window.get();
// Window.on ('loaded', function(){ Window.showDevTools(); });

// basic cross-window event listeners
controllerWindow.on ('close', function(){
Expand Down Expand Up @@ -159,9 +159,6 @@ async.parallel ([
if (winState.visualizer.maximize)
visualizerWindow.maximize();
visualizer = new Visualizer (visualizerWindow, window.console);
// there seems to be a lack of synchronization here so we'll double check that the
// Visualizer's canvas gets adjusted
setTimeout (function(){ visualizer.resize (true); }, 100);
// keyboard navigation events
visualizerWindow.window.document.body.on ('keydown', function (event) {
if (event.keyCode < 37 || event.keyCode > 40)
Expand Down
3 changes: 2 additions & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"window": {
"title": "PornMaster",
"icon": "icon.png"
"icon": "icon.png",
"show": false
}
}

0 comments on commit 8f9a8bf

Please sign in to comment.