Пример #1
0
    def log_in_or_out(self):
        if self.is_logged_in():
            proceed = helper.show_yes_no_dialog(
                'Are you sure you want to log out of your account?')
            if proceed:
                username = helper.get_setting('username')
                self._logout()
                helper.show_small_popup(msg=('Successfully logged out of %s' %
                                             username))
        else:
            username = helper.get_user_input('Please enter your username')
            if username == None:
                return

            password = helper.get_user_input('Please enter your password',
                                             hidden=True)
            if password == None:
                return

            helper.show_busy_notification()
            logged_in = self._login(username, password)
            msg = '%s into %s' % (('Successfully logged' if logged_in else
                                   'Failed to log'), username)
            helper.close_busy_notification()
            helper.show_small_popup(msg=msg)
    def search_and_update(self):
        while True:
            idx = helper.present_selection_dialog('Choose a title to search for', self.options)
            helper.log_debug('User selected index %d' % idx)
            default_text = self.options[idx] if idx != 0 else ''
            search_string = helper.get_user_input('Type the show to find metadata for', default_text)
            if search_string == None:
                helper.log_debug('User cancelled manual metadata search')
                return
            elif not search_string:
                helper.show_ok_dialog(['Invalid search query.  Please try again'])
            else:
                break

        helper.show_busy_notification()
        mc_list = media_container_list.MediaContainerList(None)
        metadata, media_type = mc_list.get_metadata(search_string)

        # Grab the ID and the actual title, which might have gotten stripped of
        # the year because of a mismatch...
        if media_type == 'tvshow':
            tmdb_id = metadata.get('tvdb_id', '')
            actual_title = mc_list.clean_tv_show_name(mc_list.clean_name(args.full_title))
        else:
            tmdb_id = metadata.get('tmdb_id', '')
            actual_title = mc_list.clean_name(args.full_title)

        helper.log_debug('Metadatafinder results: %s, %s, %s' % (tmdb_id, media_type, metadata))
        if tmdb_id:
            helper.log_debug('Found metadata from search for %s; refreshing the page' % args.base_title)
            self.meta.update_meta(media_type, actual_title, imdb_id='', new_tmdb_id=tmdb_id, new_imdb_id=metadata.get('imdb_id'))
            helper.refresh_page()
        else:
            helper.show_ok_dialog(['Did not find any metadata from the search query.  Please try again.'])
        helper.close_busy_notification()
Пример #3
0
 def search(self):
     helper.start('search')
     search_string = helper.get_user_input('Search for show title')
     if search_string:
         url = helper.domain_url() + 'AdvanceSearch'
         form_data = {
             'animeName': search_string,
             'genres': '0',
             'status': ''
         }
         helper.log_debug(
             'Searching for show using url %s and form data %s' %
             (url, str(form_data)))
         from resources.lib.list_types.media_container_list import MediaContainerList
         self._show_list(MediaContainerList(url, form_data))
     helper.end('search')