Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 4 Update & Removed CocoaPods Support #5

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@ xcuserdata
timeline.xctimeline
playground.xcworkspace

## Vim swap files
*.swp
## Vim swap and session files
*.sw[po]
*.vimsession

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
Packages/
.build/
Package.pins
Package.resolved
.AppleDouble

# CocoaPods
#
Expand Down
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1
5.0.1
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
os:
- linux
- osx
osx_image: xcode8.3
osx_image: xcode10.2
dist: trusty
sudo: required
language: generic
Expand All @@ -11,8 +11,9 @@ language: generic
#before_install:
# - sudo apt-get update
# - sudo apt-get install -y libimage-exiftool-perl
before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then eval "$(curl -sL https://swiftenv.fuller.li/install.sh)"; fi
install:
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then swiftenv install $(cat .swift-version) | grep -qe "\(been\|already\) installed"; fi
script:
- swift build -c release
- swift test
- travis_wait swift test
28 changes: 0 additions & 28 deletions Downpour.podspec

This file was deleted.

29 changes: 22 additions & 7 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
import PackageDescription

var dependencies: [Package.Dependency] = [.Package(url: "https://github.com/Ponyboy47/PathKit.git", majorVersion: 0, minor: 8)]
// swift-tools-version:5.0

#if os(Linux)
dependencies.append(.Package(url: "https://github.com/vdka/JSON.git", majorVersion: 0, minor: 16))
#endif
import PackageDescription

let package = Package(
name: "Downpour",
dependencies: dependencies
platforms: [.macOS(.v10_14)],
products: [
.library(name: "Downpour", targets: ["Downpour"])
],
dependencies: [
.package(url: "https://github.com/Ponyboy47/TrailBlazer.git", from: "0.16.0"),
.package(url: "https://github.com/kareman/SwiftShell.git", from: "5.0.0")
],
targets: [
.target(
name: "Downpour",
dependencies: ["TrailBlazer", "SwiftShell"],
path: "Sources"
),
.testTarget(
name: "DownpourTests",
dependencies: ["Downpour"],
path: "Tests/DownpourTests"
)
]
)
69 changes: 53 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,74 @@
# Downpour
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/steve228uk/Downpour/blob/master/LICENSE) [![Build Status](https://travis-ci.org/TryFetch/Downpour.svg?branch=master)](https://travis-ci.org/TryFetch/Downpour)
[![license](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://github.com/Ponyboy47/Downpour/blob/master/LICENSE) [![Build Status](https://travis-ci.org/Ponyboy47/Downpour.svg?branch=master)](https://travis-ci.org/Ponyboy47/Downpour)

Downpour was built for [Fetch](http://getfetchapp.com) — a Put.io client — to parse TV & Movie information from downloaded files. It can be used on any platform that can run Swift as it only relies on Foundation.

It can gather the following from a raw file name:
It can gather the following from a raw video file name:

- TV or movie title
- Year of release
- TV season number
- TV episode number

It can gather the following from an audio file on macOS:

- Title
- Creation Date
- Type
- Format
- Copyrights
- Album
- Artist
- Artwork
- Publisher
- Creator
- Subject
- Summary (AKA Description)
- Contributer
- Last Modified Date
- Language
- Author

And from Linux (Ubuntu if the libimage-exiftool-perl package is installed):

- Title
- Creation Date
- Type
- Format
- Copyrights
- Album
- Artist
- Artwork

NOTE: None of the fields are guaranteed to be there or even picked up, it's kinda hard to extract metadata from file names with only a few clever regexes and audio data from files is difficult to do cross-platform. Please open an issue if you know the data is there, but it's not being picked up. Also, it means everything is Optional and be sure to use `guard/if let` or nil-coalescing (`??`) to program safely. :)

## Installation
### Swift Package Manager:
This supports SPM installation for swift 5.0 by adding the following to your Package.swift dependencies:
```swift
.package(url: "https://github.com/Ponyboy47/Downpour.git", from: "0.8.0")
```
For swift 4.x use 0.7.x
For swift 3 use 0.4.x

## Usage

Using Downpour is easy. Just create a new instance and it'll do the rest.

```swift
let torrent = Downpour(string: filename)
let dvd_rip = Downpour(filename: filename)

let title = torrent.title
let year = torrent.year
let title = dvd_rip.title
let year = dvd_rip.year

if downpour.type == .TV {
let season = torrent.season
let episode = torrent.episode
if downpour.type == .tv {
let season = dvd_rip.season
let episode = dvd_rip.episode
}
```

## Installation

Install manually by copying the contents of the `Sources` directory to your project or install via CocoaPods.

```ruby
pod 'Downpour'
```
### Common Scenarios:
- Backing up your dvd/blu-ray collection
- Designed to work with media ripped using the popular [MakeMKV](http://makemkv.com) utility
- Organizing your media files

**Note:** For Swift 2.3 please use `0.1.0`
Loading