Beispiel #1
0
 def __init__(self, path):
     if not os.path.exists(path):
         ucli.drop('Doesn\'t look like a path')
     self.walk_through(path)
     if not self.is_movie:
         self.track_tvshow()
     ucli.drop('All the things done successfully', with_code=0)
Beispiel #2
0
    def search(self, **params):

        self.media_type = params['type']
        search_results = None

        try:
            search_results = ucli.gen_to_list(
                getattr(self, self.media_type)(**params))
            ucli.print_candidates(search_results)

        except MapiNotFoundException:
            ucli.info('Nothing found')
            ucli.print_options("[e]dit query, [m]anual, [s]kip, [q]uit")

        except MapiNetworkException:
            ucli.drop('Network error: couldn\'t retrieve data')

        else:
            ucli.print_options(
                "[RETURN] default, [e]dit query, [m]anual, [s]kip, [q]uit")

        finally:
            return ucli.parse_selection(
                search_results, {
                    'e': self.search_again,
                    'm': self.get_metadata_manual})
Beispiel #3
0
 def wrapper(args):
     try:
         db = DBManager()
         action(args, db)
     except TVShowsError as message:
         manager.event_log(message, log_level='exception')
     except TVShowsErrorInteractive as message:
         ucli.info(message)
     except KeyboardInterrupt:
         ucli.drop('Interrupted by user')
     finally:
         # Commit changes to DB even if exeption occured
         if db.has_changes:
             db.topics.commit()
Beispiel #4
0
            ucli.drop('Network error: couldn\'t retrieve data')

        else:
            ucli.print_options(
                "[RETURN] default, [e]dit query, [m]anual, [s]kip, [q]uit")

        finally:
            return ucli.parse_selection(
                search_results, {
                    'e': self.search_again,
                    'm': self.get_metadata_manual})

    def track_tvshow(self):
        ucli.info('Would you like to track this TV Show?')
        ucli.print_options('[RETURN] to confirm or [s]kip this step')
        if ucli.parse_selection(None):
            from tvshows import tvshows
            tvshows.add({
                'link': self.linkpath,
                'title': self.metadata['title']
                        if 'title' in self.metadata
                        else self.metadata['series']})


if __name__ == '__main__':
    args = docopt(__doc__, version='Video Namer 0.1')
    try:
        VideoNamer(args['FILE'])
    except KeyboardInterrupt:
        ucli.drop(f'{os.linesep}Interrupted by user', with_code=130)