Skip to content

Commit

Permalink
Merge pull request selwin#49 from hongquan/master
Browse files Browse the repository at this point in the history
Support Nokia N9
  • Loading branch information
selwin committed Jan 6, 2016
2 parents 1bbd4c0 + 891df5e commit 8fd709c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
18 changes: 18 additions & 0 deletions user_agents/devices.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@
"ua_string": "Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19",
"str": "Nexus 7 / Android 4.1.1 / Chrome 18.0.1025"
},
"nokia_n9": {
"is_bot": false,
"is_mobile": true,
"is_pc": false,
"is_tablet": false,
"is_touch_capable": true,
"ua_string": "Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",
"str": "Nokia N9 / MeeGo / Nokia Browser 8.5.0"
},
"nokia_n97": {
"is_bot": false,
"is_mobile": true,
Expand All @@ -152,6 +161,15 @@
"ua_string": "Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 NokiaN97-1/12.0.024; Profile/MIDP-2.1 Configuration/CLDC-1.1; en-us) AppleWebKit/525 (KHTML, like Gecko) BrowserNG/7.1.12344",
"str": "Nokia N97 / Symbian OS 9.4 / Nokia Browser 7.1.12344"
},
"nokia_n900": {
"is_bot": false,
"is_mobile": true,
"is_pc": false,
"is_tablet": false,
"is_touch_capable": false,
"ua_string": "Mozilla/5.0 (X11; U; Linux armv7l; no-NO; rv:1.9.2.3pre) Gecko/20100723 Firefox/3.5 Maemo Browser 1.7.4.8 RX-51 N900",
"str": "Nokia N900 / Maemo / Maemo Browser 1.7.4"
},
"playbook": {
"is_bot": false,
"is_mobile": false,
Expand Down
8 changes: 8 additions & 0 deletions user_agents/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'Bada',
'Windows CE',
'Windows Mobile',
'Maemo',
)

MOBILE_BROWSER_FAMILIES = (
Expand Down Expand Up @@ -63,6 +64,7 @@
'Windows CE',
'Windows Mobile',
'Firefox OS',
'MeeGo',
)

TOUCH_CAPABLE_DEVICE_FAMILIES = (
Expand Down Expand Up @@ -196,6 +198,9 @@ def is_mobile(self):
# Mobile Spiders should be identified as mobile
if self.device.family == 'Spider' and 'Mobile' in self.browser.family:
return True
# Nokia mobile
if 'NokiaBrowser' in self.ua_string and 'Mobile' in self.ua_string:
return True
return False

@property
Expand All @@ -219,6 +224,9 @@ def is_pc(self):
# TODO: remove after https://github.com/tobie/ua-parser/issues/127 is closed
if self.os.family == 'Mac OS X' and 'Silk' not in self.ua_string:
return True
# Maemo has 'Linux' and 'X11' in UA, but it is not for PC
if 'Maemo' in self.ua_string:
return False
if 'Linux' in self.ua_string and 'X11' in self.ua_string:
return True
return False
Expand Down

0 comments on commit 8fd709c

Please sign in to comment.