Skip to content

Commit

Permalink
Merge branch 'release/1.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir Mofasser committed Jan 8, 2018
2 parents 123f046 + 5f675e2 commit 0eaab08
Show file tree
Hide file tree
Showing 8 changed files with 689 additions and 671 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
# Folders
_obj
_test
bin
dest
source

# Architecture specific extensions/prefixes
*.[568vq]
Expand All @@ -22,3 +25,6 @@ _testmain.go
*.exe
*.test
*.prof

lazycopy-darwin-amd64
lazycopy-linux-amd64
48 changes: 48 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Borrowed from:
# https://github.com/silven/go-example/blob/master/Makefile
# https://vic.demuzere.be/articles/golang-makefile-crosscompile/

BINARY = lazycopy
GOARCH = amd64

VERSION=1.0.2
COMMIT=$(shell git rev-parse HEAD)
BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
GITHUB_USERNAME=amimof
BUILD_DIR=${GOPATH}/src/github.com/${GITHUB_USERNAME}/${BINARY}

# Setup the -ldflags option for go build here, interpolate the variable values
LDFLAGS = -ldflags "-X main.VERSION=${VERSION} -X main.COMMIT=${COMMIT} -X main.BRANCH=${BRANCH}"

# Build the project
all: clean fmt linux darwin windows

linux:
cd ${BUILD_DIR}; \
GOOS=linux GOARCH=${GOARCH} go build ${LDFLAGS} -o ${BINARY}-linux-${GOARCH} . ; \
cd - >/dev/null

darwin:
cd ${BUILD_DIR}; \
GOOS=darwin GOARCH=${GOARCH} go build ${LDFLAGS} -o ${BINARY}-darwin-${GOARCH} . ; \
cd - >/dev/null

windows:
cd ${BUILD_DIR}; \
GOOS=windows GOARCH=${GOARCH} go build ${LDFLAGS} -o ${BINARY}-windows-${GOARCH}.exe . ; \
cd - >/dev/null

test:
cd ${BUILD_DIR}; \
go test ; \
cd - >/dev/null

fmt:
cd ${BUILD_DIR}; \
go fmt $$(go list ./... | grep -v /vendor/) ; \
cd - >/dev/null

clean:
-rm -f ${BINARY}-*

.PHONY: linux darwin windows test fmt clean
69 changes: 49 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,57 @@
# lazycopy
A utility written in Go that copies your movies and series from source to target directory.
Scans a directory for video content and organizes them at a target directory. It is capable of
detecting movies and series based on their file name.
A utility that copies movies and tv-shows from source, usually a download directory, to a target directory. Scans the source directory for video content and organizes them at a target directory. It will automatically detect movies and tv-shows based on their file name using complex regular expressions. When matching media is found, the file or folder is copied to the target diretory, preserving permissions and creating any sub-folders if needed.

# Usage
Search the target (-t) directory ~/Downloads for media. Copies any movies (-m) to ~/Media/Movies and (-s) series to ~/Media/Series.
Below example will overwrite any already existing files and folders (-o)
## Installation

### From source
```
./lazy -m ~/Media/Movies -s ~/Media/Series -t ~/Downloads -o
$ git clone https://github.com/amimof/lazycopy.git
$ cd lazycopy
$ make
```

Other available command line options are
### From built binaries
Go to https://github.com/amimof/lazycopy/releases and download the binary for your target platform

## Usage
```
Usage of ./lazy:
-c Prompt for confirm when overwriting existing files/folders
-m string
Directory to your movies. (default ".")
$ lazycopy [options] <source dir> <target dir>
options:
-c Prompt for confirm before overwriting existing files/folders
-d Debug mode
-o Overwrite existing files/folders when copying
-s string
Directory to your series. (default ".")
-t string
Target directory. Typically your Downloads folder. (default ".")
-u string
String representation of unit to use when calculating file sizes. Choices are k, m, g and t (default "g")
-v int
Log level. 3=DEBUG, 2=WARN, 1=INFO, 0=DEBUG. (default "0")
-q Supress all output
-v Print version info
```

## Example

The download directory `~/Downloads/` contains following content:

```
.
..
Some.Movie.1977.mkv
Ultra.Hi.Resolution.Film.2016.Blu-Ray.avi
Movie.Directory.Split.In.Two.CDS.1998
Typicall.TV-show.S01E01
Some.Sitcom.S02E01
```

The following command will copy all movies, wether it's a file or a folder, and overwrite existing ones to `/Volumes/USBDrive/Movies` and `/Volumes/USBDrive/Series`. Note that the folders `Movies` and `Series` will be created automatically in `/Volumes/USBDrive` if they don't already exist.
```
$ lazycopy ~/Downloads /Volumes/USBDrive
```


The destination directory will look like this when the copy operation finishes
```
.
..
/Volumes/USBDrive/Movies/Some.Movie.1977.mkv
/Volumes/USBDrive/Movies/Ultra.Hi.Resolution.Film.2016.Blu-Ray.avi
/Volumes/USBDrive/Movies/Movie.Directory.Split.In.Two.CDS.1998
/Volumes/USBDrive/Series/Typicall TV-Show/Season 01/Typicall.TV-show.S01E01
/Volumes/USBDrive/Series/Some Sitcom/Season 02/Some.Sitcom.S02E01
```

0 comments on commit 0eaab08

Please sign in to comment.