def __init__(self, config): self.radarr = Radarr(config.radarr_url, config.radarr_base_path, config.radarr_api_key, config.radarr_quality_profile) self.imdb = Imdb() self.score11 = Score11(self.imdb) self.ask = Preferences(self.imdb)
def home(): if request.args.get('search') is None: search = None else: search = str(request.args.get('search')).strip() scale = False if request.args.get('scale') is not None: if str(request.args.get('scale')) == 'True': scale = bool(request.args.get('scale')) if search is not None: try: true_title, episodes = RatingCharts.getEpisodes(Imdb(), search) try: chart_div = RatingCharts.buildChart(true_title, episodes, scale) except: return "Unable to build chart for \"" + search + "\"" except: return "Unable to scrape episode data for \"" + search + "\"" return render_template('index.html', chart_div=chart_div, title=true_title) else: return render_template('index.html', chart_div="", title="Visualize TV Ratings")
def main(): # get title: title = input("title>").strip() print(title) # get episodes: try: trueTitle, episodes = getEpisodes(Imdb(), title) # build chart try: print(buildChart(trueTitle, episodes, False)) except: print("Unable to build chart for \"" + title + "\"") except: print("Unable to scrape episode data for \"" + title + "\"")
class ImdbSelect: def __init__(self, config): self.radarr = Radarr(config.radarr_url, config.radarr_base_path, config.radarr_api_key, config.radarr_quality_profile) self.imdb = Imdb() self.score11 = Score11(self.imdb) self.ask = Preferences(self.imdb) def add_all_actors(self, actors, rating_above=0, votes_above=0, manual=False, retry=True): for count, actor in enumerate(actors, start=1): print("[ " + str(count) + "/" + str(len(actors)) + " ] going through all movies with: " + actor) imdb_ids = self.imdb.imdb_id_list_from_person(actor) self.add_all_imdb_ids(imdb_ids, rating_above, votes_above, manual, retry) def add_all_imdb_ids(self, imdb_ids, rating_above=0, votes_above=0, manual=False, retry=True): movie_data_map = self.collect_movie_data(imdb_ids, retry) self.choices(movie_data_map, rating_above, votes_above, manual, prepare=True) movies_to_add = self.choices(movie_data_map, rating_above, votes_above, manual) self.add_movies(movies_to_add) def collect_movie_data(self, imdb_ids, retry=True): movie_data_map = {} error_list = [] print("[ " + str(len(imdb_ids)) + " ] ", end='', flush=True) next_print = 10 for count, imdb_id in enumerate(imdb_ids): try: if not self.ask.is_answered_no( imdb_id) and not self.radarr.movie_exist(imdb_id): movie_data_map[imdb_id] = self.radarr.get_movie( imdb_id, retry) print('.', end='', flush=True) except MovieNotFoundError: error_list.append(imdb_id) print(Fore.RED + '.' + Style.RESET_ALL, end='', flush=True) if 100 * count // len(imdb_ids) >= next_print: print(str(next_print) + "%", end='', flush=True) next_print += 10 print("/") if len(error_list) > 0: err_title = [ self.imdb.get_movie_title_year(imdb_id) for imdb_id in error_list ] print('Could not find ' + str(len(error_list)) + ': ' + ', '.join(err_title)) return movie_data_map def choices(self, movie_data_map, rating_above=None, votes_above=None, manual=False, prepare=False): movies_to_add = [] for imdb_id, movie in movie_data_map.items(): if rating_above and votes_above: if not movie.rating_above(rating_above): if not prepare: print("\t" + str(movie) + " has too low ratings") continue if not movie.votes_above(votes_above): if not prepare: print("\t\t" + str(movie) + " has not enough votes") continue if manual: if self.ask.ask(imdb_id, movie, prepare): movies_to_add.append(movie) else: if not prepare: print(str(movie) + " has good ratings") movies_to_add.append(movie) elif manual and self.ask.ask(imdb_id, movie, prepare): movies_to_add.append(movie) return movies_to_add def add_movies(self, movies_to_add): for movie in movies_to_add: status = self.radarr.add_movie(movie) if status / 100 == 4: print("\t" + movie.short_string() + " exists already.") else: print("\t" + movie.short_string() + " added.") def delete_non_downloaded_movies_added_ago(self, time_delta=timedelta(days=1)): movies = self.radarr.get_all_non_downloaded_movies() filtered = [ movie for movie in movies if movie.added_date() > datetime.now(timezone.utc) - time_delta ] count = len(filtered) for movie in filtered: print(count, movie.title()) count -= 1 self.radarr.remove_movie(movie)
import tensorflow as tf import numpy as np import os.path as osp import sys import gc from Network import Network from config import cfg from Imdb import Imdb from ObjectDetector import ObjectDetector if __name__ == '__main__': """ tests a pretrained faster rcnn model on the coco test2017 dataset """ sess = tf.Session(graph=tf.Graph()) net = Network(cfg, False, sess) imdb = Imdb('/content/image_data', 'test2017', cfg) od = ObjectDetector(net, imdb, cfg) od.evaluate( '/content/gdrive/My Drive/Faster-R-CNN/results/coco_results.json', True)
#!/usr/bin/env python3 import config from Imdb import Imdb from ImdbSelect import ImdbSelect from Plex import Plex from Score11 import Score11 worker = ImdbSelect(config) score11 = Score11(Imdb()) imdb_ids = score11.imdb_ids_for_sneak('Paderborn', 'Cineplex', minimum_rating=6.5, maximum_rating=7.0) worker.add_all_imdb_ids(imdb_ids, rating_above=7.5, votes_above=200, retry=False) worker.add_all_imdb_ids(imdb_ids, rating_above=6, votes_above=100, manual=True, retry=False) worker.add_all_imdb_ids(imdb_ids, manual=True, retry=False) plex = Plex(config.plex_url, config.plex_token, config.plex_movie_lib_name) actors = plex.most_common_actors(author_min_movie_threshold=10) actors -= config.actors_blacklist
import tensorflow as tf import numpy as np import os import os.path as osp import sys import gc from Network import Network from config import cfg from Imdb import Imdb from ObjectDetector import ObjectDetector if __name__ == '__main__': """ trains the faster rcnn model on the coco train2017 dataset """ sess = tf.Session(graph=tf.Graph()) net = Network(cfg, True, sess) imdb = Imdb('/content/image_data', 'train2017', cfg) od = ObjectDetector(net, imdb, cfg) od.train()