Math.getRandomNumber = function(min, max)
{
   return Math.random() * (max - min) + min;
}

Math.getRandomInteger = function(min, max)
{
   return Math.floor(Math.random() * (max - min + 1)) + min;
}
Requester = function(path, query, text)
{
   this.path = path;
   this.query = query;
   this.text = text || false;
   this.build();
}

Requester.prototype.build = function()
{
   if (window.XMLHttpRequest)
   {
      this.request = new XMLHttpRequest();
   }
   else
   {
      this.request = new ActiveXObject("Microsoft.XMLHttp");
   }
}

Requester.prototype.execute = function()
{
   var url = this.build_url();
   this.request.open("GET", url, false);
   this.request.send();
   return this.text ? this.request.responseText : this.request.responseXML;
}

Requester.prototype.build_url = function()
{
   var url = this.path + "?" + +new Date;
   if (!!this.query)
   {
      url += "&" + this.query;
   }
   return url;
}

Requester.prototype.toString = function()
{
   return "[object Requester]";
}
PerformanceTest = function(methodName)
{
   var args = arguments;
   this.incomingMethodName = methodName;
   this.incomingArgs = Array.prototype.slice.call(args, 1, args.length);
}

PerformanceTest.prototype.run = function()
{
   var methodName = this.incomingMethodName;
   var args = this.incomingArgs;
   var startTime = Date.now();
   this.response = window[methodName].apply(null, args);
   this.executionTime = Date.now() - startTime;
}

PerformanceTest.prototype.buildResults = function(showResponse)
{
   var results = this.incomingMethodName + "(), " + this.executionTime + "ms";
   if (showResponse)
   {
	 results += ", " + this.response;
   }
   return results;
}
Animation=function(b,a,c){this.rate=b;this.playing=false;this.deviation=0;this.skip_frames=a||false;this.buffer=c||false};Animation.prototype.play=function(b,a){if(b==null){b="sequence"}var c=this.extract_parameters(arguments);var d=this;this.reset_last_ms(a);this.interval=window.setTimeout(function(){d.playing=true;d.loop(b,c)},a)};Animation.prototype.reset_last_ms=function(a){if(this.skip_frames){this.last_ms=+new Date-this.rate;if(a){this.last_ms+=a}}};Animation.prototype.loop=function(a,c){var e=1;if(this.skip_frames){e+=this.measure_deviation()}var d=this;for(var b=0;b<e;b++){d[a].apply(d,c)}if(this.playing){this.interval=window.setTimeout(function(){d.loop(a,c)},this.rate-this.buffer)}};Animation.prototype.measure_deviation=function(){var a=0;var b=+new Date;var d=b-this.last_ms;var c=d-this.rate;this.deviation+=c;this.last_ms=b;if(this.deviation<-this.rate){this.deviation+=this.rate;a--}else{while(this.deviation>this.rate){this.deviation-=this.rate;a++}}return a};Animation.prototype.stop=function(){window.clearInterval(this.interval);this.playing=false};Animation.prototype.extract_parameters=function(a){if(a.length>2){a=Array.prototype.slice.call(a);return a.slice(2)}return[null]};Animation.prototype.toggle=function(){if(this.playing){this.stop()}else{this.play()}};Animation.prototype.toString=function(){return"[object Animation]"};
window.getSize=function(){if(window.innerWidth!=undefined){return{width:window.innerWidth,height:window.innerHeight}}var a=document.body;var b=document.documentElement;return{width:Math.max(a.clientWidth,b.clientWidth),height:Math.max(a.clientHeight,b.clientHeight)}};
Color=function(){this.setRGB.apply(this,arguments)};Color.prototype.setRGB=function(){if(arguments.length>1){this.rgb=[arguments[0],arguments[1],arguments[2]]}else{if(arguments.length>0){var a=arguments[0];if(a instanceof Array){this.rgb=a}else{if(a.slice(0,3)=="rgb"){this.rgb=this.extractRGBFromTuple(a)}else{this.rgb=this.extractRGBFromHexString(a)}}}else{this.randomize()}}};Color.prototype.extractRGBFromTuple=function(a){var b=a.match(/\d+/g);return[+b[0],+b[1],+b[2]]};Color.prototype.extractRGBFromHexString=function(c){var e=parseInt(c.slice(1,3),16);var d=parseInt(c.slice(3,5),16);var a=parseInt(c.slice(5,7),16);return[e,d,a]};Color.prototype.randomize=function(b,a){this.rgb=this.buildRandomRGB(b,a)};Color.prototype.buildRandomRGB=function(d,c){var d=d||0;var c=c||255;var f=this.getRandomInteger(d,c);var e=this.getRandomInteger(d,c);var a=this.getRandomInteger(d,c);return[f,e,a]};Color.prototype.getRandomInteger=function(b,a){return Math.floor(Math.random()*(a-b+1))+b};Color.prototype.getString=function(){var d=parseInt(this.rgb[0]);var c=parseInt(this.rgb[1]);var a=parseInt(this.rgb[2]);return"rgb("+d+","+c+","+a+")"};Color.prototype.changeBrightness=function(a){for(var b=0;b<this.rgb.length;b++){this.rgb[b]+=a}};Color.prototype.toString=function(){return"[object Color]"};
Math.getRandomNumber=function(b,a){return Math.random()*(a-b)+b};Math.getRandomInteger=function(b,a){return Math.floor(Math.random()*(a-b+1))+b};
Requester=function(b,a,c){this.path=b;this.query=a;this.text=c||false;this.build()};Requester.prototype.build=function(){if(window.XMLHttpRequest){this.request=new XMLHttpRequest()}else{this.request=new ActiveXObject("Microsoft.XMLHttp")}};Requester.prototype.execute=function(){var a=this.build_url();this.request.open("GET",a,false);this.request.send();return this.text?this.request.responseText:this.request.responseXML};Requester.prototype.build_url=function(){var a=this.path+"?"+ +new Date;if(!!this.query){a+="&"+this.query}return a};Requester.prototype.toString=function(){return"[object Requester]"};
PerformanceTest=function(b){var a=arguments;this.incomingMethodName=b;this.incomingArgs=Array.prototype.slice.call(a,1,a.length)};PerformanceTest.prototype.run=function(){var c=this.incomingMethodName;var b=this.incomingArgs;var a=Date.now();this.response=window[c].apply(null,b);this.executionTime=Date.now()-a};PerformanceTest.prototype.buildResults=function(b){var a=this.incomingMethodName+"(), "+this.executionTime+"ms";if(b){a+=", "+this.response}return a};
#!/usr/bin/python

from distutils.core import setup

SUMMARY="Assign arbitrary order to a directory's contents"
DESCRIPTION = "\n" + file("description").read()
CLASSIFIERS = [
    "Development Status :: 3 - Alpha",
    "Environment :: Console",
    "Intended Audience :: End Users/Desktop",
    "License :: Public Domain",
    "Operating System :: POSIX :: Linux",
    "Programming Language :: Python",
    "Topic :: System :: Filesystems",
    "Topic :: Utilities",
    ]

setup(
    name="Itemize",
    version="0.3",
    description=SUMMARY,
    long_description=DESCRIPTION,
    author="Frank DeMarco",
    author_email="frank.s.demarco@gmail.com",
    url="http://cyclops.asia/",
    packages=["itemize"],
    scripts=["src/itemize"],
    package_dir={"itemize" : "src"},
    classifiers=CLASSIFIERS
    )
import os
import sys
import re
from optparse import OptionParser
from Album import *

class Itemizer:
    
    OPTIONS = [
        ("-d", "destination", "destination directory", "DIR", "./"),
        ("-i", "index", "item index", "INT"),
        ("-f", "file_path", "input file", "PATH"),
        ("-s", "silent", "suppress messages", None, False, "store_true"),
        ("-v", "verbose", "verbose output", None, False, "store_true"),
        ("--delimiter", "delimiter", "field delimiter", "CHAR", "_"),
        ("--copy", "copy", "copy files", None, False, "store_true"),
        ("--deitemize", "deitemize", "deitemize", None, False, "store_true"),
        ("--sim", "simulate", "simulate itemization", None, False,
         "store_true"),
        ("--regroup", "regroup", "order items consecutively", None, False,
         "store_true"),
        ("--no-name", "no_name", "rename file to only item number", None, False,
         "store_true"),
        ]
    USAGE_MESSAGE = "Usage: %prog [options] PATH_1..PATH_n"

    def __init__(self):
        self.init_input()
        if len(sys.argv) > 1:
            self.add_file_contents_to_item_list()
            self.album = Album(self.options.destination, self.options.delimiter,
                               self.options.copy, self.options.simulate,
                               self.verbosity, self.options.regroup,
                               self.options.no_name)
            if self.options.deitemize:
                self.album.remove(self.item_paths)
            else:
                self.album.add_items(self.item_paths, self.options.index)
            self.album.commit()
        else:
            self.parser.print_help()

    def init_input(self):
        self.parser = OptionParser(self.USAGE_MESSAGE)
        self.parse_arguments()

    def parse_arguments(self):
        for option in self.OPTIONS:
            default = option[4] if len(option) > 4 else None
            action = option[5] if len(option) > 5 else None
            self.parser.add_option(
                option[0], dest=option[1], help=option[2],
                metavar=option[3], default=default, action=action)
        self.options, self.item_paths = self.parser.parse_args()
        self.set_verbosity(self.options.silent, self.options.verbose)

    def set_verbosity(self, silent, verbose):
        if verbose:
            self.verbosity = 2
        elif silent:
            self.verbosity = 0
        else:
            self.verbosity = 1

    def add_file_contents_to_item_list(self):
        if self.options.file_path != None:
            for line in file(self.options.file_path):
                line = line.rstrip()
                line = line.strip("\"")
                if line[0] != "#":
                    self.item_paths.append(line)

    @staticmethod
    def is_item(path):
        if os.path.isfile(path):
            file_name = os.path.basename(path)
            if re.match("^[0-9]+.*", file_name):
                return True
        return False

    @staticmethod
    def extract_item_number(path):
        file_name = os.path.basename(path)
        match = re.match("^([0-9]+).*", file_name)
        if match:
            return int(match.group(1))
        return None
3.145.85.23
3.145.85.23
3.145.85.23
 
June 7, 2018