mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-24 15:05:24 -07:00
Compare commits
No commits in common. "develop" and "v1.8.3" have entirely different histories.
2406 changed files with 114081 additions and 264959 deletions
8
.gitattributes
vendored
8
.gitattributes
vendored
|
@ -62,4 +62,10 @@
|
|||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
||||
|
||||
Old/* linguist-vendored
|
||||
|
||||
PlexRequests.UI/Content/* linguist-vendored
|
||||
PlexRequests.UI/Content/* linguist-vendored
|
||||
base.scss linguist-vendored=false
|
||||
requests-1.7.js linguist-vendored=false
|
||||
search-1.7.js linguist-vendored=false
|
||||
site-1.7.js linguist-vendored=false
|
||||
|
|
8
.github/FUNDING.yml
vendored
8
.github/FUNDING.yml
vendored
|
@ -1,8 +0,0 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: [tidusjar]
|
||||
patreon: tidusjar
|
||||
#open_collective: # Replace with a single Open Collective username
|
||||
#ko_fi: # Replace with a single Ko-fi username
|
||||
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
custom: https://paypal.me/PlexRequestsNet
|
22
.github/ISSUE_TEMPLATE.md
vendored
Normal file
22
.github/ISSUE_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
If this is a bug report please make sure you have filled the following in:
|
||||
(If it's not a bug and a feature request then just remove the below)
|
||||
|
||||
#### Plex Requests.Net Version:
|
||||
|
||||
|
||||
#### Operating System:
|
||||
|
||||
|
||||
#### Mono Version:
|
||||
|
||||
|
||||
#### Applicable Logs (from `/logs/` directory or the Admin page):
|
||||
|
||||
```
|
||||
Logs go here (Please make sure you remove any personal information from the logs)
|
||||
```
|
||||
|
||||
|
||||
#### Reproduction Steps:
|
||||
|
||||
Please include any steps to reproduce the issue, this the request that is causing the problem etc.
|
50
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
50
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
@ -1,50 +0,0 @@
|
|||
name: "\U0001F41B Bug report"
|
||||
description: 'Report a reproducible bug in Ombi'
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: Thanks for taking the time to file a bug report! Please fill out this form as completely as possible.
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
If you leave out sections there is a high likelihood your issue will be closed.
|
||||
If you have a question or you think your issue might be caused by your application code, you can get help from the community on [Discord](https://discord.gg/Sa7wNWb).
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Summary
|
||||
description: |
|
||||
Clearly describe what the expected behavior is vs. what is actually happening. Please include any reproduction steps that is required to reproduce this issue.
|
||||
If your summary is simply, for example: "I cannot setup Plex", then you will need to [continue debugging on your own](https://docs.ombi.app/) to more precisely define your issue before proceeding.
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Ombi Version
|
||||
description: What version of ombi are you running?
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: What platform(s) does this occur on?
|
||||
multiple: true
|
||||
options:
|
||||
- Docker
|
||||
- Windows
|
||||
- Linux
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: What database are you using?
|
||||
options:
|
||||
- SQLite (Default)
|
||||
- MySQL
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Relevant log output
|
||||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
||||
render: shell
|
11
.github/ISSUE_TEMPLATE/config.yml
vendored
11
.github/ISSUE_TEMPLATE/config.yml
vendored
|
@ -1,11 +0,0 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Docs
|
||||
url: https://docs.ombi.app/
|
||||
about: The Ombi documentation should help guide you through installation and setup as well as help resolve common problems and answer frequently asked questions
|
||||
- name: Discord support
|
||||
url: https://discord.gg/Sa7wNWb
|
||||
about: Ask questions about Ombi
|
||||
- name: Feature suggestions
|
||||
url: https://ombifeatures.featureupvote.com
|
||||
about: Share your suggestions or ideas to make Ombi better!
|
7
.github/labeler.yml
vendored
7
.github/labeler.yml
vendored
|
@ -1,7 +0,0 @@
|
|||
automation: tests/**/*
|
||||
|
||||
frontend: src/Ombi/ClientApp/**/*
|
||||
|
||||
backend: src/**/*.cs
|
||||
|
||||
devops: .github/workflows/*
|
23
.github/stale.yml
vendored
23
.github/stale.yml
vendored
|
@ -1,23 +0,0 @@
|
|||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 60
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 7
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- pinned
|
||||
- security
|
||||
- bug / issue
|
||||
- help wanted
|
||||
- possible feature
|
||||
- planned
|
||||
- in progress
|
||||
- enhancement
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: wontfix
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
78
.github/workflows/automation-tests.yml
vendored
78
.github/workflows/automation-tests.yml
vendored
|
@ -1,78 +0,0 @@
|
|||
name: Automation Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop, feature/** ]
|
||||
pull_request:
|
||||
branches: [ develop ]
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
automation-tests:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
'**/node_modules'
|
||||
'/home/runner/.cache/Cypress'
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||
|
||||
- name: Install Frontend Deps
|
||||
run: yarn --cwd ./src/Ombi/ClientApp install
|
||||
|
||||
- name: Install Test Dependencies
|
||||
run: yarn --cwd ./tests install
|
||||
|
||||
- name: Start Frontend
|
||||
run: |
|
||||
nohup yarn --cwd ./src/Ombi/ClientApp start &
|
||||
|
||||
- name: Restore .NET Dependencies
|
||||
run: dotnet restore ./src/Ombi/Ombi.csproj
|
||||
|
||||
- name: Build .NET Project
|
||||
run: dotnet build ./src/Ombi/Ombi.csproj --no-restore
|
||||
|
||||
- name: Start Backend
|
||||
run: |
|
||||
nohup dotnet run --project ./src/Ombi -- --host http://*:3577 &
|
||||
|
||||
- name: Run Wiremock
|
||||
run: nohup docker run --rm -p 32400:8080 --name wiremock wiremock/wiremock:2.35.0 &
|
||||
|
||||
- name: Sleep for server to start
|
||||
run: sleep 20
|
||||
|
||||
- name: Cypress Tests
|
||||
uses: cypress-io/github-action@v4
|
||||
with:
|
||||
record: true
|
||||
browser: chrome
|
||||
headless: true
|
||||
working-directory: tests
|
||||
wait-on: http://localhost:3577/
|
||||
# 10 minutes
|
||||
wait-on-timeout: 600
|
||||
env:
|
||||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Stop Services
|
||||
if: always()
|
||||
run: |
|
||||
pkill -f "dotnet.*Ombi" || true
|
||||
docker container kill wiremock || true
|
214
.github/workflows/build.yml
vendored
214
.github/workflows/build.yml
vendored
|
@ -1,214 +0,0 @@
|
|||
name: CI Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop, master ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-ui:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: NodeModules Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: node_modules-${{ hashFiles('**/yarn.lock') }}
|
||||
|
||||
- name: UI Install
|
||||
run: yarn --cwd ./src/Ombi/ClientApp install
|
||||
|
||||
- name: Build UI
|
||||
run: yarn --cwd ./src/Ombi/ClientApp run build
|
||||
|
||||
- name: Publish UI Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: angular_dist
|
||||
path: |
|
||||
./src/Ombi/ClientApp/dist
|
||||
|
||||
unit-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
- name: Nuget Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nuget
|
||||
|
||||
- name: Run Unit Tests
|
||||
run: |
|
||||
cd src
|
||||
dotnet test -c NonUiBuild --logger trx --results-directory "TestResults"
|
||||
|
||||
versioning:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ build-ui, unit-test ]
|
||||
outputs:
|
||||
changelog: ${{ steps.changelog.outputs.clean_changelog }}
|
||||
tag: ${{ steps.changelog.outputs.tag }}
|
||||
version: ${{ steps.changelog.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Conventional Changelog Action
|
||||
id: changelog
|
||||
uses: TriPSs/conventional-changelog-action@v3
|
||||
with:
|
||||
version-file: 'version.json'
|
||||
release-count: 40
|
||||
skip-on-empty: 'false'
|
||||
git-message: 'chore(release): :rocket: {version}'
|
||||
|
||||
- name: Output version
|
||||
run: |
|
||||
echo "outputs: ${{ steps.changelog.outputs.tag }}"
|
||||
echo "Version: ${{ steps.changelog.outputs.version }}"
|
||||
echo "log: ${{ steps.changelog.outputs.clean_changelog }}"
|
||||
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ build-ui, versioning ]
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: win-x64
|
||||
format: zip
|
||||
compression: zip
|
||||
- os: win-x86
|
||||
format: zip
|
||||
compression: zip
|
||||
- os: linux-x64
|
||||
format: tar.gz
|
||||
compression: tar
|
||||
- os: linux-arm
|
||||
format: tar.gz
|
||||
compression: tar
|
||||
- os: linux-arm64
|
||||
compression: tar
|
||||
format: tar.gz
|
||||
- os: osx-x64
|
||||
compression: tar
|
||||
format: tar.gz
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
- uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: '5.0.x'
|
||||
|
||||
- name: Nuget Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nuget
|
||||
|
||||
- name: Set Backend Version
|
||||
run: |
|
||||
dotnet tool install -g dotnet-setversion
|
||||
setversion -r ${{ needs.versioning.outputs.version }}
|
||||
working-directory: src
|
||||
|
||||
- name: Publish Backend ${{ matrix.os }}
|
||||
run: dotnet publish -c Release -r ${{ matrix.os }} -o "${{ matrix.os }}" --self-contained true -p:PublishSingleFile=true
|
||||
working-directory: src/Ombi
|
||||
|
||||
- name: Download Angular
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: angular_dist
|
||||
path: ~/src/Ombi/dist
|
||||
|
||||
- name: Copy Dist to Artifacts
|
||||
run: |
|
||||
cd ${{ matrix.os }}
|
||||
sudo mkdir -p ClientApp/dist
|
||||
echo "mkdir /ClientApp"
|
||||
echo "list os (ClientApp should be here)"
|
||||
ls
|
||||
cd ..
|
||||
echo "Copy dist to /ClientApp"
|
||||
sudo mv ~/src/Ombi/dist/* ${{ matrix.os }}/ClientApp/dist
|
||||
working-directory: src/Ombi
|
||||
|
||||
- name: Archive Release
|
||||
uses: thedoctor0/zip-release@master
|
||||
with:
|
||||
type: '${{ matrix.compression }}'
|
||||
filename: '../${{ matrix.os }}.${{ matrix.format }}'
|
||||
path: '.'
|
||||
directory: 'src/Ombi/${{ matrix.os }}'
|
||||
|
||||
- name: Publish Release
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.os }}
|
||||
path: |
|
||||
./src/Ombi/${{ matrix.os }}.${{ matrix.format }}
|
||||
|
||||
release:
|
||||
needs: [ publish, unit-test, versioning ]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Download Artifacts
|
||||
id: download
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: Publish to GitHub Master
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: contains(github.ref, 'master')
|
||||
with:
|
||||
body: ${{ needs.versioning.outputs.changelog }}
|
||||
name: ${{ needs.versioning.outputs.tag }}
|
||||
tag_name: ${{ needs.versioning.outputs.tag }}
|
||||
files: |
|
||||
artifacts/**/*.tar.gz
|
||||
artifacts/**/*.zip
|
||||
|
||||
- name: Publish to GitHub Develop
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: contains(github.ref, 'develop')
|
||||
with:
|
||||
prerelease: true
|
||||
generate_release_notes: false
|
||||
body: ${{ needs.versioning.outputs.changelog }}
|
||||
name: ${{ needs.versioning.outputs.tag }}
|
||||
tag_name: ${{ needs.versioning.outputs.tag }}
|
||||
files: |
|
||||
artifacts/**/*.tar.gz
|
||||
artifacts/**/*.zip
|
||||
|
||||
update-apt:
|
||||
needs: [ release, versioning ]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Trigger APT Build
|
||||
uses: fjogeleit/http-request-action@master
|
||||
with:
|
||||
url: 'https://api.github.com/repos/Ombi-app/Ombi.Apt/actions/workflows/build-deb.yml/dispatches'
|
||||
method: 'POST'
|
||||
contentType: 'application/json'
|
||||
data: '{ "ref":"main", "inputs": { "version": "${{ needs.versioning.outputs.tag }}"} }'
|
||||
customHeaders: '{"Accept":"application/vnd.github.v3+json", "Authorization":"Bearer ${{secrets.APT_PAT}}", "User-Agent":"Ombi"}'
|
||||
|
||||
|
47
.github/workflows/chromatic.yml
vendored
47
.github/workflows/chromatic.yml
vendored
|
@ -1,47 +0,0 @@
|
|||
# name: 'Chromatic'
|
||||
|
||||
# # Event for the workflow
|
||||
# on:
|
||||
# push:
|
||||
# workflow_dispatch:
|
||||
|
||||
# # List of jobs
|
||||
# jobs:
|
||||
# storybook-build:
|
||||
# # Operating System
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Checkout repository
|
||||
# uses: actions/checkout@v2
|
||||
# with:
|
||||
# fetch-depth: 0
|
||||
|
||||
# - name: NodeModules Cache
|
||||
# uses: actions/cache@v4
|
||||
# with:
|
||||
# path: '**/node_modules'
|
||||
# key: node_modules-${{ hashFiles('**/yarn.lock') }}
|
||||
|
||||
# - name: Install dependencies
|
||||
# working-directory: ./src/Ombi/ClientApp
|
||||
# run: yarn
|
||||
|
||||
# - name: Publish to Chromatic
|
||||
# if: github.ref != 'refs/heads/master'
|
||||
# uses: chromaui/action@v1
|
||||
# with:
|
||||
# projectToken: 7c47e1a1a4bd
|
||||
# exitZeroOnChanges: true
|
||||
# workingDir: ./src/Ombi/ClientApp
|
||||
# buildScriptName: storybookbuild
|
||||
# exitOnceUploaded: true
|
||||
|
||||
# - name: Publish to Chromatic and auto accept changes
|
||||
# if: github.ref == 'refs/heads/develop'
|
||||
# uses: chromaui/action@v1
|
||||
# with:
|
||||
# projectToken: 7c47e1a1a4bd
|
||||
# autoAcceptChanges: true # 👈 Option to accept all changes
|
||||
# workingDir: ./src/Ombi/ClientApp
|
||||
# buildScriptName: storybookbuild
|
||||
# exitOnceUploaded: true
|
65
.github/workflows/codeql-analysis.yml
vendored
65
.github/workflows/codeql-analysis.yml
vendored
|
@ -1,65 +0,0 @@
|
|||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop, master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ develop ]
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'csharp', 'javascript' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||
# Learn more:
|
||||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
20
.github/workflows/contributors.yml
vendored
20
.github/workflows/contributors.yml
vendored
|
@ -1,20 +0,0 @@
|
|||
name: Contributors
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
update-contributors:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Contribute List
|
||||
uses: akhilmhdh/contributors-readme-action@v2.2.1
|
||||
with:
|
||||
commit_message: "chore: :busts_in_silhouette: Updated Contributors [skip ci]"
|
||||
image_size: 50
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
32
.github/workflows/issue-check.yml
vendored
32
.github/workflows/issue-check.yml
vendored
|
@ -1,32 +0,0 @@
|
|||
name: 'Issue Check'
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
issueCheck:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- if: startsWith(github.event.issue.body , '**Describe the bug**') == false
|
||||
name: Close Issue
|
||||
uses: peter-evans/close-issue@v1
|
||||
with:
|
||||
comment: |
|
||||
Hello, Please use the Github template to report an issue. If this is a feature request, please take a look at the readme. <br/> Thanks, <br/> Ombi Bot
|
||||
|
||||
- if: startsWith(github.event.issue.body , '**Describe the bug**') == true
|
||||
name: Create comment
|
||||
uses: peter-evans/create-or-update-comment@v1
|
||||
with:
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
body: |
|
||||
Hi!
|
||||
<br/>Thanks for the issue report. Before a real human comes by, please make sure you used our bug report format.
|
||||
<br/>Have you looked at the wiki yet? https://docs.ombi.app/
|
||||
<br/>Before posting make sure you also read our [FAQ](https://docs.ombi.app/info/faq/).
|
||||
<br/> Make the title describe your issue. Having 'not working' or 'I get this bug' for 100 issues, isn't really helpful.
|
||||
<br/> If we need more information or there is some progress we tag the issue or update the tag and keep you updated.
|
||||
<br/> Thanks!
|
||||
<br/> Ombi Bot.
|
21
.github/workflows/label.yml
vendored
21
.github/workflows/label.yml
vendored
|
@ -1,21 +0,0 @@
|
|||
# This workflow will triage pull requests and apply a label based on the
|
||||
# paths that are modified in the pull request.
|
||||
#
|
||||
# To use this workflow, you will need to set up a .github/labeler.yml
|
||||
# file with configuration. For more information, see:
|
||||
# https://github.com/actions/labeler
|
||||
|
||||
name: Labeler
|
||||
on: [pull_request]
|
||||
|
||||
permissions: write-all
|
||||
|
||||
jobs:
|
||||
label:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/labeler@v2
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
116
.github/workflows/pr.yml
vendored
116
.github/workflows/pr.yml
vendored
|
@ -1,116 +0,0 @@
|
|||
name: PR Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
issues: write
|
||||
repository-projects: write
|
||||
|
||||
jobs:
|
||||
build-ui:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: NodeModules Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: node_modules-${{ hashFiles('**/yarn.lock') }}
|
||||
|
||||
- name: UI Install
|
||||
run: yarn --cwd ./src/Ombi/ClientApp install
|
||||
|
||||
- name: Build UI
|
||||
run: yarn --cwd ./src/Ombi/ClientApp run build
|
||||
|
||||
unit-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
- name: Nuget Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nuget
|
||||
|
||||
- name: Run Unit Tests
|
||||
run: |
|
||||
cd src
|
||||
dotnet test --configuration "Release" --logger "trx;LogFileName=test-results.trx"
|
||||
|
||||
analysis:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
# Disabling shallow clone is recommended for improving relevancy of reporting
|
||||
fetch-depth: 0
|
||||
- name: SonarCloud Scan
|
||||
uses: sonarsource/sonarcloud-github-action@master
|
||||
with:
|
||||
args: >
|
||||
-Dsonar.organization=ombi-app
|
||||
-Dsonar.projectKey=Ombi-app_Ombi
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ unit-test ]
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: win-x64
|
||||
format: zip
|
||||
compression: zip
|
||||
- os: win-x86
|
||||
format: zip
|
||||
compression: zip
|
||||
- os: linux-x64
|
||||
format: tar.gz
|
||||
compression: tar
|
||||
- os: linux-arm
|
||||
format: tar.gz
|
||||
compression: tar
|
||||
- os: linux-arm64
|
||||
compression: tar
|
||||
format: tar.gz
|
||||
- os: osx-x64
|
||||
compression: tar
|
||||
format: tar.gz
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
- name: Nuget Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nuget
|
||||
|
||||
- name: Publish Backend ${{ matrix.os }}
|
||||
run: dotnet publish -c Release -r ${{ matrix.os }} -o "${{ matrix.os }}" --self-contained true -p:PublishSingleFile=true
|
||||
working-directory: src/Ombi
|
||||
|
||||
|
||||
|
50
.github/workflows/sonarscan.yml
vendored
50
.github/workflows/sonarscan.yml
vendored
|
@ -1,50 +0,0 @@
|
|||
name: Sonar Scanner
|
||||
on:
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
sonarcloud:
|
||||
name: SonarCloud
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
# Shallow clones should be disabled for a better relevancy of analysis
|
||||
fetch-depth: 0
|
||||
|
||||
# Speed-up analysis by caching the scanner workspace
|
||||
- name: Cache SonarCloud workspace
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~\.sonar\cache
|
||||
key: ${{ runner.os }}-sonar-cache
|
||||
restore-keys: ${{ runner.os }}-sonar-cache
|
||||
|
||||
# Speed-up analysis by caching the scanner installation
|
||||
- name: Cache SonarCloud scanner
|
||||
id: cache-sonar-scanner
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: .\.sonar\scanner
|
||||
key: ${{ runner.os }}-sonar-scanner
|
||||
restore-keys: ${{ runner.os }}-sonar-scanner
|
||||
|
||||
- name: Install SonarCloud scanner
|
||||
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
|
||||
shell: powershell
|
||||
# The --version argument is optional. If it is omitted the latest version will be installed.
|
||||
run: |
|
||||
New-Item -Path .\.sonar\scanner -ItemType Directory
|
||||
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner --version 4.8.0
|
||||
- name: Build
|
||||
shell: powershell
|
||||
env:
|
||||
# Needed to get some information about the pull request, if any
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# The secret referenced in the command-line by SONAR_TOKEN should be generated
|
||||
# from https://sonarcloud.io/account/security/
|
||||
# The organization and project arguments (see /o and /k) are displayed
|
||||
# on the project dashboard in SonarCloud.
|
||||
run: |
|
||||
.\.sonar\scanner\dotnet-sonarscanner begin /k:"Ombi-app_Ombi" /o:"ombi-app" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
|
||||
dotnet build src/Ombi.sln -c NonUiBuild
|
||||
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
|
19
.gitignore
vendored
19
.gitignore
vendored
|
@ -7,7 +7,7 @@
|
|||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
|
@ -20,7 +20,6 @@ x86/
|
|||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
.sonarqube/
|
||||
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
|
@ -237,19 +236,3 @@ _Pvt_Extensions
|
|||
.fake/
|
||||
*.ncrunchproject
|
||||
*.ncrunchsolution
|
||||
|
||||
*.txt
|
||||
|
||||
|
||||
# CAKE - C# Make
|
||||
/Tools/*
|
||||
*.db-journal
|
||||
|
||||
# Ignore local vscode config
|
||||
*.vscode
|
||||
/src/Ombi/database.json
|
||||
/src/Ombi/databases.json
|
||||
/src/Ombi/healthchecksdb
|
||||
/src/Ombi/ClientApp/package-lock.json
|
||||
/src/Ombi.Core/Properties/launchSettings.json
|
||||
.yarn
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
pull_request_rules:
|
||||
- name: Automatic merge on approval
|
||||
conditions:
|
||||
- "#approved-reviews-by>=1"
|
||||
actions:
|
||||
merge:
|
||||
method: merge
|
7
.travis.yml
Normal file
7
.travis.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
language: csharp
|
||||
solution: PlexRequests.sln
|
||||
install:
|
||||
- mono Tools/nuget.exe restore PlexRequests.sln
|
||||
- nuget install NUnit.Runners -OutputDirectory testrunner
|
||||
script:
|
||||
- xbuild /p:Configuration=Release PlexRequests.sln /p:TargetFrameworkVersion="v4.5"
|
BIN
Assemblies/Mono.Data.Sqlite.dll
Normal file
BIN
Assemblies/Mono.Data.Sqlite.dll
Normal file
Binary file not shown.
1324
CHANGELOG.md
1324
CHANGELOG.md
File diff suppressed because it is too large
Load diff
|
@ -1,128 +0,0 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
tidusjar@gmail.com.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at
|
||||
https://www.contributor-covenant.org/translations.
|
40
PlexRequests.Api.Interfaces/IApiRequest.cs
Normal file
40
PlexRequests.Api.Interfaces/IApiRequest.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: IApiRequest.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System;
|
||||
|
||||
using RestSharp;
|
||||
|
||||
namespace PlexRequests.Api.Interfaces
|
||||
{
|
||||
public interface IApiRequest
|
||||
{
|
||||
T Execute<T>(IRestRequest request, Uri baseUri) where T : new();
|
||||
IRestResponse Execute(IRestRequest request, Uri baseUri);
|
||||
T ExecuteXml<T>(IRestRequest request, Uri baseUri) where T : class;
|
||||
T ExecuteJson<T>(IRestRequest request, Uri baseUri) where T : new();
|
||||
}
|
||||
}
|
41
PlexRequests.Api.Interfaces/ICouchPotatoApi.cs
Normal file
41
PlexRequests.Api.Interfaces/ICouchPotatoApi.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: ICouchPotatoApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
using PlexRequests.Api.Models.Movie;
|
||||
|
||||
namespace PlexRequests.Api.Interfaces
|
||||
{
|
||||
public interface ICouchPotatoApi
|
||||
{
|
||||
bool AddMovie(string imdbid, string apiKey, string title, Uri baseUrl, string profileID = default(string));
|
||||
CouchPotatoStatus GetStatus(Uri url, string apiKey);
|
||||
CouchPotatoProfiles GetProfiles(Uri url, string apiKey);
|
||||
CouchPotatoMovies GetMovies(Uri baseUrl, string apiKey, string[] status);
|
||||
}
|
||||
}
|
44
PlexRequests.Api.Interfaces/IHeadphonesApi.cs
Normal file
44
PlexRequests.Api.Interfaces/IHeadphonesApi.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: IHeadphonesApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using PlexRequests.Api.Models.Music;
|
||||
|
||||
namespace PlexRequests.Api.Interfaces
|
||||
{
|
||||
public interface IHeadphonesApi
|
||||
{
|
||||
Task<bool> AddAlbum(string apiKey, Uri baseUrl, string albumId);
|
||||
HeadphonesVersion GetVersion(string apiKey, Uri baseUrl);
|
||||
Task<bool> AddArtist(string apiKey, Uri baseUrl, string artistId);
|
||||
Task<bool> QueueAlbum(string apiKey, Uri baseUrl, string albumId);
|
||||
Task<List<HeadphonesGetIndex>> GetIndex(string apiKey, Uri baseUrl);
|
||||
Task<bool> RefreshArtist(string apiKey, Uri baseUrl, string artistId);
|
||||
}
|
||||
}
|
37
PlexRequests.Api.Interfaces/IMusicBrainzApi.cs
Normal file
37
PlexRequests.Api.Interfaces/IMusicBrainzApi.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: IMusicBrainzApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using PlexRequests.Api.Models.Music;
|
||||
|
||||
namespace PlexRequests.Api.Interfaces
|
||||
{
|
||||
public interface IMusicBrainzApi
|
||||
{
|
||||
MusicBrainzSearchResults SearchAlbum(string searchTerm);
|
||||
MusicBrainzCoverArt GetCoverArt(string releaseId);
|
||||
MusicBrainzReleaseInfo GetAlbum(string releaseId);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2017 Jamie Rees
|
||||
// File: JellyfinUser.cs
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: IPlexApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -24,24 +24,22 @@
|
|||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace Ombi.Api.Jellyfin.Models
|
||||
using PlexRequests.Api.Models;
|
||||
using PlexRequests.Api.Models.Plex;
|
||||
|
||||
namespace PlexRequests.Api.Interfaces
|
||||
{
|
||||
public class JellyfinUser
|
||||
public interface IPlexApi
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string ServerId { get; set; }
|
||||
public string ConnectUserName { get; set; }
|
||||
public string ConnectLinkType { get; set; }
|
||||
public string Id { get; set; }
|
||||
public bool HasPassword { get; set; }
|
||||
public bool HasConfiguredPassword { get; set; }
|
||||
public bool HasConfiguredEasyPassword { get; set; }
|
||||
public DateTime LastLoginDate { get; set; }
|
||||
public DateTime LastActivityDate { get; set; }
|
||||
public JellyfinConfiguration Configuration { get; set; }
|
||||
public JellyfinPolicy Policy { get; set; }
|
||||
PlexAuthentication SignIn(string username, string password);
|
||||
PlexFriends GetUsers(string authToken);
|
||||
PlexSearch SearchContent(string authToken, string searchTerm, Uri plexFullHost);
|
||||
PlexStatus GetStatus(string authToken, Uri uri);
|
||||
PlexAccount GetAccount(string authToken);
|
||||
PlexLibraries GetLibrarySections(string authToken, Uri plexFullHost);
|
||||
PlexSearch GetLibrary(string authToken, Uri plexFullHost, string libraryId);
|
||||
PlexMetadata GetMetadata(string authToken, Uri plexFullHost, string itemId);
|
||||
}
|
||||
}
|
45
PlexRequests.Api.Interfaces/IPushbulletApi.cs
Normal file
45
PlexRequests.Api.Interfaces/IPushbulletApi.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: IPushbulletApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using PlexRequests.Api.Models.Notifications;
|
||||
|
||||
namespace PlexRequests.Api.Interfaces
|
||||
{
|
||||
public interface IPushbulletApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Pushes the specified message.
|
||||
/// </summary>
|
||||
/// <param name="accessToken">The access token.</param>
|
||||
/// <param name="title">The title.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="deviceIdentifier">The device identifier.</param>
|
||||
/// <returns></returns>
|
||||
Task<PushbulletResponse> PushAsync(string accessToken, string title, string message, string deviceIdentifier = default(string));
|
||||
}
|
||||
}
|
37
PlexRequests.Api.Interfaces/IPushoverApi.cs
Normal file
37
PlexRequests.Api.Interfaces/IPushoverApi.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: IPushoverApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using PlexRequests.Api.Models.Notifications;
|
||||
|
||||
namespace PlexRequests.Api.Interfaces
|
||||
{
|
||||
public interface IPushoverApi
|
||||
{
|
||||
Task<PushoverResponse> PushAsync(string accessToken, string message, string userToken);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2017 Jamie Rees
|
||||
// File: SonarrCacheSearchRule.cs
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: ISickRageApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -25,26 +25,21 @@
|
|||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Ombi.Core.Models.Search;
|
||||
using Ombi.Core.Rule.Interfaces;
|
||||
using Ombi.Store.Context;
|
||||
using PlexRequests.Api.Models.SickRage;
|
||||
|
||||
namespace Ombi.Core.Rule.Rules.Search
|
||||
namespace PlexRequests.Api.Interfaces
|
||||
{
|
||||
public class SonarrCacheSearchRule : BaseSearchRule, IRules<SearchViewModel>
|
||||
public interface ISickRageApi
|
||||
{
|
||||
public SonarrCacheSearchRule(ExternalContext ctx)
|
||||
{
|
||||
_ctx = ctx;
|
||||
}
|
||||
Task<SickRageTvAdd> AddSeries(int tvdbId, int seasoncount, int[] seasons, string quality, string apiKey,
|
||||
Uri baseUrl);
|
||||
|
||||
private readonly ExternalContext _ctx;
|
||||
SickRagePing Ping(string apiKey, Uri baseUrl);
|
||||
|
||||
public Task<RuleResult> Execute(SearchViewModel obj)
|
||||
{
|
||||
var rule = new SonarrCacheRule(_ctx);
|
||||
return rule.Execute(obj);
|
||||
}
|
||||
Task<SickRageTvAdd> AddSeason(int tvdbId, int season, string apiKey, Uri baseUrl);
|
||||
|
||||
Task<SickrageShows> GetShows(string apiKey, Uri baseUrl);
|
||||
}
|
||||
}
|
37
PlexRequests.Api.Interfaces/ISlackApi.cs
Normal file
37
PlexRequests.Api.Interfaces/ISlackApi.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: ISlackApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using PlexRequests.Api.Models.Notifications;
|
||||
|
||||
namespace PlexRequests.Api.Interfaces
|
||||
{
|
||||
public interface ISlackApi
|
||||
{
|
||||
Task<string> PushAsync(string team, string token, string service, SlackNotificationBody message);
|
||||
}
|
||||
}
|
45
PlexRequests.Api.Interfaces/ISonarrApi.cs
Normal file
45
PlexRequests.Api.Interfaces/ISonarrApi.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: ISonarrApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using PlexRequests.Api.Models.Sonarr;
|
||||
|
||||
namespace PlexRequests.Api.Interfaces
|
||||
{
|
||||
public interface ISonarrApi
|
||||
{
|
||||
List<SonarrProfile> GetProfiles(string apiKey, Uri baseUrl);
|
||||
|
||||
SonarrAddSeries AddSeries(int tvdbId, string title, int qualityId, bool seasonFolders, string rootPath,
|
||||
int seasonCount, int[] seasons, string apiKey, Uri baseUrl);
|
||||
|
||||
SystemStatus SystemStatus(string apiKey, Uri baseUrl);
|
||||
|
||||
List<Series> GetSeries(string apiKey, Uri baseUrl);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{95834072-A675-415D-AA8F-877C91623810}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>PlexRequests.Api.Interfaces</RootNamespace>
|
||||
<AssemblyName>PlexRequests.Api.Interfaces</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="IApiRequest.cs" />
|
||||
<Compile Include="ICouchPotatoApi.cs" />
|
||||
<Compile Include="IHeadphonesApi.cs" />
|
||||
<Compile Include="IMusicBrainzApi.cs" />
|
||||
<Compile Include="IPlexApi.cs" />
|
||||
<Compile Include="IPushbulletApi.cs" />
|
||||
<Compile Include="ISlackApi.cs" />
|
||||
<Compile Include="IPushoverApi.cs" />
|
||||
<Compile Include="ISickRageApi.cs" />
|
||||
<Compile Include="ISonarrApi.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PlexRequests.Api.Models\PlexRequests.Api.Models.csproj">
|
||||
<Project>{CB37A5F8-6DFC-4554-99D3-A42B502E4591}</Project>
|
||||
<Name>PlexRequests.Api.Models</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
38
PlexRequests.Api.Interfaces/Properties/AssemblyInfo.cs
Normal file
38
PlexRequests.Api.Interfaces/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("PlexRequests.Api.Interfaces")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("PlexRequests.Api.Interfaces")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("95834072-a675-415d-aa8f-877c91623810")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
[assembly: AssemblyInformationalVersionAttribute("1.0.0.0")]
|
11
PlexRequests.Api.Interfaces/app.config
Normal file
11
PlexRequests.Api.Interfaces/app.config
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
4
PlexRequests.Api.Interfaces/packages.config
Normal file
4
PlexRequests.Api.Interfaces/packages.config
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="RestSharp" version="105.2.3" targetFramework="net45" />
|
||||
</packages>
|
100
PlexRequests.Api.Models/Movie/CouchPotatoAdd.cs
Normal file
100
PlexRequests.Api.Models/Movie/CouchPotatoAdd.cs
Normal file
|
@ -0,0 +1,100 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PlexRequests.Api.Models.Movie
|
||||
{
|
||||
|
||||
public class CouchPotatoAdd
|
||||
{
|
||||
public Movie movie { get; set; }
|
||||
public bool success { get; set; }
|
||||
}
|
||||
public class Rating
|
||||
{
|
||||
public List<string> imdb { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class Images
|
||||
{
|
||||
public List<object> disc_art { get; set; }
|
||||
public List<string> poster { get; set; }
|
||||
public List<string> backdrop { get; set; }
|
||||
public List<object> extra_thumbs { get; set; }
|
||||
public List<string> poster_original { get; set; }
|
||||
public List<string> actors { get; set; }
|
||||
public List<string> backdrop_original { get; set; }
|
||||
public List<object> clear_art { get; set; }
|
||||
public List<object> logo { get; set; }
|
||||
public List<object> banner { get; set; }
|
||||
public List<object> landscape { get; set; }
|
||||
public List<object> extra_fanart { get; set; }
|
||||
}
|
||||
|
||||
public class Info
|
||||
{
|
||||
public Rating rating { get; set; }
|
||||
public List<string> genres { get; set; }
|
||||
public int tmdb_id { get; set; }
|
||||
public string plot { get; set; }
|
||||
public string tagline { get; set; }
|
||||
public Release_Date release_date { get; set; }
|
||||
public int year { get; set; }
|
||||
public string original_title { get; set; }
|
||||
public List<string> actor_roles { get; set; }
|
||||
public bool via_imdb { get; set; }
|
||||
public Images images { get; set; }
|
||||
public List<string> directors { get; set; }
|
||||
public List<string> titles { get; set; }
|
||||
public string imdb { get; set; }
|
||||
public string mpaa { get; set; }
|
||||
public bool via_tmdb { get; set; }
|
||||
public List<string> actors { get; set; }
|
||||
public List<string> writers { get; set; }
|
||||
public int runtime { get; set; }
|
||||
public string type { get; set; }
|
||||
public string released { get; set; }
|
||||
}
|
||||
|
||||
public class Release_Date
|
||||
{
|
||||
public int dvd { get; set; }
|
||||
public int expires { get; set; }
|
||||
public int theater { get; set; }
|
||||
public bool bluray { get; set; }
|
||||
}
|
||||
|
||||
public class Files
|
||||
{
|
||||
public List<string> image_poster { get; set; }
|
||||
}
|
||||
|
||||
public class Identifiers
|
||||
{
|
||||
public string imdb { get; set; }
|
||||
}
|
||||
|
||||
public class Movie
|
||||
{
|
||||
public string status { get; set; }
|
||||
public Info info { get; set; }
|
||||
public string _t { get; set; }
|
||||
public List<object> releases { get; set; }
|
||||
public string title { get; set; }
|
||||
public string _rev { get; set; }
|
||||
public string profile_id { get; set; }
|
||||
public string _id { get; set; }
|
||||
public List<object> tags { get; set; }
|
||||
public int last_edit { get; set; }
|
||||
public object category_id { get; set; }
|
||||
public string type { get; set; }
|
||||
public Files files { get; set; }
|
||||
public Identifiers identifiers { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
12
PlexRequests.Api.Models/Movie/CouchPotatoMovies.cs
Normal file
12
PlexRequests.Api.Models/Movie/CouchPotatoMovies.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace PlexRequests.Api.Models.Movie
|
||||
{
|
||||
public class CouchPotatoMovies
|
||||
{
|
||||
public List<Movie> movies { get; set; }
|
||||
public int total { get; set; }
|
||||
public bool success { get; set; }
|
||||
public bool empty { get; set; }
|
||||
}
|
||||
}
|
58
PlexRequests.Api.Models/Movie/CouchPotatoProfiles.cs
Normal file
58
PlexRequests.Api.Models/Movie/CouchPotatoProfiles.cs
Normal file
|
@ -0,0 +1,58 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: CouchPotatoProfiles.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace PlexRequests.Api.Models.Movie
|
||||
{
|
||||
public class ProfileList
|
||||
{
|
||||
public bool core { get; set; }
|
||||
public bool hide { get; set; }
|
||||
public string _rev { get; set; }
|
||||
public List<bool> finish { get; set; }
|
||||
public List<string> qualities { get; set; }
|
||||
public string _id { get; set; }
|
||||
public string _t { get; set; }
|
||||
public string label { get; set; }
|
||||
public int minimum_score { get; set; }
|
||||
public List<int> stop_after { get; set; }
|
||||
public List<object> wait_for { get; set; }
|
||||
public int order { get; set; }
|
||||
[JsonProperty(PropertyName = "3d")]
|
||||
public List<object> threeD { get; set; }
|
||||
}
|
||||
|
||||
public class CouchPotatoProfiles
|
||||
{
|
||||
public List<ProfileList> list { get; set; }
|
||||
public bool success { get; set; }
|
||||
}
|
||||
}
|
13
PlexRequests.Api.Models/Movie/CouchPotatoStatus.cs
Normal file
13
PlexRequests.Api.Models/Movie/CouchPotatoStatus.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PlexRequests.Api.Models.Movie
|
||||
{
|
||||
public class CouchPotatoStatus
|
||||
{
|
||||
public bool success { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2017 Jamie Rees
|
||||
// File: EmbyUser.cs
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: HeadphonesAlbumSearchResult.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -24,24 +24,22 @@
|
|||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace Ombi.Api.Emby.Models
|
||||
namespace PlexRequests.Api.Models.Music
|
||||
{
|
||||
public class EmbyUser
|
||||
public class HeadphonesAlbumSearchResult
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string ServerId { get; set; }
|
||||
public string ConnectUserName { get; set; }
|
||||
public string ConnectLinkType { get; set; }
|
||||
public string Id { get; set; }
|
||||
public bool HasPassword { get; set; }
|
||||
public bool HasConfiguredPassword { get; set; }
|
||||
public bool HasConfiguredEasyPassword { get; set; }
|
||||
public DateTime LastLoginDate { get; set; }
|
||||
public DateTime LastActivityDate { get; set; }
|
||||
public EmbyConfiguration Configuration { get; set; }
|
||||
public EmbyPolicy Policy { get; set; }
|
||||
public string rgid { get; set; }
|
||||
public string albumurl { get; set; }
|
||||
public string tracks { get; set; }
|
||||
public string date { get; set; }
|
||||
public string id { get; set; } // Artist ID
|
||||
public string rgtype { get; set; }
|
||||
public string title { get; set; }
|
||||
public string url { get; set; }
|
||||
public string country { get; set; }
|
||||
public string albumid { get; set; } // AlbumId
|
||||
public int score { get; set; }
|
||||
public string uniquename { get; set; }
|
||||
public string formats { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2017 Jamie Rees
|
||||
// File: DogNzbAddResult.cs
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: HeadphonesSearchResult.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -24,22 +24,14 @@
|
|||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ombi.Api.DogNzb.Models
|
||||
namespace PlexRequests.Api.Models.Music
|
||||
{
|
||||
[XmlRoot(ElementName = "uuid")]
|
||||
public class DogNzbAddResult
|
||||
public class HeadphonesArtistSearchResult
|
||||
{
|
||||
[XmlAttribute(AttributeName = "code")]
|
||||
public string Code { get; set; }
|
||||
[XmlAttribute(AttributeName = "description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
|
||||
// We set the below
|
||||
public bool Failure { get; set; }
|
||||
public string ErrorMessage { get; set; }
|
||||
public string url { get; set; } // MusicBrainz url
|
||||
public int score { get; set; } // Search Match score?
|
||||
public string name { get; set; } // Artist Name
|
||||
public string uniquename { get; set; } // Artist Unique Name
|
||||
public string id { get; set; } // Artist Unique ID for MusicBrainz
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2017 Jamie Rees
|
||||
// File: EmbyConfiguration.cs
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: HeadphonesGetIndex.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -24,22 +24,26 @@
|
|||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
namespace Ombi.Api.Emby.Models
|
||||
namespace PlexRequests.Api.Models.Music
|
||||
{
|
||||
public class EmbyConfiguration
|
||||
public class HeadphonesGetIndex
|
||||
{
|
||||
public bool PlayDefaultAudioTrack { get; set; }
|
||||
public bool DisplayMissingEpisodes { get; set; }
|
||||
public bool DisplayUnairedEpisodes { get; set; }
|
||||
public object[] GroupedFolders { get; set; }
|
||||
public string SubtitleMode { get; set; }
|
||||
public bool DisplayCollectionsView { get; set; }
|
||||
public bool EnableLocalPassword { get; set; }
|
||||
public object[] OrderedViews { get; set; }
|
||||
public object[] LatestItemsExcludes { get; set; }
|
||||
public bool HidePlayedInLatest { get; set; }
|
||||
public bool RememberAudioSelections { get; set; }
|
||||
public bool RememberSubtitleSelections { get; set; }
|
||||
public bool EnableNextEpisodeAutoPlay { get; set; }
|
||||
public string Status { get; set; }
|
||||
public string ThumbURL { get; set; }
|
||||
public string DateAdded { get; set; }
|
||||
public string MetaCritic { get; set; }
|
||||
public int? TotalTracks { get; set; }
|
||||
public object Type { get; set; }
|
||||
public int? IncludeExtras { get; set; }
|
||||
public string ArtistName { get; set; }
|
||||
public string LastUpdated { get; set; }
|
||||
public string ReleaseDate { get; set; }
|
||||
public string AlbumID { get; set; }
|
||||
public string ArtistID { get; set; }
|
||||
public string ArtworkURL { get; set; }
|
||||
public string Extras { get; set; }
|
||||
public int? HaveTracks { get; set; }
|
||||
public string LatestAlbum { get; set; }
|
||||
public string ArtistSortName { get; set; }
|
||||
}
|
||||
}
|
37
PlexRequests.Api.Models/Music/HeadphonesVersion.cs
Normal file
37
PlexRequests.Api.Models/Music/HeadphonesVersion.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: HeadphonesVersion.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
namespace PlexRequests.Api.Models.Music
|
||||
{
|
||||
public class HeadphonesVersion
|
||||
{
|
||||
public string install_type { get; set; }
|
||||
public object current_version { get; set; }
|
||||
public string git_path { get; set; }
|
||||
public string latest_version { get; set; }
|
||||
public int commits_behind { get; set; }
|
||||
}
|
||||
}
|
55
PlexRequests.Api.Models/Music/MusicBrainzCoverArt.cs
Normal file
55
PlexRequests.Api.Models/Music/MusicBrainzCoverArt.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: MusicBrainzCoverArt.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PlexRequests.Api.Models.Music
|
||||
{
|
||||
public class Thumbnails
|
||||
{
|
||||
public string large { get; set; }
|
||||
public string small { get; set; }
|
||||
}
|
||||
|
||||
public class Image
|
||||
{
|
||||
public List<string> types { get; set; }
|
||||
public bool front { get; set; }
|
||||
public bool back { get; set; }
|
||||
public int edit { get; set; }
|
||||
public string image { get; set; }
|
||||
public string comment { get; set; }
|
||||
public bool approved { get; set; }
|
||||
public string id { get; set; }
|
||||
public Thumbnails thumbnails { get; set; }
|
||||
}
|
||||
|
||||
public class MusicBrainzCoverArt
|
||||
{
|
||||
public List<Image> images { get; set; }
|
||||
public string release { get; set; }
|
||||
}
|
||||
}
|
68
PlexRequests.Api.Models/Music/MusicBrainzReleaseInfo.cs
Normal file
68
PlexRequests.Api.Models/Music/MusicBrainzReleaseInfo.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: MusicBrainzReleaseInfo.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PlexRequests.Api.Models.Music
|
||||
{
|
||||
public class CoverArtArchive
|
||||
{
|
||||
public int count { get; set; }
|
||||
public bool back { get; set; }
|
||||
public bool artwork { get; set; }
|
||||
public bool front { get; set; }
|
||||
public bool darkened { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class MusicBrainzReleaseInfo
|
||||
{
|
||||
[JsonProperty(PropertyName = "artist-credit")]
|
||||
public List<ArtistCredit> ArtistCredits { get; set; }
|
||||
public string date { get; set; }
|
||||
public string status { get; set; }
|
||||
public string asin { get; set; }
|
||||
public string title { get; set; }
|
||||
public string quality { get; set; }
|
||||
public string country { get; set; }
|
||||
public string packaging { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "text-representation")]
|
||||
public TextRepresentation TextRepresentation { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "cover-art-archive")]
|
||||
public CoverArtArchive CoverArtArchive { get; set; }
|
||||
public string barcode { get; set; }
|
||||
public string disambiguation { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "release-events")]
|
||||
public List<ReleaseEvent> ReleaseEvents { get; set; }
|
||||
public string id { get; set; }
|
||||
}
|
||||
|
||||
}
|
154
PlexRequests.Api.Models/Music/MusicBrainzSearchResults.cs
Normal file
154
PlexRequests.Api.Models/Music/MusicBrainzSearchResults.cs
Normal file
|
@ -0,0 +1,154 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: MusicBrainzSearchResults.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PlexRequests.Api.Models.Music
|
||||
{
|
||||
public class TextRepresentation
|
||||
{
|
||||
public string language { get; set; }
|
||||
public string script { get; set; }
|
||||
}
|
||||
|
||||
public class Alias
|
||||
{
|
||||
[JsonProperty(PropertyName = "sort-name")]
|
||||
public string SortName { get; set; }
|
||||
public string name { get; set; }
|
||||
public object locale { get; set; }
|
||||
public string type { get; set; }
|
||||
public object primary { get; set; }
|
||||
[JsonProperty(PropertyName = "begin-date")]
|
||||
public object BeginDate { get; set; }
|
||||
[JsonProperty(PropertyName = "end-date")]
|
||||
public object EndDate { get; set; }
|
||||
}
|
||||
|
||||
public class Artist
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
[JsonProperty(PropertyName = "sort-date")]
|
||||
public string SortName { get; set; }
|
||||
public string disambiguation { get; set; }
|
||||
public List<Alias> aliases { get; set; }
|
||||
}
|
||||
|
||||
public class ArtistCredit
|
||||
{
|
||||
public Artist artist { get; set; }
|
||||
public string name { get; set; }
|
||||
public string joinphrase { get; set; }
|
||||
}
|
||||
|
||||
public class ReleaseGroup
|
||||
{
|
||||
public string id { get; set; }
|
||||
[JsonProperty(PropertyName = "primary-type")]
|
||||
public string PrimaryType { get; set; }
|
||||
[JsonProperty(PropertyName = "secondary-types")]
|
||||
public List<string> SecondaryTypes { get; set; }
|
||||
}
|
||||
|
||||
public class Area
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
[JsonProperty(PropertyName = "sort-name")]
|
||||
public string SortName { get; set; }
|
||||
[JsonProperty(PropertyName = "iso-3166-1-codes")]
|
||||
public List<string> ISO31661Codes { get; set; }
|
||||
}
|
||||
|
||||
public class ReleaseEvent
|
||||
{
|
||||
public string date { get; set; }
|
||||
public Area area { get; set; }
|
||||
}
|
||||
|
||||
public class Label
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class LabelInfo
|
||||
{
|
||||
[JsonProperty(PropertyName = "catalog-number")]
|
||||
public string CatalogNumber { get; set; }
|
||||
public Label label { get; set; }
|
||||
}
|
||||
|
||||
public class Medium
|
||||
{
|
||||
public string format { get; set; }
|
||||
[JsonProperty(PropertyName = "disc-count")]
|
||||
public int DiscCount { get; set; }
|
||||
[JsonProperty(PropertyName = "catalog-number")]
|
||||
public int CatalogNumber { get; set; }
|
||||
}
|
||||
|
||||
public class Release
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string score { get; set; }
|
||||
public int count { get; set; }
|
||||
public string title { get; set; }
|
||||
public string status { get; set; }
|
||||
public string disambiguation { get; set; }
|
||||
public string packaging { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "text-representation")]
|
||||
public TextRepresentation TextRepresentation { get; set; }
|
||||
[JsonProperty(PropertyName = "artist-credit")]
|
||||
public List<ArtistCredit> ArtistCredit { get; set; }
|
||||
[JsonProperty(PropertyName = "release-group")]
|
||||
public ReleaseGroup ReleaseGroup { get; set; }
|
||||
public string date { get; set; }
|
||||
public string country { get; set; }
|
||||
[JsonProperty(PropertyName = "release-events")]
|
||||
public List<ReleaseEvent> ReleaseEvents { get; set; }
|
||||
public string barcode { get; set; }
|
||||
public string asin { get; set; }
|
||||
[JsonProperty(PropertyName = "label-info")]
|
||||
public List<LabelInfo> LabelInfo { get; set; }
|
||||
[JsonProperty(PropertyName = "track-count")]
|
||||
public int TrackCount { get; set; }
|
||||
public List<Medium> media { get; set; }
|
||||
}
|
||||
|
||||
public class MusicBrainzSearchResults
|
||||
{
|
||||
public string created { get; set; }
|
||||
public int count { get; set; }
|
||||
public int offset { get; set; }
|
||||
public List<Release> releases { get; set; }
|
||||
}
|
||||
|
||||
}
|
38
PlexRequests.Api.Models/Notifications/PushbulletPush.cs
Normal file
38
PlexRequests.Api.Models/Notifications/PushbulletPush.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: PushbulletPush.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PlexRequests.Api.Models.Notifications
|
||||
{
|
||||
public class PushbulletPush
|
||||
{
|
||||
public string body { get; set; }
|
||||
public string title { get; set; }
|
||||
public string type { get; set; }
|
||||
public string device_iden { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2017 Jamie Rees
|
||||
// File: SearchResult.cs
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: PushbulletResponse.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -24,26 +24,25 @@
|
|||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
namespace Ombi.TheMovieDbApi.Models
|
||||
namespace PlexRequests.Api.Models.Notifications
|
||||
{
|
||||
public class SearchResult
|
||||
public class PushbulletResponse
|
||||
{
|
||||
public string poster_path { get; set; }
|
||||
public bool adult { get; set; }
|
||||
public string overview { get; set; }
|
||||
public string release_date { get; set; }
|
||||
public string first_air_date { get; set; }
|
||||
public int?[] genre_ids { get; set; }
|
||||
public int id { get; set; }
|
||||
public string original_title { get; set; }
|
||||
public string original_name { get; set; }
|
||||
public string name { get; set; }
|
||||
public string original_language { get; set; }
|
||||
public bool active { get; set; }
|
||||
public string iden { get; set; }
|
||||
public double created { get; set; }
|
||||
public double modified { get; set; }
|
||||
public string type { get; set; }
|
||||
public bool dismissed { get; set; }
|
||||
public string direction { get; set; }
|
||||
public string sender_iden { get; set; }
|
||||
public string sender_email { get; set; }
|
||||
public string sender_email_normalized { get; set; }
|
||||
public string sender_name { get; set; }
|
||||
public string receiver_iden { get; set; }
|
||||
public string receiver_email { get; set; }
|
||||
public string receiver_email_normalized { get; set; }
|
||||
public string title { get; set; }
|
||||
public string backdrop_path { get; set; }
|
||||
public float popularity { get; set; }
|
||||
public int vote_count { get; set; }
|
||||
public bool video { get; set; }
|
||||
public float vote_average { get; set; }
|
||||
public string body { get; set; }
|
||||
}
|
||||
}
|
34
PlexRequests.Api.Models/Notifications/PushoverResponse.cs
Normal file
34
PlexRequests.Api.Models/Notifications/PushoverResponse.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: PushoverResponse.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
namespace PlexRequests.Api.Models.Notifications
|
||||
{
|
||||
public class PushoverResponse
|
||||
{
|
||||
public int status { get; set; }
|
||||
public string request { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: SlackNotificationBody.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PlexRequests.Api.Models.Notifications
|
||||
{
|
||||
public class SlackNotificationBody
|
||||
{
|
||||
[JsonConstructor]
|
||||
public SlackNotificationBody()
|
||||
{
|
||||
username = "Plex Requests";
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
private string _username;
|
||||
public string username
|
||||
{
|
||||
get { return _username; }
|
||||
set
|
||||
{
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
_username = value;
|
||||
}
|
||||
}
|
||||
public string channel { get; set; }
|
||||
public string text { get; set; }
|
||||
|
||||
public string icon_url { get; set; }
|
||||
public string icon_emoji { get; set; }
|
||||
}
|
||||
}
|
22
PlexRequests.Api.Models/Plex/PlexAccount.cs
Normal file
22
PlexRequests.Api.Models/Plex/PlexAccount.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace PlexRequests.Api.Models.Plex
|
||||
{
|
||||
[XmlRoot(ElementName = "user")]
|
||||
public class PlexAccount
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string Id { get; set; }
|
||||
[XmlAttribute(AttributeName = "username")]
|
||||
public string Username { get; set; }
|
||||
[XmlAttribute(AttributeName = "email")]
|
||||
public string Email { get; set; }
|
||||
[XmlAttribute(AttributeName = "authenticationToken")]
|
||||
public string AuthToken { get; set; }
|
||||
}
|
||||
}
|
63
PlexRequests.Api.Models/Plex/PlexAuthentication.cs
Normal file
63
PlexRequests.Api.Models/Plex/PlexAuthentication.cs
Normal file
|
@ -0,0 +1,63 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: PlexAuthentication.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PlexRequests.Api.Models.Plex
|
||||
{
|
||||
public class PlexAuthentication
|
||||
{
|
||||
public User user { get; set; }
|
||||
}
|
||||
public class Subscription
|
||||
{
|
||||
public bool active { get; set; }
|
||||
public string status { get; set; }
|
||||
public object plan { get; set; }
|
||||
public object features { get; set; }
|
||||
}
|
||||
|
||||
public class Roles
|
||||
{
|
||||
public List<object> roles { get; set; }
|
||||
}
|
||||
|
||||
public class User
|
||||
{
|
||||
public string email { get; set; }
|
||||
public string joined_at { get; set; }
|
||||
public string username { get; set; }
|
||||
public string title { get; set; }
|
||||
public string authentication_token { get; set; }
|
||||
public Subscription subscription { get; set; }
|
||||
public Roles roles { get; set; }
|
||||
public List<string> entitlements { get; set; }
|
||||
public object confirmed_at { get; set; }
|
||||
public int forum_id { get; set; }
|
||||
}
|
||||
}
|
||||
|
39
PlexRequests.Api.Models/Plex/PlexError.cs
Normal file
39
PlexRequests.Api.Models/Plex/PlexError.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: PlexError.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace PlexRequests.Api.Models.Plex
|
||||
{
|
||||
[XmlRoot(ElementName = "errors")]
|
||||
public class PlexError
|
||||
{
|
||||
[XmlElement(ElementName = "error")]
|
||||
public string Error { get; set; }
|
||||
|
||||
}
|
||||
}
|
87
PlexRequests.Api.Models/Plex/PlexFriends.cs
Normal file
87
PlexRequests.Api.Models/Plex/PlexFriends.cs
Normal file
|
@ -0,0 +1,87 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: PlexFriends.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace PlexRequests.Api.Models.Plex
|
||||
{
|
||||
[XmlRoot(ElementName = "Server")]
|
||||
public class Server
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string Id { get; set; }
|
||||
[XmlAttribute(AttributeName = "serverId")]
|
||||
public string ServerId { get; set; }
|
||||
[XmlAttribute(AttributeName = "machineIdentifier")]
|
||||
public string MachineIdentifier { get; set; }
|
||||
[XmlAttribute(AttributeName = "name")]
|
||||
public string Name { get; set; }
|
||||
[XmlAttribute(AttributeName = "lastSeenAt")]
|
||||
public string LastSeenAt { get; set; }
|
||||
[XmlAttribute(AttributeName = "numLibraries")]
|
||||
public string NumLibraries { get; set; }
|
||||
[XmlAttribute(AttributeName = "owned")]
|
||||
public string Owned { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot(ElementName = "User")]
|
||||
public class UserFriends
|
||||
{
|
||||
[XmlElement(ElementName = "Server")]
|
||||
public Server Server { get; set; }
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string Id { get; set; }
|
||||
[XmlAttribute(AttributeName = "title")]
|
||||
public string Title { get; set; }
|
||||
[XmlAttribute(AttributeName = "username")]
|
||||
public string Username { get; set; }
|
||||
[XmlAttribute(AttributeName = "email")]
|
||||
public string Email { get; set; }
|
||||
[XmlAttribute(AttributeName = "recommendationsPlaylistId")]
|
||||
public string RecommendationsPlaylistId { get; set; }
|
||||
[XmlAttribute(AttributeName = "thumb")]
|
||||
public string Thumb { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot(ElementName = "MediaContainer")]
|
||||
public class PlexFriends
|
||||
{
|
||||
[XmlElement(ElementName = "User")]
|
||||
public UserFriends[] User { get; set; }
|
||||
[XmlAttribute(AttributeName = "friendlyName")]
|
||||
public string FriendlyName { get; set; }
|
||||
[XmlAttribute(AttributeName = "identifier")]
|
||||
public string Identifier { get; set; }
|
||||
[XmlAttribute(AttributeName = "machineIdentifier")]
|
||||
public string MachineIdentifier { get; set; }
|
||||
[XmlAttribute(AttributeName = "totalSize")]
|
||||
public string TotalSize { get; set; }
|
||||
[XmlAttribute(AttributeName = "size")]
|
||||
public string Size { get; set; }
|
||||
}
|
||||
|
||||
}
|
22
PlexRequests.Api.Models/Plex/PlexLibraries.cs
Normal file
22
PlexRequests.Api.Models/Plex/PlexLibraries.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace PlexRequests.Api.Models.Plex
|
||||
{
|
||||
[XmlRoot(ElementName = "MediaContainer")]
|
||||
public class PlexLibraries
|
||||
{
|
||||
[XmlElement(ElementName = "Directory")]
|
||||
public List<Directory> Directories { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot(ElementName = "Location")]
|
||||
public partial class Location
|
||||
{
|
||||
[XmlElement(ElementName = "id")]
|
||||
public int id { get; set; }
|
||||
[XmlElement(ElementName = "path")]
|
||||
public string path { get; set; }
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2017 Jamie Rees
|
||||
// File: PlexContentCacher.cs
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: PlexType.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -24,14 +24,12 @@
|
|||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
|
||||
namespace Ombi.Schedule.Jobs
|
||||
namespace PlexRequests.Services
|
||||
{
|
||||
public enum PlexMediaType
|
||||
{
|
||||
Movie = 0,
|
||||
Show = 1,
|
||||
Episode = 2,
|
||||
Movie,
|
||||
Show,
|
||||
Music // double check this one
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2017 Jamie Rees
|
||||
// File: PlexServer.cs
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: PlexMetadata.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -28,20 +28,31 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ombi.Api.Plex.Models.Server
|
||||
namespace PlexRequests.Api.Models.Plex
|
||||
{
|
||||
[XmlRoot(ElementName = "MediaContainer")]
|
||||
public class PlexServer
|
||||
public class PlexMetadata
|
||||
{
|
||||
[XmlElement(ElementName = "Server")]
|
||||
public List<ServerInfo> Server { get; set; }
|
||||
[XmlAttribute(AttributeName = "friendlyName")]
|
||||
public string FriendlyName { get; set; }
|
||||
[XmlAttribute(AttributeName = "identifier")]
|
||||
public string Identifier { get; set; }
|
||||
[XmlAttribute(AttributeName = "machineIdentifier")]
|
||||
public string MachineIdentifier { get; set; }
|
||||
[XmlElement(ElementName= "Video")]
|
||||
public Video Video { get; set; }
|
||||
[XmlElement(ElementName = "Directory")]
|
||||
public Directory1 Directory { get; set; }
|
||||
[XmlAttribute(AttributeName = "size")]
|
||||
public string Size { get; set; }
|
||||
[XmlAttribute(AttributeName = "allowSync")]
|
||||
public string AllowSync { get; set; }
|
||||
[XmlAttribute(AttributeName = "identifier")]
|
||||
public string Identifier { get; set; }
|
||||
[XmlAttribute(AttributeName = "librarySectionID")]
|
||||
public string LibrarySectionID { get; set; }
|
||||
[XmlAttribute(AttributeName = "librarySectionTitle")]
|
||||
public string LibrarySectionTitle { get; set; }
|
||||
[XmlAttribute(AttributeName = "librarySectionUUID")]
|
||||
public string LibrarySectionUUID { get; set; }
|
||||
[XmlAttribute(AttributeName = "mediaTagPrefix")]
|
||||
public string MediaTagPrefix { get; set; }
|
||||
[XmlAttribute(AttributeName = "mediaTagVersion")]
|
||||
public string MediaTagVersion { get; set; }
|
||||
}
|
||||
|
||||
}
|
336
PlexRequests.Api.Models/Plex/PlexSearch.cs
Normal file
336
PlexRequests.Api.Models/Plex/PlexSearch.cs
Normal file
|
@ -0,0 +1,336 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: PlexSearch.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace PlexRequests.Api.Models.Plex
|
||||
{
|
||||
[XmlRoot(ElementName = "Part")]
|
||||
public class Part
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string Id { get; set; }
|
||||
[XmlAttribute(AttributeName = "key")]
|
||||
public string Key { get; set; }
|
||||
[XmlAttribute(AttributeName = "duration")]
|
||||
public string Duration { get; set; }
|
||||
[XmlAttribute(AttributeName = "file")]
|
||||
public string File { get; set; }
|
||||
[XmlAttribute(AttributeName = "size")]
|
||||
public string Size { get; set; }
|
||||
[XmlAttribute(AttributeName = "audioProfile")]
|
||||
public string AudioProfile { get; set; }
|
||||
[XmlAttribute(AttributeName = "container")]
|
||||
public string Container { get; set; }
|
||||
[XmlAttribute(AttributeName = "videoProfile")]
|
||||
public string VideoProfile { get; set; }
|
||||
[XmlAttribute(AttributeName = "has64bitOffsets")]
|
||||
public string Has64bitOffsets { get; set; }
|
||||
[XmlAttribute(AttributeName = "hasChapterTextStream")]
|
||||
public string HasChapterTextStream { get; set; }
|
||||
[XmlAttribute(AttributeName = "optimizedForStreaming")]
|
||||
public string OptimizedForStreaming { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot(ElementName = "Media")]
|
||||
public class Media
|
||||
{
|
||||
[XmlElement(ElementName = "Part")]
|
||||
public Part Part { get; set; }
|
||||
[XmlAttribute(AttributeName = "videoResolution")]
|
||||
public string VideoResolution { get; set; }
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string Id { get; set; }
|
||||
[XmlAttribute(AttributeName = "duration")]
|
||||
public string Duration { get; set; }
|
||||
[XmlAttribute(AttributeName = "bitrate")]
|
||||
public string Bitrate { get; set; }
|
||||
[XmlAttribute(AttributeName = "width")]
|
||||
public string Width { get; set; }
|
||||
[XmlAttribute(AttributeName = "height")]
|
||||
public string Height { get; set; }
|
||||
[XmlAttribute(AttributeName = "aspectRatio")]
|
||||
public string AspectRatio { get; set; }
|
||||
[XmlAttribute(AttributeName = "audioChannels")]
|
||||
public string AudioChannels { get; set; }
|
||||
[XmlAttribute(AttributeName = "audioCodec")]
|
||||
public string AudioCodec { get; set; }
|
||||
[XmlAttribute(AttributeName = "videoCodec")]
|
||||
public string VideoCodec { get; set; }
|
||||
[XmlAttribute(AttributeName = "container")]
|
||||
public string Container { get; set; }
|
||||
[XmlAttribute(AttributeName = "videoFrameRate")]
|
||||
public string VideoFrameRate { get; set; }
|
||||
[XmlAttribute(AttributeName = "audioProfile")]
|
||||
public string AudioProfile { get; set; }
|
||||
[XmlAttribute(AttributeName = "videoProfile")]
|
||||
public string VideoProfile { get; set; }
|
||||
[XmlAttribute(AttributeName = "optimizedForStreaming")]
|
||||
public string OptimizedForStreaming { get; set; }
|
||||
[XmlAttribute(AttributeName = "has64bitOffsets")]
|
||||
public string Has64bitOffsets { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot(ElementName = "Genre")]
|
||||
public class Genre
|
||||
{
|
||||
[XmlAttribute(AttributeName = "tag")]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot(ElementName = "Writer")]
|
||||
public class Writer
|
||||
{
|
||||
[XmlAttribute(AttributeName = "tag")]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot(ElementName = "Director")]
|
||||
public class Director
|
||||
{
|
||||
[XmlAttribute(AttributeName = "tag")]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot(ElementName = "Country")]
|
||||
public class Country
|
||||
{
|
||||
[XmlAttribute(AttributeName = "tag")]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot(ElementName = "Role")]
|
||||
public class Role
|
||||
{
|
||||
[XmlAttribute(AttributeName = "tag")]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot(ElementName = "Video")]
|
||||
public class Video
|
||||
{
|
||||
public string ProviderId { get; set; }
|
||||
[XmlAttribute(AttributeName = "guid")]
|
||||
public string Guid { get; set; }
|
||||
[XmlElement(ElementName = "Media")]
|
||||
public List<Media> Media { get; set; }
|
||||
[XmlElement(ElementName = "Genre")]
|
||||
public List<Genre> Genre { get; set; }
|
||||
[XmlElement(ElementName = "Writer")]
|
||||
public List<Writer> Writer { get; set; }
|
||||
[XmlElement(ElementName = "Director")]
|
||||
public Director Director { get; set; }
|
||||
[XmlElement(ElementName = "Country")]
|
||||
public Country Country { get; set; }
|
||||
[XmlElement(ElementName = "Role")]
|
||||
public List<Role> Role { get; set; }
|
||||
[XmlAttribute(AttributeName = "allowSync")]
|
||||
public string AllowSync { get; set; }
|
||||
[XmlAttribute(AttributeName = "librarySectionID")]
|
||||
public string LibrarySectionID { get; set; }
|
||||
[XmlAttribute(AttributeName = "librarySectionTitle")]
|
||||
public string LibrarySectionTitle { get; set; }
|
||||
[XmlAttribute(AttributeName = "librarySectionUUID")]
|
||||
public string LibrarySectionUUID { get; set; }
|
||||
[XmlAttribute(AttributeName = "personal")]
|
||||
public string Personal { get; set; }
|
||||
[XmlAttribute(AttributeName = "sourceTitle")]
|
||||
public string SourceTitle { get; set; }
|
||||
[XmlAttribute(AttributeName = "ratingKey")]
|
||||
public string RatingKey { get; set; }
|
||||
[XmlAttribute(AttributeName = "key")]
|
||||
public string Key { get; set; }
|
||||
[XmlAttribute(AttributeName = "studio")]
|
||||
public string Studio { get; set; }
|
||||
[XmlAttribute(AttributeName = "type")]
|
||||
public string Type { get; set; }
|
||||
[XmlAttribute(AttributeName = "title")]
|
||||
public string Title { get; set; }
|
||||
[XmlAttribute(AttributeName = "contentRating")]
|
||||
public string ContentRating { get; set; }
|
||||
[XmlAttribute(AttributeName = "summary")]
|
||||
public string Summary { get; set; }
|
||||
[XmlAttribute(AttributeName = "rating")]
|
||||
public string Rating { get; set; }
|
||||
[XmlAttribute(AttributeName = "audienceRating")]
|
||||
public string AudienceRating { get; set; }
|
||||
[XmlAttribute(AttributeName = "year")]
|
||||
public string Year { get; set; }
|
||||
[XmlAttribute(AttributeName = "tagline")]
|
||||
public string Tagline { get; set; }
|
||||
[XmlAttribute(AttributeName = "thumb")]
|
||||
public string Thumb { get; set; }
|
||||
[XmlAttribute(AttributeName = "art")]
|
||||
public string Art { get; set; }
|
||||
[XmlAttribute(AttributeName = "duration")]
|
||||
public string Duration { get; set; }
|
||||
[XmlAttribute(AttributeName = "originallyAvailableAt")]
|
||||
public string OriginallyAvailableAt { get; set; }
|
||||
[XmlAttribute(AttributeName = "addedAt")]
|
||||
public string AddedAt { get; set; }
|
||||
[XmlAttribute(AttributeName = "updatedAt")]
|
||||
public string UpdatedAt { get; set; }
|
||||
[XmlAttribute(AttributeName = "audienceRatingImage")]
|
||||
public string AudienceRatingImage { get; set; }
|
||||
[XmlAttribute(AttributeName = "chapterSource")]
|
||||
public string ChapterSource { get; set; }
|
||||
[XmlAttribute(AttributeName = "ratingImage")]
|
||||
public string RatingImage { get; set; }
|
||||
[XmlAttribute(AttributeName = "titleSort")]
|
||||
public string TitleSort { get; set; }
|
||||
[XmlAttribute(AttributeName = "parentRatingKey")]
|
||||
public string ParentRatingKey { get; set; }
|
||||
[XmlAttribute(AttributeName = "grandparentRatingKey")]
|
||||
public string GrandparentRatingKey { get; set; }
|
||||
[XmlAttribute(AttributeName = "grandparentKey")]
|
||||
public string GrandparentKey { get; set; }
|
||||
[XmlAttribute(AttributeName = "parentKey")]
|
||||
public string ParentKey { get; set; }
|
||||
[XmlAttribute(AttributeName = "grandparentTitle")]
|
||||
public string GrandparentTitle { get; set; }
|
||||
[XmlAttribute(AttributeName = "index")]
|
||||
public string Index { get; set; }
|
||||
[XmlAttribute(AttributeName = "parentIndex")]
|
||||
public string ParentIndex { get; set; }
|
||||
[XmlAttribute(AttributeName = "parentThumb")]
|
||||
public string ParentThumb { get; set; }
|
||||
[XmlAttribute(AttributeName = "grandparentThumb")]
|
||||
public string GrandparentThumb { get; set; }
|
||||
[XmlAttribute(AttributeName = "grandparentArt")]
|
||||
public string GrandparentArt { get; set; }
|
||||
[XmlAttribute(AttributeName = "viewCount")]
|
||||
public string ViewCount { get; set; }
|
||||
[XmlAttribute(AttributeName = "lastViewedAt")]
|
||||
public string LastViewedAt { get; set; }
|
||||
[XmlAttribute(AttributeName = "grandparentTheme")]
|
||||
public string GrandparentTheme { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot(ElementName = "Provider")]
|
||||
public class Provider
|
||||
{
|
||||
[XmlAttribute(AttributeName = "key")]
|
||||
public string Key { get; set; }
|
||||
[XmlAttribute(AttributeName = "title")]
|
||||
public string Title { get; set; }
|
||||
[XmlAttribute(AttributeName = "type")]
|
||||
public string Type { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot(ElementName = "Directory")]
|
||||
public class Directory1
|
||||
{
|
||||
public string ProviderId { get; set; }
|
||||
[XmlAttribute(AttributeName = "guid")]
|
||||
public string Guid { get; set; }
|
||||
[XmlElement(ElementName = "Genre")]
|
||||
public List<Genre> Genre { get; set; }
|
||||
[XmlElement(ElementName = "Role")]
|
||||
public List<Role> Role { get; set; }
|
||||
[XmlAttribute(AttributeName = "allowSync")]
|
||||
public string AllowSync { get; set; }
|
||||
[XmlAttribute(AttributeName = "librarySectionID")]
|
||||
public string LibrarySectionID { get; set; }
|
||||
[XmlAttribute(AttributeName = "librarySectionTitle")]
|
||||
public string LibrarySectionTitle { get; set; }
|
||||
[XmlAttribute(AttributeName = "librarySectionUUID")]
|
||||
public string LibrarySectionUUID { get; set; }
|
||||
[XmlAttribute(AttributeName = "personal")]
|
||||
public string Personal { get; set; }
|
||||
[XmlAttribute(AttributeName = "sourceTitle")]
|
||||
public string SourceTitle { get; set; }
|
||||
[XmlAttribute(AttributeName = "ratingKey")]
|
||||
public string RatingKey { get; set; }
|
||||
[XmlAttribute(AttributeName = "key")]
|
||||
public string Key { get; set; }
|
||||
[XmlAttribute(AttributeName = "studio")]
|
||||
public string Studio { get; set; }
|
||||
[XmlAttribute(AttributeName = "type")]
|
||||
public string Type { get; set; }
|
||||
[XmlAttribute(AttributeName = "title")]
|
||||
public string Title { get; set; }
|
||||
[XmlAttribute(AttributeName = "contentRating")]
|
||||
public string ContentRating { get; set; }
|
||||
[XmlAttribute(AttributeName = "summary")]
|
||||
public string Summary { get; set; }
|
||||
[XmlAttribute(AttributeName = "index")]
|
||||
public string Index { get; set; }
|
||||
[XmlAttribute(AttributeName = "rating")]
|
||||
public string Rating { get; set; }
|
||||
[XmlAttribute(AttributeName = "viewCount")]
|
||||
public string ViewCount { get; set; }
|
||||
[XmlAttribute(AttributeName = "lastViewedAt")]
|
||||
public string LastViewedAt { get; set; }
|
||||
[XmlAttribute(AttributeName = "year")]
|
||||
public string Year { get; set; }
|
||||
[XmlAttribute(AttributeName = "thumb")]
|
||||
public string Thumb { get; set; }
|
||||
[XmlAttribute(AttributeName = "art")]
|
||||
public string Art { get; set; }
|
||||
[XmlAttribute(AttributeName = "banner")]
|
||||
public string Banner { get; set; }
|
||||
[XmlAttribute(AttributeName = "theme")]
|
||||
public string Theme { get; set; }
|
||||
[XmlAttribute(AttributeName = "duration")]
|
||||
public string Duration { get; set; }
|
||||
[XmlAttribute(AttributeName = "originallyAvailableAt")]
|
||||
public string OriginallyAvailableAt { get; set; }
|
||||
[XmlAttribute(AttributeName = "leafCount")]
|
||||
public string LeafCount { get; set; }
|
||||
[XmlAttribute(AttributeName = "viewedLeafCount")]
|
||||
public string ViewedLeafCount { get; set; }
|
||||
[XmlAttribute(AttributeName = "childCount")]
|
||||
public string ChildCount { get; set; }
|
||||
[XmlAttribute(AttributeName = "addedAt")]
|
||||
public string AddedAt { get; set; }
|
||||
[XmlAttribute(AttributeName = "updatedAt")]
|
||||
public string UpdatedAt { get; set; }
|
||||
[XmlAttribute(AttributeName = "parentTitle")]
|
||||
public string ParentTitle { get; set; }
|
||||
}
|
||||
|
||||
|
||||
[XmlRoot(ElementName = "MediaContainer")]
|
||||
public class PlexSearch
|
||||
{
|
||||
|
||||
[XmlElement(ElementName = "Directory")]
|
||||
public List<Directory1> Directory { get; set; }
|
||||
[XmlElement(ElementName = "Video")]
|
||||
public List<Video> Video { get; set; }
|
||||
[XmlElement(ElementName = "Provider")]
|
||||
public List<Provider> Provider { get; set; }
|
||||
[XmlAttribute(AttributeName = "size")]
|
||||
public string Size { get; set; }
|
||||
[XmlAttribute(AttributeName = "identifier")]
|
||||
public string Identifier { get; set; }
|
||||
[XmlAttribute(AttributeName = "mediaTagPrefix")]
|
||||
public string MediaTagPrefix { get; set; }
|
||||
[XmlAttribute(AttributeName = "mediaTagVersion")]
|
||||
public string MediaTagVersion { get; set; }
|
||||
}
|
||||
}
|
91
PlexRequests.Api.Models/Plex/PlexStatus.cs
Normal file
91
PlexRequests.Api.Models/Plex/PlexStatus.cs
Normal file
|
@ -0,0 +1,91 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace PlexRequests.Api.Models.Plex
|
||||
{
|
||||
[XmlRoot(ElementName = "Directory")]
|
||||
public class Directory
|
||||
{
|
||||
[XmlAttribute(AttributeName = "count")]
|
||||
public string Count { get; set; }
|
||||
[XmlAttribute(AttributeName = "key")]
|
||||
public string Key { get; set; }
|
||||
[XmlAttribute(AttributeName = "title")]
|
||||
public string Title { get; set; }
|
||||
[XmlAttribute(AttributeName = "type")]
|
||||
public string type { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot(ElementName = "MediaContainer")]
|
||||
public class PlexStatus
|
||||
{
|
||||
[XmlElement(ElementName = "Directory")]
|
||||
public List<Directory> Directory { get; set; }
|
||||
[XmlAttribute(AttributeName = "size")]
|
||||
public string Size { get; set; }
|
||||
[XmlAttribute(AttributeName = "allowCameraUpload")]
|
||||
public string AllowCameraUpload { get; set; }
|
||||
[XmlAttribute(AttributeName = "allowChannelAccess")]
|
||||
public string AllowChannelAccess { get; set; }
|
||||
[XmlAttribute(AttributeName = "allowMediaDeletion")]
|
||||
public string AllowMediaDeletion { get; set; }
|
||||
[XmlAttribute(AttributeName = "allowSync")]
|
||||
public string AllowSync { get; set; }
|
||||
[XmlAttribute(AttributeName = "backgroundProcessing")]
|
||||
public string BackgroundProcessing { get; set; }
|
||||
[XmlAttribute(AttributeName = "certificate")]
|
||||
public string Certificate { get; set; }
|
||||
[XmlAttribute(AttributeName = "companionProxy")]
|
||||
public string CompanionProxy { get; set; }
|
||||
[XmlAttribute(AttributeName = "friendlyName")]
|
||||
public string FriendlyName { get; set; }
|
||||
[XmlAttribute(AttributeName = "machineIdentifier")]
|
||||
public string MachineIdentifier { get; set; }
|
||||
[XmlAttribute(AttributeName = "multiuser")]
|
||||
public string Multiuser { get; set; }
|
||||
[XmlAttribute(AttributeName = "myPlex")]
|
||||
public string MyPlex { get; set; }
|
||||
[XmlAttribute(AttributeName = "myPlexMappingState")]
|
||||
public string MyPlexMappingState { get; set; }
|
||||
[XmlAttribute(AttributeName = "myPlexSigninState")]
|
||||
public string MyPlexSigninState { get; set; }
|
||||
[XmlAttribute(AttributeName = "myPlexSubscription")]
|
||||
public string MyPlexSubscription { get; set; }
|
||||
[XmlAttribute(AttributeName = "myPlexUsername")]
|
||||
public string MyPlexUsername { get; set; }
|
||||
[XmlAttribute(AttributeName = "platform")]
|
||||
public string Platform { get; set; }
|
||||
[XmlAttribute(AttributeName = "platformVersion")]
|
||||
public string PlatformVersion { get; set; }
|
||||
[XmlAttribute(AttributeName = "requestParametersInCookie")]
|
||||
public string RequestParametersInCookie { get; set; }
|
||||
[XmlAttribute(AttributeName = "sync")]
|
||||
public string Sync { get; set; }
|
||||
[XmlAttribute(AttributeName = "transcoderActiveVideoSessions")]
|
||||
public string TranscoderActiveVideoSessions { get; set; }
|
||||
[XmlAttribute(AttributeName = "transcoderAudio")]
|
||||
public string TranscoderAudio { get; set; }
|
||||
[XmlAttribute(AttributeName = "transcoderLyrics")]
|
||||
public string TranscoderLyrics { get; set; }
|
||||
[XmlAttribute(AttributeName = "transcoderPhoto")]
|
||||
public string TranscoderPhoto { get; set; }
|
||||
[XmlAttribute(AttributeName = "transcoderSubtitles")]
|
||||
public string TranscoderSubtitles { get; set; }
|
||||
[XmlAttribute(AttributeName = "transcoderVideo")]
|
||||
public string TranscoderVideo { get; set; }
|
||||
[XmlAttribute(AttributeName = "transcoderVideoBitrates")]
|
||||
public string TranscoderVideoBitrates { get; set; }
|
||||
[XmlAttribute(AttributeName = "transcoderVideoQualities")]
|
||||
public string TranscoderVideoQualities { get; set; }
|
||||
[XmlAttribute(AttributeName = "transcoderVideoResolutions")]
|
||||
public string TranscoderVideoResolutions { get; set; }
|
||||
[XmlAttribute(AttributeName = "updatedAt")]
|
||||
public string UpdatedAt { get; set; }
|
||||
[XmlAttribute(AttributeName = "version")]
|
||||
public string Version { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2017 Jamie Rees
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: PlexUserRequest.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
|
@ -24,10 +24,17 @@
|
|||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
namespace Ombi.Api.Plex.Models
|
||||
|
||||
namespace PlexRequests.Api.Models.Plex
|
||||
{
|
||||
public class PlexUserRequest
|
||||
{
|
||||
public UserRequest user { get; set; }
|
||||
}
|
||||
|
||||
public class UserRequest
|
||||
{
|
||||
public string login { get; set; }
|
||||
public string password { get; set; }
|
||||
}
|
||||
}
|
111
PlexRequests.Api.Models/PlexRequests.Api.Models.csproj
Normal file
111
PlexRequests.Api.Models/PlexRequests.Api.Models.csproj
Normal file
|
@ -0,0 +1,111 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{CB37A5F8-6DFC-4554-99D3-A42B502E4591}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>PlexRequests.Api.Models</RootNamespace>
|
||||
<AssemblyName>PlexRequests.Api.Models</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Movie\CouchPotatoAdd.cs" />
|
||||
<Compile Include="Movie\CouchPotatoMovies.cs" />
|
||||
<Compile Include="Movie\CouchPotatoProfiles.cs" />
|
||||
<Compile Include="Movie\CouchPotatoStatus.cs" />
|
||||
<Compile Include="Music\HeadphonesAlbumSearchResult.cs" />
|
||||
<Compile Include="Music\HeadphonesArtistSearchResult.cs" />
|
||||
<Compile Include="Music\HeadphonesGetIndex.cs" />
|
||||
<Compile Include="Music\HeadphonesVersion.cs" />
|
||||
<Compile Include="Music\MusicBrainzCoverArt.cs" />
|
||||
<Compile Include="Music\MusicBrainzReleaseInfo.cs" />
|
||||
<Compile Include="Music\MusicBrainzSearchResults.cs" />
|
||||
<Compile Include="Notifications\PushbulletPush.cs" />
|
||||
<Compile Include="Notifications\PushbulletResponse.cs" />
|
||||
<Compile Include="Notifications\PushoverResponse.cs" />
|
||||
<Compile Include="Notifications\SlackNotificationBody.cs" />
|
||||
<Compile Include="Plex\PlexAccount.cs" />
|
||||
<Compile Include="Plex\PlexAuthentication.cs" />
|
||||
<Compile Include="Plex\PlexError.cs" />
|
||||
<Compile Include="Plex\PlexFriends.cs" />
|
||||
<Compile Include="Plex\PlexLibraries.cs" />
|
||||
<Compile Include="Plex\PlexMetadata.cs" />
|
||||
<Compile Include="Plex\PlexSearch.cs" />
|
||||
<Compile Include="Plex\PlexStatus.cs" />
|
||||
<Compile Include="Plex\PlexMediaType.cs" />
|
||||
<Compile Include="Plex\PlexUserRequest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SickRage\SickRageBase.cs" />
|
||||
<Compile Include="SickRage\SickrageShows.cs" />
|
||||
<Compile Include="SickRage\SickRagePing.cs" />
|
||||
<Compile Include="SickRage\SickRageSeasonList.cs" />
|
||||
<Compile Include="SickRage\SickRageShowInformation.cs" />
|
||||
<Compile Include="SickRage\SickRageStatus.cs" />
|
||||
<Compile Include="SickRage\SickRageTvAdd.cs" />
|
||||
<Compile Include="Sonarr\SonarrAddSeries.cs" />
|
||||
<Compile Include="Sonarr\SonarrAllSeries.cs" />
|
||||
<Compile Include="Sonarr\SonarrError.cs" />
|
||||
<Compile Include="Sonarr\SonarrProfile.cs" />
|
||||
<Compile Include="Sonarr\SystemStatus.cs" />
|
||||
<Compile Include="Tv\Authentication.cs" />
|
||||
<Compile Include="Tv\TvMazeSearch.cs" />
|
||||
<Compile Include="Tv\TvMazeSeasons.cs" />
|
||||
<Compile Include="Tv\TVMazeShow.cs" />
|
||||
<Compile Include="Tv\TvSearchResult.cs" />
|
||||
<Compile Include="Tv\TvShow.cs" />
|
||||
<Compile Include="Tv\TvShowImages.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PlexRequests.Helpers\PlexRequests.Helpers.csproj">
|
||||
<Project>{1252336D-42A3-482A-804C-836E60173DFA}</Project>
|
||||
<Name>PlexRequests.Helpers</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
38
PlexRequests.Api.Models/Properties/AssemblyInfo.cs
Normal file
38
PlexRequests.Api.Models/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("PlexRequests.Api.Models")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("PlexRequests.Api.Models")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("cb37a5f8-6dfc-4554-99d3-a42b502e4591")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
[assembly: AssemblyInformationalVersionAttribute("1.0.0.0")]
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ombi.Api.SickRage.Models
|
||||
namespace PlexRequests.Api.Models.SickRage
|
||||
{
|
||||
public abstract class SickRageBase<T>
|
||||
{
|
37
PlexRequests.Api.Models/SickRage/SickRagePing.cs
Normal file
37
PlexRequests.Api.Models/SickRage/SickRagePing.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: SickRagePing.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
namespace PlexRequests.Api.Models.SickRage
|
||||
{
|
||||
public class SickRagePingData
|
||||
{
|
||||
public int pid { get; set; }
|
||||
}
|
||||
|
||||
public class SickRagePing : SickRageBase<SickRagePingData>
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
using Newtonsoft.Json;
|
||||
using Ombi.Helpers;
|
||||
using PlexRequests.Helpers;
|
||||
|
||||
namespace Ombi.Api.SickRage.Models
|
||||
namespace PlexRequests.Api.Models.SickRage
|
||||
{
|
||||
public class SickRageSeasonList : SickRageBase<object>
|
||||
{
|
82
PlexRequests.Api.Models/SickRage/SickRageShowInformation.cs
Normal file
82
PlexRequests.Api.Models/SickRage/SickRageShowInformation.cs
Normal file
|
@ -0,0 +1,82 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: SickRageShowInformation.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PlexRequests.Api.Models.SickRage
|
||||
{
|
||||
public class Cache
|
||||
{
|
||||
public int banner { get; set; }
|
||||
public int poster { get; set; }
|
||||
}
|
||||
|
||||
public class QualityDetails
|
||||
{
|
||||
public List<object> archive { get; set; }
|
||||
public List<string> initial { get; set; }
|
||||
}
|
||||
|
||||
public class SeasonList
|
||||
{
|
||||
}
|
||||
|
||||
public class Data
|
||||
{
|
||||
public int air_by_date { get; set; }
|
||||
public string airs { get; set; }
|
||||
public int anime { get; set; }
|
||||
public int archive_firstmatch { get; set; }
|
||||
public Cache cache { get; set; }
|
||||
public int dvdorder { get; set; }
|
||||
public int flatten_folders { get; set; }
|
||||
public List<string> genre { get; set; }
|
||||
public string imdbid { get; set; }
|
||||
public int indexerid { get; set; }
|
||||
public string language { get; set; }
|
||||
public string location { get; set; }
|
||||
public string network { get; set; }
|
||||
public string next_ep_airdate { get; set; }
|
||||
public int paused { get; set; }
|
||||
public string quality { get; set; }
|
||||
public QualityDetails quality_details { get; set; }
|
||||
public List<object> rls_ignore_words { get; set; }
|
||||
public List<object> rls_require_words { get; set; }
|
||||
public int scene { get; set; }
|
||||
public SeasonList season_list { get; set; }
|
||||
public string show_name { get; set; }
|
||||
public int sports { get; set; }
|
||||
public string status { get; set; }
|
||||
public int subtitles { get; set; }
|
||||
public int tvdbid { get; set; }
|
||||
}
|
||||
|
||||
public class SickRageShowInformation : SickRageBase<Data>
|
||||
{
|
||||
}
|
||||
|
||||
}
|
35
PlexRequests.Api.Models/SickRage/SickRageStatus.cs
Normal file
35
PlexRequests.Api.Models/SickRage/SickRageStatus.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: SickRageStatus.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
namespace PlexRequests.Api.Models.SickRage
|
||||
{
|
||||
public static class SickRageStatus
|
||||
{
|
||||
public const string Wanted = "wanted";
|
||||
public const string Skipped = "skipped";
|
||||
public const string Ignored = "Ignored";
|
||||
}
|
||||
}
|
38
PlexRequests.Api.Models/SickRage/SickRageTvAdd.cs
Normal file
38
PlexRequests.Api.Models/SickRage/SickRageTvAdd.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: SickRageTvAdd.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
namespace PlexRequests.Api.Models.SickRage
|
||||
{
|
||||
public class SickRageTvAddData
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class SickRageTvAdd : SickRageBase<SickRageTvAddData>
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2018 Jamie Rees
|
||||
// File: MassEmailModel.cs
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: SickrageShows.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -25,18 +25,18 @@
|
|||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Ombi.Store.Entities;
|
||||
|
||||
namespace Ombi.Core.Models
|
||||
namespace PlexRequests.Api.Models.SickRage
|
||||
{
|
||||
public class MassEmailModel
|
||||
public class SickrageShows : SickRageBase<Dictionary<int, Item>>
|
||||
{
|
||||
public string Subject { get; set; }
|
||||
public string Body { get; set; }
|
||||
|
||||
public bool Bcc { get; set; }
|
||||
}
|
||||
|
||||
public List<OmbiUser> Users { get; set; }
|
||||
public class Item
|
||||
{
|
||||
public int tvdbid { get; set; }
|
||||
}
|
||||
}
|
50
PlexRequests.Api.Models/Sonarr/SonarrAddSeries.cs
Normal file
50
PlexRequests.Api.Models/Sonarr/SonarrAddSeries.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
namespace PlexRequests.Api.Models.Sonarr
|
||||
{
|
||||
public class Season
|
||||
{
|
||||
public int seasonNumber { get; set; }
|
||||
public bool monitored { get; set; }
|
||||
public Statistics statistics { get; set; }
|
||||
}
|
||||
|
||||
public class Statistics
|
||||
{
|
||||
public int episodeFileCount { get; set; }
|
||||
public int episodeCount { get; set; }
|
||||
public int totalEpisodeCount { get; set; }
|
||||
public long sizeOnDisk { get; set; }
|
||||
public float percentOfEpisodes { get; set; }
|
||||
public DateTime previousAiring { get; set; }
|
||||
}
|
||||
|
||||
public class SonarrAddSeries
|
||||
{
|
||||
public AddOptions addOptions { get; set; }
|
||||
public string title { get; set; }
|
||||
public List<Season> seasons { get; set; }
|
||||
public string rootFolderPath { get; set; }
|
||||
public int qualityProfileId { get; set; }
|
||||
public bool seasonFolder { get; set; }
|
||||
public bool monitored { get; set; }
|
||||
public int tvdbId { get; set; }
|
||||
public int tvRageId { get; set; }
|
||||
public string cleanTitle { get; set; }
|
||||
public string imdbId { get; set; }
|
||||
public string titleSlug { get; set; }
|
||||
public int id { get; set; }
|
||||
[JsonIgnore]
|
||||
public List<string> ErrorMessages { get; set; }
|
||||
}
|
||||
|
||||
public class AddOptions
|
||||
{
|
||||
public bool ignoreEpisodesWithFiles { get; set; }
|
||||
public bool ignoreEpisodesWithoutFiles { get; set; }
|
||||
public bool searchForMissingEpisodes { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,14 +1,17 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Ombi.Api.Sonarr.Models
|
||||
namespace PlexRequests.Api.Models.Sonarr
|
||||
{
|
||||
public class SonarrAllSeries
|
||||
{
|
||||
public List<Series> list { get; set; }
|
||||
}
|
||||
|
||||
public class SonarrSeries
|
||||
public class Series
|
||||
{
|
||||
public string title { get; set; }
|
||||
public Alternatetitle[] alternateTitles { get; set; }
|
||||
public List<Alternatetitle> alternateTitles { get; set; }
|
||||
public string sortTitle { get; set; }
|
||||
public int seasonCount { get; set; }
|
||||
public int totalEpisodeCount { get; set; }
|
||||
|
@ -19,16 +22,15 @@ namespace Ombi.Api.Sonarr.Models
|
|||
public string overview { get; set; }
|
||||
public DateTime previousAiring { get; set; }
|
||||
public string network { get; set; }
|
||||
public string airTime { get; set; }
|
||||
public Image[] images { get; set; }
|
||||
public Season[] seasons { get; set; }
|
||||
public List<Image> images { get; set; }
|
||||
public List<Season> seasons { get; set; }
|
||||
public int year { get; set; }
|
||||
public string path { get; set; }
|
||||
public int profileId { get; set; }
|
||||
public bool seasonFolder { get; set; }
|
||||
public bool monitored { get; set; }
|
||||
public bool useSceneNumbering { get; set; }
|
||||
public long runtime { get; set; }
|
||||
public int runtime { get; set; }
|
||||
public int tvdbId { get; set; }
|
||||
public int tvRageId { get; set; }
|
||||
public int tvMazeId { get; set; }
|
||||
|
@ -39,14 +41,12 @@ namespace Ombi.Api.Sonarr.Models
|
|||
public string imdbId { get; set; }
|
||||
public string titleSlug { get; set; }
|
||||
public string certification { get; set; }
|
||||
public string[] genres { get; set; }
|
||||
public List<int> tags { get; set; }
|
||||
public List<string> genres { get; set; }
|
||||
public List<object> tags { get; set; }
|
||||
public DateTime added { get; set; }
|
||||
public Ratings ratings { get; set; }
|
||||
public int qualityProfileId { get; set; }
|
||||
public int languageProfileId { get; set; }
|
||||
public int id { get; set; }
|
||||
public DateTime nextAiring { get; set; }
|
||||
}
|
||||
|
||||
public class Ratings
|
||||
|
@ -58,7 +58,6 @@ namespace Ombi.Api.Sonarr.Models
|
|||
public class Alternatetitle
|
||||
{
|
||||
public string title { get; set; }
|
||||
public int sceneSeasonNumber { get; set; }
|
||||
public int seasonNumber { get; set; }
|
||||
}
|
||||
|
||||
|
@ -67,23 +66,4 @@ namespace Ombi.Api.Sonarr.Models
|
|||
public string coverType { get; set; }
|
||||
public string url { get; set; }
|
||||
}
|
||||
|
||||
public class Season
|
||||
{
|
||||
public int seasonNumber { get; set; }
|
||||
public bool monitored { get; set; }
|
||||
public Statistics statistics { get; set; }
|
||||
}
|
||||
|
||||
public class Statistics
|
||||
{
|
||||
public int episodeFileCount { get; set; }
|
||||
public int episodeCount { get; set; }
|
||||
public int totalEpisodeCount { get; set; }
|
||||
public long sizeOnDisk { get; set; }
|
||||
public long percentOfEpisodes { get; set; }
|
||||
public DateTime previousAiring { get; set; }
|
||||
public DateTime nextAiring { get; set; }
|
||||
}
|
||||
|
||||
}
|
45
PlexRequests.Api.Models/Sonarr/SonarrError.cs
Normal file
45
PlexRequests.Api.Models/Sonarr/SonarrError.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: SonarrError.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PlexRequests.Api.Models.Sonarr
|
||||
{
|
||||
public class SonarrError
|
||||
{
|
||||
public string propertyName { get; set; }
|
||||
public string errorMessage { get; set; }
|
||||
public object attemptedValue { get; set; }
|
||||
public FormattedMessagePlaceholderValues formattedMessagePlaceholderValues { get; set; }
|
||||
}
|
||||
public class FormattedMessagePlaceholderValues
|
||||
{
|
||||
public string propertyName { get; set; }
|
||||
public object propertyValue { get; set; }
|
||||
}
|
||||
}
|
57
PlexRequests.Api.Models/Sonarr/SonarrProfile.cs
Normal file
57
PlexRequests.Api.Models/Sonarr/SonarrProfile.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: SonarrProfile.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PlexRequests.Api.Models.Sonarr
|
||||
{
|
||||
public class Cutoff
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Quality
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Item
|
||||
{
|
||||
public Quality quality { get; set; }
|
||||
public bool allowed { get; set; }
|
||||
}
|
||||
|
||||
public class SonarrProfile
|
||||
{
|
||||
public string name { get; set; }
|
||||
public Cutoff cutoff { get; set; }
|
||||
public List<Item> items { get; set; }
|
||||
public int id { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2017 Jamie Rees
|
||||
// File: DogNzbMovieAddResult.cs
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: SystemStatus.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -24,32 +24,28 @@
|
|||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ombi.Api.DogNzb.Models
|
||||
namespace PlexRequests.Api.Models.Sonarr
|
||||
{
|
||||
[XmlRoot(ElementName = "channel")]
|
||||
public class MovieAddResultChannel
|
||||
public class SystemStatus
|
||||
{
|
||||
[XmlElement(ElementName = "title")]
|
||||
public string Title { get; set; }
|
||||
[XmlElement(ElementName = "link")]
|
||||
public string Link { get; set; }
|
||||
[XmlElement(ElementName = "description")]
|
||||
public string Description { get; set; }
|
||||
[XmlElement(ElementName = "language")]
|
||||
public string Language { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot(ElementName = "rss")]
|
||||
public class DogNzbMovieAddResult
|
||||
{
|
||||
[XmlElement(ElementName = "channel")]
|
||||
public MovieAddResultChannel Channel { get; set; }
|
||||
[XmlAttribute(AttributeName = "version")]
|
||||
public string Version { get; set; }
|
||||
[XmlAttribute(AttributeName = "atom", Namespace = "http://www.w3.org/2000/xmlns/")]
|
||||
public string Atom { get; set; }
|
||||
public string version { get; set; }
|
||||
public string buildTime { get; set; }
|
||||
public bool isDebug { get; set; }
|
||||
public bool isProduction { get; set; }
|
||||
public bool isAdmin { get; set; }
|
||||
public bool isUserInteractive { get; set; }
|
||||
public string startupPath { get; set; }
|
||||
public string appData { get; set; }
|
||||
public string osVersion { get; set; }
|
||||
public bool isMonoRuntime { get; set; }
|
||||
public bool isMono { get; set; }
|
||||
public bool isLinux { get; set; }
|
||||
public bool isOsx { get; set; }
|
||||
public bool isWindows { get; set; }
|
||||
public string branch { get; set; }
|
||||
public string authentication { get; set; }
|
||||
public string sqliteVersion { get; set; }
|
||||
public string urlBase { get; set; }
|
||||
public string runtimeVersion { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2017 Jamie Rees
|
||||
// File: PlexStatus.cs
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: Authentication.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -24,11 +24,10 @@
|
|||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
namespace Ombi.Api.Plex.Models.Status
|
||||
namespace PlexRequests.Api.Models.Tv
|
||||
{
|
||||
|
||||
public class PlexStatus
|
||||
public class Authentication
|
||||
{
|
||||
public Mediacontainer MediaContainer { get; set; }
|
||||
public string token { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,10 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Ombi.Api.TvMaze.Models
|
||||
namespace PlexRequests.Api.Models.Tv
|
||||
{
|
||||
public class TvMazeShow
|
||||
{
|
||||
|
||||
public int id { get; set; }
|
||||
public string url { get; set; }
|
||||
public string name { get; set; }
|
||||
|
@ -12,7 +11,7 @@ namespace Ombi.Api.TvMaze.Models
|
|||
public string language { get; set; }
|
||||
public List<string> genres { get; set; }
|
||||
public string status { get; set; }
|
||||
public double runtime { get; set; }
|
||||
public int runtime { get; set; }
|
||||
public string premiered { get; set; }
|
||||
public Schedule schedule { get; set; }
|
||||
public Rating rating { get; set; }
|
||||
|
@ -24,15 +23,10 @@ namespace Ombi.Api.TvMaze.Models
|
|||
public string summary { get; set; }
|
||||
public int updated { get; set; }
|
||||
public Links _links { get; set; }
|
||||
public int seasonCount { get; set; }
|
||||
public Embedded _embedded { get; set; }
|
||||
}
|
||||
|
||||
public class TvMazeCustomSeason
|
||||
{
|
||||
public int SeasonNumber { get; set; }
|
||||
public List<int> EpisodeNumber { get; set; }
|
||||
}
|
||||
|
||||
public class Season
|
||||
{
|
||||
public int id { get; set; }
|
||||
|
@ -49,34 +43,34 @@ namespace Ombi.Api.TvMaze.Models
|
|||
public Links2 _links { get; set; }
|
||||
}
|
||||
public class Country2
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string code { get; set; }
|
||||
public string timezone { get; set; }
|
||||
}
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string code { get; set; }
|
||||
public string timezone { get; set; }
|
||||
}
|
||||
|
||||
public class Network2
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public Country2 country { get; set; }
|
||||
}
|
||||
public class Network2
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public Country2 country { get; set; }
|
||||
}
|
||||
|
||||
public class Image2
|
||||
{
|
||||
public string medium { get; set; }
|
||||
public string original { get; set; }
|
||||
}
|
||||
public class Image2
|
||||
{
|
||||
public string medium { get; set; }
|
||||
public string original { get; set; }
|
||||
}
|
||||
|
||||
public class Self2
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
public class Self2
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Links2
|
||||
{
|
||||
public Self2 self { get; set; }
|
||||
}
|
||||
public class Links2
|
||||
{
|
||||
public Self2 self { get; set; }
|
||||
}
|
||||
|
||||
public class Embedded
|
||||
{
|
97
PlexRequests.Api.Models/Tv/TvMazeSearch.cs
Normal file
97
PlexRequests.Api.Models/Tv/TvMazeSearch.cs
Normal file
|
@ -0,0 +1,97 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PlexRequests.Api.Models.Tv
|
||||
{
|
||||
public class Schedule
|
||||
{
|
||||
public string time { get; set; }
|
||||
public List<object> days { get; set; }
|
||||
}
|
||||
|
||||
public class Rating
|
||||
{
|
||||
public double? average { get; set; }
|
||||
}
|
||||
|
||||
public class Country
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string code { get; set; }
|
||||
public string timezone { get; set; }
|
||||
}
|
||||
|
||||
public class Network
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public Country country { get; set; }
|
||||
}
|
||||
|
||||
public class Externals
|
||||
{
|
||||
public int? tvrage { get; set; }
|
||||
public int? thetvdb { get; set; }
|
||||
public string imdb { get; set; }
|
||||
}
|
||||
|
||||
public class Image
|
||||
{
|
||||
public string medium { get; set; }
|
||||
public string original { get; set; }
|
||||
}
|
||||
|
||||
public class Self
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Previousepisode
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Nextepisode
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Links
|
||||
{
|
||||
public Self self { get; set; }
|
||||
public Previousepisode previousepisode { get; set; }
|
||||
public Nextepisode nextepisode { get; set; }
|
||||
}
|
||||
|
||||
public class Show
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string url { get; set; }
|
||||
public string name { get; set; }
|
||||
public string type { get; set; }
|
||||
public string language { get; set; }
|
||||
public List<object> genres { get; set; }
|
||||
public string status { get; set; }
|
||||
public int? runtime { get; set; }
|
||||
public string premiered { get; set; }
|
||||
public Schedule schedule { get; set; }
|
||||
public Rating rating { get; set; }
|
||||
public int weight { get; set; }
|
||||
public Network network { get; set; }
|
||||
public object webChannel { get; set; }
|
||||
public Externals externals { get; set; }
|
||||
public Image image { get; set; }
|
||||
public string summary { get; set; }
|
||||
public int updated { get; set; }
|
||||
public Links _links { get; set; }
|
||||
}
|
||||
|
||||
public class TvMazeSearch
|
||||
{
|
||||
public double score { get; set; }
|
||||
public Show show { get; set; }
|
||||
}
|
||||
}
|
13
PlexRequests.Api.Models/Tv/TvMazeSeasons.cs
Normal file
13
PlexRequests.Api.Models/Tv/TvMazeSeasons.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PlexRequests.Api.Models.Tv
|
||||
{
|
||||
public class TvMazeSeasons : TvMazeShow
|
||||
{
|
||||
public int number { get; set; }
|
||||
}
|
||||
}
|
68
PlexRequests.Api.Models/Tv/TvSearchResult.cs
Normal file
68
PlexRequests.Api.Models/Tv/TvSearchResult.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: TvSearchResult.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PlexRequests.Api.Models.Tv
|
||||
{
|
||||
public class TvShowSearchResult
|
||||
{
|
||||
public int id { get; set; }
|
||||
public int airedSeason { get; set; }
|
||||
public int airedEpisodeNumber { get; set; }
|
||||
public string episodeName { get; set; }
|
||||
public string firstAired { get; set; }
|
||||
public string guestStars { get; set; }
|
||||
public string director { get; set; }
|
||||
public List<string> writers { get; set; }
|
||||
public string overview { get; set; }
|
||||
public string productionCode { get; set; }
|
||||
public string showUrl { get; set; }
|
||||
public int lastUpdated { get; set; }
|
||||
public string dvdDiscid { get; set; }
|
||||
public int dvdSeason { get; set; }
|
||||
public int dvdEpisodeNumber { get; set; }
|
||||
public int dvdChapter { get; set; }
|
||||
public int absoluteNumber { get; set; }
|
||||
public string filename { get; set; }
|
||||
public string seriesId { get; set; }
|
||||
public string lastUpdatedBy { get; set; }
|
||||
public int airsAfterSeason { get; set; }
|
||||
public int airsBeforeSeason { get; set; }
|
||||
public int airsBeforeEpisode { get; set; }
|
||||
public string thumbAuthor { get; set; }
|
||||
public string thumbAdded { get; set; }
|
||||
public string thumbWidth { get; set; }
|
||||
public string thumbHeight { get; set; }
|
||||
public string imdbId { get; set; }
|
||||
public int siteRating { get; set; }
|
||||
}
|
||||
|
||||
public class TvSearchResult
|
||||
{
|
||||
public List<TvShow> data { get; set; }
|
||||
}
|
||||
}
|
61
PlexRequests.Api.Models/Tv/TvShow.cs
Normal file
61
PlexRequests.Api.Models/Tv/TvShow.cs
Normal file
|
@ -0,0 +1,61 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: TvShow.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PlexRequests.Api.Models.Tv
|
||||
{
|
||||
public class TvShow
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string seriesName { get; set; }
|
||||
public List<string> aliases { get; set; }
|
||||
public string banner { get; set; }
|
||||
public string seriesId { get; set; }
|
||||
public string status { get; set; }
|
||||
public string firstAired { get; set; }
|
||||
public string network { get; set; }
|
||||
public string networkId { get; set; }
|
||||
public string runtime { get; set; }
|
||||
public List<string> genre { get; set; }
|
||||
public string overview { get; set; }
|
||||
public int lastUpdated { get; set; }
|
||||
public string airsDayOfWeek { get; set; }
|
||||
public string airsTime { get; set; }
|
||||
public string rating { get; set; }
|
||||
public string imdbId { get; set; }
|
||||
public string zap2itId { get; set; }
|
||||
public string added { get; set; }
|
||||
public int addedBy { get; set; }
|
||||
public int siteRating { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class TvShowInformation
|
||||
{
|
||||
public TvShow data { get; set; }
|
||||
}
|
||||
}
|
54
PlexRequests.Api.Models/Tv/TvShowImages.cs
Normal file
54
PlexRequests.Api.Models/Tv/TvShowImages.cs
Normal file
|
@ -0,0 +1,54 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: TvShowImages.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PlexRequests.Api.Models.Tv
|
||||
{
|
||||
public class RatingsInfo
|
||||
{
|
||||
public double average { get; set; }
|
||||
}
|
||||
|
||||
public class Datum
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string keyType { get; set; }
|
||||
public string subKey { get; set; }
|
||||
public string fileName { get; set; }
|
||||
public string resolution { get; set; }
|
||||
public RatingsInfo ratingsInfo { get; set; }
|
||||
public string thumbnail { get; set; }
|
||||
}
|
||||
|
||||
public class TvShowImages
|
||||
{
|
||||
public List<Datum> data { get; set; }
|
||||
public object errors { get; set; }
|
||||
}
|
||||
|
||||
}
|
11
PlexRequests.Api.Models/app.config
Normal file
11
PlexRequests.Api.Models/app.config
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
4
PlexRequests.Api.Models/packages.config
Normal file
4
PlexRequests.Api.Models/packages.config
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net45" />
|
||||
</packages>
|
148
PlexRequests.Api/ApiRequest.cs
Normal file
148
PlexRequests.Api/ApiRequest.cs
Normal file
|
@ -0,0 +1,148 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: ApiRequest.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using NLog;
|
||||
|
||||
using PlexRequests.Api.Interfaces;
|
||||
using PlexRequests.Helpers.Exceptions;
|
||||
|
||||
using RestSharp;
|
||||
|
||||
namespace PlexRequests.Api
|
||||
{
|
||||
public class ApiRequest : IApiRequest
|
||||
{
|
||||
private readonly JsonSerializerSettings _settings = new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
MissingMemberHandling = MissingMemberHandling.Ignore
|
||||
};
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
/// <summary>
|
||||
/// An API request handler
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of class you want to deserialize</typeparam>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="baseUri">The base URI.</param>
|
||||
/// <returns>The type of class you want to deserialize</returns>
|
||||
public T Execute<T>(IRestRequest request, Uri baseUri) where T : new()
|
||||
{
|
||||
var client = new RestClient { BaseUrl = baseUri };
|
||||
|
||||
var response = client.Execute<T>(request);
|
||||
Log.Trace("Api Content Response:");
|
||||
Log.Trace(response.Content);
|
||||
|
||||
if (response.ErrorException != null)
|
||||
{
|
||||
var message = "Error retrieving response. Check inner details for more info.";
|
||||
Log.Error(response.ErrorException);
|
||||
throw new ApiRequestException(message, response.ErrorException);
|
||||
}
|
||||
|
||||
return response.Data;
|
||||
}
|
||||
|
||||
public IRestResponse Execute(IRestRequest request, Uri baseUri)
|
||||
{
|
||||
var client = new RestClient { BaseUrl = baseUri };
|
||||
|
||||
var response = client.Execute(request);
|
||||
|
||||
if (response.ErrorException != null)
|
||||
{
|
||||
Log.Error(response.ErrorException);
|
||||
var message = "Error retrieving response. Check inner details for more info.";
|
||||
throw new ApiRequestException(message, response.ErrorException);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public T ExecuteXml<T>(IRestRequest request, Uri baseUri) where T : class
|
||||
{
|
||||
var client = new RestClient { BaseUrl = baseUri };
|
||||
|
||||
var response = client.Execute(request);
|
||||
|
||||
if (response.ErrorException != null)
|
||||
{
|
||||
Log.Error(response.ErrorException);
|
||||
var message = "Error retrieving response. Check inner details for more info.";
|
||||
throw new ApiRequestException(message, response.ErrorException);
|
||||
}
|
||||
|
||||
var result = DeserializeXml<T>(response.Content);
|
||||
return result;
|
||||
}
|
||||
|
||||
public T ExecuteJson<T>(IRestRequest request, Uri baseUri) where T : new()
|
||||
{
|
||||
var client = new RestClient { BaseUrl = baseUri };
|
||||
var response = client.Execute(request);
|
||||
Log.Trace("Api Content Response:");
|
||||
Log.Trace(response.Content);
|
||||
if (response.ErrorException != null)
|
||||
{
|
||||
Log.Error(response.ErrorException);
|
||||
var message = "Error retrieving response. Check inner details for more info.";
|
||||
throw new ApiRequestException(message, response.ErrorException);
|
||||
}
|
||||
|
||||
Log.Trace("Deserialzing Object");
|
||||
var json = JsonConvert.DeserializeObject<T>(response.Content, _settings);
|
||||
Log.Trace("Finished Deserialzing Object");
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
private T DeserializeXml<T>(string input)
|
||||
where T : class
|
||||
{
|
||||
var ser = new XmlSerializer(typeof(T));
|
||||
|
||||
try
|
||||
{
|
||||
using (var sr = new StringReader(input))
|
||||
return (T)ser.Deserialize(sr);
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
Log.Error(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
168
PlexRequests.Api/CouchPotatoApi.cs
Normal file
168
PlexRequests.Api/CouchPotatoApi.cs
Normal file
|
@ -0,0 +1,168 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: CouchPotatoApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System;
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using NLog;
|
||||
using PlexRequests.Api.Interfaces;
|
||||
using PlexRequests.Api.Models.Movie;
|
||||
using PlexRequests.Helpers.Exceptions;
|
||||
|
||||
using RestSharp;
|
||||
|
||||
namespace PlexRequests.Api
|
||||
{
|
||||
public class CouchPotatoApi : ICouchPotatoApi
|
||||
{
|
||||
public CouchPotatoApi()
|
||||
{
|
||||
Api = new ApiRequest();
|
||||
}
|
||||
private ApiRequest Api { get; set; }
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public bool AddMovie(string imdbid, string apiKey, string title, Uri baseUrl, string profileId = default(string))
|
||||
{
|
||||
RestRequest request;
|
||||
request = string.IsNullOrEmpty(profileId)
|
||||
? new RestRequest {Resource = "/api/{apikey}/movie.add?title={title}&identifier={imdbid}"}
|
||||
: new RestRequest { Resource = "/api/{apikey}/movie.add?title={title}&identifier={imdbid}&profile_id={profileId}" };
|
||||
|
||||
if (!string.IsNullOrEmpty(profileId))
|
||||
{
|
||||
request.AddUrlSegment("profileId", profileId);
|
||||
}
|
||||
|
||||
request.AddUrlSegment("apikey", apiKey);
|
||||
request.AddUrlSegment("imdbid", imdbid);
|
||||
request.AddUrlSegment("title", title);
|
||||
|
||||
var obj = RetryHandler.Execute(() => Api.ExecuteJson<JObject> (request, baseUrl),new[] {
|
||||
TimeSpan.FromSeconds (2),
|
||||
TimeSpan.FromSeconds(5),
|
||||
TimeSpan.FromSeconds(10)},
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling AddMovie for CP, Retrying {0}", timespan));
|
||||
|
||||
Log.Trace("CP movie Add result count {0}", obj.Count);
|
||||
|
||||
if (obj.Count > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.Trace("CP movie obj[\"success\"] = {0}", obj["success"]);
|
||||
var result = (bool)obj["success"];
|
||||
Log.Trace("CP movie Add result {0}", result);
|
||||
return result;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Fatal(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the status.
|
||||
/// </summary>
|
||||
/// <param name="url">The URL.</param>
|
||||
/// <param name="apiKey">The API key.</param>
|
||||
/// <returns></returns>
|
||||
public CouchPotatoStatus GetStatus(Uri url, string apiKey)
|
||||
{
|
||||
Log.Trace("Getting CP Status, ApiKey = {0}", apiKey);
|
||||
var request = new RestRequest
|
||||
{
|
||||
Resource = "api/{apikey}/app.available/",
|
||||
Method = Method.GET
|
||||
};
|
||||
|
||||
request.AddUrlSegment("apikey", apiKey);
|
||||
|
||||
|
||||
var obj = RetryHandler.Execute<CouchPotatoStatus>(() => Api.Execute<CouchPotatoStatus> (request, url),new TimeSpan[] {
|
||||
TimeSpan.FromSeconds (2),
|
||||
TimeSpan.FromSeconds(5),
|
||||
TimeSpan.FromSeconds(10)},
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling GetStatus for CP, Retrying {0}", timespan));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
public CouchPotatoProfiles GetProfiles(Uri url, string apiKey)
|
||||
{
|
||||
Log.Trace("Getting CP Profiles, ApiKey = {0}", apiKey);
|
||||
var request = new RestRequest
|
||||
{
|
||||
Resource = "api/{apikey}/profile.list/",
|
||||
Method = Method.GET
|
||||
};
|
||||
|
||||
request.AddUrlSegment("apikey", apiKey);
|
||||
|
||||
var obj = RetryHandler.Execute<CouchPotatoProfiles>(() => Api.Execute<CouchPotatoProfiles> (request, url),null,
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling GetProfiles for CP, Retrying {0}", timespan));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
public CouchPotatoMovies GetMovies(Uri baseUrl, string apiKey, string[] status)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Resource = "/api/{apikey}/movie.list?status={status}",
|
||||
OnBeforeDeserialization = (x =>
|
||||
{
|
||||
x.Content = x.Content.Replace("[]", "{}");
|
||||
})
|
||||
};
|
||||
|
||||
request.AddUrlSegment("apikey", apiKey);
|
||||
request.AddUrlSegment("status", string.Join(",", status));
|
||||
try
|
||||
{
|
||||
var obj = RetryHandler.Execute(() => Api.Execute<CouchPotatoMovies> (request, baseUrl),
|
||||
new[] {
|
||||
TimeSpan.FromSeconds (5),
|
||||
TimeSpan.FromSeconds(10),
|
||||
TimeSpan.FromSeconds(30)
|
||||
},
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling GetMovies for CP, Retrying {0}", timespan));
|
||||
|
||||
return obj;
|
||||
}
|
||||
catch (Exception e) // Request error is already logged in the ApiRequest class
|
||||
{
|
||||
Log.Error("Error when attempting to GetMovies.");
|
||||
Log.Error (e);
|
||||
return new CouchPotatoMovies();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
204
PlexRequests.Api/HeadphonesApi.cs
Normal file
204
PlexRequests.Api/HeadphonesApi.cs
Normal file
|
@ -0,0 +1,204 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: HeadphonesApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using NLog;
|
||||
|
||||
using PlexRequests.Api.Interfaces;
|
||||
using PlexRequests.Api.Models.Music;
|
||||
using PlexRequests.Helpers;
|
||||
|
||||
using RestSharp;
|
||||
|
||||
namespace PlexRequests.Api
|
||||
{
|
||||
public class HeadphonesApi : IHeadphonesApi
|
||||
{
|
||||
public HeadphonesApi()
|
||||
{
|
||||
Api = new ApiRequest();
|
||||
}
|
||||
private ApiRequest Api { get; }
|
||||
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public async Task<bool> AddAlbum(string apiKey, Uri baseUrl, string albumId)
|
||||
{
|
||||
Log.Trace("Adding album: {0}", albumId);
|
||||
var request = new RestRequest
|
||||
{
|
||||
Resource = "/api?cmd=addAlbum&id={albumId}",
|
||||
Method = Method.GET
|
||||
};
|
||||
|
||||
request.AddQueryParameter("apikey", apiKey);
|
||||
request.AddUrlSegment("albumId", albumId);
|
||||
|
||||
try
|
||||
{
|
||||
var result = await Task.Run(() => Api.Execute(request, baseUrl)).ConfigureAwait(false);
|
||||
Log.Trace("Add Album Result: {0}", result.DumpJson());
|
||||
|
||||
var albumResult = result.Content.Equals("OK", StringComparison.CurrentCultureIgnoreCase);
|
||||
Log.Info("Album add result {0}", albumResult);
|
||||
|
||||
return albumResult;
|
||||
}
|
||||
catch (Exception jse)
|
||||
{
|
||||
Log.Error(jse);
|
||||
return false; // If there is no matching result we do not get returned a JSON string, it just returns "false".
|
||||
}
|
||||
}
|
||||
public async Task<List<HeadphonesGetIndex>> GetIndex(string apiKey, Uri baseUrl)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Resource = "/api",
|
||||
Method = Method.GET
|
||||
};
|
||||
|
||||
request.AddQueryParameter("apikey", apiKey);
|
||||
request.AddQueryParameter("cmd", "getIndex");
|
||||
|
||||
try
|
||||
{
|
||||
var result = await Task.Run(() => Api.ExecuteJson<List<HeadphonesGetIndex>>(request, baseUrl)).ConfigureAwait(false);
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (Exception jse)
|
||||
{
|
||||
Log.Error(jse);
|
||||
return new List<HeadphonesGetIndex>();
|
||||
}
|
||||
}
|
||||
public async Task<bool> AddArtist(string apiKey, Uri baseUrl, string artistId)
|
||||
{
|
||||
Log.Trace("Adding Artist: {0}", artistId);
|
||||
var request = new RestRequest
|
||||
{
|
||||
Resource = "/api",
|
||||
Method = Method.GET
|
||||
};
|
||||
|
||||
request.AddQueryParameter("apikey", apiKey);
|
||||
request.AddQueryParameter("cmd", "addArtist");
|
||||
request.AddQueryParameter("id", artistId);
|
||||
|
||||
try
|
||||
{
|
||||
var result = await Task.Run(() => Api.Execute(request, baseUrl)).ConfigureAwait(false);
|
||||
Log.Info("Add Artist Result: {0}", result.Content);
|
||||
Log.Trace("Add Artist Result: {0}", result.DumpJson());
|
||||
return result.Content.Equals("OK", StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
catch (JsonSerializationException jse)
|
||||
{
|
||||
Log.Error(jse);
|
||||
return false; // If there is no matching result we do not get returned a JSON string, it just returns "false".
|
||||
}
|
||||
}
|
||||
public async Task<bool> QueueAlbum(string apiKey, Uri baseUrl, string albumId)
|
||||
{
|
||||
Log.Trace("Queing album: {0}", albumId);
|
||||
var request = new RestRequest
|
||||
{
|
||||
Resource = "/api?cmd=queueAlbum&id={albumId}",
|
||||
Method = Method.GET
|
||||
};
|
||||
|
||||
request.AddQueryParameter("apikey", apiKey);
|
||||
request.AddUrlSegment("albumId", albumId);
|
||||
|
||||
try
|
||||
{
|
||||
var result = await Task.Run(() => Api.Execute(request, baseUrl)).ConfigureAwait(false);
|
||||
Log.Info("Queue Result: {0}", result.Content);
|
||||
Log.Trace("Queue Result: {0}", result.DumpJson());
|
||||
return result.Content.Equals("OK", StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
catch (JsonSerializationException jse)
|
||||
{
|
||||
Log.Error(jse);
|
||||
return false; // If there is no matching result we do not get returned a JSON string, it just returns "false".
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<bool> RefreshArtist(string apiKey, Uri baseUrl, string artistId)
|
||||
{
|
||||
Log.Trace("Refreshing artist: {0}", artistId);
|
||||
var request = new RestRequest
|
||||
{
|
||||
Resource = "/api",
|
||||
Method = Method.GET
|
||||
};
|
||||
|
||||
request.AddQueryParameter("apikey", apiKey);
|
||||
request.AddQueryParameter("cmd", "queueAlbum");
|
||||
request.AddQueryParameter("id", artistId);
|
||||
|
||||
try
|
||||
{
|
||||
var result = await Task.Run(() => Api.Execute(request, baseUrl)).ConfigureAwait(false);
|
||||
Log.Info("Artist refresh Result: {0}", result.Content);
|
||||
Log.Trace("Artist refresh Result: {0}", result.DumpJson());
|
||||
return result.Content.Equals("OK", StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
catch (JsonSerializationException jse)
|
||||
{
|
||||
Log.Error(jse);
|
||||
return false; // If there is no matching result we do not get returned a JSON string, it just returns "false".
|
||||
}
|
||||
}
|
||||
|
||||
public HeadphonesVersion GetVersion(string apiKey, Uri baseUrl)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Resource = "/api",
|
||||
Method = Method.GET
|
||||
};
|
||||
|
||||
request.AddQueryParameter("apikey", apiKey);
|
||||
request.AddQueryParameter("cmd", "getVersion");
|
||||
|
||||
try
|
||||
{
|
||||
return Api.ExecuteJson<HeadphonesVersion>(request, baseUrl);
|
||||
}
|
||||
catch (JsonSerializationException jse)
|
||||
{
|
||||
Log.Error(jse);
|
||||
return new HeadphonesVersion(); // If there is no matching result we do not get returned a JSON string, it just returns "false".
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
139
PlexRequests.Api/MockApiData.Designer.cs
generated
Normal file
139
PlexRequests.Api/MockApiData.Designer.cs
generated
Normal file
|
@ -0,0 +1,139 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace PlexRequests.Api {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class MockApiData {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal MockApiData() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PlexRequests.Api.MockApiData", typeof(MockApiData).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {
|
||||
/// "title": "Archer (2009)",
|
||||
/// "seasons": [
|
||||
/// {
|
||||
/// "seasonNumber": 5,
|
||||
/// "monitored": true
|
||||
/// },
|
||||
/// {
|
||||
/// "seasonNumber": 4,
|
||||
/// "monitored": true
|
||||
/// },
|
||||
/// {
|
||||
/// "seasonNumber": 3,
|
||||
/// "monitored": true
|
||||
/// },
|
||||
/// {
|
||||
/// "seasonNumber": 2,
|
||||
/// "monitored": true
|
||||
/// },
|
||||
/// {
|
||||
/// "seasonNumber": 1,
|
||||
/// "monitored": true
|
||||
/// },
|
||||
/// {
|
||||
/// "seasonNumber": 0,
|
||||
/// "monitored": false
|
||||
/// }
|
||||
/// ],
|
||||
/// "pat [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string Sonarr_AddSeriesResult {
|
||||
get {
|
||||
return ResourceManager.GetString("Sonarr_AddSeriesResult", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to [
|
||||
/// {
|
||||
/// "name": "SD",
|
||||
/// "cutoff": {
|
||||
/// "id": 1,
|
||||
/// "name": "SDTV"
|
||||
/// },
|
||||
/// "items": [
|
||||
/// {
|
||||
/// "quality": {
|
||||
/// "id": 1,
|
||||
/// "name": "SDTV"
|
||||
/// },
|
||||
/// "allowed": true
|
||||
/// },
|
||||
/// {
|
||||
/// "quality": {
|
||||
/// "id": 8,
|
||||
/// "name": "WEBDL-480p"
|
||||
/// },
|
||||
/// "allowed": true
|
||||
/// },
|
||||
/// {
|
||||
/// "quality": {
|
||||
/// "id": 2,
|
||||
/// "name": "DVD"
|
||||
/// },
|
||||
/// "allowed": true
|
||||
/// },
|
||||
/// {
|
||||
/// "quality": { [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string Sonarr_Profiles {
|
||||
get {
|
||||
return ResourceManager.GetString("Sonarr_Profiles", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
485
PlexRequests.Api/MockApiData.resx
Normal file
485
PlexRequests.Api/MockApiData.resx
Normal file
|
@ -0,0 +1,485 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Sonarr_AddSeriesResult" xml:space="preserve">
|
||||
<value>{
|
||||
"title": "Archer (2009)",
|
||||
"seasons": [
|
||||
{
|
||||
"seasonNumber": 5,
|
||||
"monitored": true
|
||||
},
|
||||
{
|
||||
"seasonNumber": 4,
|
||||
"monitored": true
|
||||
},
|
||||
{
|
||||
"seasonNumber": 3,
|
||||
"monitored": true
|
||||
},
|
||||
{
|
||||
"seasonNumber": 2,
|
||||
"monitored": true
|
||||
},
|
||||
{
|
||||
"seasonNumber": 1,
|
||||
"monitored": true
|
||||
},
|
||||
{
|
||||
"seasonNumber": 0,
|
||||
"monitored": false
|
||||
}
|
||||
],
|
||||
"path": "T:\\Archer (2009)",
|
||||
"qualityProfileId": 1,
|
||||
"seasonFolder": true,
|
||||
"monitored": true,
|
||||
"tvdbId": 110381,
|
||||
"tvRageId": 23354,
|
||||
"cleanTitle": "archer2009",
|
||||
"imdbId": "tt1486217",
|
||||
"titleSlug": "archer-2009",
|
||||
"id": 1
|
||||
}</value>
|
||||
</data>
|
||||
<data name="Sonarr_Profiles" xml:space="preserve">
|
||||
<value>[
|
||||
{
|
||||
"name": "SD",
|
||||
"cutoff": {
|
||||
"id": 1,
|
||||
"name": "SDTV"
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
"quality": {
|
||||
"id": 1,
|
||||
"name": "SDTV"
|
||||
},
|
||||
"allowed": true
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 8,
|
||||
"name": "WEBDL-480p"
|
||||
},
|
||||
"allowed": true
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 2,
|
||||
"name": "DVD"
|
||||
},
|
||||
"allowed": true
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 4,
|
||||
"name": "HDTV-720p"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 9,
|
||||
"name": "HDTV-1080p"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 10,
|
||||
"name": "Raw-HD"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 5,
|
||||
"name": "WEBDL-720p"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 6,
|
||||
"name": "Bluray-720p"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 3,
|
||||
"name": "WEBDL-1080p"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 7,
|
||||
"name": "Bluray-1080p"
|
||||
},
|
||||
"allowed": false
|
||||
}
|
||||
],
|
||||
"id": 1
|
||||
},
|
||||
{
|
||||
"name": "HD 720p",
|
||||
"cutoff": {
|
||||
"id": 4,
|
||||
"name": "HDTV-720p"
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
"quality": {
|
||||
"id": 1,
|
||||
"name": "SDTV"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 8,
|
||||
"name": "WEBDL-480p"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 2,
|
||||
"name": "DVD"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 4,
|
||||
"name": "HDTV-720p"
|
||||
},
|
||||
"allowed": true
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 9,
|
||||
"name": "HDTV-1080p"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 10,
|
||||
"name": "Raw-HD"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 5,
|
||||
"name": "WEBDL-720p"
|
||||
},
|
||||
"allowed": true
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 6,
|
||||
"name": "Bluray-720p"
|
||||
},
|
||||
"allowed": true
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 3,
|
||||
"name": "WEBDL-1080p"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 7,
|
||||
"name": "Bluray-1080p"
|
||||
},
|
||||
"allowed": false
|
||||
}
|
||||
],
|
||||
"id": 2
|
||||
},
|
||||
{
|
||||
"name": "HD 1080p",
|
||||
"cutoff": {
|
||||
"id": 9,
|
||||
"name": "HDTV-1080p"
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
"quality": {
|
||||
"id": 1,
|
||||
"name": "SDTV"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 8,
|
||||
"name": "WEBDL-480p"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 2,
|
||||
"name": "DVD"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 4,
|
||||
"name": "HDTV-720p"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 9,
|
||||
"name": "HDTV-1080p"
|
||||
},
|
||||
"allowed": true
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 10,
|
||||
"name": "Raw-HD"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 5,
|
||||
"name": "WEBDL-720p"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 6,
|
||||
"name": "Bluray-720p"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 3,
|
||||
"name": "WEBDL-1080p"
|
||||
},
|
||||
"allowed": true
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 7,
|
||||
"name": "Bluray-1080p"
|
||||
},
|
||||
"allowed": true
|
||||
}
|
||||
],
|
||||
"id": 3
|
||||
},
|
||||
{
|
||||
"name": "HD - All",
|
||||
"cutoff": {
|
||||
"id": 4,
|
||||
"name": "HDTV-720p"
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
"quality": {
|
||||
"id": 1,
|
||||
"name": "SDTV"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 8,
|
||||
"name": "WEBDL-480p"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 2,
|
||||
"name": "DVD"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 4,
|
||||
"name": "HDTV-720p"
|
||||
},
|
||||
"allowed": true
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 9,
|
||||
"name": "HDTV-1080p"
|
||||
},
|
||||
"allowed": true
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 10,
|
||||
"name": "Raw-HD"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 5,
|
||||
"name": "WEBDL-720p"
|
||||
},
|
||||
"allowed": true
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 6,
|
||||
"name": "Bluray-720p"
|
||||
},
|
||||
"allowed": true
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 3,
|
||||
"name": "WEBDL-1080p"
|
||||
},
|
||||
"allowed": true
|
||||
},
|
||||
{
|
||||
"quality": {
|
||||
"id": 7,
|
||||
"name": "Bluray-1080p"
|
||||
},
|
||||
"allowed": true
|
||||
}
|
||||
],
|
||||
"id": 4
|
||||
}
|
||||
]</value>
|
||||
</data>
|
||||
</root>
|
64
PlexRequests.Api/Mocks/MockSonarrApi.cs
Normal file
64
PlexRequests.Api/Mocks/MockSonarrApi.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: MockSonarrApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using PlexRequests.Api.Interfaces;
|
||||
using PlexRequests.Api.Models.Sonarr;
|
||||
|
||||
namespace PlexRequests.Api.Mocks
|
||||
{
|
||||
public class MockSonarrApi : ISonarrApi
|
||||
{
|
||||
public List<SonarrProfile> GetProfiles(string apiKey, Uri baseUrl)
|
||||
{
|
||||
var json = MockApiData.Sonarr_Profiles;
|
||||
var obj = JsonConvert.DeserializeObject<List<SonarrProfile>>(json);
|
||||
return obj;
|
||||
}
|
||||
|
||||
public SonarrAddSeries AddSeries(int tvdbId, string title, int qualityId, bool seasonFolders, string rootPath, int seasonCount, int[] seasons,
|
||||
string apiKey, Uri baseUrl)
|
||||
{
|
||||
var json = MockApiData.Sonarr_AddSeriesResult;
|
||||
var obj = JsonConvert.DeserializeObject<SonarrAddSeries>(json);
|
||||
return obj;
|
||||
}
|
||||
|
||||
public SystemStatus SystemStatus(string apiKey, Uri baseUrl)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<Series> GetSeries(string apiKey, Uri baseUrl)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
36
PlexRequests.Api/MovieBase.cs
Normal file
36
PlexRequests.Api/MovieBase.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: TvBase.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using PlexRequests.Helpers;
|
||||
|
||||
namespace PlexRequests.Api
|
||||
{
|
||||
public abstract class MovieBase
|
||||
{
|
||||
private static readonly string Encrypted = "0T3QNSseexLO7n7UPiJvl70Y+KKnvbeTlsusl7Kwq0hPH0BHOuFNGwksNCjkwqWedyDdI/MJeUR4wtL4bIl0Z+//uHXEaYM/4H2pjeLbH5EWdUe5TTj1AhaIR5PQweamvcienRyFD/3YPCC/+qL5mHkKXBkPumMod3Zb/4yN0Ik=";
|
||||
protected string ApiKey = StringCipher.Decrypt(Encrypted, "ApiKey");
|
||||
}
|
||||
}
|
116
PlexRequests.Api/MusicBrainzApi.cs
Normal file
116
PlexRequests.Api/MusicBrainzApi.cs
Normal file
|
@ -0,0 +1,116 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: MusicBrainzApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using NLog;
|
||||
|
||||
using PlexRequests.Api.Interfaces;
|
||||
using PlexRequests.Api.Models.Music;
|
||||
|
||||
using RestSharp;
|
||||
|
||||
namespace PlexRequests.Api
|
||||
{
|
||||
public class MusicBrainzApi : IMusicBrainzApi
|
||||
{
|
||||
public MusicBrainzApi()
|
||||
{
|
||||
Api = new ApiRequest();
|
||||
}
|
||||
private ApiRequest Api { get; }
|
||||
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private readonly Uri BaseUri = new Uri("http://musicbrainz.org/ws/2/");
|
||||
|
||||
public MusicBrainzSearchResults SearchAlbum(string searchTerm)
|
||||
{
|
||||
Log.Trace("Searching for album: {0}", searchTerm);
|
||||
var request = new RestRequest
|
||||
{
|
||||
Resource = "release/?query={searchTerm}&fmt=json",
|
||||
Method = Method.GET
|
||||
};
|
||||
request.AddUrlSegment("searchTerm", searchTerm);
|
||||
|
||||
try
|
||||
{
|
||||
return Api.ExecuteJson<MusicBrainzSearchResults>(request, BaseUri);
|
||||
}
|
||||
catch (JsonSerializationException jse)
|
||||
{
|
||||
Log.Warn(jse);
|
||||
return new MusicBrainzSearchResults(); // If there is no matching result we do not get returned a JSON string, it just returns "false".
|
||||
}
|
||||
}
|
||||
|
||||
public MusicBrainzReleaseInfo GetAlbum(string releaseId)
|
||||
{
|
||||
Log.Trace("Getting album: {0}", releaseId);
|
||||
var request = new RestRequest
|
||||
{
|
||||
Resource = "release/{albumId}",
|
||||
Method = Method.GET
|
||||
};
|
||||
request.AddUrlSegment("albumId", releaseId);
|
||||
request.AddQueryParameter("fmt", "json");
|
||||
request.AddQueryParameter("inc", "artists");
|
||||
|
||||
try
|
||||
{
|
||||
return Api.ExecuteJson<MusicBrainzReleaseInfo>(request, BaseUri);
|
||||
}
|
||||
catch (JsonSerializationException jse)
|
||||
{
|
||||
Log.Warn(jse);
|
||||
return new MusicBrainzReleaseInfo(); // If there is no matching result we do not get returned a JSON string, it just returns "false".
|
||||
}
|
||||
}
|
||||
|
||||
public MusicBrainzCoverArt GetCoverArt(string releaseId)
|
||||
{
|
||||
Log.Trace("Getting cover art for release: {0}", releaseId);
|
||||
var request = new RestRequest
|
||||
{
|
||||
Resource = "release/{releaseId}",
|
||||
Method = Method.GET
|
||||
};
|
||||
request.AddUrlSegment("releaseId", releaseId);
|
||||
|
||||
try
|
||||
{
|
||||
return Api.Execute<MusicBrainzCoverArt>(request, new Uri("http://coverartarchive.org/"));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Warn(e);
|
||||
return new MusicBrainzCoverArt(); // If there is no matching result we do not get returned a JSON string, it just returns "false".
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
268
PlexRequests.Api/PlexApi.cs
Normal file
268
PlexRequests.Api/PlexApi.cs
Normal file
|
@ -0,0 +1,268 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: PlexApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
using Polly;
|
||||
|
||||
|
||||
#endregion
|
||||
using System;
|
||||
|
||||
using NLog;
|
||||
|
||||
using PlexRequests.Api.Interfaces;
|
||||
using PlexRequests.Api.Models.Plex;
|
||||
using PlexRequests.Helpers;
|
||||
using PlexRequests.Helpers.Exceptions;
|
||||
|
||||
using RestSharp;
|
||||
|
||||
namespace PlexRequests.Api
|
||||
{
|
||||
public class PlexApi : IPlexApi
|
||||
{
|
||||
static PlexApi()
|
||||
{
|
||||
Version = AssemblyHelper.GetAssemblyVersion();
|
||||
}
|
||||
|
||||
public PlexApi (IApiRequest api)
|
||||
{
|
||||
Api = api;
|
||||
}
|
||||
|
||||
private IApiRequest Api { get; }
|
||||
|
||||
private const string SignInUri = "https://plex.tv/users/sign_in.json";
|
||||
private const string FriendsUri = "https://plex.tv/pms/friends/all";
|
||||
private const string GetAccountUri = "https://plex.tv/users/account";
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private static string Version { get; }
|
||||
|
||||
public PlexAuthentication SignIn(string username, string password)
|
||||
{
|
||||
var userModel = new PlexUserRequest
|
||||
{
|
||||
user = new UserRequest
|
||||
{
|
||||
password = password,
|
||||
login = username
|
||||
}
|
||||
};
|
||||
var request = new RestRequest
|
||||
{
|
||||
Method = Method.POST
|
||||
};
|
||||
|
||||
AddHeaders(ref request);
|
||||
|
||||
request.AddJsonBody(userModel);
|
||||
|
||||
var obj = RetryHandler.Execute<PlexAuthentication>(() => Api.Execute<PlexAuthentication> (request, new Uri(SignInUri)),
|
||||
null,
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling SignIn for Plex, Retrying {0}", timespan));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
public PlexFriends GetUsers(string authToken)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Method = Method.GET,
|
||||
};
|
||||
|
||||
AddHeaders(ref request, authToken);
|
||||
|
||||
var users = RetryHandler.Execute(() => Api.ExecuteXml<PlexFriends> (request, new Uri(FriendsUri)),
|
||||
null,
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling GetUsers for Plex, Retrying {0}", timespan));
|
||||
|
||||
|
||||
return users;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the users.
|
||||
/// </summary>
|
||||
/// <param name="authToken">The authentication token.</param>
|
||||
/// <param name="searchTerm">The search term.</param>
|
||||
/// <param name="plexFullHost">The full plex host.</param>
|
||||
/// <returns></returns>
|
||||
public PlexSearch SearchContent(string authToken, string searchTerm, Uri plexFullHost)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Method = Method.GET,
|
||||
Resource = "search?query={searchTerm}"
|
||||
};
|
||||
|
||||
request.AddUrlSegment("searchTerm", searchTerm);
|
||||
AddHeaders(ref request, authToken);
|
||||
|
||||
var search = RetryHandler.Execute<PlexSearch>(() => Api.ExecuteXml<PlexSearch> (request, plexFullHost),
|
||||
null,
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling SearchContent for Plex, Retrying {0}", timespan));
|
||||
|
||||
return search;
|
||||
}
|
||||
|
||||
public PlexStatus GetStatus(string authToken, Uri uri)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Method = Method.GET,
|
||||
};
|
||||
|
||||
AddHeaders(ref request, authToken);
|
||||
|
||||
var users = RetryHandler.Execute<PlexStatus>(() => Api.ExecuteXml<PlexStatus> (request, uri),
|
||||
null,
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling GetStatus for Plex, Retrying {0}", timespan));
|
||||
|
||||
return users;
|
||||
}
|
||||
|
||||
public PlexAccount GetAccount(string authToken)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Method = Method.GET,
|
||||
};
|
||||
|
||||
AddHeaders(ref request, authToken);
|
||||
|
||||
var account = RetryHandler.Execute<PlexAccount>(() => Api.ExecuteXml<PlexAccount> (request, new Uri(GetAccountUri)),
|
||||
null,
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling GetAccount for Plex, Retrying {0}", timespan));
|
||||
|
||||
return account;
|
||||
}
|
||||
|
||||
public PlexLibraries GetLibrarySections(string authToken, Uri plexFullHost)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Method = Method.GET,
|
||||
Resource = "library/sections"
|
||||
};
|
||||
|
||||
AddHeaders(ref request, authToken);
|
||||
|
||||
try
|
||||
{
|
||||
var lib = RetryHandler.Execute<PlexLibraries>(() => Api.ExecuteXml<PlexLibraries> (request, plexFullHost),
|
||||
new TimeSpan[] {
|
||||
TimeSpan.FromSeconds (5),
|
||||
TimeSpan.FromSeconds(10),
|
||||
TimeSpan.FromSeconds(30)
|
||||
},
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling GetLibrarySections for Plex, Retrying {0}", timespan));
|
||||
|
||||
return lib;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e,"There has been a API Exception when attempting to get the Plex Libraries");
|
||||
return new PlexLibraries();
|
||||
}
|
||||
}
|
||||
|
||||
public PlexSearch GetLibrary(string authToken, Uri plexFullHost, string libraryId)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Method = Method.GET,
|
||||
Resource = "library/sections/{libraryId}/all"
|
||||
};
|
||||
|
||||
request.AddUrlSegment("libraryId", libraryId);
|
||||
AddHeaders(ref request, authToken);
|
||||
|
||||
try
|
||||
{
|
||||
var lib = RetryHandler.Execute<PlexSearch>(() => Api.ExecuteXml<PlexSearch> (request, plexFullHost),
|
||||
new TimeSpan[] {
|
||||
TimeSpan.FromSeconds (5),
|
||||
TimeSpan.FromSeconds(10),
|
||||
TimeSpan.FromSeconds(30)
|
||||
},
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling GetLibrary for Plex, Retrying {0}", timespan));
|
||||
|
||||
return lib;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e,"There has been a API Exception when attempting to get the Plex Library");
|
||||
return new PlexSearch();
|
||||
}
|
||||
}
|
||||
|
||||
public PlexMetadata GetMetadata(string authToken, Uri plexFullHost, string itemId)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Method = Method.GET,
|
||||
Resource = "library/metadata/{itemId}"
|
||||
};
|
||||
|
||||
request.AddUrlSegment("itemId", itemId);
|
||||
AddHeaders(ref request, authToken);
|
||||
|
||||
try
|
||||
{
|
||||
var lib = RetryHandler.Execute(() => Api.ExecuteXml<PlexMetadata>(request, plexFullHost),
|
||||
new[] {
|
||||
TimeSpan.FromSeconds (5),
|
||||
TimeSpan.FromSeconds(10),
|
||||
TimeSpan.FromSeconds(30)
|
||||
},
|
||||
(exception, timespan) => Log.Error(exception, "Exception when calling GetMetadata for Plex, Retrying {0}", timespan));
|
||||
|
||||
return lib;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e, "There has been a API Exception when attempting to get the Plex GetMetadata");
|
||||
return new PlexMetadata();
|
||||
}
|
||||
}
|
||||
|
||||
private void AddHeaders(ref RestRequest request, string authToken)
|
||||
{
|
||||
request.AddHeader("X-Plex-Token", authToken);
|
||||
AddHeaders(ref request);
|
||||
}
|
||||
|
||||
private void AddHeaders(ref RestRequest request)
|
||||
{
|
||||
request.AddHeader("X-Plex-Client-Identifier", "Test213");
|
||||
request.AddHeader("X-Plex-Product", "Request Plex");
|
||||
request.AddHeader("X-Plex-Version", Version);
|
||||
request.AddHeader("Content-Type", "application/xml");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
124
PlexRequests.Api/PlexRequests.Api.csproj
Normal file
124
PlexRequests.Api/PlexRequests.Api.csproj
Normal file
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{8CB8D235-2674-442D-9C6A-35FCAEEB160D}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>PlexRequests.Api</RootNamespace>
|
||||
<AssemblyName>PlexRequests.Api</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.3.4\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Dapper, Version=1.40.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\packages\Dapper.1.42\lib\net45\Dapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Nancy, Version=1.4.2.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\packages\Nancy.1.4.3\lib\net40\Nancy.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="TMDbLib, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\packages\TMDbLib.0.9.0.0-alpha\lib\net45\TMDbLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Polly">
|
||||
<HintPath>..\packages\Polly-Signed.4.2.0\lib\net45\Polly.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ApiRequest.cs" />
|
||||
<Compile Include="MusicBrainzApi.cs" />
|
||||
<Compile Include="MockApiData.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>MockApiData.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Mocks\MockSonarrApi.cs" />
|
||||
<Compile Include="SlackApi.cs" />
|
||||
<Compile Include="PushoverApi.cs" />
|
||||
<Compile Include="PushbulletApi.cs" />
|
||||
<Compile Include="SickrageApi.cs" />
|
||||
<Compile Include="HeadphonesApi.cs" />
|
||||
<Compile Include="SonarrApi.cs" />
|
||||
<Compile Include="CouchPotatoApi.cs" />
|
||||
<Compile Include="MovieBase.cs" />
|
||||
<Compile Include="PlexApi.cs" />
|
||||
<Compile Include="TheMovieDbApi.cs" />
|
||||
<Compile Include="TvBase.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TheTvDbApi.cs" />
|
||||
<Compile Include="TvMazeApi.cs" />
|
||||
<Compile Include="TvMazeBase.cs" />
|
||||
<Compile Include="RetryHandler.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PlexRequests.Api.Interfaces\PlexRequests.Api.Interfaces.csproj">
|
||||
<Project>{95834072-A675-415D-AA8F-877C91623810}</Project>
|
||||
<Name>PlexRequests.Api.Interfaces</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\PlexRequests.Api.Models\PlexRequests.Api.Models.csproj">
|
||||
<Project>{CB37A5F8-6DFC-4554-99D3-A42B502E4591}</Project>
|
||||
<Name>PlexRequests.Api.Models</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\PlexRequests.Helpers\PlexRequests.Helpers.csproj">
|
||||
<Project>{1252336D-42A3-482A-804C-836E60173DFA}</Project>
|
||||
<Name>PlexRequests.Helpers</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="MockApiData.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>MockApiData.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
37
PlexRequests.Api/Properties/AssemblyInfo.cs
Normal file
37
PlexRequests.Api/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("PlexRequests.Api")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("PlexRequests.Api")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("8cb8d235-2674-442d-9c6a-35fcaeeb160d")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyInformationalVersionAttribute("1.0.0.0")]
|
64
PlexRequests.Api/PushbulletApi.cs
Normal file
64
PlexRequests.Api/PushbulletApi.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: PlexApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using PlexRequests.Api.Interfaces;
|
||||
using PlexRequests.Api.Models.Notifications;
|
||||
|
||||
using RestSharp;
|
||||
|
||||
namespace PlexRequests.Api
|
||||
{
|
||||
public class PushbulletApi : IPushbulletApi
|
||||
{
|
||||
public async Task<PushbulletResponse> PushAsync(string accessToken, string title, string message, string deviceIdentifier = default(string))
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Method = Method.POST,
|
||||
|
||||
};
|
||||
|
||||
request.AddHeader("Access-Token", accessToken);
|
||||
request.AddHeader("Content-Type", "application/json");
|
||||
|
||||
var push = new PushbulletPush { title = title, body = message, type = "note"};
|
||||
|
||||
if (!string.IsNullOrEmpty(deviceIdentifier))
|
||||
{
|
||||
push.device_iden = deviceIdentifier;
|
||||
}
|
||||
|
||||
request.AddJsonBody(push);
|
||||
|
||||
var api = new ApiRequest();
|
||||
return await Task.Run(() => api.ExecuteJson<PushbulletResponse>(request, new Uri("https://api.pushbullet.com/v2/pushes")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
57
PlexRequests.Api/PushoverApi.cs
Normal file
57
PlexRequests.Api/PushoverApi.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: PlexApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using PlexRequests.Api.Interfaces;
|
||||
using PlexRequests.Api.Models.Notifications;
|
||||
|
||||
using RestSharp;
|
||||
|
||||
namespace PlexRequests.Api
|
||||
{
|
||||
public class PushoverApi : IPushoverApi
|
||||
{
|
||||
public async Task<PushoverResponse> PushAsync(string accessToken, string message, string userToken)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Method = Method.POST,
|
||||
Resource = "messages.json?token={token}&user={user}&message={message}"
|
||||
};
|
||||
|
||||
request.AddUrlSegment("token", accessToken);
|
||||
request.AddUrlSegment("message", message);
|
||||
request.AddUrlSegment("user", userToken);
|
||||
|
||||
|
||||
var api = new ApiRequest();
|
||||
return await Task.Run(() => api.ExecuteJson<PushoverResponse>(request, new Uri("https://api.pushover.net/1")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
71
PlexRequests.Api/RetryHandler.cs
Normal file
71
PlexRequests.Api/RetryHandler.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
using System;
|
||||
using Polly.Retry;
|
||||
using Polly;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PlexRequests.Api
|
||||
{
|
||||
public static class RetryHandler
|
||||
{
|
||||
|
||||
private static readonly TimeSpan[] DefaultTime = new TimeSpan[] {
|
||||
TimeSpan.FromSeconds (2),
|
||||
TimeSpan.FromSeconds(5),
|
||||
TimeSpan.FromSeconds(10)};
|
||||
|
||||
public static RetryPolicy RetryAndWaitPolicy(TimeSpan[] timeSpan, Action action)
|
||||
{
|
||||
if(timeSpan == null)
|
||||
{
|
||||
timeSpan = DefaultTime;
|
||||
}
|
||||
var policy = Policy.Handle<Exception> ()
|
||||
.WaitAndRetry(timeSpan, (e, ts) => action());
|
||||
|
||||
return policy;
|
||||
}
|
||||
|
||||
public static RetryPolicy RetryAndWaitPolicy(TimeSpan[] timeSpan)
|
||||
{
|
||||
if(timeSpan == null)
|
||||
{
|
||||
timeSpan = DefaultTime;
|
||||
}
|
||||
var policy = Policy.Handle<Exception> ()
|
||||
.WaitAndRetry(timeSpan);
|
||||
|
||||
return policy;
|
||||
}
|
||||
|
||||
public static RetryPolicy RetryAndWaitPolicy(TimeSpan[] timeSpan, Action<Exception, TimeSpan> action)
|
||||
{
|
||||
if(timeSpan == null)
|
||||
{
|
||||
timeSpan = DefaultTime;
|
||||
}
|
||||
var policy = Policy.Handle<Exception> ()
|
||||
.WaitAndRetry(timeSpan, action);
|
||||
|
||||
return policy;
|
||||
}
|
||||
|
||||
public static T Execute<T>(Func<T> action, TimeSpan[] timeSpan)
|
||||
{
|
||||
var policy = RetryAndWaitPolicy (timeSpan);
|
||||
|
||||
return policy.Execute (action);
|
||||
}
|
||||
|
||||
public static T Execute<T>(Func<T> func, TimeSpan[] timeSpan, Action<Exception, TimeSpan> action)
|
||||
{
|
||||
if(timeSpan == null)
|
||||
{
|
||||
timeSpan = DefaultTime;
|
||||
}
|
||||
var policy = RetryAndWaitPolicy (timeSpan, action);
|
||||
|
||||
return policy.Execute (func);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
227
PlexRequests.Api/SickrageApi.cs
Normal file
227
PlexRequests.Api/SickrageApi.cs
Normal file
|
@ -0,0 +1,227 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: SickrageApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System.Linq;
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using NLog;
|
||||
|
||||
using PlexRequests.Api.Interfaces;
|
||||
using PlexRequests.Api.Models.SickRage;
|
||||
using PlexRequests.Helpers;
|
||||
using PlexRequests.Helpers.Exceptions;
|
||||
|
||||
using RestSharp;
|
||||
|
||||
namespace PlexRequests.Api
|
||||
{
|
||||
public class SickrageApi : ISickRageApi
|
||||
{
|
||||
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public SickrageApi()
|
||||
{
|
||||
Api = new ApiRequest();
|
||||
}
|
||||
|
||||
private ApiRequest Api { get; }
|
||||
|
||||
public SickRageSeasonList VerifyShowHasLoaded(int tvdbId, string apiKey, Uri baseUrl)
|
||||
{
|
||||
Log.Trace("Entered `VerifyShowHasLoaded({0} <- id)`", tvdbId);
|
||||
var request = new RestRequest { Resource = "/api/{apiKey}/?cmd=show.seasonlist", Method = Method.GET };
|
||||
request.AddUrlSegment("apiKey", apiKey);
|
||||
request.AddQueryParameter("tvdbid", tvdbId.ToString());
|
||||
|
||||
try
|
||||
{
|
||||
var policy = RetryHandler.RetryAndWaitPolicy(
|
||||
null,
|
||||
(exception, timespan) => Log.Error(exception, "Exception when calling VerifyShowHasLoaded for SR, Retrying {0}", timespan));
|
||||
|
||||
var obj = policy.Execute(() => Api.ExecuteJson<SickRageSeasonList>(request, baseUrl));
|
||||
return obj;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
return new SickRageSeasonList();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<SickRageTvAdd> AddSeries(int tvdbId, int seasonCount, int[] seasons, string quality, string apiKey, Uri baseUrl)
|
||||
{
|
||||
var futureStatus = seasons.Length > 0 && !seasons.Any(x => x == seasonCount) ? SickRageStatus.Skipped : SickRageStatus.Wanted;
|
||||
var status = seasons.Length > 0 ? SickRageStatus.Skipped : SickRageStatus.Wanted;
|
||||
|
||||
Log.Trace("Future Status: {0}", futureStatus);
|
||||
Log.Trace("Current Status: {0}", status);
|
||||
|
||||
var request = new RestRequest { Resource = "/api/{apiKey}/?cmd=show.addnew", Method = Method.GET };
|
||||
request.AddUrlSegment("apiKey", apiKey);
|
||||
request.AddQueryParameter("tvdbid", tvdbId.ToString());
|
||||
request.AddQueryParameter("status", status);
|
||||
request.AddQueryParameter("future_status", futureStatus);
|
||||
if (!quality.Equals("default", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Log.Trace("Settings quality to {0}", quality);
|
||||
request.AddQueryParameter("initial", quality);
|
||||
}
|
||||
|
||||
var policy = RetryHandler.RetryAndWaitPolicy(
|
||||
null,
|
||||
(exception, timespan) => Log.Error(exception, "Exception when calling AddSeries for SR, Retrying {0}", timespan));
|
||||
|
||||
var obj = policy.Execute(() => Api.Execute<SickRageTvAdd>(request, baseUrl));
|
||||
Log.Trace("obj Result:");
|
||||
Log.Trace(obj.DumpJson());
|
||||
|
||||
if (obj.result != "failure")
|
||||
{
|
||||
var sw = new Stopwatch();
|
||||
sw.Start();
|
||||
|
||||
var seasonIncrement = 0;
|
||||
var seasonList = new SickRageSeasonList();
|
||||
try
|
||||
{
|
||||
while (seasonIncrement < seasonCount)
|
||||
{
|
||||
seasonList = VerifyShowHasLoaded(tvdbId, apiKey, baseUrl);
|
||||
if (seasonList.result.Equals("failure"))
|
||||
{
|
||||
Thread.Sleep(3000);
|
||||
continue;
|
||||
}
|
||||
seasonIncrement = seasonList.Data?.Length ?? 0;
|
||||
Log.Trace("New seasonIncrement -> {0}", seasonIncrement);
|
||||
|
||||
if (sw.ElapsedMilliseconds > 30000) // Break out after 30 seconds, it's not going to get added
|
||||
{
|
||||
Log.Warn("Couldn't find out if the show had been added after 10 seconds. I doubt we can change the status to wanted.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
sw.Stop();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error("Exception thrown when getting the seasonList");
|
||||
Log.Error(e);
|
||||
}
|
||||
}
|
||||
Log.Trace("seasons.Length > 0 where seasons.Len -> {0}", seasons.Length);
|
||||
try
|
||||
{
|
||||
if (seasons.Length > 0)
|
||||
{
|
||||
//handle the seasons requested
|
||||
foreach (var s in seasons)
|
||||
{
|
||||
Log.Trace("Adding season {0}", s);
|
||||
|
||||
var result = await AddSeason(tvdbId, s, apiKey, baseUrl);
|
||||
Log.Trace("SickRage adding season results: ");
|
||||
Log.Trace(result.DumpJson());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Trace("Exception when adding seasons:");
|
||||
Log.Error(e);
|
||||
throw;
|
||||
}
|
||||
|
||||
Log.Trace("Finished with the API, returning the obj");
|
||||
return obj;
|
||||
}
|
||||
|
||||
public SickRagePing Ping(string apiKey, Uri baseUrl)
|
||||
{
|
||||
var request = new RestRequest { Resource = "/api/{apiKey}/?cmd=sb.ping", Method = Method.GET };
|
||||
|
||||
var policy = RetryHandler.RetryAndWaitPolicy(
|
||||
null,
|
||||
(exception, timespan) => Log.Error(exception, "Exception when calling Ping for SR, Retrying {0}", timespan));
|
||||
|
||||
request.AddUrlSegment("apiKey", apiKey);
|
||||
var obj = policy.Execute(() => Api.ExecuteJson<SickRagePing>(request, baseUrl));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
public async Task<SickRageTvAdd> AddSeason(int tvdbId, int season, string apiKey, Uri baseUrl)
|
||||
{
|
||||
var request = new RestRequest { Resource = "/api/{apiKey}/?cmd=episode.setstatus", Method = Method.GET };
|
||||
request.AddUrlSegment("apiKey", apiKey);
|
||||
request.AddQueryParameter("tvdbid", tvdbId.ToString());
|
||||
request.AddQueryParameter("season", season.ToString());
|
||||
request.AddQueryParameter("status", SickRageStatus.Wanted);
|
||||
|
||||
await Task.Run(() => Thread.Sleep(2000));
|
||||
return await Task.Run(
|
||||
() =>
|
||||
{
|
||||
var policy = RetryHandler.RetryAndWaitPolicy(
|
||||
null,
|
||||
(exception, timespan) => Log.Error(exception, "Exception when calling AddSeason for SR, Retrying {0}", timespan));
|
||||
|
||||
var result = policy.Execute(() => Api.Execute<SickRageTvAdd>(request, baseUrl));
|
||||
|
||||
return result;
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<SickrageShows> GetShows(string apiKey, Uri baseUrl)
|
||||
{
|
||||
var request = new RestRequest { Resource = "/api/{apiKey}/?cmd=shows", Method = Method.GET };
|
||||
request.AddUrlSegment("apiKey", apiKey);
|
||||
|
||||
return await Task.Run(
|
||||
() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var policy = RetryHandler.RetryAndWaitPolicy(
|
||||
new[] { TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(30) },
|
||||
(exception, timespan) => Log.Error(exception, "Exception when calling GetShows for SR, Retrying {0}", timespan));
|
||||
|
||||
return policy.Execute(() => Api.Execute<SickrageShows>(request, baseUrl));
|
||||
}
|
||||
catch (ApiRequestException)
|
||||
{
|
||||
Log.Error("There has been a API exception when Getting the Sickrage shows");
|
||||
return null;
|
||||
}
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
62
PlexRequests.Api/SlackApi.cs
Normal file
62
PlexRequests.Api/SlackApi.cs
Normal file
|
@ -0,0 +1,62 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: PlexApi.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// 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.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using PlexRequests.Api.Interfaces;
|
||||
using PlexRequests.Api.Models.Notifications;
|
||||
|
||||
using RestSharp;
|
||||
|
||||
namespace PlexRequests.Api
|
||||
{
|
||||
public class SlackApi : ISlackApi
|
||||
{
|
||||
public async Task<string> PushAsync(string team, string token, string service, SlackNotificationBody message)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Method = Method.POST,
|
||||
Resource = "/services/{team}/{service}/{token}"
|
||||
};
|
||||
|
||||
request.AddUrlSegment("team", team);
|
||||
request.AddUrlSegment("service", service);
|
||||
request.AddUrlSegment("token", token);
|
||||
request.AddJsonBody(message);
|
||||
|
||||
var api = new ApiRequest();
|
||||
return await Task.Run(
|
||||
() =>
|
||||
{
|
||||
var result = api.Execute(request, new Uri("https://hooks.slack.com/"));
|
||||
return result.Content;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue