Example #1
0
 def setFavorite(self, value):
     req = Request('account/{0}/favorite'.format(\
                                     Account(session=self._session).id),
                         session_id=self._session.sessionid)
     req.add_data({'movie_id':self.id, 'favorite':str(bool(value)).lower()})
     req.lifetime = 0
     req.readJSON()
Example #2
0
 def setWatchlist(self, value):
     req = Request('account/{0}/movie_watchlist'.format(
                   Account(session=self._session).id),
                           session_id=self._session.sessionid)
     req.lifetime = 0
     req.add_data({'movie_id': self.id, 'movie_watchlist': str(bool(value)).lower()})
     req.readJSON()
 def setFavorite(self, value):
     req = Request('account/{0}/favorite'.format(\
                                     Account(session=self._session).id),
                         session_id=self._session.sessionid)
     req.add_data({'movie_id':self.id, 'favorite':str(bool(value)).lower()})
     req.lifetime = 0
     req.readJSON()
Example #4
0
 def setRating(self, value):
     if not (0 <= value <= 10):
         raise TMDBError("Ratings must be between '0' and '10'.")
     req = Request('movie/{0}/rating'.format(self.id),
                   session_id=self._session.sessionid)
     req.lifetime = 0
     req.add_data({'value':value})
     req.readJSON()
Example #5
0
 def setWatchlist(self, value):
     req = Request('account/{0}/movie_watchlist'.format(
                     Account(session=self._session).id),
                   session_id=self._session.sessionid)
     req.lifetime = 0
     req.add_data({'movie_id': self.id,
                   'movie_watchlist': str(bool(value)).lower()})
     req.readJSON()
Example #6
0
 def setRating(self, value):
     if not (0 <= value <= 10):
         raise TMDBError("Ratings must be between '0' and '10'.")
     req = Request('movie/{0}/rating'.format(self.id),
                   session_id=self._session.sessionid)
     req.lifetime = 0
     req.add_data({'value': value})
     req.readJSON()
Example #7
0
def scan(profile, smoonURL):
    print _("Scanning %s for known errata.\n" % smoonURL)
    devices = []
    for VendorID, DeviceID, SubsysVendorID, SubsysDeviceID, Bus, Driver, Type, Description in hardware().deviceIter():
        if VendorID:
            devices.append('%s/%04x/%04x/%04x/%04x' % (Bus,
                                             int(VendorID or 0),
                                             int(DeviceID or 0),
                                             int(SubsysVendorID or 0),
                                             int(SubsysDeviceID or 0)) )
    searchDevices = 'NULLPAGE'
    devices.append('System/%s/%s' % ( urllib.quote(hardware().host.systemVendor), urllib.quote(hardware().host.systemModel) ))
    for dev in devices:
        searchDevices = "%s|%s" % (searchDevices, dev)
    try:
        req = Request('/smolt-w/api.php')
        req.add_data('action=query&titles=%s&format=json' % searchDevices)
        r = json.load(req.open())
    except urllib2.HTTPError:
        print "Could not wiki for errata!"
        return
    found = []

    for page in r['query']['pages']:
        try:
            if int(page) > 0:
                found.append('\t%swiki/%s' % (smoonURL, r['query']['pages'][page]['title']))
        except KeyError:
            pass

    if found:
        print _("\tErrata Found!")
        for f in found: print "\t%s" % f
    else:
        print _("\tNo errata found, if this machine is having issues please go to")
        print _("\tyour profile and create a wiki page for the device so others can")
        print _("\tbenefit")
Example #8
0
(opts, args) = parser.parse_args()
ConnSetup(opts.smoonURL, opts.user_agent, opts.timeout, None)

smolt.DEBUG = opts.DEBUG
smolt.hw_uuid_file = opts.uuidFile
# read the profile
profile = smolt.Hardware()

delHostString = 'uuid=%s' % profile.host.UUID

try:
    req = Request('/client/delete')
    req.add_header('Content-length', '%i' % len(delHostString))
    req.add_header('Content-type', 'application/x-www-form-urlencoded')
    req.add_data(delHostString)
    o = req.open()
except urllib2.URLError, 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()

sys.stdout.write(_('Profile removed, please verify at'))
sys.stdout.write(' ')
sys.stdout.write(urljoin(opts.smoonURL + '/', '/client/show?%s\n' % delHostString))

Example #9
0
(opts, args) = parser.parse_args()
ConnSetup(opts.smoonURL, opts.user_agent, opts.timeout, None)

smolt.DEBUG = opts.DEBUG
smolt.hw_uuid_file = opts.uuidFile
# read the profile
profile = smolt.Hardware()

delHostString = 'uuid=%s' % profile.host.UUID

try:
    req = Request('/client/delete')
    req.add_header('Content-length', '%i' % len(delHostString))
    req.add_header('Content-type', 'application/x-www-form-urlencoded')
    req.add_data(delHostString)
    o = req.open()
except urllib2.URLError, 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()

sys.stdout.write(_('Profile removed, please verify at'))
sys.stdout.write(' ')
sys.stdout.write(
    urljoin(opts.smoonURL + '/', '/client/show?%s\n' % delHostString))