示例#1
0
def main():
    from gate import create_default_gate
    profile = smolt.create_profile(create_default_gate(), smolt.read_uuid())
    session = requests.Session()
    session.headers.update({'USER-AGENT': opts.user_agent})

    o = session.post(opts.smoonURL + '', timeout=opts.timeout)

    exceptions = (requests.exceptions.HTTPError,
                  requests.exceptions.URLRequired,
                  requests.exceptions.Timeout,
                  requests.exceptions.ConnectionError,
                  requests.exceptions.InvalidURL)

    #first find out the server desired protocol
    try:
        #fli is a file like item
        pub_uuid_fli = opts.smoonURL + 'client/pub_uuid?uuid=%s' % profile.host.UUID
        pub_uuid_fli = session.get(pub_uuid_fli, timeout=opts.timeout)
    except exceptions as e:
        error(_('Error contacting Server: %s') % e)
        return 1
    try:
        pub_uuid_obj = pub_uuid_fli.json()
        try:
            print(_('To view your profile visit: %s') % smolt.get_profile_link(opts.smoonURL, pub_uuid_obj["pub_uuid"]))
        except ValueError as e:
            error(_('Something went wrong fetching the public UUID'))
    finally:
        session.close()
示例#2
0
def mention_profile_web_view(opts, pub_uuid, admin):
    ensure_code_reachability()
    import smolt
    from i18n import _

    pubUrl = smolt.get_profile_link(opts.smoonURL, pub_uuid)
    print
    print _('To share your profile: \n\t%s (public)') % pubUrl
    if not smolt.secure:
        print _('\tAdmin Password: %s') % admin
示例#3
0
def mention_profile_web_view(opts, pub_uuid, admin):
    ensure_code_reachability()
    import smolt
    from i18n import _

    pubUrl = smolt.get_profile_link(opts.smoonURL, pub_uuid)
    print
    print _('To share your profile: \n\t%s (public)') % pubUrl
    if not smolt.secure:
        print _('\tAdmin Password: %s') % admin
示例#4
0
	def _on_submission_completed(self):
		self._tear_progress_down(success=True)
		url = smolt.get_profile_link(smolt.smoonURL, self._submit_thread.pub_uuid)
		admin_password = self._submit_thread.admin
		QMessageBox(QMessageBox.Information, unicode(_('Profile Sent'), 'UTF-8'),
				unicode(_('<b>Your profile was sent successfully!</b><br>\
				<br>\
				Your profiles is available online at:<br>\
				<a href="%(url)s">%(url)s</a><br>\
				<br>\
				Your profile admin password is:<br><i>%(password)s</i>'), 'UTF-8') % \
					{'url':url, 'password':admin_password},
				QMessageBox.NoButton, self).exec_()

		self._smoltPageStatus(True)
示例#5
0
    def on_submission_completed(self):
        url = smolt.get_profile_link(smolt.smoonURL, smolt.getPubUUID())
        window = self.builder.get_object('window_main')
        message = ('<b>Your profile was sent successfully!</b>\n'
                   'Your profile is available at <a href="%(url)s">this</a> link.\n'
                   'Your profile admin password is:\n'
                   '<i>%(password)s</i>' % {'url':url, 'password':self.admin})

        dialog = gtk.MessageDialog(window,
                    gtk.DIALOG_DESTROY_WITH_PARENT,
                    gtk.MESSAGE_INFO,
                    gtk.BUTTONS_CLOSE, message)
        dialog.set_property('use-markup', True)
        dialog.run()
        dialog.destroy()
示例#6
0
    def _on_submission_completed(self):
        global server_url
        self._tear_progress_down(success=True)
        url = smolt.get_profile_link(server_url, self._submit_thread.pub_uuid)
        admin_password = self._submit_thread.admin
        QMessageBox(QMessageBox.Information, _('Profile Sent'),
          _('<b>Your profile was sent successfully!</b><br>\
				<br>\
				Your profiles is available online at:<br>\
				<a href="%(url)s">%(url)s</a><br>\
				<br>\
				Your profile admin password is:<br><i>%(password)s</i>'                                                                 ) % \
           {'url':url, 'password':admin_password},
          QMessageBox.NoButton, self).exec_()

        self._smoltPageStatus(True)
示例#7
0
	def openSmoltPage(self):
 
		''' Open My Smolt Page '''
		url = smolt.get_profile_link(smolt.smoonURL, smolt.getPubUUID())
		QDesktopServices.openUrl(QUrl(url))
示例#8
0
文件: getLink.py 项目: MythTV/smolt
                  help = _('specify HTTP timeout in seconds (default %default seconds)'))
parser.add_option('--uuidFile',
                  dest = 'uuidFile',
                  default = smolt.hw_uuid_file,
                  help = _('specify which uuid to use, useful for debugging and testing mostly.'))

(opts, args) = parser.parse_args()

def main():
    profile = smolt.get_profile()
    grabber = urlgrabber.grabber.URLGrabber(user_agent=opts.user_agent, timeout=opts.timeout)
    #first find out the server desired protocol
    try:
        #fli is a file like item
        pub_uuid_fli = grabber.urlopen(urljoin(opts.smoonURL + "/", '/client/pub_uuid?uuid=%s' % profile.host.UUID, False))
    except urlgrabber.grabber.URLGrabError, e:
        error(_('Error contacting Server: %s') % e)
        return 1
    pub_uuid_str = pub_uuid_fli.read()
    try:
        try:
            pub_uuid_obj = simplejson.loads(pub_uuid_str)
            print _('To view your profile visit: %s') % smolt.get_profile_link(opts.smoonURL, pub_uuid_obj["pub_uuid"])
        except ValueError, e:
            error(_('Something went wrong fetching the public UUID'))
    finally:
        pub_uuid_fli.close()
        
if __name__ == '__main__':
    main() 
示例#9
0
 def on_action_mypage_activate(self, widget, data=None):
     url = smolt.get_profile_link(smolt.smoonURL, smolt.getPubUUID())
     webbrowser.open(url)
示例#10
0
文件: getLink.py 项目: yvlf/mythtv

def main():
    from gate import create_default_gate
    profile = smolt.create_profile(create_default_gate(), smolt.read_uuid())
    grabber = urlgrabber.grabber.URLGrabber(user_agent=opts.user_agent,
                                            timeout=opts.timeout)
    #first find out the server desired protocol
    try:
        #fli is a file like item
        pub_uuid_fli = grabber.urlopen(
            urljoin(opts.smoonURL + "/",
                    '/client/pub_uuid?uuid=%s' % profile.host.UUID, False))
    except urlgrabber.grabber.URLGrabError, e:
        error(_('Error contacting Server: %s') % e)
        return 1
    pub_uuid_str = pub_uuid_fli.read()
    try:
        try:
            pub_uuid_obj = json.loads(pub_uuid_str)
            print _('To view your profile visit: %s') % smolt.get_profile_link(
                opts.smoonURL, pub_uuid_obj["pub_uuid"])
        except ValueError, e:
            error(_('Something went wrong fetching the public UUID'))
    finally:
        pub_uuid_fli.close()


if __name__ == '__main__':
    main()
示例#11
0
文件: smoltGui.py 项目: MythTV/smolt
	def openSmoltPage(self):
		global server_url

		''' Open My Smolt Page '''
		url = smolt.get_profile_link(server_url, smolt.getPubUUID())
		QDesktopServices.openUrl(QUrl(url))
示例#12
0
    # Try retrieving current pub_uuid  (from cache or remotely if necessary)
    pub_uuid = None
    try:
        pub_uuid = smolt.read_pub_uuid(create_default_uuiddb(), uuid, silent=True)
    except PubUUIDError:
        pass


    try:
        o=grabber.urlopen(urljoin(opts.smoonURL + '/', '/client/delete'), data=delHostString, http_headers=(
                        ('Content-length', '%i' % len(delHostString)),
                        ('Content-type', 'application/x-www-form-urlencoded')))
    except urlgrabber.grabber.URLGrabError, e:
        sys.stderr.write(_('Error contacting Server:'))
        sys.stderr.write(str(e))
        sys.stderr.write('\n')
        sys.exit(1)
    else:
        serverMessage(o.read())
        o.close()

    if pub_uuid is None:
        profile_url = urljoin(opts.smoonURL + '/', '/client/show?%s' % delHostString)
    else:
        profile_url = get_profile_link(opts.smoonURL, pub_uuid)
    print _('Profile removed, please verify at'), profile_url


if __name__ == '__main__':
    main()
示例#13
0
 def openSmoltPage(self):
     global server_url
     ''' Open My Smolt Page '''
     url = smolt.get_profile_link(server_url, smolt.getPubUUID())
     QDesktopServices.openUrl(QUrl(url))
示例#14
0
        print _('Could not send - Exiting')
        sys.exit(1)

if opts.userName:
    if not opts.password:
        password = getpass.getpass('\n' + _('Password:'******' ')
    else:
        password = opts.password

    if profile.register(userName=opts.userName, password=password, user_agent=opts.user_agent, smoonURL=opts.smoonURL, timeout=opts.timeout):
        print _('Registration Failed, Try again')
if not opts.submitOnly and not opts.checkin:
    scan(profile, opts.smoonURL)
    try:
        rating(profile, opts.smoonURL)
    except ValueError:
        print "Could not get rating!"
print

if pub_uuid:
    pubUrl = smolt.get_profile_link(opts.smoonURL, pub_uuid)
    print _('To share your profile: \n\t%s (public)') % pubUrl
    hw_uuid_file = get_config_attr("HW_PUBID", "/etc/smolt/hw-uuid.pub")
    hw_uuid_pub = os.path.basename(pubUrl)
    if not smolt.secure:
        print _('\tAdmin Password: %s') % admin

else:
    print _('No Public UUID found!  Please re-run with -n to generate a new public uuid')

示例#15
0
        password = getpass.getpass('\n' + _('Password:'******' ')
    else:
        password = opts.password

    if profile.register(userName=opts.userName,
                        password=password,
                        user_agent=opts.user_agent,
                        smoonURL=opts.smoonURL,
                        timeout=opts.timeout):
        print _('Registration Failed, Try again')
if not opts.submitOnly and not opts.checkin:
    scan(profile, opts.smoonURL)
    try:
        rating(profile, opts.smoonURL)
    except ValueError:
        print "Could not get rating!"
print

if pub_uuid:
    pubUrl = smolt.get_profile_link(opts.smoonURL, pub_uuid)
    print _('To share your profile: \n\t%s (public)') % pubUrl
    hw_uuid_file = get_config_attr("HW_PUBID", "/etc/smolt/hw-uuid.pub")
    hw_uuid_pub = os.path.basename(pubUrl)
    if not smolt.secure:
        print _('\tAdmin Password: %s') % admin

elif not opts.checkin:
    print _(
        'No Public UUID found!  Please re-run with -n to generate a new public uuid'
    )