From cacafcff582d1fe530a49516e0d09e03a156c85e Mon Sep 17 00:00:00 2001 From: kaso17 Date: Wed, 3 Jan 2018 19:46:12 +0100 Subject: [PATCH] Secret Cinema: migrate to gazelle base --- .../Definitions/secretcinema.yml | 92 ------------------- src/Jackett.Common/Indexers/SecretCinema.cs | 64 +++++++++++++ 2 files changed, 64 insertions(+), 92 deletions(-) delete mode 100644 src/Jackett.Common/Definitions/secretcinema.yml create mode 100644 src/Jackett.Common/Indexers/SecretCinema.cs diff --git a/src/Jackett.Common/Definitions/secretcinema.yml b/src/Jackett.Common/Definitions/secretcinema.yml deleted file mode 100644 index 6bf9087a6..000000000 --- a/src/Jackett.Common/Definitions/secretcinema.yml +++ /dev/null @@ -1,92 +0,0 @@ ---- - site: secretcinema - name: Secret Cinema - description: "A tracker for rare movies." - language: en-us - type: private - encoding: "UTF-8" - links: - - https://secret-cinema.pw - - caps: - categorymappings: - - { id: 1, cat: Movies, desc: "Movies" } - - { id: "1]=1&nzbcat[2030", cat: Movies/SD, desc: "Movies/SD" } - - { id: "1]=1&nzbcat[2040", cat: Movies/HD, desc: "Movies/HD" } - - { id: "1]=1&nzbcat[2060", cat: Movies/BluRay, desc: "Movies/BluRay" } - - { id: "1]=1&nzbcat[2070", cat: Movies/DVD, desc: "Movies/DVD" } - - { id: 2, cat: Audio/MP3, desc: "Music" } - - { id: 3, cat: Books/Ebook, desc: "E-Books" } - - modes: - search: [q, imdbid] - movie-search: [q, imdbid] - - login: - path: login.php - method: form - form: form - inputs: - username: "{{ .Config.username }}" - password: "{{ .Config.password }}" - error: - - selector: table:contains("Login failed!") - test: - path: index.php - - ratio: - path: torrents.php - selector: li#stats_ratio > span - - search: - paths: - - path: torrents.php - inputs: - $raw: "{{range .Categories}}filter_cat[{{.}}]=1&{{end}}" - searchstr: "{{if .Query.IMDBID}}{{else}}{{ .Keywords }}{{end}}" - cataloguenumber: "{{ .Query.IMDBID }}" - searchsubmit: 1 - rows: - selector: table#torrent_table > tbody > tr.torrent - fields: - download: - selector: a[href^="torrents.php?action=download&id="] - attribute: href - description: - selector: div.group_info > a.tooltip - remove: span, div.tags, div.torrent_info - title: - selector: div.group_info > a.tooltip - remove: span, div.tags, div.torrent_info - category: - selector: tr.torrent - case: - div.torrent_info:contains('720'), div.torrent_info:contains('1080p'), div.torrent_info:contains('4k'): "1]=1&nzbcat[2040" - div.torrent_info:contains('SD'): "1]=1&nzbcat[2030" - div.torrent_info:contains('BDMV'): "1]=1&nzbcat[2060" - div.torrent_info:contains('DVD-R'): "1]=1&nzbcat[2070" - div.cats_movies: 1 - div.cats_music: 2 - div.cats_ebooks: 3 - comments: - selector: a[href^="torrents.php?id="] - attribute: href - files: - selector: td:nth-child(4) - date: - selector: td:nth-child(5) - size: - selector: td:nth-child(6) - grabs: - selector: td:nth-child(7) - seeders: - selector: td:nth-child(8) - leechers: - selector: td:nth-child(9) - downloadvolumefactor: - case: - "strong.tl_free:contains(\"Freeleech!\")": "0" - "*": "1" - uploadvolumefactor: - case: - "*": "1" diff --git a/src/Jackett.Common/Indexers/SecretCinema.cs b/src/Jackett.Common/Indexers/SecretCinema.cs new file mode 100644 index 000000000..a8b49a9cd --- /dev/null +++ b/src/Jackett.Common/Indexers/SecretCinema.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; +using Jackett.Indexers.Abstract; +using Jackett.Models; +using Jackett.Services.Interfaces; +using Jackett.Utils.Clients; +using Newtonsoft.Json.Linq; +using NLog; + +namespace Jackett.Indexers +{ + public class SecretCinema : GazelleTracker + { + public SecretCinema(IIndexerConfigurationService configService, WebClient webClient, Logger logger, IProtectionService protectionService) + : base(name: "Secret Cinema", + desc: "A tracker for rare movies.", + link: "https://secret-cinema.pw/", + configService: configService, + logger: logger, + protectionService: protectionService, + webClient: webClient, + supportsFreeleechTokens: false // ratio free tracker + ) + { + Language = "en-us"; + Type = "private"; + TorznabCaps.SupportedMusicSearchParamsList = new List() { "q", "album", "artist", "label", "year" }; + TorznabCaps.SupportsImdbSearch = true; + + AddCategoryMapping(1, TorznabCatType.Movies, "Movies"); + AddCategoryMapping(2, TorznabCatType.Audio, "Music"); + AddCategoryMapping(3, TorznabCatType.Books, "E-Books"); + } + + protected override bool ReleaseInfoPostParse(ReleaseInfo release, JObject torrent, JObject result) + { + var media = (string)torrent["media"]; + if (!string.IsNullOrEmpty(media)) + { + switch (media) + { + case "SD": + release.Category.Remove(TorznabCatType.Movies.ID); + release.Category.Add(TorznabCatType.MoviesSD.ID); + break; + case "720p": + case "1080p": + case "4k": // not verified + release.Category.Remove(TorznabCatType.Movies.ID); + release.Category.Add(TorznabCatType.MoviesHD.ID); + break; + case "DVD-R": + release.Category.Remove(TorznabCatType.Movies.ID); + release.Category.Add(TorznabCatType.MoviesDVD.ID); + break; + case "BDMV": + release.Category.Remove(TorznabCatType.Movies.ID); + release.Category.Add(TorznabCatType.MoviesBluRay.ID); + break; + } + } + return true; + } + } +} \ No newline at end of file