Skip to content
This repository has been archived by the owner on Mar 23, 2020. It is now read-only.

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacharyDuBois committed Mar 31, 2015
2 parents b5ce433 + c68f7f6 commit 15d12c3
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 32 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Change Log

## v0.4.2

- Fix invalid input for ETC.
- Fix repository URL.
- Hide the output of ETC (For real this time).
- Update message types to align output.
- Add more file types.

## v0.4.1

- Tiny HTML fixes.
- Hide output of ETC creations.
- Add Pixelmator extension.

## v0.4

- Moves most tasks into functions.
Expand Down
6 changes: 3 additions & 3 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Installation

*v0.4*
*v0.4.2*

#### 1)

Expand All @@ -21,7 +21,7 @@ Night Uploader needs four directories:
- A template directory.
- And a temporary files directory.

Make these and take note of the locations.
Make these and take note of the locations.

#### 3)

Expand Down Expand Up @@ -117,4 +117,4 @@ If you want to be able to use your own index theme or HTML, you can! Open up the

Items in brackets `[]` are added by the script and items not in brackets are added directly from that named template file.

For an easy color or CSS/JS tweak, you can also edit the `assets/night/*` with whatever you want because it is already loaded on the page.
For an easy color or CSS/JS tweak, you can also edit the `assets/night/*` with whatever you want because it is already loaded on the page.
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014 Zachary DuBois.
Copyright (c) 2014-2015 Zachary DuBois.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ 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.
THE SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Night Uploader

*v0.4*
*v0.4.2*

## Features

Expand Down
6 changes: 6 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# TODO

- Add muting for notifications.
- Better debug output (Wrong information levels).
- Log failed ETC items so they do not get reattempted.
- Update startup checks.
- Add video/media pages *v0.5*
- More file type icons.
50 changes: 25 additions & 25 deletions night-uploader
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# Night Updater
# https://github.com/ZacharyDuBois/Night-Uploader
version="v0.4"
version="v0.4.2"


##
Expand All @@ -29,9 +29,9 @@ pushoverURLTitle=""
# File extentions and formats below.
formatVideo=".*\.(mp4|mov|mkv|m4v|ogv|avi)$"
formatAudio=".*\.(mp3|acc|ogg|wav|m4a|ogg|oga|opus)$"
formatCode=".*\.(html|htm|xml|py|c)$"
formatCode=".*\.(html|htm|xml|py|c|http|log|rb|cpp|sh|bash)$"
formatPDF=".*\.(pdf)$"
formatImage=".*\.(png|jpg|jpeg|tiff|gif|svg|ico)$"
formatImage=".*\.(png|jpg|jpeg|tiff|gif|svg|ico|pxm)$"
formatArchive=".*\.(zip|tar|gz)$"
# The next 7 are not recommend to edit but you may if you'd like.
indexFile="index.html"
Expand All @@ -49,13 +49,13 @@ runType=$1
# Message Types
##

fail="[$(tput setaf 1)FAIL$(tput sgr0)]"
ok="[$(tput setaf 2)OK$(tput sgr0)]"
running="[$(tput setaf 3)*$(tput sgr0)]"
fail="[$(tput setaf 1) FAIL $(tput sgr0)]"
ok="[$(tput setaf 2) OK $(tput sgr0)]"
running="[$(tput setaf 3) ** $(tput sgr0)]"
notice="[$(tput setaf 3)NOTICE$(tput sgr0)]"
warning="[$(tput setaf 3)WARNING$(tput sgr0)]"
info="[$(tput setaf 6)INFO$(tput sgr0)]"
finish="[$(tput setaf 4)DONE$(tput sgr0)]"
warn="[$(tput setaf 3) WARN $(tput sgr0)]"
info="[$(tput setaf 6) INFO $(tput sgr0)]"
finish="[$(tput setaf 4) DONE $(tput sgr0)]"


##
Expand All @@ -73,7 +73,7 @@ fi
which aws > /dev/null
checkForAWS=$?
if [[ "$checkForAWS" != 0 ]]
then
then
echo "$fail You need AWS CLI to run this script."
exit 1
fi
Expand Down Expand Up @@ -132,14 +132,14 @@ makeIndex() {
# Generate Index
echo "$running Generating index file."
pushoverSend "Generating index file."

numberOfFiles=0

aws s3 ls s3://"$s3bucket"/ | grep -v PRE | awk -F' ' '{ print $4 }' > $listingFileLoc
sort -f $listingFileLoc -o $listingFileLoc
cat "$templateLoc""index/""head.html" > $indexFileLoc
echo " <ul>" >> $indexFileLoc

while read listItem
do
numberOfFiles=$(($numberOfFiles+1))
Expand Down Expand Up @@ -171,15 +171,15 @@ makeIndex() {
echo " <li><a href=\"/"$listItem"\"><i class=\"fa "$itemIcon"\"></i> "$listItem"</a></li>" >> $indexFileLoc

done < $listingFileLoc

echo " </ul>" >> $indexFileLoc

cat "$templateLoc""index/""aftercontent.html" >> $indexFileLoc
echo " <p><code>"$numberOfFiles" Items</code></p>" >> $indexFileLoc
echo " <p>Index Last Updated: <code>"$curTime"</code></p>" >> $indexFileLoc
echo " <p>Powered by <a href=\"https://bitbucket.org/Zachary_DuBois/night-uploader\">Night Uploader</a> <code>"$version"</code></p>" >> $indexFileLoc
echo " <p>Powered by <a href=\"https://we.destroy.tokyo/Night-Uploader\">Night Uploader</a> <code>"$version"</code></p>" >> $indexFileLoc
cat "$templateLoc""index/""footer.html" >> $indexFileLoc

# Upload Index
echo "$running Uploading index."
aws s3 cp $indexFileLoc s3://"$s3bucket"/"$indexFile" --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
Expand Down Expand Up @@ -234,7 +234,7 @@ transcodeMedia() {
then
# If there is no matches for the mp3 version, make a conversion.
outputName=$noExtItem$mp3
aws elastictranscoder create-job --pipeline-id $etcPipelineID --input Key=$mediaItem --outputs \{\"Key\":\"$outputName\",\"PresetId\":\"$etcMP3PresetID\"\}
aws elastictranscoder create-job --pipeline-id $etcPipelineID --input \{\"Key\":\"$mediaItem\"\} --outputs \{\"Key\":\"$outputName\",\"PresetId\":\"$etcMP3PresetID\"\} > /dev/null
etcQueued=$(($etcQueued+1))
echo "$ok Created MP3 job for $mediaItem to $outputName"
fi
Expand All @@ -247,15 +247,15 @@ transcodeMedia() {
then
# If there is no matches for the mp4 version, make a conversion.
outputName=$noExtItem$mp4
aws elastictranscoder create-job --pipeline-id $etcPipelineID --input Key=$mediaItem --outputs \{\"Key\":\"$outputName\",\"PresetId\":\"$etcMP4PresetID\"\}
aws elastictranscoder create-job --pipeline-id $etcPipelineID --input \{\"Key\":\"$mediaItem\"\} --outputs \{\"Key\":\"$outputName\",\"PresetId\":\"$etcMP4PresetID\"\} > /dev/null
etcQueued=$(($etcQueued+1))
echo "$ok Created MP4 job for $mediaItem to $outputName"
fi
if [[ $(echo $filesList | grep $noExtItem$mp3) == "" ]]
then
# If there is no matches for the mp3 version, make a conversion.
outputName=$noExtItem$mp3
aws elastictranscoder create-job --pipeline-id $etcPipelineID --input Key=$mediaItem --outputs \{\"Key\":\"$outputName\",\"PresetId\":\"$etcMP3PresetID\"\}
aws elastictranscoder create-job --pipeline-id $etcPipelineID --input \{\"Key\":\"$mediaItem\"\} --outputs \{\"Key\":\"$outputName\",\"PresetId\":\"$etcMP3PresetID\"\} > /dev/null
etcQueued=$(($etcQueued+1))
echo "$ok Created MP3 job for $mediaItem to $outputName"
fi
Expand Down Expand Up @@ -308,14 +308,14 @@ do
echo "$warning AWS is currently running. Waiting for AWS to finish to avoid issues."
pushoverSend "There is a process matching AWS already running on your system. To avoid conflict, this script will wait for it to finish."
fi

if [[ "$retryCount" == $failTime ]]
then
echo "$fail Night Uploader failed to run due to an active AWS process taking longer than $failTime seconds."
pushoverSend "Night Uploader is canceling because the current running AWS process took longer than $failTime seconds."
exit 1
fi

echo -n "."
retryCount=$((retryCount+1))
sleep 1
Expand Down Expand Up @@ -349,7 +349,7 @@ then
# New files found. Make listing of new, upload, move, transcode, media player pages, and index.
echo "$ok Files found, continuing with workflow."
pushoverSend "New files are being prepared for upload."

makeNewFilesList
uploadFiles
cleanUp
Expand All @@ -364,15 +364,15 @@ then
# Index run transcode media, make media pages, index.
echo "$ok Running index workflow."
pushoverSend "Running index workflow."

transcodeMedia
makeIndex
cleanUp
else
echo "$fail Unknown workflow ID $runType."
exit 1
fi

echo "$ok Finished workflow ID $runType."
pushoverSend "Finished workflow ID $runType."

Expand Down
2 changes: 1 addition & 1 deletion templates/index/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navCollapseTop">
<span class="sr-only">Toggle navigation</span> <i class="fa fa-angle-double-down"></i> <i class="fa fa-list"></i>
</button>
<a class="navbar-brand" href="index.html" title="Index"><i class="fa fa-hdd-o"></i> CDN</a>
<a class="navbar-brand" href="/index.html" title="Index"><i class="fa fa-hdd-o"></i> CDN</a>
</div>

<div class="collapse navbar-collapse" id="navCollapseTop">
Expand Down

0 comments on commit 15d12c3

Please sign in to comment.